@backstage/backend-app-api 0.7.8 → 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 CHANGED
@@ -1,34 +1,17 @@
1
1
  # @backstage/backend-app-api
2
2
 
3
- ## 0.7.8
3
+ ## 0.7.9-next.0
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - c5957b0: Fixing issue with `MiddlewareFactory` deprecation wrapping
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-common@0.23.1
10
- - @backstage/backend-plugin-api@0.6.20
11
- - @backstage/backend-tasks@0.5.25
12
- - @backstage/cli-common@0.1.14
13
- - @backstage/cli-node@0.2.6
14
- - @backstage/config@1.2.0
15
- - @backstage/config-loader@1.8.1
16
- - @backstage/errors@1.2.4
17
- - @backstage/types@1.1.1
18
- - @backstage/plugin-auth-node@0.4.15
19
- - @backstage/plugin-permission-node@0.7.31
20
-
21
- ## 0.7.7
22
-
23
- ### Patch Changes
24
-
25
- - d7cce61: Fixing exporting of classes properly from new packages
26
- - Updated dependencies
27
- - @backstage/backend-common@0.23.1
28
- - @backstage/backend-tasks@0.5.25
29
- - @backstage/plugin-auth-node@0.4.15
30
- - @backstage/plugin-permission-node@0.7.31
31
- - @backstage/backend-plugin-api@0.6.20
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
32
15
  - @backstage/cli-common@0.1.14
33
16
  - @backstage/cli-node@0.2.6
34
17
  - @backstage/config@1.2.0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-app-api__alpha",
3
- "version": "0.7.8",
3
+ "version": "0.7.9-next.0",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/index.cjs.js CHANGED
@@ -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());