@celljs/web 3.0.0
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.
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/cell.yml +29 -0
- package/lib/browser/module.d.ts +3 -0
- package/lib/browser/module.d.ts.map +1 -0
- package/lib/browser/module.js +5 -0
- package/lib/browser/module.js.map +1 -0
- package/lib/common/constants.d.ts +5 -0
- package/lib/common/constants.d.ts.map +1 -0
- package/lib/common/constants.js +8 -0
- package/lib/common/constants.js.map +1 -0
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +21 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/module.d.ts +4 -0
- package/lib/common/module.d.ts.map +1 -0
- package/lib/common/module.js +6 -0
- package/lib/common/module.js.map +1 -0
- package/lib/common/pipe/index.d.ts +6 -0
- package/lib/common/pipe/index.d.ts.map +1 -0
- package/lib/common/pipe/index.js +22 -0
- package/lib/common/pipe/index.js.map +1 -0
- package/lib/common/pipe/pipe-manager.d.ts +6 -0
- package/lib/common/pipe/pipe-manager.d.ts.map +1 -0
- package/lib/common/pipe/pipe-manager.js +37 -0
- package/lib/common/pipe/pipe-manager.js.map +1 -0
- package/lib/common/pipe/pipe-protocol.d.ts +23 -0
- package/lib/common/pipe/pipe-protocol.d.ts.map +1 -0
- package/lib/common/pipe/pipe-protocol.js +7 -0
- package/lib/common/pipe/pipe-protocol.js.map +1 -0
- package/lib/common/pipe/pipe-provider.d.ts +8 -0
- package/lib/common/pipe/pipe-provider.d.ts.map +1 -0
- package/lib/common/pipe/pipe-provider.js +36 -0
- package/lib/common/pipe/pipe-provider.js.map +1 -0
- package/lib/common/pipe/pipe-transtorm.d.ts +11 -0
- package/lib/common/pipe/pipe-transtorm.d.ts.map +1 -0
- package/lib/common/pipe/pipe-transtorm.js +97 -0
- package/lib/common/pipe/pipe-transtorm.js.map +1 -0
- package/lib/common/pipe/validation-errors.d.ts +6 -0
- package/lib/common/pipe/validation-errors.d.ts.map +1 -0
- package/lib/common/pipe/validation-errors.js +11 -0
- package/lib/common/pipe/validation-errors.js.map +1 -0
- package/lib/common/resolver/index.d.ts +3 -0
- package/lib/common/resolver/index.d.ts.map +1 -0
- package/lib/common/resolver/index.js +19 -0
- package/lib/common/resolver/index.js.map +1 -0
- package/lib/common/resolver/path-resolver.d.ts +6 -0
- package/lib/common/resolver/path-resolver.d.ts.map +1 -0
- package/lib/common/resolver/path-resolver.js +40 -0
- package/lib/common/resolver/path-resolver.js.map +1 -0
- package/lib/common/resolver/resolver-protocol.d.ts +5 -0
- package/lib/common/resolver/resolver-protocol.d.ts.map +1 -0
- package/lib/common/resolver/resolver-protocol.js +5 -0
- package/lib/common/resolver/resolver-protocol.js.map +1 -0
- package/lib/common/utils/index.d.ts +2 -0
- package/lib/common/utils/index.d.ts.map +1 -0
- package/lib/common/utils/index.js +18 -0
- package/lib/common/utils/index.js.map +1 -0
- package/lib/common/utils/url-util.d.ts +11 -0
- package/lib/common/utils/url-util.d.ts.map +1 -0
- package/lib/common/utils/url-util.js +36 -0
- package/lib/common/utils/url-util.js.map +1 -0
- package/lib/hooks/serve.d.ts +8 -0
- package/lib/hooks/serve.d.ts.map +1 -0
- package/lib/hooks/serve.js +60 -0
- package/lib/hooks/serve.js.map +1 -0
- package/lib/node/application/dev-application-entry.d.ts +7 -0
- package/lib/node/application/dev-application-entry.d.ts.map +1 -0
- package/lib/node/application/dev-application-entry.js +23 -0
- package/lib/node/application/dev-application-entry.js.map +1 -0
- package/lib/node/body/body-middleware.d.ts +11 -0
- package/lib/node/body/body-middleware.d.ts.map +1 -0
- package/lib/node/body/body-middleware.js +43 -0
- package/lib/node/body/body-middleware.js.map +1 -0
- package/lib/node/body/body-protocol.d.ts +2 -0
- package/lib/node/body/body-protocol.d.ts.map +1 -0
- package/lib/node/body/body-protocol.js +6 -0
- package/lib/node/body/body-protocol.js.map +1 -0
- package/lib/node/body/index.d.ts +3 -0
- package/lib/node/body/index.d.ts.map +1 -0
- package/lib/node/body/index.js +19 -0
- package/lib/node/body/index.js.map +1 -0
- package/lib/node/context.d.ts +33 -0
- package/lib/node/context.d.ts.map +1 -0
- package/lib/node/context.js +79 -0
- package/lib/node/context.js.map +1 -0
- package/lib/node/cookies/cookies-factory.d.ts +7 -0
- package/lib/node/cookies/cookies-factory.d.ts.map +1 -0
- package/lib/node/cookies/cookies-factory.js +37 -0
- package/lib/node/cookies/cookies-factory.js.map +1 -0
- package/lib/node/cookies/cookies-middleware.d.ts +9 -0
- package/lib/node/cookies/cookies-middleware.d.ts.map +1 -0
- package/lib/node/cookies/cookies-middleware.js +37 -0
- package/lib/node/cookies/cookies-middleware.js.map +1 -0
- package/lib/node/cookies/cookies-protocol.d.ts +7 -0
- package/lib/node/cookies/cookies-protocol.d.ts.map +1 -0
- package/lib/node/cookies/cookies-protocol.js +7 -0
- package/lib/node/cookies/cookies-protocol.js.map +1 -0
- package/lib/node/cookies/index.d.ts +4 -0
- package/lib/node/cookies/index.d.ts.map +1 -0
- package/lib/node/cookies/index.js +20 -0
- package/lib/node/cookies/index.js.map +1 -0
- package/lib/node/cors/cors-middleware.d.ts +11 -0
- package/lib/node/cors/cors-middleware.d.ts.map +1 -0
- package/lib/node/cors/cors-middleware.js +51 -0
- package/lib/node/cors/cors-middleware.js.map +1 -0
- package/lib/node/cors/cors-protocol.d.ts +2 -0
- package/lib/node/cors/cors-protocol.d.ts.map +1 -0
- package/lib/node/cors/cors-protocol.js +6 -0
- package/lib/node/cors/cors-protocol.js.map +1 -0
- package/lib/node/cors/index.d.ts +3 -0
- package/lib/node/cors/index.d.ts.map +1 -0
- package/lib/node/cors/index.js +19 -0
- package/lib/node/cors/index.js.map +1 -0
- package/lib/node/dispatcher/dispatcher-protocol.d.ts +6 -0
- package/lib/node/dispatcher/dispatcher-protocol.d.ts.map +1 -0
- package/lib/node/dispatcher/dispatcher-protocol.js +5 -0
- package/lib/node/dispatcher/dispatcher-protocol.js.map +1 -0
- package/lib/node/dispatcher/dispatcher.d.ts +16 -0
- package/lib/node/dispatcher/dispatcher.d.ts.map +1 -0
- package/lib/node/dispatcher/dispatcher.js +71 -0
- package/lib/node/dispatcher/dispatcher.js.map +1 -0
- package/lib/node/dispatcher/index.d.ts +3 -0
- package/lib/node/dispatcher/index.d.ts.map +1 -0
- package/lib/node/dispatcher/index.js +19 -0
- package/lib/node/dispatcher/index.js.map +1 -0
- package/lib/node/error/error-hander-provider.d.ts +28 -0
- package/lib/node/error/error-hander-provider.d.ts.map +1 -0
- package/lib/node/error/error-hander-provider.js +97 -0
- package/lib/node/error/error-hander-provider.js.map +1 -0
- package/lib/node/error/error-protocol.d.ts +14 -0
- package/lib/node/error/error-protocol.d.ts.map +1 -0
- package/lib/node/error/error-protocol.js +8 -0
- package/lib/node/error/error-protocol.js.map +1 -0
- package/lib/node/error/http-error.d.ts +6 -0
- package/lib/node/error/http-error.d.ts.map +1 -0
- package/lib/node/error/http-error.js +12 -0
- package/lib/node/error/http-error.js.map +1 -0
- package/lib/node/error/index.d.ts +5 -0
- package/lib/node/error/index.d.ts.map +1 -0
- package/lib/node/error/index.js +21 -0
- package/lib/node/error/index.js.map +1 -0
- package/lib/node/error/not-found-error.d.ts +7 -0
- package/lib/node/error/not-found-error.d.ts.map +1 -0
- package/lib/node/error/not-found-error.js +15 -0
- package/lib/node/error/not-found-error.js.map +1 -0
- package/lib/node/handler/handler-execution-chain.d.ts +6 -0
- package/lib/node/handler/handler-execution-chain.d.ts.map +1 -0
- package/lib/node/handler/handler-execution-chain.js +27 -0
- package/lib/node/handler/handler-execution-chain.js.map +1 -0
- package/lib/node/handler/handler-mapping.d.ts +8 -0
- package/lib/node/handler/handler-mapping.d.ts.map +1 -0
- package/lib/node/handler/handler-mapping.js +56 -0
- package/lib/node/handler/handler-mapping.js.map +1 -0
- package/lib/node/handler/handler-protocol.d.ts +16 -0
- package/lib/node/handler/handler-protocol.d.ts.map +1 -0
- package/lib/node/handler/handler-protocol.js +7 -0
- package/lib/node/handler/handler-protocol.js.map +1 -0
- package/lib/node/handler/index.d.ts +4 -0
- package/lib/node/handler/index.d.ts.map +1 -0
- package/lib/node/handler/index.js +20 -0
- package/lib/node/handler/index.js.map +1 -0
- package/lib/node/health/health-errors.d.ts +6 -0
- package/lib/node/health/health-errors.d.ts.map +1 -0
- package/lib/node/health/health-errors.js +12 -0
- package/lib/node/health/health-errors.js.map +1 -0
- package/lib/node/health/health-executor.d.ts +8 -0
- package/lib/node/health/health-executor.d.ts.map +1 -0
- package/lib/node/health/health-executor.js +63 -0
- package/lib/node/health/health-executor.js.map +1 -0
- package/lib/node/health/health-indicator.d.ts +8 -0
- package/lib/node/health/health-indicator.d.ts.map +1 -0
- package/lib/node/health/health-indicator.js +24 -0
- package/lib/node/health/health-indicator.js.map +1 -0
- package/lib/node/health/health-middleware.d.ts +17 -0
- package/lib/node/health/health-middleware.d.ts.map +1 -0
- package/lib/node/health/health-middleware.js +68 -0
- package/lib/node/health/health-middleware.js.map +1 -0
- package/lib/node/health/health-protocol.d.ts +83 -0
- package/lib/node/health/health-protocol.d.ts.map +1 -0
- package/lib/node/health/health-protocol.js +30 -0
- package/lib/node/health/health-protocol.js.map +1 -0
- package/lib/node/health/health-status-aggregator.d.ts +5 -0
- package/lib/node/health/health-status-aggregator.d.ts.map +1 -0
- package/lib/node/health/health-status-aggregator.js +31 -0
- package/lib/node/health/health-status-aggregator.js.map +1 -0
- package/lib/node/health/index.d.ts +7 -0
- package/lib/node/health/index.d.ts.map +1 -0
- package/lib/node/health/index.js +23 -0
- package/lib/node/health/index.js.map +1 -0
- package/lib/node/http/http-middleware.d.ts +9 -0
- package/lib/node/http/http-middleware.d.ts.map +1 -0
- package/lib/node/http/http-middleware.js +46 -0
- package/lib/node/http/http-middleware.js.map +1 -0
- package/lib/node/http/http-protocol.d.ts +14 -0
- package/lib/node/http/http-protocol.d.ts.map +1 -0
- package/lib/node/http/http-protocol.js +7 -0
- package/lib/node/http/http-protocol.js.map +1 -0
- package/lib/node/http/index.d.ts +4 -0
- package/lib/node/http/index.d.ts.map +1 -0
- package/lib/node/http/index.js +20 -0
- package/lib/node/http/index.js.map +1 -0
- package/lib/node/http/server-aware.d.ts +7 -0
- package/lib/node/http/server-aware.d.ts.map +1 -0
- package/lib/node/http/server-aware.js +21 -0
- package/lib/node/http/server-aware.js.map +1 -0
- package/lib/node/index.d.ts +15 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +31 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/matcher/index.d.ts +3 -0
- package/lib/node/matcher/index.d.ts.map +1 -0
- package/lib/node/matcher/index.js +19 -0
- package/lib/node/matcher/index.js.map +1 -0
- package/lib/node/matcher/matcher-protocol.d.ts +5 -0
- package/lib/node/matcher/matcher-protocol.d.ts.map +1 -0
- package/lib/node/matcher/matcher-protocol.js +5 -0
- package/lib/node/matcher/matcher-protocol.js.map +1 -0
- package/lib/node/matcher/request-matcher.d.ts +8 -0
- package/lib/node/matcher/request-matcher.d.ts.map +1 -0
- package/lib/node/matcher/request-matcher.js +52 -0
- package/lib/node/matcher/request-matcher.js.map +1 -0
- package/lib/node/middleware/compose.d.ts +4 -0
- package/lib/node/middleware/compose.d.ts.map +1 -0
- package/lib/node/middleware/compose.js +25 -0
- package/lib/node/middleware/compose.js.map +1 -0
- package/lib/node/middleware/express-middleware-converter.d.ts +4 -0
- package/lib/node/middleware/express-middleware-converter.d.ts.map +1 -0
- package/lib/node/middleware/express-middleware-converter.js +26 -0
- package/lib/node/middleware/express-middleware-converter.js.map +1 -0
- package/lib/node/middleware/index.d.ts +4 -0
- package/lib/node/middleware/index.d.ts.map +1 -0
- package/lib/node/middleware/index.js +20 -0
- package/lib/node/middleware/index.js.map +1 -0
- package/lib/node/middleware/middleware-provider.d.ts +13 -0
- package/lib/node/middleware/middleware-provider.d.ts.map +1 -0
- package/lib/node/middleware/middleware-provider.js +36 -0
- package/lib/node/middleware/middleware-provider.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/redirect/index.d.ts +3 -0
- package/lib/node/redirect/index.d.ts.map +1 -0
- package/lib/node/redirect/index.js +19 -0
- package/lib/node/redirect/index.js.map +1 -0
- package/lib/node/redirect/redirect-protocol.d.ts +5 -0
- package/lib/node/redirect/redirect-protocol.d.ts.map +1 -0
- package/lib/node/redirect/redirect-protocol.js +5 -0
- package/lib/node/redirect/redirect-protocol.js.map +1 -0
- package/lib/node/redirect/redirect-strategy.d.ts +7 -0
- package/lib/node/redirect/redirect-strategy.d.ts.map +1 -0
- package/lib/node/redirect/redirect-strategy.js +33 -0
- package/lib/node/redirect/redirect-strategy.js.map +1 -0
- package/lib/node/session/index.d.ts +6 -0
- package/lib/node/session/index.d.ts.map +1 -0
- package/lib/node/session/index.js +22 -0
- package/lib/node/session/index.js.map +1 -0
- package/lib/node/session/session-manager.d.ts +12 -0
- package/lib/node/session/session-manager.d.ts.map +1 -0
- package/lib/node/session/session-manager.js +75 -0
- package/lib/node/session/session-manager.js.map +1 -0
- package/lib/node/session/session-middleware.d.ts +10 -0
- package/lib/node/session/session-middleware.d.ts.map +1 -0
- package/lib/node/session/session-middleware.js +45 -0
- package/lib/node/session/session-middleware.js.map +1 -0
- package/lib/node/session/session-protocol.d.ts +31 -0
- package/lib/node/session/session-protocol.d.ts.map +1 -0
- package/lib/node/session/session-protocol.js +11 -0
- package/lib/node/session/session-protocol.js.map +1 -0
- package/lib/node/session/session-store.d.ts +12 -0
- package/lib/node/session/session-store.d.ts.map +1 -0
- package/lib/node/session/session-store.js +57 -0
- package/lib/node/session/session-store.js.map +1 -0
- package/lib/node/session/session-strategy.d.ts +8 -0
- package/lib/node/session/session-strategy.d.ts.map +1 -0
- package/lib/node/session/session-strategy.js +50 -0
- package/lib/node/session/session-strategy.js.map +1 -0
- package/lib/node/session/session.d.ts +13 -0
- package/lib/node/session/session.d.ts.map +1 -0
- package/lib/node/session/session.js +42 -0
- package/lib/node/session/session.js.map +1 -0
- package/lib/node/trace/index.d.ts +5 -0
- package/lib/node/trace/index.d.ts.map +1 -0
- package/lib/node/trace/index.js +21 -0
- package/lib/node/trace/index.js.map +1 -0
- package/lib/node/trace/trace-id-provider.d.ts +5 -0
- package/lib/node/trace/trace-id-provider.d.ts.map +1 -0
- package/lib/node/trace/trace-id-provider.js +21 -0
- package/lib/node/trace/trace-id-provider.js.map +1 -0
- package/lib/node/trace/trace-id-resolver.d.ts +6 -0
- package/lib/node/trace/trace-id-resolver.d.ts.map +1 -0
- package/lib/node/trace/trace-id-resolver.js +35 -0
- package/lib/node/trace/trace-id-resolver.js.map +1 -0
- package/lib/node/trace/trace-middleware.d.ts +10 -0
- package/lib/node/trace/trace-middleware.d.ts.map +1 -0
- package/lib/node/trace/trace-middleware.js +40 -0
- package/lib/node/trace/trace-middleware.js.map +1 -0
- package/lib/node/trace/trace-protocol.d.ts +8 -0
- package/lib/node/trace/trace-protocol.d.ts.map +1 -0
- package/lib/node/trace/trace-protocol.js +9 -0
- package/lib/node/trace/trace-protocol.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +4 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +54 -0
- package/src/browser/module.ts +2 -0
- package/src/common/constants.ts +5 -0
- package/src/common/index.ts +4 -0
- package/src/common/module.ts +4 -0
- package/src/common/pipe/index.ts +5 -0
- package/src/common/pipe/pipe-manager.ts +23 -0
- package/src/common/pipe/pipe-protocol.ts +32 -0
- package/src/common/pipe/pipe-provider.ts +21 -0
- package/src/common/pipe/pipe-transtorm.ts +96 -0
- package/src/common/pipe/validation-errors.ts +10 -0
- package/src/common/resolver/index.ts +2 -0
- package/src/common/resolver/path-resolver.ts +23 -0
- package/src/common/resolver/resolver-protocol.ts +5 -0
- package/src/common/utils/index.ts +1 -0
- package/src/common/utils/url-util.ts +33 -0
- package/src/hooks/serve.ts +56 -0
- package/src/node/application/dev-application-entry.ts +6 -0
- package/src/node/body/body-middleware.ts +28 -0
- package/src/node/body/body-protocol.ts +4 -0
- package/src/node/body/index.ts +2 -0
- package/src/node/context.ts +97 -0
- package/src/node/cookies/cookies-factory.ts +22 -0
- package/src/node/cookies/cookies-middleware.ts +23 -0
- package/src/node/cookies/cookies-protocol.ts +10 -0
- package/src/node/cookies/index.ts +3 -0
- package/src/node/cors/cors-middleware.ts +35 -0
- package/src/node/cors/cors-protocol.ts +2 -0
- package/src/node/cors/index.ts +2 -0
- package/src/node/dispatcher/dispatcher-protocol.ts +7 -0
- package/src/node/dispatcher/dispatcher.ts +51 -0
- package/src/node/dispatcher/index.ts +2 -0
- package/src/node/error/error-hander-provider.ts +77 -0
- package/src/node/error/error-protocol.ts +16 -0
- package/src/node/error/http-error.ts +9 -0
- package/src/node/error/index.ts +4 -0
- package/src/node/error/not-found-error.ts +14 -0
- package/src/node/handler/handler-execution-chain.ts +17 -0
- package/src/node/handler/handler-mapping.ts +41 -0
- package/src/node/handler/handler-protocol.ts +21 -0
- package/src/node/handler/index.ts +3 -0
- package/src/node/health/health-errors.ts +7 -0
- package/src/node/health/health-executor.ts +50 -0
- package/src/node/health/health-indicator.ts +12 -0
- package/src/node/health/health-middleware.ts +51 -0
- package/src/node/health/health-protocol.ts +90 -0
- package/src/node/health/health-status-aggregator.ts +22 -0
- package/src/node/health/index.ts +6 -0
- package/src/node/http/http-middleware.ts +30 -0
- package/src/node/http/http-protocol.ts +17 -0
- package/src/node/http/index.ts +3 -0
- package/src/node/http/server-aware.ts +12 -0
- package/src/node/index.ts +14 -0
- package/src/node/matcher/index.ts +2 -0
- package/src/node/matcher/matcher-protocol.ts +5 -0
- package/src/node/matcher/request-matcher.ts +35 -0
- package/src/node/middleware/compose.ts +23 -0
- package/src/node/middleware/express-middleware-converter.ts +23 -0
- package/src/node/middleware/index.ts +3 -0
- package/src/node/middleware/middleware-provider.ts +30 -0
- package/src/node/module.ts +4 -0
- package/src/node/redirect/index.ts +2 -0
- package/src/node/redirect/redirect-protocol.ts +5 -0
- package/src/node/redirect/redirect-strategy.ts +19 -0
- package/src/node/session/index.ts +5 -0
- package/src/node/session/session-manager.ts +61 -0
- package/src/node/session/session-middleware.ts +28 -0
- package/src/node/session/session-protocol.ts +40 -0
- package/src/node/session/session-store.ts +45 -0
- package/src/node/session/session-strategy.ts +37 -0
- package/src/node/session/session.ts +45 -0
- package/src/node/trace/index.ts +4 -0
- package/src/node/trace/trace-id-provider.ts +10 -0
- package/src/node/trace/trace-id-resolver.ts +19 -0
- package/src/node/trace/trace-middleware.ts +24 -0
- package/src/node/trace/trace-protocol.ts +11 -0
- package/src/package.spec.ts +4 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.HandlerMappingImpl = void 0;
|
|
16
|
+
const core_1 = require("@celljs/core");
|
|
17
|
+
const handler_protocol_1 = require("./handler-protocol");
|
|
18
|
+
const error_1 = require("../error");
|
|
19
|
+
const context_1 = require("../context");
|
|
20
|
+
let HandlerMappingImpl = class HandlerMappingImpl {
|
|
21
|
+
constructor(handlerAdapters = []) {
|
|
22
|
+
this.handlerAdapters = handlerAdapters;
|
|
23
|
+
this.prioritized = core_1.Prioritizeable.prioritizeAllSync(this.handlerAdapters).map(c => c.value);
|
|
24
|
+
}
|
|
25
|
+
async handle() {
|
|
26
|
+
let lastError;
|
|
27
|
+
for (const handler of this.prioritized) {
|
|
28
|
+
if (await handler.canHandle()) {
|
|
29
|
+
try {
|
|
30
|
+
await handler.handle();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error instanceof error_1.NotFoundAndContinueError) {
|
|
35
|
+
lastError = error;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (lastError) {
|
|
44
|
+
throw lastError;
|
|
45
|
+
}
|
|
46
|
+
throw new error_1.NotFoundError(`Not found a suitable handler adapter: ${context_1.Context.getRequest().path}`);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
HandlerMappingImpl = __decorate([
|
|
50
|
+
(0, core_1.Component)(handler_protocol_1.HandlerMapping),
|
|
51
|
+
__param(0, (0, core_1.Autowired)(handler_protocol_1.HandlerAdapter)),
|
|
52
|
+
__param(0, (0, core_1.Optional)()),
|
|
53
|
+
__metadata("design:paramtypes", [Array])
|
|
54
|
+
], HandlerMappingImpl);
|
|
55
|
+
exports.HandlerMappingImpl = HandlerMappingImpl;
|
|
56
|
+
//# sourceMappingURL=handler-mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-mapping.js","sourceRoot":"","sources":["../../../src/node/handler/handler-mapping.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAA8E;AAC9E,yDAAoE;AACpE,oCAAmE;AACnE,wCAAqC;AAG9B,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAI3B,YAGuB,kBAAoC,EAAE;QAAtC,oBAAe,GAAf,eAAe,CAAuB;QAEzD,IAAI,CAAC,WAAW,GAAG,qBAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,MAAM;QACR,IAAI,SAAS,CAAC;QACd,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI,MAAM,OAAO,CAAC,SAAS,EAAE,EAAE;gBAC3B,IAAI;oBACA,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;oBACvB,OAAO;iBACV;gBAAC,OAAO,KAAK,EAAE;oBACZ,IAAI,KAAK,YAAY,gCAAwB,EAAE;wBAC3C,SAAS,GAAG,KAAK,CAAC;qBACrB;yBAAM;wBACH,MAAM,KAAK,CAAC;qBACf;iBACJ;aACJ;SACJ;QACD,IAAI,SAAS,EAAE;YACX,MAAM,SAAS,CAAC;SACnB;QACD,MAAM,IAAI,qBAAa,CAAC,yCAA0C,iBAAO,CAAC,UAAU,EAAE,CAAC,IAAK,EAAE,CAAC,CAAC;IACpG,CAAC;CAEJ,CAAA;AAlCY,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,iCAAc,CAAC;IAMjB,WAAA,IAAA,gBAAS,EAAC,iCAAc,CAAC,CAAA;IACzB,WAAA,IAAA,eAAQ,GAAE,CAAA;;GANN,kBAAkB,CAkC9B;AAlCY,gDAAkB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Middleware } from '../middleware';
|
|
2
|
+
export declare const HandlerExecutionChain: unique symbol;
|
|
3
|
+
export declare const HandlerAdapter: unique symbol;
|
|
4
|
+
export declare const HandlerMapping: unique symbol;
|
|
5
|
+
export interface HandlerExecutionChain {
|
|
6
|
+
execute(middlewares: Middleware[], next: () => Promise<void>): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface HandlerAdapter {
|
|
9
|
+
readonly priority: number;
|
|
10
|
+
handle(): Promise<void>;
|
|
11
|
+
canHandle(): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export interface HandlerMapping {
|
|
14
|
+
handle(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=handler-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/handler/handler-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAErE,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD,MAAM,WAAW,qBAAqB;IAClC,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HandlerMapping = exports.HandlerAdapter = exports.HandlerExecutionChain = void 0;
|
|
4
|
+
exports.HandlerExecutionChain = Symbol('HandlerExecutionChain');
|
|
5
|
+
exports.HandlerAdapter = Symbol('HandlerAdapter');
|
|
6
|
+
exports.HandlerMapping = Symbol('HandlerMapping');
|
|
7
|
+
//# sourceMappingURL=handler-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-protocol.js","sourceRoot":"","sources":["../../../src/node/handler/handler-protocol.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAExD,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE1C,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/handler/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./handler-execution-chain"), exports);
|
|
18
|
+
__exportStar(require("./handler-mapping"), exports);
|
|
19
|
+
__exportStar(require("./handler-protocol"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/handler/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,oDAAkC;AAClC,qDAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-errors.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,qBAAa,mBAAoB,SAAQ,WAAW;IAC7B,aAAa,EAAE,MAAM;gBAArB,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAG5D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HealthNotFoundError = void 0;
|
|
4
|
+
const core_1 = require("@celljs/core");
|
|
5
|
+
class HealthNotFoundError extends core_1.CustomError {
|
|
6
|
+
constructor(indicatorName, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.indicatorName = indicatorName;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.HealthNotFoundError = HealthNotFoundError;
|
|
12
|
+
//# sourceMappingURL=health-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-errors.js","sourceRoot":"","sources":["../../../src/node/health/health-errors.ts"],"names":[],"mappings":";;;AAAA,uCAA2C;AAE3C,MAAa,mBAAoB,SAAQ,kBAAW;IAChD,YAAmB,aAAqB,EAAE,OAAe;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QADA,kBAAa,GAAb,aAAa,CAAQ;IAExC,CAAC;CACJ;AAJD,kDAIC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HealthComponent, HealthExecutor, HealthIndicator, HealthStatusAggregator } from './health-protocol';
|
|
2
|
+
export declare class HealthExecutorImpl implements HealthExecutor {
|
|
3
|
+
protected readonly healthIndicators: HealthIndicator[];
|
|
4
|
+
protected readonly healthStatusAggregator: HealthStatusAggregator;
|
|
5
|
+
protected getHealthIndicatorName(healthIndicator: HealthIndicator): string | undefined;
|
|
6
|
+
execute(indicatorName?: string): Promise<HealthComponent>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=health-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-executor.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE9H,qBACa,kBAAmB,YAAW,cAAc;IAGrD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAGvD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAElE,SAAS,CAAC,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;IAIhF,OAAO,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAgClE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HealthExecutorImpl = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const health_errors_1 = require("./health-errors");
|
|
15
|
+
const health_protocol_1 = require("./health-protocol");
|
|
16
|
+
let HealthExecutorImpl = class HealthExecutorImpl {
|
|
17
|
+
getHealthIndicatorName(healthIndicator) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
return (_b = (_a = (0, core_1.getTargetClass)(healthIndicator)) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
20
|
+
}
|
|
21
|
+
async execute(indicatorName) {
|
|
22
|
+
if (indicatorName) {
|
|
23
|
+
const healthIndicator = this.healthIndicators.find(h => {
|
|
24
|
+
const name = this.getHealthIndicatorName(h);
|
|
25
|
+
return name === null || name === void 0 ? void 0 : name.startsWith(indicatorName);
|
|
26
|
+
});
|
|
27
|
+
if (healthIndicator) {
|
|
28
|
+
return healthIndicator.health();
|
|
29
|
+
}
|
|
30
|
+
throw new health_errors_1.HealthNotFoundError(indicatorName, `Health indicator ${indicatorName} not found`);
|
|
31
|
+
}
|
|
32
|
+
const components = {};
|
|
33
|
+
for (const healthIndicator of this.healthIndicators) {
|
|
34
|
+
const name = this.getHealthIndicatorName(healthIndicator);
|
|
35
|
+
if (name) {
|
|
36
|
+
components[name.toLowerCase().replace('healthindicator', '')] = await healthIndicator.health();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
await Promise.all(this.healthIndicators.map(async (h) => {
|
|
40
|
+
const name = this.getHealthIndicatorName(h);
|
|
41
|
+
if (name) {
|
|
42
|
+
components[name.toLowerCase().replace('healthindicator', '')] = await h.health();
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
return {
|
|
46
|
+
status: this.healthStatusAggregator.aggregate(Object.values(components).map(c => c.status)),
|
|
47
|
+
components
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, core_1.Autowired)(health_protocol_1.HealthIndicator),
|
|
53
|
+
__metadata("design:type", Array)
|
|
54
|
+
], HealthExecutorImpl.prototype, "healthIndicators", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, core_1.Autowired)(health_protocol_1.HealthStatusAggregator),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], HealthExecutorImpl.prototype, "healthStatusAggregator", void 0);
|
|
59
|
+
HealthExecutorImpl = __decorate([
|
|
60
|
+
(0, core_1.Component)(health_protocol_1.HealthExecutor)
|
|
61
|
+
], HealthExecutorImpl);
|
|
62
|
+
exports.HealthExecutorImpl = HealthExecutorImpl;
|
|
63
|
+
//# sourceMappingURL=health-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-executor.js","sourceRoot":"","sources":["../../../src/node/health/health-executor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoE;AACpE,mDAAsD;AACtD,uDAA8H;AAGvH,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAQjB,sBAAsB,CAAC,eAAgC;;QAC7D,OAAO,MAAA,MAAA,IAAA,qBAAc,EAAC,eAAe,CAAC,0CAAE,IAAI,0CAAE,WAAW,EAAE,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,aAAsB;QAChC,IAAI,aAAa,EAAE;YACf,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBACnD,MAAM,IAAI,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;gBAC5C,OAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAC,aAAa,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;YACH,IAAI,eAAe,EAAE;gBACjB,OAAO,eAAe,CAAC,MAAM,EAAE,CAAC;aACnC;YACD,MAAM,IAAI,mCAAmB,CAAC,aAAa,EAAE,oBAAoB,aAAa,YAAY,CAAC,CAAC;SAC/F;QACD,MAAM,UAAU,GAAuC,EAAE,CAAC;QAC1D,KAAK,MAAM,eAAe,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACjD,MAAM,IAAI,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC;YAC1D,IAAI,IAAI,EAAE;gBACN,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,CAAC;aAClG;SACJ;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;YAClD,MAAM,IAAI,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,IAAI,EAAE;gBACN,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;aACpF;QACL,CAAC,CAAC,CAAC,CAAC;QAEJ,OAAwB;YACpB,MAAM,EAAE,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC3F,UAAU;SACb,CAAC;IACN,CAAC;CAEJ,CAAA;AA1CG;IAAC,IAAA,gBAAS,EAAC,iCAAe,CAAC;;4DAC4B;AAEvD;IAAC,IAAA,gBAAS,EAAC,wCAAsB,CAAC;;kEACgC;AANzD,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,gCAAc,CAAC;GACb,kBAAkB,CA4C9B;AA5CY,gDAAkB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Health, HealthIndicator } from './health-protocol';
|
|
2
|
+
/**
|
|
3
|
+
* Default implementation of {@link HealthIndicator} that returns {@link HealthStatus.UP}.
|
|
4
|
+
*/
|
|
5
|
+
export declare class PingHealthIndicator implements HealthIndicator {
|
|
6
|
+
health(): Promise<Health>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=health-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-indicator.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-indicator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAgB,MAAM,mBAAmB,CAAC;AAE1E;;GAEG;AACH,qBACa,mBAAoB,YAAW,eAAe;IACjD,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CAGlC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PingHealthIndicator = void 0;
|
|
10
|
+
const core_1 = require("@celljs/core");
|
|
11
|
+
const health_protocol_1 = require("./health-protocol");
|
|
12
|
+
/**
|
|
13
|
+
* Default implementation of {@link HealthIndicator} that returns {@link HealthStatus.UP}.
|
|
14
|
+
*/
|
|
15
|
+
let PingHealthIndicator = class PingHealthIndicator {
|
|
16
|
+
async health() {
|
|
17
|
+
return { status: health_protocol_1.HealthStatus.UP };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
PingHealthIndicator = __decorate([
|
|
21
|
+
(0, core_1.Component)(health_protocol_1.HealthIndicator)
|
|
22
|
+
], PingHealthIndicator);
|
|
23
|
+
exports.PingHealthIndicator = PingHealthIndicator;
|
|
24
|
+
//# sourceMappingURL=health-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-indicator.js","sourceRoot":"","sources":["../../../src/node/health/health-indicator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyC;AACzC,uDAA0E;AAE1E;;GAEG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC5B,KAAK,CAAC,MAAM;QACR,OAAO,EAAE,MAAM,EAAE,8BAAY,CAAC,EAAE,EAAE,CAAC;IACvC,CAAC;CACJ,CAAA;AAJY,mBAAmB;IAD/B,IAAA,gBAAS,EAAC,iCAAe,CAAC;GACd,mBAAmB,CAI/B;AAJY,kDAAmB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Middleware } from '../middleware';
|
|
2
|
+
import { Context } from '../context';
|
|
3
|
+
import { HealthExecutor, HealthOptions } from './health-protocol';
|
|
4
|
+
import { RequestMatcher } from '../matcher';
|
|
5
|
+
import { PathResolver } from '../../common/resolver';
|
|
6
|
+
export declare class HealthMiddleware implements Middleware {
|
|
7
|
+
protected readonly healthExecutor: HealthExecutor;
|
|
8
|
+
protected readonly requestMatcher: RequestMatcher;
|
|
9
|
+
protected readonly pathResolver: PathResolver;
|
|
10
|
+
protected readonly healthOptions: HealthOptions;
|
|
11
|
+
handle(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
12
|
+
protected match(): Promise<{
|
|
13
|
+
indicatorName?: string;
|
|
14
|
+
}>;
|
|
15
|
+
readonly priority: number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=health-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-middleware.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,aAAa,EAA8B,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,qBACa,gBAAiB,YAAW,UAAU;IAG/C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAG9C,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAE1C,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAmBpD,KAAK,IAAI,OAAO,CAAC;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAK5D,QAAQ,CAAC,QAAQ,SAA8B;CAElD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HealthMiddleware = void 0;
|
|
13
|
+
const middleware_1 = require("../middleware");
|
|
14
|
+
const core_1 = require("@celljs/core");
|
|
15
|
+
const health_protocol_1 = require("./health-protocol");
|
|
16
|
+
const error_1 = require("../error");
|
|
17
|
+
const matcher_1 = require("../matcher");
|
|
18
|
+
const resolver_1 = require("../../common/resolver");
|
|
19
|
+
const http_1 = require("@celljs/http");
|
|
20
|
+
let HealthMiddleware = class HealthMiddleware {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.priority = health_protocol_1.HEALTH_MIDDLEWARE_PRIORITY;
|
|
23
|
+
}
|
|
24
|
+
async handle(ctx, next) {
|
|
25
|
+
try {
|
|
26
|
+
await next();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
const { response } = ctx;
|
|
30
|
+
if (error instanceof error_1.NotFoundError && !response.writableEnded) {
|
|
31
|
+
const result = await this.match();
|
|
32
|
+
if (result) {
|
|
33
|
+
const health = await this.healthExecutor.execute(result.indicatorName);
|
|
34
|
+
response.status(200);
|
|
35
|
+
response.setHeader(http_1.HttpHeaders.CONTENT_TYPE, http_1.MediaType.APPLICATION_JSON);
|
|
36
|
+
response.body = JSON.stringify(health);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async match() {
|
|
44
|
+
const pattern = await this.pathResolver.resolve(this.healthOptions.url + '(/:indicatorName)');
|
|
45
|
+
return this.requestMatcher.match(pattern, this.healthOptions.method);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, core_1.Autowired)(health_protocol_1.HealthExecutor),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], HealthMiddleware.prototype, "healthExecutor", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, core_1.Autowired)(matcher_1.RequestMatcher),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], HealthMiddleware.prototype, "requestMatcher", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, core_1.Autowired)(resolver_1.PathResolver),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], HealthMiddleware.prototype, "pathResolver", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, core_1.Value)('cell.health'),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], HealthMiddleware.prototype, "healthOptions", void 0);
|
|
64
|
+
HealthMiddleware = __decorate([
|
|
65
|
+
(0, core_1.Component)(middleware_1.Middleware)
|
|
66
|
+
], HealthMiddleware);
|
|
67
|
+
exports.HealthMiddleware = HealthMiddleware;
|
|
68
|
+
//# sourceMappingURL=health-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-middleware.js","sourceRoot":"","sources":["../../../src/node/health/health-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2C;AAE3C,uCAA2D;AAC3D,uDAA8F;AAC9F,oCAAyC;AACzC,wCAA4C;AAC5C,oDAAqD;AACrD,uCAAsD;AAG/C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAAtB;QAsCM,aAAQ,GAAG,4CAA0B,CAAC;IAEnD,CAAC;IA1BG,KAAK,CAAC,MAAM,CAAC,GAAY,EAAE,IAAyB;QAChD,IAAI;YACA,MAAM,IAAI,EAAE,CAAC;SAChB;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;YACzB,IAAI,KAAK,YAAY,qBAAa,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE;gBAC3D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;gBAClC,IAAI,MAAM,EAAE;oBACR,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;oBACvE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACrB,QAAQ,CAAC,SAAS,CAAC,kBAAW,CAAC,YAAY,EAAE,gBAAS,CAAC,gBAAgB,CAAC,CAAC;oBACzE,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;oBACvC,OAAO;iBACV;aACJ;YACD,MAAM,KAAK,CAAC;SACf;IACL,CAAC;IAES,KAAK,CAAC,KAAK;QACjB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,GAAG,mBAAmB,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;CAIJ,CAAA;AAtCG;IAAC,IAAA,gBAAS,EAAC,gCAAc,CAAC;;wDACwB;AAElD;IAAC,IAAA,gBAAS,EAAC,wBAAc,CAAC;;wDACwB;AAElD;IAAC,IAAA,gBAAS,EAAC,uBAAY,CAAC;;sDACsB;AAE9C;IAAC,IAAA,YAAK,EAAC,aAAa,CAAC;;uDAC2B;AAZvC,gBAAgB;IAD5B,IAAA,gBAAS,EAAC,uBAAU,CAAC;GACT,gBAAgB,CAwC5B;AAxCY,4CAAgB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const HealthIndicator: unique symbol;
|
|
2
|
+
export declare const HealthExecutor: unique symbol;
|
|
3
|
+
export declare const HealthStatusAggregator: unique symbol;
|
|
4
|
+
export declare const HEALTH_MIDDLEWARE_PRIORITY: number;
|
|
5
|
+
export declare enum HealthStatus {
|
|
6
|
+
/**
|
|
7
|
+
* {@link HealthStatus} indicating that the component or subsystem is in an unknown state.
|
|
8
|
+
*/
|
|
9
|
+
UP = "UP",
|
|
10
|
+
/**
|
|
11
|
+
* {@link HealthStatus} indicating that the component or subsystem has suffered an
|
|
12
|
+
* unexpected failure.
|
|
13
|
+
*/
|
|
14
|
+
DOWN = "DOWN",
|
|
15
|
+
/**
|
|
16
|
+
* {@link HealthStatus} indicating that the component or subsystem has been taken out of
|
|
17
|
+
* service and should not be used.
|
|
18
|
+
*/
|
|
19
|
+
OUT_OF_SERVICE = "OUT_OF_SERVICE",
|
|
20
|
+
/**
|
|
21
|
+
* {@link HealthStatus} indicating that the component or subsystem is in an unknown state.
|
|
22
|
+
*/
|
|
23
|
+
UNKNOWN = "UNKNOWN"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A component that contributes data to results returned from the {@link HealthEndpoint}.
|
|
27
|
+
*/
|
|
28
|
+
export interface HealthComponent {
|
|
29
|
+
status: HealthStatus;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Carries information about the health of a component or subsystem. Extends
|
|
33
|
+
* {@link HealthComponent} so that additional contextual details about the system can be
|
|
34
|
+
* returned along with the {@link HealthStatus}.
|
|
35
|
+
*/
|
|
36
|
+
export interface Health extends HealthComponent {
|
|
37
|
+
details?: {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A {@link HealthComponent} that is composed of other {@link HealthComponent} instances.
|
|
43
|
+
* Used to provide a unified view of related components. For example, a database health
|
|
44
|
+
* indicator may be a composite containing the {@link Health} of each datasource
|
|
45
|
+
* connection.
|
|
46
|
+
*/
|
|
47
|
+
export interface CompositeHealth extends HealthComponent {
|
|
48
|
+
components: {
|
|
49
|
+
[key: string]: HealthComponent;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Strategy interface used to contribute {@link Health} to the results returned from the health endpoint.
|
|
54
|
+
*/
|
|
55
|
+
export interface HealthIndicator {
|
|
56
|
+
/**
|
|
57
|
+
* Return an indication of health.
|
|
58
|
+
* @return the health
|
|
59
|
+
*/
|
|
60
|
+
health(): Promise<Health>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Strategy interface used to execute {@link HealthIndicator} instances.
|
|
64
|
+
*/
|
|
65
|
+
export interface HealthExecutor {
|
|
66
|
+
execute(indicatorName?: string): Promise<HealthComponent>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Strategy interface used to aggregate {@link HealthStatus} instances.
|
|
70
|
+
*/
|
|
71
|
+
export interface HealthStatusAggregator {
|
|
72
|
+
/**
|
|
73
|
+
* Aggregate the given health statuses into a single status.
|
|
74
|
+
* @param statuses the health statuses to aggregate
|
|
75
|
+
* @return the aggregated status
|
|
76
|
+
*/
|
|
77
|
+
aggregate(statuses: HealthStatus[]): HealthStatus;
|
|
78
|
+
}
|
|
79
|
+
export interface HealthOptions {
|
|
80
|
+
url: string;
|
|
81
|
+
method: string;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=health-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-protocol.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-protocol.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,eAA4B,CAAC;AACzD,eAAO,MAAM,cAAc,eAA2B,CAAC;AACvD,eAAO,MAAM,sBAAsB,eAAmC,CAAC;AAEvE,eAAO,MAAM,0BAA0B,QAAiC,CAAC;AAEzE,oBAAY,YAAY;IACpB;;OAEG;IACH,EAAE,OAAO;IACT;;;OAGG;IACH,IAAI,SAAS;IACb;;;OAGG;IACH,cAAc,mBAAmB;IACjC;;OAEG;IACH,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,YAAY,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAO,SAAQ,eAAe;IAC3C,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACpD,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAE3B,OAAO,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY,CAAC;CACrD;AAED,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HealthStatus = exports.HEALTH_MIDDLEWARE_PRIORITY = exports.HealthStatusAggregator = exports.HealthExecutor = exports.HealthIndicator = void 0;
|
|
4
|
+
const http_protocol_1 = require("../http/http-protocol");
|
|
5
|
+
exports.HealthIndicator = Symbol('HealthIndicator');
|
|
6
|
+
exports.HealthExecutor = Symbol('HealthExecutor');
|
|
7
|
+
exports.HealthStatusAggregator = Symbol('HealthStatusAggregator');
|
|
8
|
+
exports.HEALTH_MIDDLEWARE_PRIORITY = http_protocol_1.HTTP_MIDDLEWARE_PRIORITY - 100;
|
|
9
|
+
var HealthStatus;
|
|
10
|
+
(function (HealthStatus) {
|
|
11
|
+
/**
|
|
12
|
+
* {@link HealthStatus} indicating that the component or subsystem is in an unknown state.
|
|
13
|
+
*/
|
|
14
|
+
HealthStatus["UP"] = "UP";
|
|
15
|
+
/**
|
|
16
|
+
* {@link HealthStatus} indicating that the component or subsystem has suffered an
|
|
17
|
+
* unexpected failure.
|
|
18
|
+
*/
|
|
19
|
+
HealthStatus["DOWN"] = "DOWN";
|
|
20
|
+
/**
|
|
21
|
+
* {@link HealthStatus} indicating that the component or subsystem has been taken out of
|
|
22
|
+
* service and should not be used.
|
|
23
|
+
*/
|
|
24
|
+
HealthStatus["OUT_OF_SERVICE"] = "OUT_OF_SERVICE";
|
|
25
|
+
/**
|
|
26
|
+
* {@link HealthStatus} indicating that the component or subsystem is in an unknown state.
|
|
27
|
+
*/
|
|
28
|
+
HealthStatus["UNKNOWN"] = "UNKNOWN";
|
|
29
|
+
})(HealthStatus = exports.HealthStatus || (exports.HealthStatus = {}));
|
|
30
|
+
//# sourceMappingURL=health-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-protocol.js","sourceRoot":"","sources":["../../../src/node/health/health-protocol.ts"],"names":[],"mappings":";;;AAAA,yDAAiE;AAEpD,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC5C,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC1C,QAAA,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAE1D,QAAA,0BAA0B,GAAG,wCAAwB,GAAG,GAAG,CAAC;AAEzE,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACpB;;OAEG;IACH,yBAAS,CAAA;IACT;;;OAGG;IACH,6BAAa,CAAA;IACb;;;OAGG;IACH,iDAAiC,CAAA;IACjC;;OAEG;IACH,mCAAmB,CAAA;AACvB,CAAC,EAnBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAmBvB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HealthStatus, HealthStatusAggregator } from './health-protocol';
|
|
2
|
+
export declare class HealthStatusAggregatorImpl implements HealthStatusAggregator {
|
|
3
|
+
aggregate(statuses: HealthStatus[]): HealthStatus;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=health-status-aggregator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-status-aggregator.d.ts","sourceRoot":"","sources":["../../../src/node/health/health-status-aggregator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AASzE,qBACa,0BAA2B,YAAW,sBAAsB;IAErE,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,YAAY;CAQpD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.HealthStatusAggregatorImpl = void 0;
|
|
10
|
+
const core_1 = require("@celljs/core");
|
|
11
|
+
const health_protocol_1 = require("./health-protocol");
|
|
12
|
+
const defaultOrder = [
|
|
13
|
+
health_protocol_1.HealthStatus.DOWN,
|
|
14
|
+
health_protocol_1.HealthStatus.OUT_OF_SERVICE,
|
|
15
|
+
health_protocol_1.HealthStatus.UP,
|
|
16
|
+
health_protocol_1.HealthStatus.UNKNOWN
|
|
17
|
+
];
|
|
18
|
+
let HealthStatusAggregatorImpl = class HealthStatusAggregatorImpl {
|
|
19
|
+
aggregate(statuses) {
|
|
20
|
+
return [...statuses, health_protocol_1.HealthStatus.UNKNOWN].reduce((a, b) => {
|
|
21
|
+
const orderA = defaultOrder.indexOf(a);
|
|
22
|
+
const orderB = defaultOrder.indexOf(b);
|
|
23
|
+
return orderA < orderB ? a : b;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
HealthStatusAggregatorImpl = __decorate([
|
|
28
|
+
(0, core_1.Component)(health_protocol_1.HealthStatusAggregator)
|
|
29
|
+
], HealthStatusAggregatorImpl);
|
|
30
|
+
exports.HealthStatusAggregatorImpl = HealthStatusAggregatorImpl;
|
|
31
|
+
//# sourceMappingURL=health-status-aggregator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-status-aggregator.js","sourceRoot":"","sources":["../../../src/node/health/health-status-aggregator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyC;AACzC,uDAAyE;AAEzE,MAAM,YAAY,GAAmB;IACjC,8BAAY,CAAC,IAAI;IACjB,8BAAY,CAAC,cAAc;IAC3B,8BAAY,CAAC,EAAE;IACf,8BAAY,CAAC,OAAO;CACvB,CAAC;AAGK,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAEnC,SAAS,CAAC,QAAwB;QAC9B,OAAO,CAAC,GAAG,QAAQ,EAAE,8BAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACvD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACvC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACvC,OAAO,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;CAEJ,CAAA;AAVY,0BAA0B;IADtC,IAAA,gBAAS,EAAC,wCAAsB,CAAC;GACrB,0BAA0B,CAUtC;AAVY,gEAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/health/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./health-indicator"), exports);
|
|
18
|
+
__exportStar(require("./health-protocol"), exports);
|
|
19
|
+
__exportStar(require("./health-executor"), exports);
|
|
20
|
+
__exportStar(require("./health-errors"), exports);
|
|
21
|
+
__exportStar(require("./health-middleware"), exports);
|
|
22
|
+
__exportStar(require("./health-status-aggregator"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/health/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,sDAAoC;AACpC,6DAA2C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Middleware } from '../middleware';
|
|
2
|
+
import { Context } from '../context';
|
|
3
|
+
import { Logger } from '@celljs/core';
|
|
4
|
+
export declare class HttpMiddleware implements Middleware {
|
|
5
|
+
protected readonly logger: Logger;
|
|
6
|
+
handle(ctx: Context, next: () => Promise<void>): Promise<void>;
|
|
7
|
+
readonly priority: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=http-middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-middleware.d.ts","sourceRoot":"","sources":["../../../src/node/http/http-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAwB,MAAM,EAAE,MAAM,cAAc,CAAC;AAG5D,qBACa,cAAe,YAAW,UAAU;IAG7C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAE5B,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBpE,QAAQ,CAAC,QAAQ,SAA4B;CAEhD"}
|