@backstage/backend-app-api 0.2.5-next.0 → 0.3.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.
Potentially problematic release.
This version of @backstage/backend-app-api might be problematic. Click here for more details.
- package/CHANGELOG.md +60 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +396 -18
- package/dist/index.beta.d.ts +396 -18
- package/dist/index.cjs.js +1267 -242
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +396 -18
- package/package.json +37 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @backstage/backend-app-api
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 02b119ff93: **BREAKING**: The `httpRouterFactory` now accepts a `getPath` option rather than `indexPlugin`. To set up custom index path, configure the new `rootHttpRouterFactory` with a custom `indexPath` instead.
|
|
8
|
+
|
|
9
|
+
Added an implementation for the new `rootHttpRouterServiceRef`.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ecc6bfe4c9: Use new `ServiceFactoryOrFunction` type.
|
|
14
|
+
- b99c030f1b: Moved over implementation of the root HTTP service from `@backstage/backend-common`, and replaced the `middleware` option with a `configure` callback option.
|
|
15
|
+
- 170282ece6: Fixed a bug in the default token manager factory where it created multiple incompatible instances.
|
|
16
|
+
- 843a0a158c: Added service factory for the new core identity service.
|
|
17
|
+
- 150a7dd790: An error will now be thrown if attempting to override the plugin metadata service.
|
|
18
|
+
- 483e907eaf: Internal updates of `createServiceFactory` from `@backstage/backend-plugin-api`.
|
|
19
|
+
- 015a6dced6: The `createSpecializedBackend` function will now throw an error if duplicate service implementations are provided.
|
|
20
|
+
- e3fca10038: Tweaked the plugin logger to use `plugin` as the label for the plugin ID, rather than `pluginId`.
|
|
21
|
+
- ecbec4ec4c: Internal refactor to match new options pattern in the experimental backend system.
|
|
22
|
+
- 51b7a7ed07: Exported the default root HTTP router implementation as `DefaultRootHttpRouter`. It only implements the routing layer and needs to be exposed via an HTTP server similar to the built-in setup in the `rootHttpRouterFactory`.
|
|
23
|
+
- 0e63aab311: Moved over logging and configuration loading implementations from `@backstage/backend-common`. There is a now `WinstonLogger` which implements the `RootLoggerService` through Winston with accompanying utilities. For configuration the `loadBackendConfig` function has been moved over, but it now instead returns an object with a `config` property.
|
|
24
|
+
- 8e06f3cf00: Switched imports of `loggerToWinstonLogger` to `@backstage/backend-common`.
|
|
25
|
+
- 3b8fd4169b: Internal folder structure refactor.
|
|
26
|
+
- 6cfd4d7073: Updated implementations for the new `RootLifecycleService`.
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/backend-plugin-api@0.3.0
|
|
29
|
+
- @backstage/backend-common@0.18.0
|
|
30
|
+
- @backstage/backend-tasks@0.4.1
|
|
31
|
+
- @backstage/config@1.0.6
|
|
32
|
+
- @backstage/cli-common@0.1.11
|
|
33
|
+
- @backstage/config-loader@1.1.8
|
|
34
|
+
- @backstage/errors@1.1.4
|
|
35
|
+
- @backstage/types@1.0.2
|
|
36
|
+
- @backstage/plugin-auth-node@0.2.9
|
|
37
|
+
- @backstage/plugin-permission-node@0.7.3
|
|
38
|
+
|
|
39
|
+
## 0.3.0-next.1
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
43
|
+
- 02b119ff93: **BREAKING**: The `httpRouterFactory` now accepts a `getPath` option rather than `indexPlugin`. To set up custom index path, configure the new `rootHttpRouterFactory` with a custom `indexPath` instead.
|
|
44
|
+
|
|
45
|
+
Added an implementation for the new `rootHttpRouterServiceRef`.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- ecc6bfe4c9: Use new `ServiceFactoryOrFunction` type.
|
|
50
|
+
- b99c030f1b: Moved over implementation of the root HTTP service from `@backstage/backend-common`, and replaced the `middleware` option with a `configure` callback option.
|
|
51
|
+
- 150a7dd790: An error will now be thrown if attempting to override the plugin metadata service.
|
|
52
|
+
- 015a6dced6: The `createSpecializedBackend` function will now throw an error if duplicate service implementations are provided.
|
|
53
|
+
- e3fca10038: Tweaked the plugin logger to use `plugin` as the label for the plugin ID, rather than `pluginId`.
|
|
54
|
+
- 8e06f3cf00: Switched imports of `loggerToWinstonLogger` to `@backstage/backend-common`.
|
|
55
|
+
- Updated dependencies
|
|
56
|
+
- @backstage/backend-plugin-api@0.3.0-next.1
|
|
57
|
+
- @backstage/backend-common@0.18.0-next.1
|
|
58
|
+
- @backstage/backend-tasks@0.4.1-next.1
|
|
59
|
+
- @backstage/plugin-permission-node@0.7.3-next.1
|
|
60
|
+
- @backstage/config@1.0.6-next.0
|
|
61
|
+
- @backstage/errors@1.1.4
|
|
62
|
+
|
|
3
63
|
## 0.2.5-next.0
|
|
4
64
|
|
|
5
65
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -4,20 +4,40 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
|
|
7
9
|
import { BackendFeature } from '@backstage/backend-plugin-api';
|
|
8
10
|
import { Config } from '@backstage/config';
|
|
11
|
+
import { ConfigService } from '@backstage/backend-plugin-api';
|
|
12
|
+
import { CorsOptions } from 'cors';
|
|
13
|
+
import { ErrorRequestHandler } from 'express';
|
|
14
|
+
import { Express as Express_2 } from 'express';
|
|
9
15
|
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
|
16
|
+
import { Format } from 'logform';
|
|
17
|
+
import { Handler } from 'express';
|
|
18
|
+
import { HelmetOptions } from 'helmet';
|
|
19
|
+
import * as http from 'http';
|
|
10
20
|
import { HttpRouterService } from '@backstage/backend-plugin-api';
|
|
21
|
+
import { IdentityService } from '@backstage/backend-plugin-api';
|
|
11
22
|
import { LifecycleService } from '@backstage/backend-plugin-api';
|
|
23
|
+
import { LoadConfigOptionsRemote } from '@backstage/config-loader';
|
|
12
24
|
import { LoggerService } from '@backstage/backend-plugin-api';
|
|
25
|
+
import { LogMeta } from '@backstage/backend-plugin-api';
|
|
13
26
|
import { PermissionsService } from '@backstage/backend-plugin-api';
|
|
14
27
|
import { PluginCacheManager } from '@backstage/backend-common';
|
|
15
28
|
import { PluginDatabaseManager } from '@backstage/backend-common';
|
|
16
29
|
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
|
17
|
-
import {
|
|
30
|
+
import { RequestHandler } from 'express';
|
|
31
|
+
import { RequestListener } from 'http';
|
|
32
|
+
import { RootHttpRouterService } from '@backstage/backend-plugin-api';
|
|
33
|
+
import { RootLifecycleService } from '@backstage/backend-plugin-api';
|
|
34
|
+
import { RootLoggerService } from '@backstage/backend-plugin-api';
|
|
35
|
+
import { SchedulerService } from '@backstage/backend-plugin-api';
|
|
18
36
|
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
|
37
|
+
import { ServiceFactoryOrFunction } from '@backstage/backend-plugin-api';
|
|
19
38
|
import { ServiceRef } from '@backstage/backend-plugin-api';
|
|
20
|
-
import {
|
|
39
|
+
import { TokenManagerService } from '@backstage/backend-plugin-api';
|
|
40
|
+
import { transport } from 'winston';
|
|
21
41
|
import { UrlReader } from '@backstage/backend-common';
|
|
22
42
|
|
|
23
43
|
/**
|
|
@@ -30,10 +50,37 @@ export declare interface Backend {
|
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
/** @public */
|
|
33
|
-
export declare const cacheFactory: (
|
|
53
|
+
export declare const cacheFactory: () => ServiceFactory<PluginCacheManager>;
|
|
54
|
+
|
|
55
|
+
/** @public */
|
|
56
|
+
export declare const configFactory: () => ServiceFactory<ConfigService>;
|
|
57
|
+
|
|
58
|
+
/** @public */
|
|
59
|
+
export declare interface ConfigFactoryOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Process arguments to use instead of the default `process.argv()`.
|
|
62
|
+
*/
|
|
63
|
+
argv?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* Enables and sets options for remote configuration loading.
|
|
66
|
+
*/
|
|
67
|
+
remote?: LoadConfigOptionsRemote;
|
|
68
|
+
}
|
|
34
69
|
|
|
35
70
|
/** @public */
|
|
36
|
-
export declare
|
|
71
|
+
export declare function createConfigSecretEnumerator(options: {
|
|
72
|
+
logger: LoggerService;
|
|
73
|
+
dir?: string;
|
|
74
|
+
}): Promise<(config: Config) => Iterable<string>>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Creates a Node.js HTTP or HTTPS server instance.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
export declare function createHttpServer(listener: RequestListener, options: HttpServerOptions, deps: {
|
|
82
|
+
logger: LoggerService;
|
|
83
|
+
}): Promise<ExtendedHttpServer>;
|
|
37
84
|
|
|
38
85
|
/**
|
|
39
86
|
* @public
|
|
@@ -44,14 +91,52 @@ export declare function createSpecializedBackend(options: CreateSpecializedBacke
|
|
|
44
91
|
* @public
|
|
45
92
|
*/
|
|
46
93
|
export declare interface CreateSpecializedBackendOptions {
|
|
47
|
-
services:
|
|
94
|
+
services: ServiceFactoryOrFunction[];
|
|
48
95
|
}
|
|
49
96
|
|
|
50
97
|
/** @public */
|
|
51
|
-
export declare const databaseFactory: (
|
|
98
|
+
export declare const databaseFactory: () => ServiceFactory<PluginDatabaseManager>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The default implementation of the {@link @backstage/backend-plugin-api#RootHttpRouterService} interface for
|
|
102
|
+
* {@link @backstage/backend-plugin-api#coreServices.rootHttpRouter}.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export declare class DefaultRootHttpRouter implements RootHttpRouterService {
|
|
107
|
+
#private;
|
|
108
|
+
static create(options?: DefaultRootHttpRouterOptions): DefaultRootHttpRouter;
|
|
109
|
+
private constructor();
|
|
110
|
+
use(path: string, handler: Handler): void;
|
|
111
|
+
handler(): Handler;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Options for the {@link DefaultRootHttpRouter} class.
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export declare interface DefaultRootHttpRouterOptions {
|
|
120
|
+
/**
|
|
121
|
+
* The path to forward all unmatched requests to. Defaults to '/api/app' if
|
|
122
|
+
* not given. Disables index path behavior if false is given.
|
|
123
|
+
*/
|
|
124
|
+
indexPath?: string | false;
|
|
125
|
+
}
|
|
52
126
|
|
|
53
127
|
/** @public */
|
|
54
|
-
export declare const discoveryFactory: (
|
|
128
|
+
export declare const discoveryFactory: () => ServiceFactory<PluginEndpointDiscovery>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* An HTTP server extended with utility methods.
|
|
132
|
+
*
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export declare interface ExtendedHttpServer extends http.Server {
|
|
136
|
+
start(): Promise<void>;
|
|
137
|
+
stop(): Promise<void>;
|
|
138
|
+
port(): number;
|
|
139
|
+
}
|
|
55
140
|
|
|
56
141
|
/** @public */
|
|
57
142
|
export declare const httpRouterFactory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService>;
|
|
@@ -59,34 +144,286 @@ export declare const httpRouterFactory: (options?: HttpRouterFactoryOptions | un
|
|
|
59
144
|
/**
|
|
60
145
|
* @public
|
|
61
146
|
*/
|
|
62
|
-
export declare
|
|
147
|
+
export declare interface HttpRouterFactoryOptions {
|
|
63
148
|
/**
|
|
64
|
-
*
|
|
149
|
+
* A callback used to generate the path for each plugin, defaults to `/api/{pluginId}`.
|
|
65
150
|
*/
|
|
66
|
-
|
|
151
|
+
getPath(pluginId: string): string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Options for configuring HTTPS for an HTTP server.
|
|
156
|
+
*
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
export declare type HttpServerCertificateOptions = {
|
|
160
|
+
type: 'plain';
|
|
161
|
+
key: string;
|
|
162
|
+
cert: string;
|
|
163
|
+
} | {
|
|
164
|
+
type: 'generated';
|
|
165
|
+
hostname: string;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Options for starting up an HTTP server.
|
|
170
|
+
*
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
export declare type HttpServerOptions = {
|
|
174
|
+
listen: {
|
|
175
|
+
port: number;
|
|
176
|
+
host: string;
|
|
177
|
+
};
|
|
178
|
+
https?: {
|
|
179
|
+
certificate: HttpServerCertificateOptions;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/** @public */
|
|
184
|
+
export declare const identityFactory: (options?: IdentityFactoryOptions | undefined) => ServiceFactory<IdentityService>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* An identity client options object which allows extra configurations
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
export declare type IdentityFactoryOptions = {
|
|
192
|
+
issuer?: string;
|
|
193
|
+
/** JWS "alg" (Algorithm) Header Parameter values. Defaults to an array containing just ES256.
|
|
194
|
+
* More info on supported algorithms: https://github.com/panva/jose */
|
|
195
|
+
algorithms?: string[];
|
|
67
196
|
};
|
|
68
197
|
|
|
69
198
|
/**
|
|
70
199
|
* Allows plugins to register shutdown hooks that are run when the process is about to exit.
|
|
71
200
|
* @public */
|
|
72
|
-
export declare const lifecycleFactory: (
|
|
201
|
+
export declare const lifecycleFactory: () => ServiceFactory<LifecycleService>;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Load configuration for a Backend.
|
|
205
|
+
*
|
|
206
|
+
* This function should only be called once, during the initialization of the backend.
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
210
|
+
export declare function loadBackendConfig(options: {
|
|
211
|
+
remote?: LoadConfigOptionsRemote;
|
|
212
|
+
argv: string[];
|
|
213
|
+
}): Promise<{
|
|
214
|
+
config: Config;
|
|
215
|
+
}>;
|
|
73
216
|
|
|
74
217
|
/** @public */
|
|
75
|
-
export declare const loggerFactory: (
|
|
218
|
+
export declare const loggerFactory: () => ServiceFactory<LoggerService>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A utility to configure common middleware.
|
|
222
|
+
*
|
|
223
|
+
* @public
|
|
224
|
+
*/
|
|
225
|
+
export declare class MiddlewareFactory {
|
|
226
|
+
#private;
|
|
227
|
+
/**
|
|
228
|
+
* Creates a new {@link MiddlewareFactory}.
|
|
229
|
+
*/
|
|
230
|
+
static create(options: MiddlewareFactoryOptions): MiddlewareFactory;
|
|
231
|
+
private constructor();
|
|
232
|
+
/**
|
|
233
|
+
* Returns a middleware that unconditionally produces a 404 error response.
|
|
234
|
+
*
|
|
235
|
+
* @remarks
|
|
236
|
+
*
|
|
237
|
+
* Typically you want to place this middleware at the end of the chain, such
|
|
238
|
+
* that it's the last one attempted after no other routes matched.
|
|
239
|
+
*
|
|
240
|
+
* @returns An Express request handler
|
|
241
|
+
*/
|
|
242
|
+
notFound(): RequestHandler;
|
|
243
|
+
/**
|
|
244
|
+
* Returns the compression middleware.
|
|
245
|
+
*
|
|
246
|
+
* @remarks
|
|
247
|
+
*
|
|
248
|
+
* The middleware will attempt to compress response bodies for all requests
|
|
249
|
+
* that traverse through the middleware.
|
|
250
|
+
*/
|
|
251
|
+
compression(): RequestHandler;
|
|
252
|
+
/**
|
|
253
|
+
* Returns a request logging middleware.
|
|
254
|
+
*
|
|
255
|
+
* @remarks
|
|
256
|
+
*
|
|
257
|
+
* Typically you want to place this middleware at the start of the chain, such
|
|
258
|
+
* that it always logs requests whether they are "caught" by handlers farther
|
|
259
|
+
* down or not.
|
|
260
|
+
*
|
|
261
|
+
* @returns An Express request handler
|
|
262
|
+
*/
|
|
263
|
+
logging(): RequestHandler;
|
|
264
|
+
/**
|
|
265
|
+
* Returns a middleware that implements the helmet library.
|
|
266
|
+
*
|
|
267
|
+
* @remarks
|
|
268
|
+
*
|
|
269
|
+
* This middleware applies security policies to incoming requests and outgoing
|
|
270
|
+
* responses. It is configured using config keys such as `backend.csp`.
|
|
271
|
+
*
|
|
272
|
+
* @see {@link https://helmetjs.github.io/}
|
|
273
|
+
*
|
|
274
|
+
* @returns An Express request handler
|
|
275
|
+
*/
|
|
276
|
+
helmet(): RequestHandler;
|
|
277
|
+
/**
|
|
278
|
+
* Returns a middleware that implements the cors library.
|
|
279
|
+
*
|
|
280
|
+
* @remarks
|
|
281
|
+
*
|
|
282
|
+
* This middleware handles CORS. It is configured using the config key
|
|
283
|
+
* `backend.cors`.
|
|
284
|
+
*
|
|
285
|
+
* @see {@link https://github.com/expressjs/cors}
|
|
286
|
+
*
|
|
287
|
+
* @returns An Express request handler
|
|
288
|
+
*/
|
|
289
|
+
cors(): RequestHandler;
|
|
290
|
+
/**
|
|
291
|
+
* Express middleware to handle errors during request processing.
|
|
292
|
+
*
|
|
293
|
+
* @remarks
|
|
294
|
+
*
|
|
295
|
+
* This is commonly the very last middleware in the chain.
|
|
296
|
+
*
|
|
297
|
+
* Its primary purpose is not to do translation of business logic exceptions,
|
|
298
|
+
* but rather to be a global catch-all for uncaught "fatal" errors that are
|
|
299
|
+
* expected to result in a 500 error. However, it also does handle some common
|
|
300
|
+
* error types (such as http-error exceptions, and the well-known error types
|
|
301
|
+
* in the `@backstage/errors` package) and returns the enclosed status code
|
|
302
|
+
* accordingly.
|
|
303
|
+
*
|
|
304
|
+
* It will also produce a response body with a serialized form of the error,
|
|
305
|
+
* unless a previous handler already did send a body. See
|
|
306
|
+
* {@link @backstage/errors#ErrorResponseBody} for the response shape used.
|
|
307
|
+
*
|
|
308
|
+
* @returns An Express error request handler
|
|
309
|
+
*/
|
|
310
|
+
error(options?: MiddlewareFactoryErrorOptions): ErrorRequestHandler;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Options passed to the {@link MiddlewareFactory.error} middleware.
|
|
315
|
+
*
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
318
|
+
export declare interface MiddlewareFactoryErrorOptions {
|
|
319
|
+
/**
|
|
320
|
+
* Whether error response bodies should show error stack traces or not.
|
|
321
|
+
*
|
|
322
|
+
* If not specified, by default shows stack traces only in development mode.
|
|
323
|
+
*/
|
|
324
|
+
showStackTraces?: boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Whether any 4xx errors should be logged or not.
|
|
327
|
+
*
|
|
328
|
+
* If not specified, default to only logging 5xx errors.
|
|
329
|
+
*/
|
|
330
|
+
logAllErrors?: boolean;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Options used to create a {@link MiddlewareFactory}.
|
|
335
|
+
*
|
|
336
|
+
* @public
|
|
337
|
+
*/
|
|
338
|
+
export declare interface MiddlewareFactoryOptions {
|
|
339
|
+
config: ConfigService;
|
|
340
|
+
logger: LoggerService;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** @public */
|
|
344
|
+
export declare const permissionsFactory: () => ServiceFactory<PermissionsService>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Attempts to read a CORS options object from the backend configuration object.
|
|
348
|
+
*
|
|
349
|
+
* @public
|
|
350
|
+
* @param config - The backend configuration object.
|
|
351
|
+
* @returns A CORS options object, or undefined if no cors configuration is present.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* const corsOptions = readCorsOptions(config.getConfig('backend'));
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
export declare function readCorsOptions(config?: Config): CorsOptions;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Attempts to read Helmet options from the backend configuration object.
|
|
362
|
+
*
|
|
363
|
+
* @public
|
|
364
|
+
* @param config - The backend configuration object.
|
|
365
|
+
* @returns A Helmet options object, or undefined if no Helmet configuration is present.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```ts
|
|
369
|
+
* const helmetOptions = readHelmetOptions(config.getConfig('backend'));
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
export declare function readHelmetOptions(config?: Config): HelmetOptions;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Reads {@link HttpServerOptions} from a {@link @backstage/config#Config} object.
|
|
376
|
+
*
|
|
377
|
+
* @public
|
|
378
|
+
* @remarks
|
|
379
|
+
*
|
|
380
|
+
* The provided configuration object should contain the `listen` and
|
|
381
|
+
* additional keys directly.
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```ts
|
|
385
|
+
* const opts = readHttpServerOptions(config.getConfig('backend'));
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export declare function readHttpServerOptions(config?: Config): HttpServerOptions;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @public
|
|
392
|
+
*/
|
|
393
|
+
export declare interface RootHttpRouterConfigureOptions {
|
|
394
|
+
app: Express_2;
|
|
395
|
+
middleware: MiddlewareFactory;
|
|
396
|
+
routes: RequestHandler;
|
|
397
|
+
config: ConfigService;
|
|
398
|
+
logger: LoggerService;
|
|
399
|
+
lifecycle: LifecycleService;
|
|
400
|
+
}
|
|
76
401
|
|
|
77
402
|
/** @public */
|
|
78
|
-
export declare const
|
|
403
|
+
export declare const rootHttpRouterFactory: () => ServiceFactory<RootHttpRouterService>;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* @public
|
|
407
|
+
*/
|
|
408
|
+
export declare type RootHttpRouterFactoryOptions = {
|
|
409
|
+
/**
|
|
410
|
+
* The path to forward all unmatched requests to. Defaults to '/api/app' if
|
|
411
|
+
* not given. Disables index path behavior if false is given.
|
|
412
|
+
*/
|
|
413
|
+
indexPath?: string | false;
|
|
414
|
+
configure?(options: RootHttpRouterConfigureOptions): void;
|
|
415
|
+
};
|
|
79
416
|
|
|
80
417
|
/**
|
|
81
418
|
* Allows plugins to register shutdown hooks that are run when the process is about to exit.
|
|
82
419
|
* @public */
|
|
83
|
-
export declare const rootLifecycleFactory: (
|
|
420
|
+
export declare const rootLifecycleFactory: () => ServiceFactory<RootLifecycleService>;
|
|
84
421
|
|
|
85
422
|
/** @public */
|
|
86
|
-
export declare const rootLoggerFactory: (
|
|
423
|
+
export declare const rootLoggerFactory: () => ServiceFactory<RootLoggerService>;
|
|
87
424
|
|
|
88
425
|
/** @public */
|
|
89
|
-
export declare const schedulerFactory: (
|
|
426
|
+
export declare const schedulerFactory: () => ServiceFactory<SchedulerService>;
|
|
90
427
|
|
|
91
428
|
/**
|
|
92
429
|
* @public
|
|
@@ -94,9 +431,50 @@ export declare const schedulerFactory: (options?: undefined) => ServiceFactory<P
|
|
|
94
431
|
export declare type ServiceOrExtensionPoint<T = unknown> = ExtensionPoint<T> | ServiceRef<T>;
|
|
95
432
|
|
|
96
433
|
/** @public */
|
|
97
|
-
export declare const tokenManagerFactory: (
|
|
434
|
+
export declare const tokenManagerFactory: () => ServiceFactory<TokenManagerService>;
|
|
98
435
|
|
|
99
436
|
/** @public */
|
|
100
|
-
export declare const urlReaderFactory: (
|
|
437
|
+
export declare const urlReaderFactory: () => ServiceFactory<UrlReader>;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* A {@link @backstage/backend-plugin-api#LoggerService} implementation based on winston.
|
|
441
|
+
*
|
|
442
|
+
* @public
|
|
443
|
+
*/
|
|
444
|
+
export declare class WinstonLogger implements RootLoggerService {
|
|
445
|
+
#private;
|
|
446
|
+
/**
|
|
447
|
+
* Creates a {@link WinstonLogger} instance.
|
|
448
|
+
*/
|
|
449
|
+
static create(options: WinstonLoggerOptions): WinstonLogger;
|
|
450
|
+
/**
|
|
451
|
+
* Creates a winston log formatter for redacting secrets.
|
|
452
|
+
*/
|
|
453
|
+
static redacter(): {
|
|
454
|
+
format: Format;
|
|
455
|
+
add: (redactions: Iterable<string>) => void;
|
|
456
|
+
};
|
|
457
|
+
/**
|
|
458
|
+
* Creates a pretty printed winston log formatter.
|
|
459
|
+
*/
|
|
460
|
+
static colorFormat(): Format;
|
|
461
|
+
private constructor();
|
|
462
|
+
error(message: string, meta?: LogMeta): void;
|
|
463
|
+
warn(message: string, meta?: LogMeta): void;
|
|
464
|
+
info(message: string, meta?: LogMeta): void;
|
|
465
|
+
debug(message: string, meta?: LogMeta): void;
|
|
466
|
+
child(meta: LogMeta): LoggerService;
|
|
467
|
+
addRedactions(redactions: Iterable<string>): void;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* @public
|
|
472
|
+
*/
|
|
473
|
+
export declare interface WinstonLoggerOptions {
|
|
474
|
+
meta?: LogMeta;
|
|
475
|
+
level: string;
|
|
476
|
+
format: Format;
|
|
477
|
+
transports: transport[];
|
|
478
|
+
}
|
|
101
479
|
|
|
102
480
|
export { }
|