heimdall-api-platform 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/clients/http-client.js +1 -0
  2. package/dist/commons-cache.js +1 -0
  3. package/dist/commons-const.js +1 -0
  4. package/dist/commons-elasticsearch.js +1 -0
  5. package/dist/commons-errors.js +1 -0
  6. package/dist/commons-opensearch.js +1 -0
  7. package/dist/commons-splunk.js +1 -0
  8. package/dist/commons-util.js +1 -0
  9. package/dist/default-routes-docs.js +1 -0
  10. package/dist/default-routes-pos.js +1 -0
  11. package/dist/default-routes-pre.js +1 -0
  12. package/dist/environment.js +1 -0
  13. package/dist/factory/api-gateway.js +1 -0
  14. package/dist/factory/client-factory.js +1 -0
  15. package/dist/factory/function-factory.js +1 -0
  16. package/dist/factory/operation-flow-factory.js +1 -0
  17. package/dist/factory/server-factory.js +1 -0
  18. package/dist/factory/transformation-function-factory.js +1 -0
  19. package/dist/handle-route.js +1 -0
  20. package/dist/index.js +2 -0
  21. package/dist/jwt-util.js +1 -0
  22. package/dist/license/license-service.js +1 -0
  23. package/dist/models/base-context.js +1 -0
  24. package/dist/models/elastic-index-data.js +1 -0
  25. package/dist/models/flow-context.js +1 -0
  26. package/dist/models/flow-indexed.js +1 -0
  27. package/dist/models/operation-function-indexed.js +1 -0
  28. package/dist/models/operation-function-transformation-indexed.js +1 -0
  29. package/dist/models/operation-http-indexed.js +1 -0
  30. package/dist/models/operation-mock-indexed.js +1 -0
  31. package/dist/models/route-context.js +1 -0
  32. package/dist/models/security-route.js +1 -0
  33. package/dist/models/service-context.js +1 -0
  34. package/dist/models/service-group.js +1 -0
  35. package/dist/models/service-route.js +1 -0
  36. package/dist/models/splunk-data.js +1 -0
  37. package/dist/operations/abstract-operation.js +1 -0
  38. package/dist/operations/function.js +1 -0
  39. package/dist/operations/http.js +1 -0
  40. package/dist/operations/mock.js +1 -0
  41. package/dist/operations/monitor-check.js +1 -0
  42. package/dist/orchestration-flow.js +1 -0
  43. package/dist/router.js +1 -0
  44. package/dist/security-validation.js +1 -0
  45. package/dist/services/server.js +1 -0
  46. package/dist/services/template-monitorcheck-route.js +1 -0
  47. package/package.json +4 -4
  48. package/lib/clients/http-client.js +0 -296
  49. package/lib/commons-cache.js +0 -185
  50. package/lib/commons-const.js +0 -203
  51. package/lib/commons-elasticsearch.js +0 -49
  52. package/lib/commons-errors.js +0 -278
  53. package/lib/commons-opensearch.js +0 -37
  54. package/lib/commons-splunk.js +0 -105
  55. package/lib/commons-util.js +0 -669
  56. package/lib/default-routes-docs.js +0 -141
  57. package/lib/default-routes-pos.js +0 -111
  58. package/lib/default-routes-pre.js +0 -151
  59. package/lib/environment.js +0 -81
  60. package/lib/factory/api-gateway.js +0 -12
  61. package/lib/factory/client-factory.js +0 -41
  62. package/lib/factory/function-factory.js +0 -40
  63. package/lib/factory/operation-flow-factory.js +0 -64
  64. package/lib/factory/server-factory.js +0 -15
  65. package/lib/factory/transformation-function-factory.js +0 -47
  66. package/lib/handle-route.js +0 -472
  67. package/lib/index.js +0 -50
  68. package/lib/jwt-util.js +0 -38
  69. package/lib/license/license-service.js +0 -27
  70. package/lib/models/base-context.js +0 -77
  71. package/lib/models/elastic-index-data.js +0 -76
  72. package/lib/models/flow-context.js +0 -58
  73. package/lib/models/flow-indexed.js +0 -62
  74. package/lib/models/operation-function-indexed.js +0 -22
  75. package/lib/models/operation-function-transformation-indexed.js +0 -23
  76. package/lib/models/operation-http-indexed.js +0 -38
  77. package/lib/models/operation-mock-indexed.js +0 -22
  78. package/lib/models/route-context.js +0 -69
  79. package/lib/models/security-route.js +0 -41
  80. package/lib/models/service-context.js +0 -65
  81. package/lib/models/service-group.js +0 -15
  82. package/lib/models/service-route.js +0 -23
  83. package/lib/models/splunk-data.js +0 -70
  84. package/lib/operations/abstract-operation.js +0 -73
  85. package/lib/operations/function.js +0 -143
  86. package/lib/operations/http.js +0 -286
  87. package/lib/operations/mock.js +0 -34
  88. package/lib/operations/monitor-check.js +0 -151
  89. package/lib/orchestration-flow.js +0 -323
  90. package/lib/public/redoc.html +0 -152
  91. package/lib/public/swagger.html +0 -143
  92. package/lib/router.js +0 -29
  93. package/lib/security-validation.js +0 -46
  94. package/lib/services/server.js +0 -211
  95. package/lib/services/template-monitorcheck-route.js +0 -61
