@backstage/backend-app-api 0.7.6 → 0.7.8

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/dist/index.d.ts CHANGED
@@ -3,9 +3,9 @@ import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
3
3
  import { LoggerService, RootConfigService, RootLoggerService, BackendFeature, ServiceFactoryOrFunction, DiscoveryService, LifecycleService, RootLifecycleService, RootHttpRouterService } from '@backstage/backend-plugin-api';
4
4
  import { Config, AppConfig } from '@backstage/config';
5
5
  import { ConfigSchema, LoadConfigOptionsRemote, RemoteConfigSourceOptions } from '@backstage/config-loader';
6
+ import { RequestHandler, ErrorRequestHandler, Express, Handler } from 'express';
6
7
  import * as http from 'http';
7
8
  import { RequestListener } from 'http';
8
- import { RequestHandler, ErrorRequestHandler, Express, Handler } from 'express';
9
9
  import { CorsOptions } from 'cors';
10
10
  import { HelmetOptions } from 'helmet';
11
11
  import { JsonObject, HumanDuration } from '@backstage/types';
@@ -278,7 +278,93 @@ declare const readHelmetOptions: typeof readHelmetOptions$1;
278
278
  * @public
279
279
  * @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
280
280
  */
281
- declare const MiddlewareFactory: typeof MiddlewareFactory$1;
281
+ declare class MiddlewareFactory {
282
+ private readonly impl;
283
+ /**
284
+ * Creates a new {@link MiddlewareFactory}.
285
+ */
286
+ static create(options: MiddlewareFactoryOptions): MiddlewareFactory;
287
+ private constructor();
288
+ /**
289
+ * Returns a middleware that unconditionally produces a 404 error response.
290
+ *
291
+ * @remarks
292
+ *
293
+ * Typically you want to place this middleware at the end of the chain, such
294
+ * that it's the last one attempted after no other routes matched.
295
+ *
296
+ * @returns An Express request handler
297
+ */
298
+ notFound(): RequestHandler;
299
+ /**
300
+ * Returns the compression middleware.
301
+ *
302
+ * @remarks
303
+ *
304
+ * The middleware will attempt to compress response bodies for all requests
305
+ * that traverse through the middleware.
306
+ */
307
+ compression(): RequestHandler;
308
+ /**
309
+ * Returns a request logging middleware.
310
+ *
311
+ * @remarks
312
+ *
313
+ * Typically you want to place this middleware at the start of the chain, such
314
+ * that it always logs requests whether they are "caught" by handlers farther
315
+ * down or not.
316
+ *
317
+ * @returns An Express request handler
318
+ */
319
+ logging(): RequestHandler;
320
+ /**
321
+ * Returns a middleware that implements the helmet library.
322
+ *
323
+ * @remarks
324
+ *
325
+ * This middleware applies security policies to incoming requests and outgoing
326
+ * responses. It is configured using config keys such as `backend.csp`.
327
+ *
328
+ * @see {@link https://helmetjs.github.io/}
329
+ *
330
+ * @returns An Express request handler
331
+ */
332
+ helmet(): RequestHandler;
333
+ /**
334
+ * Returns a middleware that implements the cors library.
335
+ *
336
+ * @remarks
337
+ *
338
+ * This middleware handles CORS. It is configured using the config key
339
+ * `backend.cors`.
340
+ *
341
+ * @see {@link https://github.com/expressjs/cors}
342
+ *
343
+ * @returns An Express request handler
344
+ */
345
+ cors(): RequestHandler;
346
+ /**
347
+ * Express middleware to handle errors during request processing.
348
+ *
349
+ * @remarks
350
+ *
351
+ * This is commonly the very last middleware in the chain.
352
+ *
353
+ * Its primary purpose is not to do translation of business logic exceptions,
354
+ * but rather to be a global catch-all for uncaught "fatal" errors that are
355
+ * expected to result in a 500 error. However, it also does handle some common
356
+ * error types (such as http-error exceptions, and the well-known error types
357
+ * in the `@backstage/errors` package) and returns the enclosed status code
358
+ * accordingly.
359
+ *
360
+ * It will also produce a response body with a serialized form of the error,
361
+ * unless a previous handler already did send a body. See
362
+ * {@link @backstage/errors#ErrorResponseBody} for the response shape used.
363
+ *
364
+ * @returns An Express error request handler
365
+ */
366
+ error(options?: MiddlewareFactoryErrorOptions): ErrorRequestHandler;
367
+ }
282
368
  /**
283
369
  * @public
284
370
  * @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-app-api",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "Core API used by Backstage backend apps",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -49,16 +49,16 @@
49
49
  "test": "backstage-cli package test"
50
50
  },
51
51
  "dependencies": {
52
- "@backstage/backend-common": "^0.23.0",
53
- "@backstage/backend-plugin-api": "^0.6.19",
54
- "@backstage/backend-tasks": "^0.5.24",
52
+ "@backstage/backend-common": "^0.23.1",
53
+ "@backstage/backend-plugin-api": "^0.6.20",
54
+ "@backstage/backend-tasks": "^0.5.25",
55
55
  "@backstage/cli-common": "^0.1.14",
56
56
  "@backstage/cli-node": "^0.2.6",
57
57
  "@backstage/config": "^1.2.0",
58
58
  "@backstage/config-loader": "^1.8.1",
59
59
  "@backstage/errors": "^1.2.4",
60
- "@backstage/plugin-auth-node": "^0.4.14",
61
- "@backstage/plugin-permission-node": "^0.7.30",
60
+ "@backstage/plugin-auth-node": "^0.4.15",
61
+ "@backstage/plugin-permission-node": "^0.7.31",
62
62
  "@backstage/types": "^1.1.1",
63
63
  "@manypkg/get-packages": "^1.1.3",
64
64
  "@types/cors": "^2.8.6",
@@ -89,9 +89,9 @@
89
89
  "winston-transport": "^4.5.0"
90
90
  },
91
91
  "devDependencies": {
92
- "@backstage/backend-defaults": "^0.3.0",
93
- "@backstage/backend-test-utils": "^0.4.0",
94
- "@backstage/cli": "^0.26.7",
92
+ "@backstage/backend-defaults": "^0.3.2",
93
+ "@backstage/backend-test-utils": "^0.4.2",
94
+ "@backstage/cli": "^0.26.9",
95
95
  "@types/compression": "^1.7.0",
96
96
  "@types/fs-extra": "^11.0.0",
97
97
  "@types/http-errors": "^2.0.0",