@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/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @backstage/backend-app-api
2
2
 
3
+ ## 0.7.8
4
+
5
+ ### Patch Changes
6
+
7
+ - c5957b0: Fixing issue with `MiddlewareFactory` deprecation wrapping
8
+ - 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
32
+ - @backstage/cli-common@0.1.14
33
+ - @backstage/cli-node@0.2.6
34
+ - @backstage/config@1.2.0
35
+ - @backstage/config-loader@1.8.1
36
+ - @backstage/errors@1.2.4
37
+ - @backstage/types@1.1.1
38
+
3
39
  ## 0.7.6
4
40
 
5
41
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "@backstage/backend-app-api",
3
- "version": "0.7.6",
2
+ "name": "@backstage/backend-app-api__alpha",
3
+ "version": "0.7.8",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
package/dist/index.cjs.js CHANGED
@@ -770,7 +770,108 @@ const readHttpServerOptions = readHttpServerOptions$1;
770
770
  const createHttpServer = createHttpServer$1;
771
771
  const readCorsOptions = readCorsOptions$1;
772
772
  const readHelmetOptions = readHelmetOptions$1;
773
- const MiddlewareFactory = MiddlewareFactory$1;
773
+ class MiddlewareFactory {
774
+ constructor(impl) {
775
+ this.impl = impl;
776
+ }
777
+ /**
778
+ * Creates a new {@link MiddlewareFactory}.
779
+ */
780
+ static create(options) {
781
+ return new MiddlewareFactory(MiddlewareFactory$1.create(options));
782
+ }
783
+ /**
784
+ * Returns a middleware that unconditionally produces a 404 error response.
785
+ *
786
+ * @remarks
787
+ *
788
+ * Typically you want to place this middleware at the end of the chain, such
789
+ * that it's the last one attempted after no other routes matched.
790
+ *
791
+ * @returns An Express request handler
792
+ */
793
+ notFound() {
794
+ return this.impl.notFound();
795
+ }
796
+ /**
797
+ * Returns the compression middleware.
798
+ *
799
+ * @remarks
800
+ *
801
+ * The middleware will attempt to compress response bodies for all requests
802
+ * that traverse through the middleware.
803
+ */
804
+ compression() {
805
+ return this.impl.compression();
806
+ }
807
+ /**
808
+ * Returns a request logging middleware.
809
+ *
810
+ * @remarks
811
+ *
812
+ * Typically you want to place this middleware at the start of the chain, such
813
+ * that it always logs requests whether they are "caught" by handlers farther
814
+ * down or not.
815
+ *
816
+ * @returns An Express request handler
817
+ */
818
+ logging() {
819
+ return this.impl.logging();
820
+ }
821
+ /**
822
+ * Returns a middleware that implements the helmet library.
823
+ *
824
+ * @remarks
825
+ *
826
+ * This middleware applies security policies to incoming requests and outgoing
827
+ * responses. It is configured using config keys such as `backend.csp`.
828
+ *
829
+ * @see {@link https://helmetjs.github.io/}
830
+ *
831
+ * @returns An Express request handler
832
+ */
833
+ helmet() {
834
+ return this.impl.helmet();
835
+ }
836
+ /**
837
+ * Returns a middleware that implements the cors library.
838
+ *
839
+ * @remarks
840
+ *
841
+ * This middleware handles CORS. It is configured using the config key
842
+ * `backend.cors`.
843
+ *
844
+ * @see {@link https://github.com/expressjs/cors}
845
+ *
846
+ * @returns An Express request handler
847
+ */
848
+ cors() {
849
+ return this.impl.cors();
850
+ }
851
+ /**
852
+ * Express middleware to handle errors during request processing.
853
+ *
854
+ * @remarks
855
+ *
856
+ * This is commonly the very last middleware in the chain.
857
+ *
858
+ * Its primary purpose is not to do translation of business logic exceptions,
859
+ * but rather to be a global catch-all for uncaught "fatal" errors that are
860
+ * expected to result in a 500 error. However, it also does handle some common
861
+ * error types (such as http-error exceptions, and the well-known error types
862
+ * in the `@backstage/errors` package) and returns the enclosed status code
863
+ * accordingly.
864
+ *
865
+ * It will also produce a response body with a serialized form of the error,
866
+ * unless a previous handler already did send a body. See
867
+ * {@link @backstage/errors#ErrorResponseBody} for the response shape used.
868
+ *
869
+ * @returns An Express error request handler
870
+ */
871
+ error(options = {}) {
872
+ return this.impl.error(options);
873
+ }
874
+ }
774
875
 
775
876
  const escapeRegExp = (text) => {
776
877
  return text.replace(/[.*+?^${}(\)|[\]\\]/g, "\\$&");