@backstage/backend-app-api 0.7.7 → 0.7.9-next.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/CHANGELOG.md +8 -7
- package/alpha/package.json +1 -1
- package/dist/index.cjs.js +26 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# @backstage/backend-app-api
|
|
2
2
|
|
|
3
|
-
## 0.7.
|
|
3
|
+
## 0.7.9-next.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- b60db08: Fixing exporting of classes properly from new packages
|
|
8
|
+
- a63c4b6: Fixing issue with `MiddlewareFactory` deprecation wrapping
|
|
8
9
|
- Updated dependencies
|
|
9
|
-
- @backstage/backend-
|
|
10
|
-
- @backstage/backend-
|
|
11
|
-
- @backstage/
|
|
12
|
-
- @backstage/plugin-
|
|
13
|
-
- @backstage/
|
|
10
|
+
- @backstage/backend-plugin-api@0.6.21-next.0
|
|
11
|
+
- @backstage/backend-common@0.23.2-next.0
|
|
12
|
+
- @backstage/backend-tasks@0.5.26-next.0
|
|
13
|
+
- @backstage/plugin-auth-node@0.4.16-next.0
|
|
14
|
+
- @backstage/plugin-permission-node@0.7.32-next.0
|
|
14
15
|
- @backstage/cli-common@0.1.14
|
|
15
16
|
- @backstage/cli-node@0.2.6
|
|
16
17
|
- @backstage/config@1.2.0
|
package/alpha/package.json
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -778,7 +778,7 @@ class MiddlewareFactory {
|
|
|
778
778
|
* Creates a new {@link MiddlewareFactory}.
|
|
779
779
|
*/
|
|
780
780
|
static create(options) {
|
|
781
|
-
return MiddlewareFactory$1.create(options);
|
|
781
|
+
return new MiddlewareFactory(MiddlewareFactory$1.create(options));
|
|
782
782
|
}
|
|
783
783
|
/**
|
|
784
784
|
* Returns a middleware that unconditionally produces a 404 error response.
|
|
@@ -3690,6 +3690,25 @@ let DefaultRootHttpRouter$1 = class DefaultRootHttpRouter {
|
|
|
3690
3690
|
}
|
|
3691
3691
|
};
|
|
3692
3692
|
|
|
3693
|
+
function createHealthRouter(options) {
|
|
3694
|
+
const router = Router__default.default();
|
|
3695
|
+
router.get(
|
|
3696
|
+
".backstage/health/v1/readiness",
|
|
3697
|
+
async (_request, response) => {
|
|
3698
|
+
const { status, payload } = await options.health.getReadiness();
|
|
3699
|
+
response.status(status).json(payload);
|
|
3700
|
+
}
|
|
3701
|
+
);
|
|
3702
|
+
router.get(
|
|
3703
|
+
".backstage/health/v1/liveness",
|
|
3704
|
+
async (_request, response) => {
|
|
3705
|
+
const { status, payload } = await options.health.getLiveness();
|
|
3706
|
+
response.status(status).json(payload);
|
|
3707
|
+
}
|
|
3708
|
+
);
|
|
3709
|
+
return router;
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3693
3712
|
function defaultConfigure({ applyDefaults }) {
|
|
3694
3713
|
applyDefaults();
|
|
3695
3714
|
}
|
|
@@ -3699,15 +3718,17 @@ const rootHttpRouterServiceFactory$1 = backendPluginApi.createServiceFactory(
|
|
|
3699
3718
|
deps: {
|
|
3700
3719
|
config: backendPluginApi.coreServices.rootConfig,
|
|
3701
3720
|
rootLogger: backendPluginApi.coreServices.rootLogger,
|
|
3702
|
-
lifecycle: backendPluginApi.coreServices.rootLifecycle
|
|
3721
|
+
lifecycle: backendPluginApi.coreServices.rootLifecycle,
|
|
3722
|
+
health: backendPluginApi.coreServices.rootHealth
|
|
3703
3723
|
},
|
|
3704
|
-
async factory({ config, rootLogger, lifecycle }) {
|
|
3724
|
+
async factory({ config, rootLogger, lifecycle, health }) {
|
|
3705
3725
|
const { indexPath, configure = defaultConfigure } = options ?? {};
|
|
3706
3726
|
const logger = rootLogger.child({ service: "rootHttpRouter" });
|
|
3707
3727
|
const app = express__default.default();
|
|
3708
3728
|
const router = DefaultRootHttpRouter$1.create({ indexPath });
|
|
3709
3729
|
const middleware = MiddlewareFactory$1.create({ config, logger });
|
|
3710
3730
|
const routes = router.handler();
|
|
3731
|
+
const healthRouter = createHealthRouter({ health });
|
|
3711
3732
|
const server = await createHttpServer$1(
|
|
3712
3733
|
app,
|
|
3713
3734
|
readHttpServerOptions$1(config.getOptionalConfig("backend")),
|
|
@@ -3721,11 +3742,13 @@ const rootHttpRouterServiceFactory$1 = backendPluginApi.createServiceFactory(
|
|
|
3721
3742
|
config,
|
|
3722
3743
|
logger,
|
|
3723
3744
|
lifecycle,
|
|
3745
|
+
healthRouter,
|
|
3724
3746
|
applyDefaults() {
|
|
3725
3747
|
app.use(middleware.helmet());
|
|
3726
3748
|
app.use(middleware.cors());
|
|
3727
3749
|
app.use(middleware.compression());
|
|
3728
3750
|
app.use(middleware.logging());
|
|
3751
|
+
app.use(healthRouter);
|
|
3729
3752
|
app.use(routes);
|
|
3730
3753
|
app.use(middleware.notFound());
|
|
3731
3754
|
app.use(middleware.error());
|