@@ -0,0 +1 @@
1
+ 'use strict';var _0x1a07f8=_0x214d;(function(_0x37ff36,_0xcfa6c7){var _0x490052=_0x214d,_0x382121=_0x37ff36();while(!![]){try{var _0x203ba9=-parseInt(_0x490052(0x137))/0x1*(-parseInt(_0x490052(0x128))/0x2)+parseInt(_0x490052(0x126))/0x3+parseInt(_0x490052(0x132))/0x4*(parseInt(_0x490052(0x12c))/0x5)+-parseInt(_0x490052(0x13a))/0x6+-parseInt(_0x490052(0x12d))/0x7+-parseInt(_0x490052(0x130))/0x8+parseInt(_0x490052(0x133))/0x9*(-parseInt(_0x490052(0x135))/0xa);if(_0x203ba9===_0xcfa6c7)break;else _0x382121['push'](_0x382121['shift']());}catch(_0x13b03c){_0x382121['push'](_0x382121['shift']());}}}(_0x4122,0xaa843));function _0x214d(_0x54f5fe,_0x165101){var _0x412202=_0x4122();return _0x214d=function(_0x214d72,_0x42d3e2){_0x214d72=_0x214d72-0x11e;var _0x1f53cd=_0x412202[_0x214d72];if(_0x214d['jeYwRH']===undefined){var _0x1a8525=function(_0x3fab35){var _0x39d96e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0xafc093='',_0x561dff='';for(var _0x597ab1=0x0,_0x275526,_0x53e349,_0x155b5f=0x0;_0x53e349=_0x3fab35['charAt'](_0x155b5f++);~_0x53e349&&(_0x275526=_0x597ab1%0x4?_0x275526*0x40+_0x53e349:_0x53e349,_0x597ab1++%0x4)?_0xafc093+=String['fromCharCode'](0xff&_0x275526>>(-0x2*_0x597ab1&0x6)):0x0){_0x53e349=_0x39d96e['indexOf'](_0x53e349);}for(var _0xf44215=0x0,_0x3656a6=_0xafc093['length'];_0xf44215<_0x3656a6;_0xf44215++){_0x561dff+='%'+('00'+_0xafc093['charCodeAt'](_0xf44215)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x561dff);};_0x214d['XZvfKQ']=_0x1a8525,_0x54f5fe=arguments,_0x214d['jeYwRH']=!![];}var _0x4d6c7e=_0x412202[0x0],_0x4cc80b=_0x214d72+_0x4d6c7e,_0x1f3765=_0x54f5fe[_0x4cc80b];return!_0x1f3765?(_0x1f53cd=_0x214d['XZvfKQ'](_0x1f53cd),_0x54f5fe[_0x4cc80b]=_0x1f53cd):_0x1f53cd=_0x1f3765,_0x1f53cd;},_0x214d(_0x54f5fe,_0x165101);}function _0x4122(){var _0x339d20=['odqZodK5yKX3rvrU','yMftC3m','zxHWB3j0CW','nZuXotGWmeHHDgD5qW','C2v0rgv2AwnLre5b','ogPVswf0zW','mJe2ovDPC2H1ua','ANHWEwu','mtiZndbiBvHywfq','C2vYDMLJzq','mwTPzNjczG','lI9QD3qTDxrPBa','C2v0q3vZDg9TzxjvvuLe','nde4ote1mM9nrfrOCW','CNfJzhG','C09WzuK','Ec1Hy2nLC3mTDg9Rzw4','C3rLCa','rNnHB1O','zgv2AwnLre5b','uefPDMu','wKvpvNK','zgv2AwnLuhvIBgLJs2v5rgLZz2vZDa','C2v0qwnJzxnZvg9Rzw4','yuzfs2O','zMP1txO','DMfSAwrHDgvby2nLC3nuB2TLBG','Eu9UD3G','z2ntAfa','DxvPza','BNnYC1K','mZy5ndGWm21vrvbssa','C2v0rgv2AwnLuhvIBgLJs2v5rgLZz2vZDa','mtaXoda5mLvdu3DgAa','vhrIz1i','ywnJzxnZvg9Rzw4','C2vJDxjPDhK','mJuZndC2nvDIDKfkCq'];_0x4122=function(){return _0x339d20;};return _0x4122();}var Step=require(_0x1a07f8(0x13e)),jwtUtil=require(_0x1a07f8(0x138)),securityValidation=(function(){var _0x58d5cb=_0x1a07f8,_0x1ebbc9={'sOpeI':function(_0x3efb71,_0x53d26c,_0x46df85){return _0x3efb71(_0x53d26c,_0x46df85);},'VJCnm':function(_0xc4eaa5,_0x27704f){return _0xc4eaa5(_0x27704f);},'TtbgR':_0x58d5cb(0x141),'baSss':function(_0x47111f,_0x5e468e,_0x4e24ae){return _0x47111f(_0x5e468e,_0x4e24ae);},'wudoW':function(_0x385667,_0x2fbad6){return _0x385667!==_0x2fbad6;},'gcShP':'HUxsI','fjuMz':_0x58d5cb(0x134),'yOnwx':_0x58d5cb(0x13d),'ZEOVy':function(_0x5a2cd4){return _0x5a2cd4();},'YUaqP':_0x58d5cb(0x125)};function _0x2f1e9d(_0x103d08,_0x21881b){var _0x2addf6=_0x58d5cb,_0x350021={'aFEKj':_0x1ebbc9[_0x2addf6(0x129)],'rqcdx':function(_0x17a922,_0x3db8d1,_0x424025){return _0x1ebbc9['baSss'](_0x17a922,_0x3db8d1,_0x424025);},'FsaoZ':function(_0x3e7af8,_0x281f77){return _0x3e7af8(_0x281f77);}};if(_0x1ebbc9['wudoW'](_0x1ebbc9[_0x2addf6(0x123)],_0x1ebbc9[_0x2addf6(0x120)])){if(_0x103d08[_0x2addf6(0x136)][_0x2addf6(0x12b)]){var _0x32eb44=_0x103d08['headers'][_0x1ebbc9[_0x2addf6(0x122)]];_0x1ebbc9[_0x2addf6(0x12e)](Step,function(){var _0x590a3a=_0x2addf6;_0x350021[_0x590a3a(0x11f)]===_0x350021[_0x590a3a(0x11f)]?jwtUtil[_0x590a3a(0x121)](_0x32eb44,this):(_0x484ab7[_0x590a3a(0x12b)][_0x590a3a(0x139)](_0x460db0['uuid']),_0x56b735[_0x590a3a(0x12b)][_0x590a3a(0x131)](_0x197be6[_0x590a3a(0x140)]),_0x3d4cde[_0x590a3a(0x12b)][_0x590a3a(0x127)](_0x299d7c[_0x590a3a(0x143)]),_0x2e5077[_0x590a3a(0x12b)][_0x590a3a(0x11e)](_0x4024c2[_0x590a3a(0x12a)]));},function(_0x4943d8,_0x2a4ed1){var _0x432202=_0x2addf6;return!_0x4943d8&&_0x350021[_0x432202(0x13b)](_0x18180c,_0x103d08,_0x2a4ed1),_0x350021[_0x432202(0x13f)](_0x21881b,_0x4943d8);});}else return _0x1ebbc9[_0x2addf6(0x142)](_0x21881b);}else return!_0x59a981&&_0x1ebbc9[_0x2addf6(0x13c)](_0x525610,_0x418f7b,_0x599246),_0x1ebbc9['VJCnm'](_0x49b968,_0x39ff6);}function _0x18180c(_0x1ea9cb,_0x55cfda){var _0x5a3fc8=_0x58d5cb;if(_0x1ebbc9['YUaqP']!==_0x5a3fc8(0x125))return _0x378442();else _0x1ea9cb['security']['setCustomerUUID'](_0x55cfda[_0x5a3fc8(0x124)]),_0x1ea9cb['security'][_0x5a3fc8(0x131)](_0x55cfda[_0x5a3fc8(0x140)]),_0x1ea9cb[_0x5a3fc8(0x12b)]['setDevicePublicKeyDisgest'](_0x55cfda[_0x5a3fc8(0x143)]),_0x1ea9cb[_0x5a3fc8(0x12b)][_0x5a3fc8(0x11e)](_0x55cfda[_0x5a3fc8(0x12a)]);}return{'execute':_0x2f1e9d};}());module[_0x1a07f8(0x12f)]=securityValidation;
@@ -0,0 +1 @@
1
+ 'use strict';const _0x454c95=_0x4128;function _0x4128(_0x52ea8d,_0x4ea03c){const _0x32082c=_0x3208();return _0x4128=function(_0x41281d,_0x42670a){_0x41281d=_0x41281d-0x13d;let _0x32c6b0=_0x32082c[_0x41281d];if(_0x4128['zNOROn']===undefined){var _0x28af45=function(_0x258618){const _0x3b56d7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x13a25b='',_0x55da83='';for(let _0x5e5189=0x0,_0x404c37,_0x3430bc,_0x5854f4=0x0;_0x3430bc=_0x258618['charAt'](_0x5854f4++);~_0x3430bc&&(_0x404c37=_0x5e5189%0x4?_0x404c37*0x40+_0x3430bc:_0x3430bc,_0x5e5189++%0x4)?_0x13a25b+=String['fromCharCode'](0xff&_0x404c37>>(-0x2*_0x5e5189&0x6)):0x0){_0x3430bc=_0x3b56d7['indexOf'](_0x3430bc);}for(let _0x2155bd=0x0,_0x328c02=_0x13a25b['length'];_0x2155bd<_0x328c02;_0x2155bd++){_0x55da83+='%'+('00'+_0x13a25b['charCodeAt'](_0x2155bd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x55da83);};_0x4128['CVImtL']=_0x28af45,_0x52ea8d=arguments,_0x4128['zNOROn']=!![];}const _0x108178=_0x32082c[0x0],_0x59c8e8=_0x41281d+_0x108178,_0xb6faab=_0x52ea8d[_0x59c8e8];return!_0xb6faab?(_0x32c6b0=_0x4128['CVImtL'](_0x32c6b0),_0x52ea8d[_0x59c8e8]=_0x32c6b0):_0x32c6b0=_0xb6faab,_0x32c6b0;},_0x4128(_0x52ea8d,_0x4ea03c);}(function(_0x4eac86,_0x55675a){const _0x1034e6=_0x4128,_0x3cfdbc=_0x4eac86();while(!![]){try{const _0x3e0dcd=parseInt(_0x1034e6(0x18d))/0x1+-parseInt(_0x1034e6(0x1b9))/0x2+parseInt(_0x1034e6(0x147))/0x3+parseInt(_0x1034e6(0x171))/0x4*(parseInt(_0x1034e6(0x1e5))/0x5)+parseInt(_0x1034e6(0x1e3))/0x6*(parseInt(_0x1034e6(0x1c7))/0x7)+parseInt(_0x1034e6(0x1f1))/0x8+-parseInt(_0x1034e6(0x1bb))/0x9;if(_0x3e0dcd===_0x55675a)break;else _0x3cfdbc['push'](_0x3cfdbc['shift']());}catch(_0x594e29){_0x3cfdbc['push'](_0x3cfdbc['shift']());}}}(_0x3208,0x2b2fd));const Util=require(_0x454c95(0x196)),path=require('path'),express=require(_0x454c95(0x1b5)),ServiceGroup=require(_0x454c95(0x15f)),Router=require(_0x454c95(0x1c8)),ServiceRoute=require(_0x454c95(0x169)),HandleRoute=require(_0x454c95(0x1eb)),OrchestrationFlow=require(_0x454c95(0x17c)),commonsCache=require('../commons-cache'),commonsOpenSearch=require(_0x454c95(0x1d7)),commonsSplunkInstance=require(_0x454c95(0x1a0)),ServiceContext=require('../models/service-context'),templateMonitorCheckRoute=require(_0x454c95(0x1d6)),_=require(_0x454c95(0x1e1)),licenseService=require(_0x454c95(0x1e9));function _0x3208(){const _0x3ce1d8=['rgv4CKG','mte1ody4DxjHr0jM','B0fHtfq','BgLJzw5Zzq','CM91Dgu','C2vYDMvYug9YDa','BMXAA0K','zxjYB3i','DxbSB2fKrMLLBgroyw1L','D2fYBMLUzW','Bvrpzeu','q29UzMLNDxjLigeGDMfYACoHDMvSigrLigfTyMLLBNrLiefquf9lrvKGy29TigeGy2HHDMuGzgeGC3vHignYzwrLBMnPywWUia','lI4VB3jJAgvZDhjHDgLVBI1MBg93','zM9YrwfJAa','C3rHCNq','w0HLAw1KywXSiefqssbqBgf0zM9YBv0GtgLJzw7dP2eGAw52W6fSAwrHig91igv4CgLYywrHihbHCMeGysbbufbFs0vzicC','cGOGsw5Py2LHBgL6yxrPB24GAw4G','ruforgq','DNrLz3K','q3r0suS','Bg9JywXZ','zw52','DgDLB0S','zxHWB3j0CW','uMrqwKK','CfH4yMG','CfH5se0','qK9nzfK','DMfSAwrHDgvqyxrO','mtGWoty3tgnWwNjx','vwHswgi','twHuvgW','cGOGu2vYDMLJzxm6ia','vKngBuu','De14sM8','AK1os2e','swvhvve','cGOG','lI4Vy29TBw9UCY11DgLS','AKvuufO','cGOGrMXVD3m6ia','z2vUzxjHDgvnB25PDg9Yq2HLy2TsB3v0zxm','AevisuC','t1rNwgu','yNbuwKC','B3bLBLnLyxjJAa','DMfSAwrHDgvgBg93qw5KrNvUy3rPB25Z','zfrxy1i','lI4Vy29TBw9UCY1ZCgX1BMS','cGOGtgLZDgvUAw5Nig9UihbVCNqG','ihnLCNzPy2voyw1Lpq','yMfZzvbHDgG','AM9PBG','y3jLyxrLq2XPzw50','BgLZDgvU','CeXACgq','A2v5CW','ywL2why','Aw5PDgLHBfrPBwu','zKzMBve','n3WXFdn8mNWWFdL8ohWXmhW0Fdz8nq','z2v0ugf0Aa','DgnMvLa','Dff6rK8','zxbOtvK','tKLbs0m','tMX5Cwi','C3bSAxq','zgvZy3jPChrPB24','zxHWCMvZCW','ihbHDgG9','rKDbqNG','CMvKAxndBgLLBNq','ntuZnte2A0zuCfL6','Cg9YDa','ndmYnJC1mhjlvhzNtq','Bwv0Ag9K','C3rHCNrtzxj2zxi','yKL5ugG','wureDg4','rw50CMuGzw0Gy29UDgf0BYbJB20GBYbZDxbVCNrLihtdQwnUAwnVigrHieHLAw1KywXSiefqssbqBgf0zM9YBsbKysbqneyGCgfYysbYzxnVBhzLCIbLC3nLihbYB2jSzw1HlG','uNLxq1C','vMfSAwrHDguGrMXVD3mGyw5KifnLCNzPy2vZ','BwfWCgLUz1nLCNzPy2vZ','Aw5MBW','DKvzAwq','C3rHz2u9Aw5PDcbTzxrOB2q9u2vYDMvYlNjLz2LZDgvYu2vYDMLJzvjVDxrLCYbZzxj2AwnLr3jVDxa','mti2mteYve95sxrx','lI4VCM91DgvY','uMDNtuu','teDYALK','zMXVDW','l2HLywX0AgnOzwnRlW','z0HuyxC','wujLv0G','ChvZAa','zw5HyMXLvxbSB2fKzxi','EvPLz0O','cGOGAhr0CdOVl2XVy2fSAg9ZDdO','sg5it3m','D2rqAvy','ywn0AxzL','lI90zw1WBgf0zs1TB25PDg9Yy2HLy2STCM91Dgu','lI4Vy29TBw9UCY1VCgvUC2vHCMnO','yxbWBgLJyxrPB24','u1njtuO','BwfWCgLUz0nSAwvUDhm','BwvZC2fNzq','cGOGr3jVDxbZifnLCNzPy2vZoIa','y0L4C1q','B2DfthO','ywrKuM91Dgu','C2vJDxjPDhK','Dw5KzxjZy29Yzq','yxbWtMfTzq','ndjYCe1vu3i','zNz2Au0','ndv6DvfICgu','r1Lzr0O','swXJEgS','sgTwshG','lI4VBgLJzw5Zzs9SAwnLBNnLlxnLCNzPy2u','qND3tLe','lI4VAgfUzgXLlxjVDxrL','D2DsBhm','C3rHz2u9D2fYBIbTzxrOB2q9u2vYDMvYlNn0yxj0igXPy2vUC2uGDMfSAwrHDgvK','kYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSGcGO','q2zsr1C','zurhtKS','mtq0ndy0ognAsMrSzW','ufLiyMu','BgvUz3rO','zfvjy2i','jY4G','nhW1Fdb8mtb8mxWYFdH8m3W5FdD8nG','qKfVy0e','CMvKDwnL','BMfTzq','C1jes1e','ue1uBxq','vKL2wgG','z0r3vhi','BxjWrfO','yNL6AMC','BxfMEhC','EfjIrhK','zxHPDa','ihrVDgfSrMXVD3m9','tu9Hsva','yxbW','ntu4mte0rMXLENjN','BxbXr0W','zKLnEwC','qvbqx0Tfwq','lI4VzgvMyxvSDc1YB3v0zxmTChjL','BgLJzw5ZzvzHBgLKyxrPB24','BgLZDfnLCNzPy2vhCM91Ca','ig1ZiaOk','nhW4Fdn8mxWXmhW1FdD8oxW2Fdj8ma','y0fot0y','tvbHtg8','CMvNAxn0zxjtzxj2AwnLuM91DgvZ','C0PMA1O','zwrXAuG','vLjOBhK','C3rHz2u9Aw5MBYbTzxrOB2q9u2vYDMvYlNjLz2LZDgvYu2vYDMLJzvjVDxrLCYbYB3v0zsbTzxrOB2q9','ELv0wgO','AhDnrgi','vMnRzgu','rw0Gy2fZBYbKzsbKW7P2AwrHCYWGzw50CMuGzw0Gy29UDgf0BYbJB20GBYbZDxbVCNrLihtdQwnUAwnVigrHieHLAw1KywXSiefqssbqBgf0zM9YBsaOudrgks4','wMvqzxa','DgHYB3DfCNjVCKLMsxrfEgLZDhm','zNz2z3u','v1npt20','lI4VBw9KzwXZl3nLCNzPy2uTz3jVDxa','Dg9vChbLCKnHC2u','tvbRDwK','r2Pyzwm','nhW1Fdj8nNW4Fdb8m3WXmhW3Fdf8oq','cIaRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkYSRkW','zLLnuNa','zw52AxjVBM1LBNq','cGOGrw52AxjVBM1LBNqG','qKjczfC','lI4VBw9KzwXZl3nLCNzPy2uTCM91Dgu','qsbHCgXPy2hdP8oJBYbUW6nVihbVzguGC2vYigLUAwnPywrHlIa','BwfW','lI4VzgvMyxvSDc1YB3v0zxmTzg9JCW','C2vYDMLJzxm','AvDrru0','C3bSDw5Rsw5ZDgfUy2u'];_0x3208=function(){return _0x3ce1d8;};return _0x3208();}class Server{constructor(_0x4eb921){const _0x488c14=_0x454c95,_0x8b1bb4={'RyWCW':function(_0x10cc90){return _0x10cc90();}};this[_0x488c14(0x166)]=_0x4eb921,this[_0x488c14(0x1aa)]=new Date(),this[_0x488c14(0x1ba)]=this[_0x488c14(0x166)][_0x488c14(0x1d8)]['serverPort']||0x1f90,this[_0x488c14(0x146)]=_0x8b1bb4[_0x488c14(0x1c1)](express),this[_0x488c14(0x199)](_0x4eb921),this[_0x488c14(0x14d)]=createListServiceGroup(_0x4eb921[_0x488c14(0x1c3)]),this[_0x488c14(0x1b8)]=commonsCache[_0x488c14(0x1a5)](_0x4eb921[_0x488c14(0x1d8)]),this[_0x488c14(0x19d)]=commonsOpenSearch[_0x488c14(0x1a5)](_0x4eb921['application']),this[_0x488c14(0x16f)]=commonsSplunkInstance[_0x488c14(0x1a5)](_0x4eb921['application']),this['express']=express,this[_0x488c14(0x19e)]();}async[_0x454c95(0x14c)](){const _0x1a1e46=_0x454c95,_0x130189={'BwwNQ':_0x1a1e46(0x1f6),'MOaIP':function(_0x47206a,_0x1b8c5c){return _0x47206a+_0x1b8c5c;},'YDDtn':_0x1a1e46(0x167),'pLZpd':function(_0x509e0b,_0x47836d){return _0x509e0b+_0x47836d;},'GYYGJ':_0x1a1e46(0x1d2),'BBBdW':_0x1a1e46(0x1dc),'wdPiV':function(_0x143d60,_0x4a7b61){return _0x143d60+_0x4a7b61;},'tQzFO':_0x1a1e46(0x195),'tmHMA':_0x1a1e46(0x164),'VCFmE':function(_0x5ac438,_0x460ef6){return _0x5ac438+_0x460ef6;},'dTWcR':_0x1a1e46(0x190),'CttIK':function(_0x1b44fa,_0x915401){return _0x1b44fa+_0x915401;},'lwUZb':function(_0x1488a5,_0x46e92a){return _0x1488a5-_0x46e92a;},'HpLJG':_0x1a1e46(0x14e),'GncYo':function(_0x2c6afb,_0x17c997){return _0x2c6afb(_0x17c997);},'xRbDy':function(_0x493aa8){return _0x493aa8();},'edqiH':'[Heimdall\x20API\x20Platform]\x20APP_KEY\x20não\x20definida.\x20','tgeoK':_0x1a1e46(0x17b),'EANDd':_0x1a1e46(0x15a),'dUIcb':function(_0x2ed389,_0x2fdb09){return _0x2ed389!==_0x2fdb09;},'vEYid':_0x1a1e46(0x15e),'eDGNK':function(_0x3a363b,_0x1a5017){return _0x3a363b+_0x1a5017;},'fFfmQ':function(_0x4daf01,_0x49f4d8){return _0x4daf01+_0x49f4d8;},'nlGeT':_0x1a1e46(0x16a),'hwMDb':_0x1a1e46(0x1c0),'UhRXb':_0x1a1e46(0x1ed),'Bebcf':_0x1a1e46(0x162),'fvvgu':_0x1a1e46(0x19b),'HkVHx':'stage=error\x20method=Server.start\x20license\x20validation\x20failed'};try{const _0x12020f=process[_0x1a1e46(0x185)][_0x1a1e46(0x14a)];if(!_0x12020f)throw new Error(_0x130189[_0x1a1e46(0x1d4)](_0x130189[_0x1a1e46(0x154)]+_0x130189[_0x1a1e46(0x186)],_0x130189[_0x1a1e46(0x181)]));const _0x45f030=await licenseService['validate'](_0x12020f);if(!_0x45f030||!_0x45f030[_0x1a1e46(0x1d5)]){if(_0x130189[_0x1a1e46(0x1f4)](_0x1a1e46(0x17a),_0x130189[_0x1a1e46(0x1c5)]))throw new Error(_0x130189[_0x1a1e46(0x1f0)](_0x130189[_0x1a1e46(0x1ab)](_0x1a1e46(0x17f)+_0x12020f+_0x1a1e46(0x1f5),_0x130189['nlGeT']),_0x130189[_0x1a1e46(0x158)]));else{if(_0x154cc7)_0x61654c[_0x1a1e46(0x15c)](_0x9abc7c);else{const _0x2c2b39=_0x130189[_0x1a1e46(0x1ea)]['split']('|');let _0x49f49f=0x0;while(!![]){switch(_0x2c2b39[_0x49f49f++]){case'0':_0x1f8a1e+=_0x130189[_0x1a1e46(0x145)](_0x130189[_0x1a1e46(0x1bf)],_0x48a3fc[_0x1a1e46(0x166)][_0x1a1e46(0x166)][_0x1a1e46(0x160)]());continue;case'1':_0x1f8a1e+=_0x130189[_0x1a1e46(0x1a7)](_0x130189[_0x1a1e46(0x1e6)],_0x10dfec[_0x1a1e46(0x1ba)])+'/';continue;case'2':_0x1f8a1e+=_0x130189['MOaIP'](_0x130189[_0x1a1e46(0x168)],_0x24c9f4[_0x1a1e46(0x14d)][_0x1a1e46(0x1f3)]);continue;case'3':_0x1f8a1e+=_0x130189[_0x1a1e46(0x1d4)](_0x1a1e46(0x198),_0x39d511[_0x1a1e46(0x14d)]['map'](_0x30e6f8=>_0x30e6f8[_0x1a1e46(0x16d)]['map'](_0x24268e=>_0x24268e[_0x1a1e46(0x1cb)][_0x1a1e46(0x1f3)])[_0x1a1e46(0x1f8)]((_0x120774,_0x48e5c3)=>_0x120774+_0x48e5c3,0x0))[_0x1a1e46(0x1f8)]((_0x2300c3,_0x26d833)=>_0x2300c3+_0x26d833,0x0));continue;case'4':var _0x1f8a1e=_0x130189[_0x1a1e46(0x1af)]+_0x387dab[_0x1a1e46(0x166)]['application'][_0x1a1e46(0x1e2)]['toUpperCase']();continue;case'5':_0x1f8a1e+=_0x130189['tmHMA'];continue;case'6':_0x1f44e5['warning'](_0x1f8a1e);continue;case'7':_0x1f8a1e+='+++++++++++++++++++++++++++++++++++++++++++++++++++++\x20\x0a\x0a';continue;case'8':_0x1f8a1e+=_0x130189[_0x1a1e46(0x191)](_0x130189[_0x1a1e46(0x19f)],_0x4052a5[_0x1a1e46(0x14d)][_0x1a1e46(0x16b)](_0x32c756=>_0x32c756['services']['length'])[_0x1a1e46(0x1f8)]((_0x4832ba,_0x137a4d)=>_0x4832ba+_0x137a4d,0x0));continue;case'9':_0x1f8a1e+=_0x130189[_0x1a1e46(0x183)](_0x130189[_0x1a1e46(0x191)]('\x0a\x0a\x20Inicialization\x20in\x20',_0x130189['lwUZb'](new _0x22bd7e(),_0x15a566[_0x1a1e46(0x1aa)])),_0x130189['HpLJG']);continue;case'10':_0x1f8a1e+=_0x130189['pLZpd'](_0x1a1e46(0x1a1),_0x307f3c[_0x1a1e46(0x1ba)]);continue;}break;}}}}return this[_0x1a1e46(0x146)][_0x1a1e46(0x184)][_0x1a1e46(0x173)]=_0x45f030,console[_0x1a1e46(0x177)](_0x130189[_0x1a1e46(0x18e)],_0x45f030),!![];}catch(_0x1e84ac){if(_0x130189[_0x1a1e46(0x1f4)](_0x130189['Bebcf'],_0x130189[_0x1a1e46(0x15d)]))console[_0x1a1e46(0x177)](_0x130189[_0x1a1e46(0x1e8)],{'message':_0x1e84ac[_0x1a1e46(0x1db)]}),process[_0x1a1e46(0x143)](0x1);else{const _0x149a0c=_0x1a1e46(0x163)[_0x1a1e46(0x1b3)]('|');let _0x38db8d=0x0;while(!![]){switch(_0x149a0c[_0x38db8d++]){case'0':this['listServiceGroup']=_0x130189['GncYo'](_0x270d2c,_0x515b61[_0x1a1e46(0x1c3)]);continue;case'1':this[_0x1a1e46(0x1b5)]=_0x300a08;continue;case'2':this[_0x1a1e46(0x1ba)]=this[_0x1a1e46(0x166)]['application'][_0x1a1e46(0x175)]||0x1f90;continue;case'3':this[_0x1a1e46(0x1b8)]=_0x4eaa74[_0x1a1e46(0x1a5)](_0x3f5a61[_0x1a1e46(0x1d8)]);continue;case'4':this[_0x1a1e46(0x166)]=_0x2a24f0;continue;case'5':this[_0x1a1e46(0x1aa)]=new _0x16e175();continue;case'6':this[_0x1a1e46(0x146)]=_0x130189[_0x1a1e46(0x142)](_0x23eed7);continue;case'7':this[_0x1a1e46(0x16f)]=_0xd11d07['createClient'](_0x1ad3f3[_0x1a1e46(0x1d8)]);continue;case'8':this[_0x1a1e46(0x199)](_0xcb783a);continue;case'9':this['validateFlowAndFunctions']();continue;case'10':this[_0x1a1e46(0x19d)]=_0x29816c[_0x1a1e46(0x1a5)](_0x5ba33e[_0x1a1e46(0x1d8)]);continue;}break;}}}}[_0x454c95(0x199)](_0x26c8aa){const _0x331537=_0x454c95,_0x2827d7={'PMTmt':_0x331537(0x1c6),'fvviM':function(_0x33968a,_0x2cc5ce){return _0x33968a+_0x2cc5ce;},'KshfY':function(_0x337b6b,_0x58a38c){return _0x337b6b!==_0x58a38c;},'tMxJo':'NeATJ','FjNJD':_0x331537(0x1d3),'Ilcxk':_0x331537(0x1cc),'OFpkf':'Health\x20Clients'};let _0x597eba={'basePath':_0x2827d7[_0x331537(0x1e7)],'description':_0x2827d7['OFpkf'],'version':'V1','services':[]},_0x58159f=_0x26c8aa[_0x331537(0x1da)];Object[_0x331537(0x1a8)](_0x58159f)[_0x331537(0x16b)](function(_0x19cf90){const _0x44eaf7=_0x331537,_0x440336={'mqfxw':function(_0x3d80ac,_0x6d8ae3){const _0x1c747c=_0x4128;return _0x2827d7[_0x1c747c(0x1e4)](_0x3d80ac,_0x6d8ae3);}};if(_0x2827d7['KshfY'](_0x2827d7[_0x44eaf7(0x192)],_0x2827d7['FjNJD'])){let _0x1cd654=_0x58159f[_0x19cf90];_0x597eba['services'][_0x44eaf7(0x1cf)](new templateMonitorCheckRoute(_0x19cf90,_0x1cd654));}else _0x3b504f[_0x44eaf7(0x1c4)](_0x2827d7[_0x44eaf7(0x1fb)],{'description':_0x589de3[_0x44eaf7(0x1b4)],'basePath':_0x7d31bf[_0x44eaf7(0x1a3)],'totalServices':_0x797e7c[_0x44eaf7(0x16d)][_0x44eaf7(0x1f3)]}),_0x4ee29b[_0x44eaf7(0x16d)][_0x44eaf7(0x17d)](function(_0xdf3f66){const _0x1a52db=_0x44eaf7;let _0x528a4b=new _0x35823c({'path':_0x2c3ee4[_0x1a52db(0x18c)]?_0x3f3dc0[_0x1a52db(0x1a4)]('/',_0x2bdfe7[_0x1a52db(0x1a3)],'/',_0xdf3f66['route']||''):_0x440336[_0x1a52db(0x141)](_0x6d0834['basePath'],_0x43b5c2['join']('/',_0xdf3f66['route']||'')),'method':_0xdf3f66[_0x1a52db(0x1bc)],'enableUploader':_0xdf3f66[_0x1a52db(0x1d0)],'uploadFieldName':_0xdf3f66[_0x1a52db(0x178)],'security':_0xdf3f66[_0x1a52db(0x1e0)]});_0x29a15a[_0x1a52db(0x1c4)](_0x1a52db(0x156)+_0xdf3f66[_0x1a52db(0x1bc)][_0x1a52db(0x160)]()+_0x1a52db(0x1b6)+_0x528a4b[_0x1a52db(0x1ad)]()+'\x20serviceName='+_0xdf3f66[_0x1a52db(0x1f9)]+_0x1a52db(0x144)+_0xdf3f66[_0x1a52db(0x1cb)][_0x1a52db(0x1f3)]);let _0x453d70=new _0x2683ad(_0x4b55fa[_0x1a52db(0x1b8)]),_0x1fa07e=new _0xea4c67(_0x453d70,_0xdf3f66,_0x5132af[_0x1a52db(0x16f)],_0x6dce27[_0x1a52db(0x19d)]);_0x94ed29[_0x1a52db(0x1df)](_0x528a4b,_0x1fa07e);});}),_0x26c8aa[_0x331537(0x1c3)]['push'](_0x597eba);}['validateFlowAndFunctions'](){const _0x4daa50=_0x454c95,_0x30a64c={'ephMY':_0x4daa50(0x1ac),'fYMRp':function(_0x3266dc,_0x5071c2){return _0x3266dc+_0x5071c2;},'YGxYZ':_0x4daa50(0x167),'CvBgu':_0x4daa50(0x14e),'SzktB':function(_0x5d37b5,_0x1fba48){return _0x5d37b5+_0x1fba48;},'pXxbh':_0x4daa50(0x195),'LGrjY':_0x4daa50(0x1dc),'SSIMJ':_0x4daa50(0x1c9),'NIAKC':function(_0x3ebbcf,_0x457131){return _0x3ebbcf===_0x457131;},'CfRGW':_0x4daa50(0x176),'tCGCE':_0x4daa50(0x1c2),'VIvXh':_0x4daa50(0x1de)};Util[_0x4daa50(0x179)](_0x30a64c['tCGCE']);try{if(_0x30a64c[_0x4daa50(0x1b1)](_0x30a64c['VIvXh'],_0x30a64c[_0x4daa50(0x13d)])){let _0x47db72=this['listServiceGroup'][_0x4daa50(0x16b)](_0x4b481c=>{const _0x4dc9cd=_0x4daa50,_0xcce74f={'mpqGL':_0x30a64c[_0x4dc9cd(0x1b0)],'BFDwg':function(_0x3701ff,_0x27c410){const _0x9e37bd=_0x4dc9cd;return _0x30a64c[_0x9e37bd(0x165)](_0x3701ff,_0x27c410);},'BAocA':'\x0a\x0a\x20http://localhost:','xmpAU':_0x4dc9cd(0x1a1),'gDwTr':function(_0x426663,_0x3d3e12){const _0x336fb7=_0x4dc9cd;return _0x30a64c[_0x336fb7(0x165)](_0x426663,_0x3d3e12);},'gHTaw':_0x30a64c['YGxYZ'],'hEHIG':function(_0x441c59,_0x4a7589){return _0x441c59-_0x4a7589;},'mrpDZ':_0x30a64c['CvBgu'],'sJgJr':function(_0x1c53ce,_0x35dbdf){return _0x30a64c['SzktB'](_0x1c53ce,_0x35dbdf);},'oAaLT':_0x30a64c[_0x4dc9cd(0x189)],'zUtXj':'\x0a\x0a\x20Services:\x20','Mzghz':function(_0x138848,_0x49542e){return _0x138848+_0x49542e;},'DexrH':_0x30a64c[_0x4dc9cd(0x1ca)],'YBeWH':function(_0x2f3bec,_0x557158){return _0x2f3bec===_0x557158;},'Nlyqb':_0x30a64c[_0x4dc9cd(0x1d9)]};if(_0x30a64c[_0x4dc9cd(0x1b1)](_0x30a64c['CfRGW'],_0x30a64c[_0x4dc9cd(0x1ef)]))return _0x4b481c['services'][_0x4dc9cd(0x16b)](_0x12f353=>{const _0x45452b=_0x4dc9cd;if(_0xcce74f[_0x45452b(0x1ce)]('RWCkB',_0xcce74f[_0x45452b(0x1b2)])){const _0x44d0ef=_0xcce74f[_0x45452b(0x148)][_0x45452b(0x1b3)]('|');let _0x183ab3=0x0;while(!![]){switch(_0x44d0ef[_0x183ab3++]){case'0':_0x3f7009+=_0xcce74f['BFDwg'](_0xcce74f[_0x45452b(0x1f7)]+_0x511362['port'],'/');continue;case'1':_0x3f7009+=_0x45452b(0x164);continue;case'2':_0x3f7009+=_0xcce74f['xmpAU']+_0x2c6120[_0x45452b(0x1ba)];continue;case'3':_0x3f7009+=_0xcce74f['gDwTr'](_0xcce74f[_0x45452b(0x1cd)],_0x4fda4b[_0x45452b(0x166)][_0x45452b(0x166)][_0x45452b(0x160)]());continue;case'4':_0x3f7009+=_0xcce74f['BFDwg'](_0x45452b(0x180)+_0xcce74f[_0x45452b(0x19a)](new _0x5d7f18(),_0x3c55bb[_0x45452b(0x1aa)]),_0xcce74f[_0x45452b(0x13f)]);continue;case'5':_0x3d2ef8[_0x45452b(0x179)](_0x3f7009);continue;case'6':_0x3f7009+=_0x45452b(0x1ee);continue;case'7':var _0x3f7009=_0xcce74f['sJgJr'](_0xcce74f[_0x45452b(0x172)],_0x28e3fc['environment'][_0x45452b(0x1d8)]['appName'][_0x45452b(0x160)]());continue;case'8':_0x3f7009+=_0xcce74f[_0x45452b(0x13e)](_0xcce74f[_0x45452b(0x157)],_0x21c287['listServiceGroup'][_0x45452b(0x16b)](_0x227383=>_0x227383[_0x45452b(0x16d)][_0x45452b(0x1f3)])[_0x45452b(0x1f8)]((_0x509b40,_0xe3d718)=>_0x509b40+_0xe3d718,0x0));continue;case'9':_0x3f7009+=_0xcce74f['Mzghz'](_0xcce74f[_0x45452b(0x170)],_0x58b647['listServiceGroup'][_0x45452b(0x1f3)]);continue;case'10':_0x3f7009+='\x0a\x0a\x20Flows:\x20'+_0x79410f[_0x45452b(0x14d)][_0x45452b(0x16b)](_0x34d790=>_0x34d790[_0x45452b(0x16d)][_0x45452b(0x16b)](_0x5f319f=>_0x5f319f['flow']['length'])['reduce']((_0x49cedd,_0x425ee3)=>_0x49cedd+_0x425ee3,0x0))[_0x45452b(0x1f8)]((_0x3c40a6,_0x3376e0)=>_0x3c40a6+_0x3376e0,0x0);continue;}break;}}else return new ServiceContext(_0x12f353,null);});else _0x495de2[_0x4dc9cd(0x15c)](_0x434ad8);});}else{let _0x27c925=new _0x1681b5({'path':_0x33d333[_0x4daa50(0x18c)]?_0x3e010c[_0x4daa50(0x1a4)]('/',_0x27b79f[_0x4daa50(0x1a3)],'/',_0x2430c5['route']||''):_0x30a64c[_0x4daa50(0x165)](_0x1e324a['basePath'],_0x8c9c14[_0x4daa50(0x1a4)]('/',_0x5df8d7['route']||'')),'method':_0x48e910[_0x4daa50(0x1bc)],'enableUploader':_0x2ea55a[_0x4daa50(0x1d0)],'uploadFieldName':_0x1c3d29[_0x4daa50(0x178)],'security':_0x2b39c5[_0x4daa50(0x1e0)]});_0x48b6e0[_0x4daa50(0x1c4)](_0x4daa50(0x156)+_0x225589[_0x4daa50(0x1bc)]['toUpperCase']()+_0x4daa50(0x1b6)+_0x27c925['getPath']()+'\x20serviceName='+_0xfa0171[_0x4daa50(0x1f9)]+_0x4daa50(0x144)+_0x4b0ce6['flow'][_0x4daa50(0x1f3)]);let _0x1091b0=new _0x4a4fa4(_0x1ddf42[_0x4daa50(0x1b8)]),_0x23e73b=new _0x23b98c(_0x1091b0,_0x46faa3,_0x39b570[_0x4daa50(0x16f)],_0x20f223['openSearch']);_0x4ef29a['addRoute'](_0x27c925,_0x23e73b);}}catch(_0x2dbdb1){Util[_0x4daa50(0x15c)](_0x2dbdb1);}}async[_0x454c95(0x17e)](){const _0x1a98b8=_0x454c95,_0x4511e8={'byzjg':function(_0x39e554,_0x5bed2e){return _0x39e554+_0x5bed2e;},'jETPZ':function(_0x8c6863,_0x900232){return _0x8c6863===_0x900232;},'ZePep':'ChRgD','MPaLo':_0x1a98b8(0x14f),'pXyHM':_0x1a98b8(0x1a1),'tcfVP':_0x1a98b8(0x1ee),'IeGUQ':function(_0x1e0451,_0x508249){return _0x1e0451+_0x508249;},'sRDKQ':_0x1a98b8(0x167),'FGABx':function(_0x3a22e0,_0x12ee1e){return _0x3a22e0+_0x12ee1e;},'cANOF':_0x1a98b8(0x1dc),'sJfkZ':function(_0x46b056,_0x1de6d5){return _0x46b056+_0x1de6d5;},'cIxsT':_0x1a98b8(0x14e),'BOMdY':_0x1a98b8(0x190),'PYHbe':_0x1a98b8(0x164),'vtegy':function(_0x32e533,_0x379a02){return _0x32e533+_0x379a02;},'MPkui':_0x1a98b8(0x198),'RdPZI':function(_0x1edebd,_0x5cee79){return _0x1edebd+_0x5cee79;},'fIMyg':function(_0x11b355,_0x1f84ed){return _0x11b355+_0x1f84ed;},'bpTZG':_0x1a98b8(0x1d2),'bIyPh':function(_0x3fd864,_0x56c94d){return _0x3fd864(_0x56c94d);},'yZegJ':_0x1a98b8(0x14b),'VRhly':function(_0x652dbe,_0x507505){return _0x652dbe(_0x507505);}};let _0x4338a6=this;await this['licenseValidation'](),_0x4511e8[_0x1a98b8(0x1be)](require,_0x4511e8[_0x1a98b8(0x1d1)])(this),require(_0x1a98b8(0x16c))(this),this[_0x1a98b8(0x152)](),_0x4511e8[_0x1a98b8(0x155)](require,'../default-routes-pos')(this),this[_0x1a98b8(0x166)][_0x1a98b8(0x1bd)]&&this[_0x1a98b8(0x146)][_0x1a98b8(0x1a6)](this[_0x1a98b8(0x1ba)],function(_0x21fc6b){const _0x194e64=_0x1a98b8,_0x12ca92={'MhTTl':function(_0x2914f5,_0x4be337){const _0x738634=_0x4128;return _0x4511e8[_0x738634(0x140)](_0x2914f5,_0x4be337);}};if(_0x21fc6b)Util[_0x194e64(0x15c)](_0x21fc6b);else{if(_0x4511e8[_0x194e64(0x197)](_0x4511e8[_0x194e64(0x15b)],_0x4511e8['ZePep'])){const _0x26dd2a=_0x4511e8[_0x194e64(0x151)][_0x194e64(0x1b3)]('|');let _0x318412=0x0;while(!![]){switch(_0x26dd2a[_0x318412++]){case'0':Util[_0x194e64(0x179)](_0x2a32de);continue;case'1':_0x2a32de+=_0x4511e8[_0x194e64(0x140)](_0x4511e8[_0x194e64(0x18a)],_0x4338a6['port']);continue;case'2':_0x2a32de+=_0x4511e8[_0x194e64(0x1ae)];continue;case'3':_0x2a32de+=_0x4511e8[_0x194e64(0x194)](_0x4511e8[_0x194e64(0x1fa)],_0x4338a6['environment'][_0x194e64(0x166)][_0x194e64(0x160)]());continue;case'4':var _0x2a32de=_0x4511e8['IeGUQ'](_0x194e64(0x195),_0x4338a6[_0x194e64(0x166)][_0x194e64(0x1d8)]['appName']['toUpperCase']());continue;case'5':_0x2a32de+=_0x4511e8[_0x194e64(0x1b7)](_0x4511e8[_0x194e64(0x150)],_0x4338a6[_0x194e64(0x14d)][_0x194e64(0x1f3)]);continue;case'6':_0x2a32de+=_0x4511e8[_0x194e64(0x1b7)](_0x4511e8[_0x194e64(0x153)](_0x194e64(0x180),new Date()-_0x4338a6[_0x194e64(0x1aa)]),_0x4511e8[_0x194e64(0x1dd)]);continue;case'7':_0x2a32de+=_0x4511e8[_0x194e64(0x18b)]+_0x4338a6['listServiceGroup']['map'](_0x2c956a=>_0x2c956a['services'][_0x194e64(0x1f3)])[_0x194e64(0x1f8)]((_0x20be26,_0x4d2a5a)=>_0x20be26+_0x4d2a5a,0x0);continue;case'8':_0x2a32de+=_0x4511e8[_0x194e64(0x1f2)];continue;case'9':_0x2a32de+=_0x4511e8[_0x194e64(0x182)](_0x4511e8[_0x194e64(0x161)],_0x4338a6[_0x194e64(0x14d)]['map'](_0x5c8500=>_0x5c8500['services']['map'](_0x598cdc=>_0x598cdc[_0x194e64(0x1cb)]['length'])[_0x194e64(0x1f8)]((_0x2751c6,_0x1cba52)=>_0x2751c6+_0x1cba52,0x0))[_0x194e64(0x1f8)]((_0x43f8d5,_0x2960b5)=>_0x43f8d5+_0x2960b5,0x0));continue;case'10':_0x2a32de+=_0x4511e8[_0x194e64(0x188)](_0x4511e8[_0x194e64(0x149)](_0x4511e8[_0x194e64(0x19c)],_0x4338a6[_0x194e64(0x1ba)]),'/');continue;}break;}}else{let _0x2a03bd=this,_0x297d34=new _0x55e6a1(_0x2a03bd['app']);_0x2a03bd[_0x194e64(0x14d)]['forEach'](function(_0x45ef3e){const _0x496240=_0x194e64,_0x2b3c49={'DmhKh':function(_0x3bb85f,_0x24ee14){const _0x138141=_0x4128;return _0x12ca92[_0x138141(0x18f)](_0x3bb85f,_0x24ee14);}};_0x41e0f3[_0x496240(0x1c4)](_0x496240(0x1c6),{'description':_0x45ef3e['description'],'basePath':_0x45ef3e[_0x496240(0x1a3)],'totalServices':_0x45ef3e['services'][_0x496240(0x1f3)]}),_0x45ef3e[_0x496240(0x16d)][_0x496240(0x17d)](function(_0x31e5a7){const _0x2d2391=_0x496240;let _0x326ae9=new _0xda12df({'path':_0x45ef3e['validatePath']?_0x2d36e9[_0x2d2391(0x1a4)]('/',_0x45ef3e[_0x2d2391(0x1a3)],'/',_0x31e5a7[_0x2d2391(0x174)]||''):_0x2b3c49['DmhKh'](_0x45ef3e['basePath'],_0x29be5d['join']('/',_0x31e5a7['route']||'')),'method':_0x31e5a7[_0x2d2391(0x1bc)],'enableUploader':_0x31e5a7[_0x2d2391(0x1d0)],'uploadFieldName':_0x31e5a7[_0x2d2391(0x178)],'security':_0x31e5a7[_0x2d2391(0x1e0)]});_0x223cec[_0x2d2391(0x1c4)]('stage=info\x20method=Server.registerServiceRoutes\x20route\x20method='+_0x31e5a7['method']['toUpperCase']()+'\x20path='+_0x326ae9[_0x2d2391(0x1ad)]()+_0x2d2391(0x1a2)+_0x31e5a7['name']+_0x2d2391(0x144)+_0x31e5a7['flow'][_0x2d2391(0x1f3)]);let _0x1e6b20=new _0x2859d1(_0x2a03bd['redisClient']),_0x16bbf9=new _0xc6d456(_0x1e6b20,_0x31e5a7,_0x2a03bd[_0x2d2391(0x16f)],_0x2a03bd[_0x2d2391(0x19d)]);_0x297d34[_0x2d2391(0x1df)](_0x326ae9,_0x16bbf9);});});}}});}[_0x454c95(0x152)](){const _0x4e1cdb=_0x454c95,_0x4af835={'aivXv':function(_0x428b2d,_0x438024){return _0x428b2d+_0x438024;},'DLDvl':function(_0x12ef10,_0x1230b7){return _0x12ef10!==_0x1230b7;},'wgRls':_0x4e1cdb(0x159),'jMNKa':_0x4e1cdb(0x1c6)};let _0x289b16=this,_0x464c05=new Router(_0x289b16['app']);_0x289b16['listServiceGroup'][_0x4e1cdb(0x17d)](function(_0x1be066){const _0x509b16=_0x4e1cdb,_0x48e56d={'iWQEM':function(_0xc9d701,_0x23ef77){const _0x2c4ae7=_0x4128;return _0x4af835[_0x2c4ae7(0x1a9)](_0xc9d701,_0x23ef77);}};if(_0x4af835['DLDvl'](_0x4af835[_0x509b16(0x1ec)],_0x4af835[_0x509b16(0x1ec)]))return _0x449c69[_0x509b16(0x16d)][_0x509b16(0x16b)](_0x4d3125=>{return new _0xf5e2ad(_0x4d3125,null);});else Util[_0x509b16(0x1c4)](_0x4af835[_0x509b16(0x193)],{'description':_0x1be066['description'],'basePath':_0x1be066[_0x509b16(0x1a3)],'totalServices':_0x1be066['services'][_0x509b16(0x1f3)]}),_0x1be066[_0x509b16(0x16d)][_0x509b16(0x17d)](function(_0x1e7a75){const _0x5d20d4=_0x509b16;let _0x5a6db0=new ServiceRoute({'path':_0x1be066[_0x5d20d4(0x18c)]?path[_0x5d20d4(0x1a4)]('/',_0x1be066[_0x5d20d4(0x1a3)],'/',_0x1e7a75[_0x5d20d4(0x174)]||''):_0x48e56d[_0x5d20d4(0x16e)](_0x1be066[_0x5d20d4(0x1a3)],path['join']('/',_0x1e7a75[_0x5d20d4(0x174)]||'')),'method':_0x1e7a75[_0x5d20d4(0x1bc)],'enableUploader':_0x1e7a75[_0x5d20d4(0x1d0)],'uploadFieldName':_0x1e7a75[_0x5d20d4(0x178)],'security':_0x1e7a75['security']});Util[_0x5d20d4(0x1c4)](_0x5d20d4(0x156)+_0x1e7a75[_0x5d20d4(0x1bc)][_0x5d20d4(0x160)]()+'\x20path='+_0x5a6db0[_0x5d20d4(0x1ad)]()+_0x5d20d4(0x1a2)+_0x1e7a75[_0x5d20d4(0x1f9)]+_0x5d20d4(0x144)+_0x1e7a75['flow'][_0x5d20d4(0x1f3)]);let _0x506039=new OrchestrationFlow(_0x289b16['redisClient']),_0x47892e=new HandleRoute(_0x506039,_0x1e7a75,_0x289b16[_0x5d20d4(0x16f)],_0x289b16[_0x5d20d4(0x19d)]);_0x464c05['addRoute'](_0x5a6db0,_0x47892e);});});}}function createListServiceGroup(_0x598ec3){const _0x2fbbae=_0x454c95;return _0x598ec3[_0x2fbbae(0x16b)](_0x4928fa=>{return new ServiceGroup(_0x4928fa);});}module[_0x454c95(0x187)]=Server;
@@ -0,0 +1 @@
1
+ 'use strict';const _0x3c2094=_0x5a29;(function(_0x5be7b9,_0x18c71d){const _0x39301f=_0x5a29,_0x4e4bd6=_0x5be7b9();while(!![]){try{const _0x5a90d3=parseInt(_0x39301f(0x1de))/0x1+parseInt(_0x39301f(0x1d8))/0x2+parseInt(_0x39301f(0x1db))/0x3*(-parseInt(_0x39301f(0x1d7))/0x4)+parseInt(_0x39301f(0x1ca))/0x5+parseInt(_0x39301f(0x1da))/0x6*(-parseInt(_0x39301f(0x1e3))/0x7)+parseInt(_0x39301f(0x1d0))/0x8*(parseInt(_0x39301f(0x1c9))/0x9)+parseInt(_0x39301f(0x1d2))/0xa*(-parseInt(_0x39301f(0x1ce))/0xb);if(_0x5a90d3===_0x18c71d)break;else _0x4e4bd6['push'](_0x4e4bd6['shift']());}catch(_0x390012){_0x4e4bd6['push'](_0x4e4bd6['shift']());}}}(_0x3439,0x5436c));const path=require(_0x3c2094(0x1e4));function _0x3439(){const _0x73217b=['BMfTzq','mZC5otmXmML5t1P4tW','zgvZy3jPChrPB24','mtbgzfLyCeK','Bwv0Ag9K','r0vu','AgfZt3DUuhjVCgvYDhK','rNPprgO','ngLbquzICq','nteXntu4sNL0quzY','Aw5MBW','mZmWntrJCejhzg4','mty1mJDyC1zSBgm','Bw9UAxrVCG','DurlCee','ntm3ntu0q3rxEMTy','ywrKrMXVD0LUzM8','sgvHBhrOq2HLy2S','B0LbBwq','DKLgqui','mte5BvjjB1vi','Cgf0Aa','ywrKrMXVD0HLywX0Aa','Aw5MB0nOzwnR','AgvHBhrO','AgvHBhrOq2HLy2S','oxzUswTPBa','mtC1nZC5nxHxExPJyG','zMXVDW','CM91Dgu','ChvZAa','mti5mZi3ndrSuLLls3e'];_0x3439=function(){return _0x73217b;};return _0x3439();}class templateMonitorCheckRoute{constructor(_0x9646b9,_0x58b4b0){const _0x5ebcb6=_0x3c2094,_0x187669={'FtMMV':_0x5ebcb6(0x1d4),'lUWdU':function(_0x4142ae,_0x169d43){return _0x4142ae===_0x169d43;},'TRvvA':'mSNza','oIAmd':'VMVbs'};this[_0x5ebcb6(0x1cf)]=_0x9646b9+_0x5ebcb6(0x1e0),this[_0x5ebcb6(0x1d1)]=_0x58b4b0[_0x5ebcb6(0x1d1)],this[_0x5ebcb6(0x1d3)]=_0x187669['FtMMV'],this[_0x5ebcb6(0x1cc)]=''+_0x9646b9,this[_0x5ebcb6(0x1cb)]=[];if(_0x58b4b0[_0x5ebcb6(0x1d5)]('healthCheck')){if(_0x187669['lUWdU'](_0x187669['TRvvA'],_0x187669[_0x5ebcb6(0x1e1)]))return{'resultVariable':_0x5ebcb6(0x1c7),'operation':{'clientName':_0x101652,'path':_0x416fb9[_0x5ebcb6(0x1c8)],'type':_0x5ebcb6(0x1dc)}};else this[_0x5ebcb6(0x1cb)][_0x5ebcb6(0x1cd)](this[_0x5ebcb6(0x1c5)](_0x9646b9,_0x58b4b0));};_0x58b4b0[_0x5ebcb6(0x1d5)](_0x5ebcb6(0x1c6))&&this[_0x5ebcb6(0x1cb)]['push'](this[_0x5ebcb6(0x1df)](_0x9646b9,_0x58b4b0));;}[_0x3c2094(0x1df)](_0x2e616f,_0x36f652){const _0x59483d=_0x3c2094,_0x2c1b26={'KNaua':_0x59483d(0x1d9),'FzODj':_0x59483d(0x1dc)};return{'resultVariable':_0x2c1b26['KNaua'],'operation':{'clientName':_0x2e616f,'path':_0x36f652[_0x59483d(0x1c6)],'type':_0x2c1b26[_0x59483d(0x1d6)]}};}['addFlowHealth'](_0x1f78f1,_0x254cc2){const _0x1815d3=_0x3c2094,_0x209945={'uDKpA':'health','vIFAB':'monitor'};return{'resultVariable':_0x209945[_0x1815d3(0x1dd)],'operation':{'clientName':_0x1f78f1,'path':_0x254cc2[_0x1815d3(0x1c8)],'type':_0x209945[_0x1815d3(0x1e2)]}};}};function _0x5a29(_0x3b96fa,_0x5127f5){const _0x343999=_0x3439();return _0x5a29=function(_0x5a2989,_0x1425e8){_0x5a2989=_0x5a2989-0x1c5;let _0x4eaa33=_0x343999[_0x5a2989];if(_0x5a29['aPBZYM']===undefined){var _0x247042=function(_0x2b6527){const _0x710aba='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x35f9a3='',_0x33243d='';for(let _0x451174=0x0,_0x65a201,_0x5587c9,_0x348c63=0x0;_0x5587c9=_0x2b6527['charAt'](_0x348c63++);~_0x5587c9&&(_0x65a201=_0x451174%0x4?_0x65a201*0x40+_0x5587c9:_0x5587c9,_0x451174++%0x4)?_0x35f9a3+=String['fromCharCode'](0xff&_0x65a201>>(-0x2*_0x451174&0x6)):0x0){_0x5587c9=_0x710aba['indexOf'](_0x5587c9);}for(let _0x32925f=0x0,_0x2a77b7=_0x35f9a3['length'];_0x32925f<_0x2a77b7;_0x32925f++){_0x33243d+='%'+('00'+_0x35f9a3['charCodeAt'](_0x32925f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x33243d);};_0x5a29['DCReep']=_0x247042,_0x3b96fa=arguments,_0x5a29['aPBZYM']=!![];}const _0x5eab53=_0x343999[0x0],_0x36d1a5=_0x5a2989+_0x5eab53,_0x4368e4=_0x3b96fa[_0x36d1a5];return!_0x4368e4?(_0x4eaa33=_0x5a29['DCReep'](_0x4eaa33),_0x3b96fa[_0x36d1a5]=_0x4eaa33):_0x4eaa33=_0x4368e4,_0x4eaa33;},_0x5a29(_0x3b96fa,_0x5127f5);}module['exports']=templateMonitorCheckRoute;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "heimdall-api-platform",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
- "main": "lib/index.js",
6
- "bin": "lib/index.js",
5
+ "main": "dist/index.js",
6
+ "bin": "dist/index.js",
7
7
  "license": "MIT",
8
8
  "files": [
9
- "lib",
9
+ "dist",
10
10
  "LICENSE",
11
11
  "README.md",
12
12
  "package.json"
@@ -1,296 +0,0 @@
1
- "use strict";
2
-
3
- const Util = require("../commons-util");
4
- const Const = require("../commons-const");
5
- const { CreateHttpError } = require("../commons-errors");
6
- const http = require("http");
7
- const https = require("https");
8
- const doRequest = require("axios");
9
- const path = require("path");
10
- const _ = require("underscore");
11
- const { promisify } = require("util");
12
- const FormData = require('form-data');
13
-
14
-
15
- // require("axios-debug-log")({
16
- // request: function (debug, config) {
17
- // Util.info(
18
- // `stage=request method=interceptors.request url=${config.baseURL}${config.url} request=${config.data}`
19
- // );
20
- // },
21
- // response: function (debug, response) {
22
- // Util.info(
23
- // `stage=request method=interceptors.response url=${response.config.baseURL}${response.config.url} request=${
24
- // response.config.data
25
- // } response=${JSON.stringify(response.data, null, 2)}`
26
- // );
27
- // },
28
- // error: function (debug, error) {
29
- // Util.error(
30
- // `stage=request method=interceptors.error url=${error.config.baseURL}${error.config.url} request=${
31
- // error.config.data
32
- // } error=${JSON.stringify(new CreateHttpError(error), null, 2)}`
33
- // );
34
- // },
35
- // });
36
-
37
- class HttpClient {
38
- constructor(options) {
39
- if (!options.host) {
40
- Util.throwErrorIfItExists(new Error("The url can not be empty."));
41
- }
42
-
43
- this.host = options.host || "";
44
- this.basePath = options.basePath || "";
45
- this.user = options.user;
46
- this.password = options.password || "";
47
- this.token = options.token || "";
48
- this.poolSize = options.poolSize || Const.DEFAULT_POOLSIZE;
49
- this.authentication = options.authentication || "";
50
- this.timeout = options.timeout || Const.DEFAULT_TIMEOUT_MS;
51
- this.mtls = options.mtls || {};
52
- this.enableMtls = this.mtls.hasOwnProperty("cert") && this.mtls.hasOwnProperty("key") ? true : false;
53
- this.enableMtlsPfx = this.mtls.hasOwnProperty("pfx") && this.mtls.hasOwnProperty("passphrase") ? true : false;
54
- this.protocol = this.host.substr(0, this.host.indexOf(":"));
55
- }
56
-
57
- generateRequestOptions(options) {
58
-
59
- let requestOptions = {
60
- method: (options.method || Const.HTTP_METHOD.GET).toLocaleLowerCase(),
61
- baseURL: this.host,
62
- url: path.join("/", this.basePath),
63
- params: options.query || {},
64
- timeout: this.timeout,
65
- gzip: true,
66
- responseType: "json",
67
- headers: this.generateRequestHeaders(options),
68
- };
69
-
70
- // Adicionar options.path à URL se existir
71
- if (options.path) {
72
- requestOptions.url = path.join(requestOptions.url, "/", options.path);
73
- }
74
-
75
- // Construir a URL completa
76
- requestOptions.urlFull = requestOptions.baseURL + requestOptions.url;
77
-
78
- // Ajustar a URL para rotas de monitoramento
79
- if (options.monitor) {
80
- requestOptions.url = this.host + path.join("/", options.path || "").replace(/\\/g, "/");
81
- }
82
-
83
- //Validate path windows
84
- if (process.platform == 'win32') {
85
- requestOptions.url = requestOptions.url.replace(/\\/g, "/");
86
- }
87
-
88
- // Configurar agentes HTTP/HTTPS com mTLS se necessário
89
- if (this.protocol === "https") {
90
- if (this.enableMtls) {
91
- requestOptions.httpsAgent = new https.Agent({
92
- cert: Buffer.from(this.mtls.cert, "base64").toString("utf8"),
93
- key: Buffer.from(this.mtls.key, "base64").toString("utf8"),
94
- keepAlive: true,
95
- });
96
- } else if (this.enableMtlsPfx) {
97
- requestOptions.httpsAgent = new https.Agent({
98
- pfx: Buffer.from(this.mtls.pfx, "base64"),
99
- passphrase: Buffer.from(this.mtls.passphrase, "base64").toString("utf8"),
100
- minVersion: 'TLSv1.2',
101
- keepAlive: true,
102
- });
103
- } else {
104
- requestOptions.httpsAgent = this.getAgent();
105
- }
106
- } else {
107
- requestOptions.httpAgent = this.getAgent();
108
- }
109
-
110
- // Configurar dados da requisição para métodos POST
111
- if (
112
- requestOptions.method === Const.HTTP_METHOD.POST.toLocaleLowerCase() &&
113
- requestOptions.headers[Const.HEADERS.CONTENT_TYPE].indexOf(Const.FORM_CONTENT_TYPE_VALUE) > -1
114
- ) {
115
- requestOptions.data = !_.isEmpty(options.params) ? options.params : options.body;
116
- requestOptions.dataType = "form";
117
- } else if (
118
- requestOptions.method === Const.HTTP_METHOD.POST.toLowerCase() &&
119
- requestOptions.headers[Const.HEADERS.CONTENT_TYPE].indexOf(Const.FORM_MULTIPART_CONTENT_TYPE_VALUE) > -1
120
- ) {
121
- requestOptions.dataType = "multipart";
122
-
123
- const form = new FormData();
124
-
125
- if (options.request?.file) {
126
- const request = options.request;
127
- const file = request.file;
128
- form.append(options.service.rawOptions.uploadFieldName || 'file', file.buffer, {
129
- filename: file.originalname,
130
- contentType: file.mimetype,
131
- });
132
- }
133
-
134
- // Adiciona outros campos do params/body
135
- const fields = !_.isEmpty(options.params) ? options.params : options.body;
136
- if (fields && typeof fields === 'object') {
137
- for (const [key, value] of Object.entries(fields)) {
138
- form.append(key, value);
139
- }
140
- }
141
-
142
- // Sobrescreve os headers para incluir os do FormData
143
- requestOptions.headers = {
144
- ...requestOptions.headers,
145
- ...form.getHeaders(),
146
- };
147
-
148
- requestOptions.data = form;
149
-
150
- } else if (!_.isEmpty(options.body)) {
151
- requestOptions.dataType = "json";
152
- requestOptions.data = JSON.stringify(options.body);
153
- }
154
-
155
- return requestOptions;
156
- }
157
-
158
-
159
- getAgent() {
160
- let agent = null;
161
-
162
- switch (this.protocol) {
163
- case "https":
164
- agent = new https.Agent({ keepAlive: true });
165
- break;
166
- default:
167
- agent = new http.Agent({ keepAlive: true });
168
- break;
169
- }
170
-
171
- agent.maxSockets = this.poolSize || Const.DEFAULT_POOLSIZE;
172
-
173
- return agent;
174
- }
175
-
176
- generateRequestHeaders(options) {
177
- let headers = {};
178
-
179
- if (options.headers) {
180
- headers = _.extend(headers, options.headers);
181
- }
182
-
183
- if (this.authentication && this.authentication.toLowerCase() === "basic" && this.user && this.password) {
184
- headers.Authorization = "Basic " + new Buffer(this.user + ":" + this.password).toString("base64");
185
- }
186
-
187
- if (this.authentication && this.authentication.toLowerCase() === "bearer" && this.token) {
188
- headers.Authorization = "Bearer " + this.token;
189
- }
190
-
191
- /*if (options.method == Const.HTTP_METHOD.POST &&
192
- options.headers[Const.HEADERS.CONTENT_TYPE] == 'application/x-www-form-urlencoded;charset=UTF-8') {
193
- headers[Const.HEADERS.CONTENT_LENGTH] = querystring.stringify(options.params).length;
194
- } else {
195
- headers[Const.HEADERS.CONTENT_LENGTH] = querystring.stringify(options.body).length;
196
- }*/
197
-
198
- //headers.Connection = 'keep-alive';
199
-
200
- headers.Connection = "close";
201
-
202
- return headers;
203
- }
204
-
205
- //TODO ADICIONAR O STEPFLOW PORQUE ELE TEM O CONTEXT
206
- async execute(options, callbackStep) {
207
-
208
- let requestOptions = this.generateRequestOptions(options);
209
-
210
- Util.info(
211
- `stage=init method=HttpClient.execute (${this.protocol.toUpperCase()}) for Client Name=${options.name || ""
212
- } config`,
213
- {
214
- uuid: options.uuid || "",
215
- flowStepUuid: options.flowStepUuid || "",
216
- contextUuid: options.contextUuid || "",
217
- timeout: requestOptions.timeout,
218
- method: requestOptions.method,
219
- url: requestOptions.urlFull,
220
- body: Util.isJSONValid(requestOptions.data) ? Util.obfuscationJSON(requestOptions.data) : {},
221
- query: requestOptions.params || {},
222
- headers: Util.obfuscationJSON(requestOptions.headers || {}),
223
- }
224
- );
225
-
226
- doRequest(requestOptions)
227
- .then((response) => {
228
- Util.info(
229
- `stage=end method=HttpClient.execute (${this.protocol.toUpperCase()}) for Client Name=${options.name || ""
230
- } response`,
231
- {
232
- uuid: options.uuid || "",
233
- flowStepUuid: options.flowStepUuid || "",
234
- contextUuid: options.contextUuid || "",
235
- timeout: requestOptions.timeout,
236
- method: requestOptions.method,
237
- url: requestOptions.urlFull,
238
- body: Util.isJSONValid(requestOptions.data) ? Util.obfuscationJSON(requestOptions.data) : {},
239
- query: requestOptions.params || {},
240
- headers: Util.obfuscationJSON(requestOptions.headers || {}),
241
- result: Util.obfuscationJSON(response.data || {}),
242
- }
243
- );
244
-
245
- callbackStep(null, response);
246
- })
247
- .catch((error) => {
248
- //TODO: TRATAR ESSES ERROS
249
- //error.code[EHOSTUNREACH,ECONNREFUSED,ECONNRESET,ESOCKETTIMEDOUT]
250
-
251
- Util.error(
252
- `stage=error method=HttpClient.execute (${this.protocol.toUpperCase()}) for Client Name=${options.name || ""
253
- } response`,
254
- {
255
- uuid: options.uuid || "",
256
- flowStepUuid: options.flowStepUuid || "",
257
- contextUuid: options.contextUuid || "",
258
- timeout: requestOptions.timeout,
259
- method: requestOptions.method,
260
- url: requestOptions.urlFull,
261
- body: Util.isJSONValid(requestOptions.data) ? Util.obfuscationJSON(requestOptions.data) : {},
262
- query: requestOptions.params || {},
263
- headers: Util.obfuscationJSON(requestOptions.headers || {}),
264
- error: Util.obfuscationJSON(new CreateHttpError(error) || {}),
265
- }
266
- );
267
-
268
- if (error || error.response.status >= Const.HTTP_STATUS.ERROR_CLIENT_RANGE_START) {
269
- callbackStep(new CreateHttpError(error), null);
270
- } else {
271
- Util.info(
272
- `stage=error method=HttpClient.execute (${this.protocol.toUpperCase()}) for Client Name=${options.name || ""
273
- } response`,
274
- {
275
- uuid: options.uuid || "",
276
- flowStepUuid: options.flowStepUuid || "",
277
- contextUuid: options.contextUuid || "",
278
- timeout: requestOptions.timeout,
279
- method: requestOptions.method,
280
- url: requestOptions.urlFull,
281
- body: Util.isJSONValid(requestOptions.data) ? Util.obfuscationJSON(requestOptions.data) : {},
282
- query: requestOptions.params || {},
283
- headers: Util.obfuscationJSON(requestOptions.headers || {}),
284
- result: Util.obfuscationJSON(error.response.data || {}),
285
- }
286
- );
287
-
288
- callbackStep(null, error.response || {});
289
- }
290
- });
291
- }
292
- }
293
-
294
- HttpClient.prototype.executePromise = promisify(HttpClient.prototype.execute);
295
-
296
- module.exports = HttpClient;
@@ -1,185 +0,0 @@
1
- "use strict";
2
-
3
- const redis = require("redis");
4
- const { promisify } = require("util");
5
- const NodeCache = require("node-cache");
6
- const Util = require("./commons-util.js");
7
-
8
- const DEFAULT_REDIS_CONNECT_TIMEOUT = 30000;
9
- const DEFAULT_REDIS_RECONNECT_TIMEOUT = 30000;
10
-
11
- class RedisClient {
12
- constructor(options = {}) {
13
- this.enableRedis = options.enableRedis || false;
14
- this.readClient = null;
15
- this.writerClient = null;
16
-
17
- this.localCache = new NodeCache({
18
- stdTTL: 120, // Default TTL of 120 seconds
19
- checkperiod: 1, // Check expired keys every 1 second
20
- });
21
-
22
- if (this.enableRedis && options.redisCache) {
23
- const { reader, writer } = options.redisCache;
24
- this.readClient = this.createRedisClient(reader, "read");
25
- this.writerClient = this.createRedisClient(writer, "writer");
26
- }
27
- }
28
-
29
- createRedisClient(config, type) {
30
- if (!config) {
31
- Util.warning(`stage=warn method=createRedisClient message=No Redis configuration provided for type=${type}`);
32
- return null;
33
- }
34
-
35
- const client = redis.createClient(config.port, config.host, {
36
- enable_offline_queue: false,
37
- no_ready_check: true,
38
- connect_timeout: config.connectTimeout || DEFAULT_REDIS_CONNECT_TIMEOUT,
39
- retry_strategy: RedisClient.retryStrategy,
40
- });
41
-
42
- client.on("error", (err) => {
43
- Util.error(`stage=error method=createRedisClient message=Redis[${type}] error`, err);
44
- });
45
-
46
- client.on("connect", () => {
47
- Util.info(`stage=info method=createRedisClient message=Redis[${type}] connected`, {
48
- host: config.host,
49
- port: config.port,
50
- });
51
- });
52
-
53
- return client;
54
- }
55
-
56
- async put(cacheName, key, value, ttl) {
57
- const composedKey = this.composeKey(cacheName, key);
58
-
59
- if (this.writerClient && this.writerClient.connected) {
60
- const setexAsync = promisify(this.writerClient.setex).bind(this.writerClient);
61
- try {
62
- await setexAsync(composedKey, ttl, JSON.stringify(value));
63
- Util.info(`stage=info method=put message=Cache set successfully`, { cacheName, key, ttl });
64
- return;
65
- } catch (err) {
66
- Util.error(`stage=error method=put message=Error setting cache in Redis`, err);
67
- }
68
- }
69
-
70
- // Fallback to local cache
71
- this.localCache.set(composedKey, value, ttl);
72
- Util.warning(`stage=warn method=put message=Using local cache as fallback`, { cacheName, key });
73
- }
74
-
75
- async get(cacheName, key) {
76
- const composedKey = this.composeKey(cacheName, key);
77
-
78
- if (this.readClient && this.readClient.connected) {
79
- const getAsync = promisify(this.readClient.get).bind(this.readClient);
80
- try {
81
- const entry = await getAsync(composedKey);
82
- if (entry) {
83
- Util.info(`stage=info method=get message=Cache hit in Redis`, { cacheName, key });
84
- return JSON.parse(entry);
85
- } else {
86
- Util.warning(`stage=warn method=get message=Cache miss in Redis`, { cacheName, key });
87
- }
88
- } catch (err) {
89
- Util.error(`stage=error method=get message=Error retrieving cache from Redis`, err);
90
- }
91
- }
92
-
93
- // Fallback to local cache
94
- const localValue = this.localCache.get(composedKey);
95
- if (localValue) {
96
- Util.info(`stage=info method=get message=Cache hit in local cache`, { cacheName, key });
97
- } else {
98
- Util.warning(`stage=warn method=get message=Cache miss in local cache`, { cacheName, key });
99
- }
100
- return localValue || null;
101
- }
102
-
103
- async delete(cacheName, key) {
104
- const composedKey = this.composeKey(cacheName, key);
105
-
106
- if (this.writerClient && this.writerClient.connected) {
107
- const delAsync = promisify(this.writerClient.del).bind(this.writerClient);
108
- try {
109
- const result = await delAsync(composedKey);
110
- if (result) {
111
- Util.info(`stage=info method=delete message=Key deleted successfully in Redis`, { cacheName, key });
112
- return;
113
- }
114
- Util.warning(`stage=warn method=delete message=Key not found in Redis`, { cacheName, key });
115
- } catch (err) {
116
- Util.error(`stage=error method=delete message=Error deleting key in Redis`, err);
117
- }
118
- }
119
-
120
- // Fallback to local cache
121
- const localDeleted = this.localCache.del(composedKey);
122
- if (localDeleted) {
123
- Util.info(`stage=info method=delete message=Key deleted successfully in local cache`, { cacheName, key });
124
- } else {
125
- Util.warning(`stage=warn method=delete message=Key not found in local cache`, { cacheName, key });
126
- }
127
- }
128
-
129
- async getKeys(cacheName) {
130
- if (this.readClient && this.readClient.connected) {
131
- const keysAsync = promisify(this.readClient.keys).bind(this.readClient);
132
- try {
133
- const keys = await keysAsync(`${cacheName}:*`);
134
- if (keys.length) {
135
- Util.info(`stage=info method=getKeys message=Keys found in Redis`, { cacheName, keys });
136
- return keys;
137
- }
138
- Util.warning(`stage=warn method=getKeys message=No keys found in Redis`, { cacheName });
139
- } catch (err) {
140
- Util.error(`stage=error method=getKeys message=Error retrieving keys from Redis`, err);
141
- }
142
- }
143
-
144
- // Fallback to local cache
145
- const keys = this.localCache.keys().filter((key) => key.startsWith(`${cacheName}:`));
146
- if (keys.length) {
147
- Util.info(`stage=info method=getKeys message=Keys found in local cache`, { cacheName, keys });
148
- } else {
149
- Util.warning(`stage=warn method=getKeys message=No keys found in local cache`, { cacheName });
150
- }
151
- return keys;
152
- }
153
-
154
- composeKey(cacheName, key) {
155
- return `${cacheName}:${key}`;
156
- }
157
-
158
- static retryStrategy(options) {
159
- const MAX_RETRY_TIME = 1000 * 60 * 60;
160
- const MAX_ATTEMPTS = 10;
161
-
162
- if (options.error && options.error.code === "ECONNREFUSED") {
163
- Util.error(`stage=error method=retryStrategy message=Connection refused`, options.error);
164
- return DEFAULT_REDIS_RECONNECT_TIMEOUT;
165
- }
166
-
167
- if (options.total_retry_time > MAX_RETRY_TIME) {
168
- Util.error(`stage=error method=retryStrategy message=Retry time exhausted`);
169
- return new Error("Retry time exhausted");
170
- }
171
-
172
- if (options.attempt > MAX_ATTEMPTS) {
173
- Util.warning(`stage=warn method=retryStrategy message=Max attempts reached`, { attempts: options.attempt });
174
- return undefined;
175
- }
176
-
177
- Util.info(`stage=info method=retryStrategy message=Retrying connection`, { attempts: options.attempt });
178
- return Math.min(options.attempt * 100, DEFAULT_REDIS_RECONNECT_TIMEOUT);
179
- }
180
- }
181
-
182
- module.exports = {
183
- createClient: (options) => new RedisClient(options),
184
- RedisClient,
185
- };