@backstage/backend-app-api 0.7.6-next.3 → 0.7.6
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 +69 -0
- package/alpha/package.json +1 -1
- package/config.d.ts +33 -0
- package/dist/alpha.cjs.js +1 -1
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/index.cjs.js +1449 -1158
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +246 -85
- package/package.json +13 -11
- package/migrations/20240327104803_public_keys.js +0 -50
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
3
|
-
import { LoggerService, RootConfigService, RootLoggerService, BackendFeature, ServiceFactoryOrFunction, DiscoveryService,
|
|
4
|
-
import { ConfigSchema, LoadConfigOptionsRemote, RemoteConfigSourceOptions } from '@backstage/config-loader';
|
|
3
|
+
import { LoggerService, RootConfigService, RootLoggerService, BackendFeature, ServiceFactoryOrFunction, DiscoveryService, LifecycleService, RootLifecycleService, RootHttpRouterService } from '@backstage/backend-plugin-api';
|
|
5
4
|
import { Config, AppConfig } from '@backstage/config';
|
|
5
|
+
import { ConfigSchema, LoadConfigOptionsRemote, RemoteConfigSourceOptions } from '@backstage/config-loader';
|
|
6
6
|
import * as http from 'http';
|
|
7
7
|
import { RequestListener } from 'http';
|
|
8
8
|
import { RequestHandler, ErrorRequestHandler, Express, Handler } from 'express';
|
|
@@ -11,21 +11,27 @@ import { HelmetOptions } from 'helmet';
|
|
|
11
11
|
import { JsonObject, HumanDuration } from '@backstage/types';
|
|
12
12
|
import { Format } from 'logform';
|
|
13
13
|
import { transport } from 'winston';
|
|
14
|
-
import * as _backstage_backend_common from '@backstage/backend-common';
|
|
15
14
|
import { Server } from 'node:http';
|
|
16
15
|
|
|
17
16
|
/** @public */
|
|
18
|
-
declare function createConfigSecretEnumerator(options: {
|
|
17
|
+
declare function createConfigSecretEnumerator$1(options: {
|
|
19
18
|
logger: LoggerService;
|
|
20
19
|
dir?: string;
|
|
21
20
|
schema?: ConfigSchema;
|
|
22
21
|
}): Promise<(config: Config) => Iterable<string>>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootConfig` instead.
|
|
26
|
+
*/
|
|
27
|
+
declare const createConfigSecretEnumerator: typeof createConfigSecretEnumerator$1;
|
|
23
28
|
/**
|
|
24
29
|
* Load configuration for a Backend.
|
|
25
30
|
*
|
|
26
31
|
* This function should only be called once, during the initialization of the backend.
|
|
27
32
|
*
|
|
28
33
|
* @public
|
|
34
|
+
* @deprecated Please migrate to the new backend system and use `coreServices.rootConfig` instead, or the {@link @backstage/config-loader#ConfigSources} facilities if required.
|
|
29
35
|
*/
|
|
30
36
|
declare function loadBackendConfig(options: {
|
|
31
37
|
remote?: LoadConfigOptionsRemote;
|
|
@@ -41,7 +47,7 @@ declare function loadBackendConfig(options: {
|
|
|
41
47
|
*
|
|
42
48
|
* @public
|
|
43
49
|
*/
|
|
44
|
-
interface ExtendedHttpServer extends http.Server {
|
|
50
|
+
interface ExtendedHttpServer$1 extends http.Server {
|
|
45
51
|
start(): Promise<void>;
|
|
46
52
|
stop(): Promise<void>;
|
|
47
53
|
port(): number;
|
|
@@ -51,13 +57,13 @@ interface ExtendedHttpServer extends http.Server {
|
|
|
51
57
|
*
|
|
52
58
|
* @public
|
|
53
59
|
*/
|
|
54
|
-
type HttpServerOptions = {
|
|
60
|
+
type HttpServerOptions$1 = {
|
|
55
61
|
listen: {
|
|
56
62
|
port: number;
|
|
57
63
|
host: string;
|
|
58
64
|
};
|
|
59
65
|
https?: {
|
|
60
|
-
certificate: HttpServerCertificateOptions;
|
|
66
|
+
certificate: HttpServerCertificateOptions$1;
|
|
61
67
|
};
|
|
62
68
|
};
|
|
63
69
|
/**
|
|
@@ -65,7 +71,7 @@ type HttpServerOptions = {
|
|
|
65
71
|
*
|
|
66
72
|
* @public
|
|
67
73
|
*/
|
|
68
|
-
type HttpServerCertificateOptions = {
|
|
74
|
+
type HttpServerCertificateOptions$1 = {
|
|
69
75
|
type: 'pem';
|
|
70
76
|
key: string;
|
|
71
77
|
cert: string;
|
|
@@ -88,23 +94,23 @@ type HttpServerCertificateOptions = {
|
|
|
88
94
|
* const opts = readHttpServerOptions(config.getConfig('backend'));
|
|
89
95
|
* ```
|
|
90
96
|
*/
|
|
91
|
-
declare function readHttpServerOptions(config?: Config): HttpServerOptions;
|
|
97
|
+
declare function readHttpServerOptions$1(config?: Config): HttpServerOptions$1;
|
|
92
98
|
|
|
93
99
|
/**
|
|
94
100
|
* Creates a Node.js HTTP or HTTPS server instance.
|
|
95
101
|
*
|
|
96
102
|
* @public
|
|
97
103
|
*/
|
|
98
|
-
declare function createHttpServer(listener: RequestListener, options: HttpServerOptions, deps: {
|
|
104
|
+
declare function createHttpServer$1(listener: RequestListener, options: HttpServerOptions$1, deps: {
|
|
99
105
|
logger: LoggerService;
|
|
100
|
-
}): Promise<ExtendedHttpServer>;
|
|
106
|
+
}): Promise<ExtendedHttpServer$1>;
|
|
101
107
|
|
|
102
108
|
/**
|
|
103
109
|
* Options used to create a {@link MiddlewareFactory}.
|
|
104
110
|
*
|
|
105
111
|
* @public
|
|
106
112
|
*/
|
|
107
|
-
interface MiddlewareFactoryOptions {
|
|
113
|
+
interface MiddlewareFactoryOptions$1 {
|
|
108
114
|
config: RootConfigService;
|
|
109
115
|
logger: LoggerService;
|
|
110
116
|
}
|
|
@@ -113,7 +119,7 @@ interface MiddlewareFactoryOptions {
|
|
|
113
119
|
*
|
|
114
120
|
* @public
|
|
115
121
|
*/
|
|
116
|
-
interface MiddlewareFactoryErrorOptions {
|
|
122
|
+
interface MiddlewareFactoryErrorOptions$1 {
|
|
117
123
|
/**
|
|
118
124
|
* Whether error response bodies should show error stack traces or not.
|
|
119
125
|
*
|
|
@@ -132,12 +138,12 @@ interface MiddlewareFactoryErrorOptions {
|
|
|
132
138
|
*
|
|
133
139
|
* @public
|
|
134
140
|
*/
|
|
135
|
-
declare class MiddlewareFactory {
|
|
141
|
+
declare class MiddlewareFactory$1 {
|
|
136
142
|
#private;
|
|
137
143
|
/**
|
|
138
144
|
* Creates a new {@link MiddlewareFactory}.
|
|
139
145
|
*/
|
|
140
|
-
static create(options: MiddlewareFactoryOptions): MiddlewareFactory;
|
|
146
|
+
static create(options: MiddlewareFactoryOptions$1): MiddlewareFactory$1;
|
|
141
147
|
private constructor();
|
|
142
148
|
/**
|
|
143
149
|
* Returns a middleware that unconditionally produces a 404 error response.
|
|
@@ -217,7 +223,7 @@ declare class MiddlewareFactory {
|
|
|
217
223
|
*
|
|
218
224
|
* @returns An Express error request handler
|
|
219
225
|
*/
|
|
220
|
-
error(options?: MiddlewareFactoryErrorOptions): ErrorRequestHandler;
|
|
226
|
+
error(options?: MiddlewareFactoryErrorOptions$1): ErrorRequestHandler;
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
/**
|
|
@@ -232,7 +238,7 @@ declare class MiddlewareFactory {
|
|
|
232
238
|
* const corsOptions = readCorsOptions(config.getConfig('backend'));
|
|
233
239
|
* ```
|
|
234
240
|
*/
|
|
235
|
-
declare function readCorsOptions(config?: Config): CorsOptions;
|
|
241
|
+
declare function readCorsOptions$1(config?: Config): CorsOptions;
|
|
236
242
|
|
|
237
243
|
/**
|
|
238
244
|
* Attempts to read Helmet options from the backend configuration object.
|
|
@@ -246,24 +252,82 @@ declare function readCorsOptions(config?: Config): CorsOptions;
|
|
|
246
252
|
* const helmetOptions = readHelmetOptions(config.getConfig('backend'));
|
|
247
253
|
* ```
|
|
248
254
|
*/
|
|
249
|
-
declare function readHelmetOptions(config?: Config): HelmetOptions;
|
|
255
|
+
declare function readHelmetOptions$1(config?: Config): HelmetOptions;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @public
|
|
259
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
260
|
+
*/
|
|
261
|
+
declare const readHttpServerOptions: typeof readHttpServerOptions$1;
|
|
262
|
+
/**
|
|
263
|
+
* @public
|
|
264
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
265
|
+
*/
|
|
266
|
+
declare const createHttpServer: typeof createHttpServer$1;
|
|
267
|
+
/**
|
|
268
|
+
* @public
|
|
269
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
270
|
+
*/
|
|
271
|
+
declare const readCorsOptions: typeof readCorsOptions$1;
|
|
272
|
+
/**
|
|
273
|
+
* @public
|
|
274
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
275
|
+
*/
|
|
276
|
+
declare const readHelmetOptions: typeof readHelmetOptions$1;
|
|
277
|
+
/**
|
|
278
|
+
* @public
|
|
279
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
280
|
+
*/
|
|
281
|
+
declare const MiddlewareFactory: typeof MiddlewareFactory$1;
|
|
282
|
+
/**
|
|
283
|
+
* @public
|
|
284
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
285
|
+
*/
|
|
286
|
+
type MiddlewareFactoryErrorOptions = MiddlewareFactoryErrorOptions$1;
|
|
287
|
+
/**
|
|
288
|
+
* @public
|
|
289
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
290
|
+
*/
|
|
291
|
+
type MiddlewareFactoryOptions = MiddlewareFactoryOptions$1;
|
|
292
|
+
/**
|
|
293
|
+
* @public
|
|
294
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
295
|
+
*/
|
|
296
|
+
type ExtendedHttpServer = ExtendedHttpServer$1;
|
|
297
|
+
/**
|
|
298
|
+
* @public
|
|
299
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
300
|
+
*/
|
|
301
|
+
type HttpServerCertificateOptions = HttpServerCertificateOptions$1;
|
|
302
|
+
/**
|
|
303
|
+
* @public
|
|
304
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
305
|
+
*/
|
|
306
|
+
type HttpServerOptions = HttpServerOptions$1;
|
|
250
307
|
|
|
251
308
|
/**
|
|
252
309
|
* @public
|
|
253
310
|
*/
|
|
254
|
-
interface WinstonLoggerOptions {
|
|
311
|
+
interface WinstonLoggerOptions$1 {
|
|
255
312
|
meta?: JsonObject;
|
|
256
313
|
level?: string;
|
|
257
314
|
format?: Format;
|
|
258
315
|
transports?: transport[];
|
|
259
316
|
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @public
|
|
320
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootLogger` instead.
|
|
321
|
+
*/
|
|
322
|
+
type WinstonLoggerOptions = WinstonLoggerOptions$1;
|
|
260
323
|
/**
|
|
261
324
|
* A {@link @backstage/backend-plugin-api#LoggerService} implementation based on winston.
|
|
262
325
|
*
|
|
263
326
|
* @public
|
|
327
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootLogger` instead.
|
|
264
328
|
*/
|
|
265
329
|
declare class WinstonLogger implements RootLoggerService {
|
|
266
|
-
|
|
330
|
+
private readonly impl;
|
|
267
331
|
/**
|
|
268
332
|
* Creates a {@link WinstonLogger} instance.
|
|
269
333
|
*/
|
|
@@ -310,9 +374,6 @@ interface CreateSpecializedBackendOptions {
|
|
|
310
374
|
*/
|
|
311
375
|
declare function createSpecializedBackend(options: CreateSpecializedBackendOptions): Backend;
|
|
312
376
|
|
|
313
|
-
/** @public */
|
|
314
|
-
declare const authServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.AuthService, "plugin">;
|
|
315
|
-
|
|
316
377
|
/**
|
|
317
378
|
* @public
|
|
318
379
|
* @deprecated Please import from `@backstage/backend-defaults/cache` instead.
|
|
@@ -344,7 +405,7 @@ declare const rootConfigServiceFactory: (options?: RootConfigFactoryOptions | un
|
|
|
344
405
|
* @public
|
|
345
406
|
* @deprecated Please import from `@backstage/backend-defaults/database` instead.
|
|
346
407
|
*/
|
|
347
|
-
declare const databaseServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<
|
|
408
|
+
declare const databaseServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.DatabaseService, "plugin">;
|
|
348
409
|
|
|
349
410
|
/**
|
|
350
411
|
* @public
|
|
@@ -364,9 +425,7 @@ declare const discoveryServiceFactory: () => _backstage_backend_plugin_api.Servi
|
|
|
364
425
|
* @deprecated Please import from `@backstage/backend-defaults/discovery` instead.
|
|
365
426
|
*/
|
|
366
427
|
declare class HostDiscovery implements DiscoveryService {
|
|
367
|
-
private readonly
|
|
368
|
-
private readonly externalBaseUrl;
|
|
369
|
-
private readonly discoveryConfig;
|
|
428
|
+
private readonly impl;
|
|
370
429
|
/**
|
|
371
430
|
* Creates a new HostDiscovery discovery instance by reading
|
|
372
431
|
* from the `backend` config section, specifically the `.baseUrl` for
|
|
@@ -395,31 +454,108 @@ declare class HostDiscovery implements DiscoveryService {
|
|
|
395
454
|
basePath?: string;
|
|
396
455
|
}): HostDiscovery;
|
|
397
456
|
private constructor();
|
|
398
|
-
private getTargetFromConfig;
|
|
399
457
|
getBaseUrl(pluginId: string): Promise<string>;
|
|
400
458
|
getExternalBaseUrl(pluginId: string): Promise<string>;
|
|
401
459
|
}
|
|
402
460
|
|
|
403
|
-
/**
|
|
404
|
-
|
|
461
|
+
/**
|
|
462
|
+
* An identity client options object which allows extra configurations
|
|
463
|
+
*
|
|
464
|
+
* @public
|
|
465
|
+
* @deprecated Please migrate to the new `coreServices.auth`, `coreServices.httpAuth`, and `coreServices.userInfo` services as needed instead
|
|
466
|
+
*/
|
|
467
|
+
type IdentityFactoryOptions = {
|
|
468
|
+
issuer?: string;
|
|
469
|
+
/**
|
|
470
|
+
* JWS "alg" (Algorithm) Header Parameter values. Defaults to an array containing just ES256.
|
|
471
|
+
* More info on supported algorithms: https://github.com/panva/jose
|
|
472
|
+
*/
|
|
473
|
+
algorithms?: string[];
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* @public
|
|
477
|
+
* @deprecated Please migrate to the new `coreServices.auth`, `coreServices.httpAuth`, and `coreServices.userInfo` services as needed instead
|
|
478
|
+
*/
|
|
479
|
+
declare const identityServiceFactory: (options?: IdentityFactoryOptions | undefined) => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.IdentityService, "plugin">;
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Allows plugins to register shutdown hooks that are run when the process is about to exit.
|
|
483
|
+
*
|
|
484
|
+
* @public
|
|
485
|
+
* @deprecated Please import from `@backstage/backend-defaults/lifecycle` instead.
|
|
486
|
+
*/
|
|
487
|
+
declare const lifecycleServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<LifecycleService, "plugin">;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* @public
|
|
491
|
+
* @deprecated Please import from `@backstage/backend-defaults/permissions` instead.
|
|
492
|
+
*/
|
|
493
|
+
declare const permissionsServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.PermissionsService, "plugin">;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Allows plugins to register shutdown hooks that are run when the process is about to exit.
|
|
497
|
+
*
|
|
498
|
+
* @public
|
|
499
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootLifecycle` instead.
|
|
500
|
+
*/
|
|
501
|
+
declare const rootLifecycleServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<RootLifecycleService, "root">;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* @public
|
|
505
|
+
* @deprecated Please migrate to the new `coreServices.auth`, `coreServices.httpAuth`, and `coreServices.userInfo` services as needed instead
|
|
506
|
+
*/
|
|
507
|
+
declare const tokenManagerServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.TokenManagerService, "plugin">;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* @public
|
|
511
|
+
* @deprecated Please import from `@backstage/backend-defaults/urlReader` instead.
|
|
512
|
+
*/
|
|
513
|
+
declare const urlReaderServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.UrlReaderService, "plugin">;
|
|
405
514
|
|
|
406
515
|
/**
|
|
407
516
|
* @public
|
|
517
|
+
* @deprecated Please import from `@backstage/backend-defaults/auth` instead.
|
|
408
518
|
*/
|
|
409
|
-
|
|
519
|
+
declare const authServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.AuthService, "plugin">;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* @public
|
|
523
|
+
* @deprecated Please import from `@backstage/backend-defaults/httpAuth` instead.
|
|
524
|
+
*/
|
|
525
|
+
declare const httpAuthServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.HttpAuthService, "plugin">;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* @public
|
|
529
|
+
*/
|
|
530
|
+
interface HttpRouterFactoryOptions$1 {
|
|
410
531
|
/**
|
|
411
532
|
* A callback used to generate the path for each plugin, defaults to `/api/{pluginId}`.
|
|
412
533
|
*/
|
|
413
534
|
getPath?(pluginId: string): string;
|
|
414
535
|
}
|
|
415
|
-
|
|
416
|
-
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* @public
|
|
539
|
+
* @deprecated Please import from `@backstage/backend-defaults/httpRouter` instead.
|
|
540
|
+
*/
|
|
541
|
+
type HttpRouterFactoryOptions = HttpRouterFactoryOptions$1;
|
|
542
|
+
/**
|
|
543
|
+
* HTTP route registration for plugins.
|
|
544
|
+
*
|
|
545
|
+
* See {@link @backstage/code-plugin-api#HttpRouterService}
|
|
546
|
+
* and {@link https://backstage.io/docs/backend-system/core-services/http-router | the service docs}
|
|
547
|
+
* for more information.
|
|
548
|
+
*
|
|
549
|
+
* @public
|
|
550
|
+
* @deprecated Please import from `@backstage/backend-defaults/httpRouter` instead.
|
|
551
|
+
*/
|
|
552
|
+
declare const httpRouterServiceFactory: (options?: HttpRouterFactoryOptions$1 | undefined) => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.HttpRouterService, "plugin">;
|
|
417
553
|
|
|
418
554
|
/**
|
|
419
555
|
* Options for {@link createLifecycleMiddleware}.
|
|
420
556
|
* @public
|
|
421
557
|
*/
|
|
422
|
-
interface LifecycleMiddlewareOptions {
|
|
558
|
+
interface LifecycleMiddlewareOptions$1 {
|
|
423
559
|
lifecycle: LifecycleService;
|
|
424
560
|
/**
|
|
425
561
|
* The maximum time that paused requests will wait for the service to start, before returning an error.
|
|
@@ -442,52 +578,50 @@ interface LifecycleMiddlewareOptions {
|
|
|
442
578
|
*
|
|
443
579
|
* @public
|
|
444
580
|
*/
|
|
445
|
-
declare function createLifecycleMiddleware(options: LifecycleMiddlewareOptions): RequestHandler;
|
|
581
|
+
declare function createLifecycleMiddleware$1(options: LifecycleMiddlewareOptions$1): RequestHandler;
|
|
446
582
|
|
|
447
583
|
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
584
|
+
* Options for {@link createLifecycleMiddleware}.
|
|
450
585
|
* @public
|
|
451
|
-
* @deprecated Please
|
|
586
|
+
* @deprecated Please import from `@backstage/backend-defaults/httpRouter` instead.
|
|
452
587
|
*/
|
|
453
|
-
type
|
|
454
|
-
issuer?: string;
|
|
455
|
-
/**
|
|
456
|
-
* JWS "alg" (Algorithm) Header Parameter values. Defaults to an array containing just ES256.
|
|
457
|
-
* More info on supported algorithms: https://github.com/panva/jose
|
|
458
|
-
*/
|
|
459
|
-
algorithms?: string[];
|
|
460
|
-
};
|
|
588
|
+
type LifecycleMiddlewareOptions = LifecycleMiddlewareOptions$1;
|
|
461
589
|
/**
|
|
590
|
+
* Creates a middleware that pauses requests until the service has started.
|
|
591
|
+
*
|
|
592
|
+
* @remarks
|
|
593
|
+
*
|
|
594
|
+
* Requests that arrive before the service has started will be paused until startup is complete.
|
|
595
|
+
* If the service does not start within the provided timeout, the request will be rejected with a
|
|
596
|
+
* {@link @backstage/errors#ServiceUnavailableError}.
|
|
597
|
+
*
|
|
598
|
+
* If the service is shutting down, all requests will be rejected with a
|
|
599
|
+
* {@link @backstage/errors#ServiceUnavailableError}.
|
|
600
|
+
*
|
|
462
601
|
* @public
|
|
463
|
-
* @deprecated Please
|
|
602
|
+
* @deprecated Please import from `@backstage/backend-defaults/httpRouter` instead.
|
|
464
603
|
*/
|
|
465
|
-
declare const
|
|
604
|
+
declare const createLifecycleMiddleware: typeof createLifecycleMiddleware$1;
|
|
466
605
|
|
|
467
606
|
/**
|
|
468
|
-
*
|
|
607
|
+
* Plugin-level logging.
|
|
608
|
+
*
|
|
609
|
+
* See {@link @backstage/code-plugin-api#LoggerService}
|
|
610
|
+
* and {@link https://backstage.io/docs/backend-system/core-services/logger | the service docs}
|
|
611
|
+
* for more information.
|
|
469
612
|
*
|
|
470
613
|
* @public
|
|
471
|
-
* @deprecated Please import from `@backstage/backend-defaults/
|
|
614
|
+
* @deprecated Please import from `@backstage/backend-defaults/logger` instead.
|
|
472
615
|
*/
|
|
473
|
-
declare const lifecycleServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<LifecycleService, "plugin">;
|
|
474
|
-
|
|
475
|
-
/** @public */
|
|
476
616
|
declare const loggerServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.LoggerService, "plugin">;
|
|
477
617
|
|
|
478
|
-
/**
|
|
479
|
-
* @public
|
|
480
|
-
* @deprecated Please import from `@backstage/backend-defaults/permissions` instead.
|
|
481
|
-
*/
|
|
482
|
-
declare const permissionsServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.PermissionsService, "plugin">;
|
|
483
|
-
|
|
484
618
|
/**
|
|
485
619
|
* @public
|
|
486
620
|
*/
|
|
487
|
-
interface RootHttpRouterConfigureContext {
|
|
621
|
+
interface RootHttpRouterConfigureContext$1 {
|
|
488
622
|
app: Express;
|
|
489
623
|
server: Server;
|
|
490
|
-
middleware: MiddlewareFactory;
|
|
624
|
+
middleware: MiddlewareFactory$1;
|
|
491
625
|
routes: RequestHandler;
|
|
492
626
|
config: RootConfigService;
|
|
493
627
|
logger: LoggerService;
|
|
@@ -495,39 +629,74 @@ interface RootHttpRouterConfigureContext {
|
|
|
495
629
|
applyDefaults: () => void;
|
|
496
630
|
}
|
|
497
631
|
/**
|
|
632
|
+
* HTTP route registration for root services.
|
|
633
|
+
*
|
|
634
|
+
* See {@link @backstage/code-plugin-api#RootHttpRouterService}
|
|
635
|
+
* and {@link https://backstage.io/docs/backend-system/core-services/root-http-router | the service docs}
|
|
636
|
+
* for more information.
|
|
637
|
+
*
|
|
498
638
|
* @public
|
|
499
639
|
*/
|
|
500
|
-
type RootHttpRouterFactoryOptions = {
|
|
640
|
+
type RootHttpRouterFactoryOptions$1 = {
|
|
501
641
|
/**
|
|
502
642
|
* The path to forward all unmatched requests to. Defaults to '/api/app' if
|
|
503
643
|
* not given. Disables index path behavior if false is given.
|
|
504
644
|
*/
|
|
505
645
|
indexPath?: string | false;
|
|
506
|
-
configure?(context: RootHttpRouterConfigureContext): void;
|
|
646
|
+
configure?(context: RootHttpRouterConfigureContext$1): void;
|
|
507
647
|
};
|
|
508
|
-
|
|
509
|
-
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* @public
|
|
651
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
652
|
+
*/
|
|
653
|
+
type RootHttpRouterConfigureContext = RootHttpRouterConfigureContext$1;
|
|
654
|
+
/**
|
|
655
|
+
* HTTP route registration for root services.
|
|
656
|
+
*
|
|
657
|
+
* See {@link @backstage/code-plugin-api#RootHttpRouterService}
|
|
658
|
+
* and {@link https://backstage.io/docs/backend-system/core-services/root-http-router | the service docs}
|
|
659
|
+
* for more information.
|
|
660
|
+
*
|
|
661
|
+
* @public
|
|
662
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
663
|
+
*/
|
|
664
|
+
type RootHttpRouterFactoryOptions = RootHttpRouterFactoryOptions$1;
|
|
665
|
+
/**
|
|
666
|
+
* @public
|
|
667
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
668
|
+
*/
|
|
669
|
+
declare const rootHttpRouterServiceFactory: (options?: RootHttpRouterFactoryOptions$1 | undefined) => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.RootHttpRouterService, "root">;
|
|
510
670
|
|
|
511
671
|
/**
|
|
512
672
|
* Options for the {@link DefaultRootHttpRouter} class.
|
|
513
673
|
*
|
|
514
674
|
* @public
|
|
515
675
|
*/
|
|
516
|
-
interface DefaultRootHttpRouterOptions {
|
|
676
|
+
interface DefaultRootHttpRouterOptions$1 {
|
|
517
677
|
/**
|
|
518
678
|
* The path to forward all unmatched requests to. Defaults to '/api/app' if
|
|
519
679
|
* not given. Disables index path behavior if false is given.
|
|
520
680
|
*/
|
|
521
681
|
indexPath?: string | false;
|
|
522
682
|
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Options for the {@link DefaultRootHttpRouter} class.
|
|
686
|
+
*
|
|
687
|
+
* @public
|
|
688
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
689
|
+
*/
|
|
690
|
+
type DefaultRootHttpRouterOptions = DefaultRootHttpRouterOptions$1;
|
|
523
691
|
/**
|
|
524
692
|
* The default implementation of the {@link @backstage/backend-plugin-api#RootHttpRouterService} interface for
|
|
525
693
|
* {@link @backstage/backend-plugin-api#coreServices.rootHttpRouter}.
|
|
526
694
|
*
|
|
527
695
|
* @public
|
|
696
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootHttpRouter` instead.
|
|
528
697
|
*/
|
|
529
698
|
declare class DefaultRootHttpRouter implements RootHttpRouterService {
|
|
530
|
-
|
|
699
|
+
private readonly impl;
|
|
531
700
|
static create(options?: DefaultRootHttpRouterOptions): DefaultRootHttpRouter;
|
|
532
701
|
private constructor();
|
|
533
702
|
use(path: string, handler: Handler): void;
|
|
@@ -535,35 +704,27 @@ declare class DefaultRootHttpRouter implements RootHttpRouterService {
|
|
|
535
704
|
}
|
|
536
705
|
|
|
537
706
|
/**
|
|
538
|
-
*
|
|
707
|
+
* Root-level logging.
|
|
708
|
+
*
|
|
709
|
+
* See {@link @backstage/code-plugin-api#RootLoggerService}
|
|
710
|
+
* and {@link https://backstage.io/docs/backend-system/core-services/root-logger | the service docs}
|
|
711
|
+
* for more information.
|
|
539
712
|
*
|
|
540
713
|
* @public
|
|
541
|
-
* @deprecated Please import from `@backstage/backend-defaults/
|
|
714
|
+
* @deprecated Please import from `@backstage/backend-defaults/rootLogger` instead.
|
|
542
715
|
*/
|
|
543
|
-
declare const rootLifecycleServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<RootLifecycleService, "root">;
|
|
544
|
-
|
|
545
|
-
/** @public */
|
|
546
716
|
declare const rootLoggerServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.RootLoggerService, "root">;
|
|
547
717
|
|
|
548
718
|
/**
|
|
549
719
|
* @public
|
|
550
|
-
* @deprecated Please
|
|
551
|
-
*/
|
|
552
|
-
declare const tokenManagerServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.TokenManagerService, "plugin">;
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* @public
|
|
556
|
-
* @deprecated Please import from `@backstage/backend-defaults/urlReader` instead.
|
|
720
|
+
* @deprecated Please import from `@backstage/backend-defaults/scheduler` instead.
|
|
557
721
|
*/
|
|
558
|
-
declare const
|
|
559
|
-
|
|
560
|
-
/** @public */
|
|
561
|
-
declare const userInfoServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<UserInfoService, "plugin">;
|
|
722
|
+
declare const schedulerServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.SchedulerService, "plugin">;
|
|
562
723
|
|
|
563
724
|
/**
|
|
564
725
|
* @public
|
|
565
|
-
* @deprecated Please import from `@backstage/backend-defaults/
|
|
726
|
+
* @deprecated Please import from `@backstage/backend-defaults/userInfo` instead.
|
|
566
727
|
*/
|
|
567
|
-
declare const
|
|
728
|
+
declare const userInfoServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.UserInfoService, "plugin">;
|
|
568
729
|
|
|
569
730
|
export { type Backend, type CreateSpecializedBackendOptions, DefaultRootHttpRouter, type DefaultRootHttpRouterOptions, type ExtendedHttpServer, HostDiscovery, type HttpRouterFactoryOptions, type HttpServerCertificateOptions, type HttpServerOptions, type IdentityFactoryOptions, type LifecycleMiddlewareOptions, MiddlewareFactory, type MiddlewareFactoryErrorOptions, type MiddlewareFactoryOptions, type RootConfigFactoryOptions, type RootHttpRouterConfigureContext, type RootHttpRouterFactoryOptions, WinstonLogger, type WinstonLoggerOptions, authServiceFactory, cacheServiceFactory, createConfigSecretEnumerator, createHttpServer, createLifecycleMiddleware, createSpecializedBackend, databaseServiceFactory, discoveryServiceFactory, httpAuthServiceFactory, httpRouterServiceFactory, identityServiceFactory, lifecycleServiceFactory, loadBackendConfig, loggerServiceFactory, permissionsServiceFactory, readCorsOptions, readHelmetOptions, readHttpServerOptions, rootConfigServiceFactory, rootHttpRouterServiceFactory, rootLifecycleServiceFactory, rootLoggerServiceFactory, schedulerServiceFactory, tokenManagerServiceFactory, urlReaderServiceFactory, userInfoServiceFactory };
|
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.6",
|
|
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
|
|
55
|
-
"@backstage/cli-common": "^0.1.14
|
|
56
|
-
"@backstage/cli-node": "^0.2.6
|
|
52
|
+
"@backstage/backend-common": "^0.23.0",
|
|
53
|
+
"@backstage/backend-plugin-api": "^0.6.19",
|
|
54
|
+
"@backstage/backend-tasks": "^0.5.24",
|
|
55
|
+
"@backstage/cli-common": "^0.1.14",
|
|
56
|
+
"@backstage/cli-node": "^0.2.6",
|
|
57
57
|
"@backstage/config": "^1.2.0",
|
|
58
|
-
"@backstage/config-loader": "^1.8.1
|
|
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.14",
|
|
61
|
+
"@backstage/plugin-permission-node": "^0.7.30",
|
|
62
62
|
"@backstage/types": "^1.1.1",
|
|
63
63
|
"@manypkg/get-packages": "^1.1.3",
|
|
64
64
|
"@types/cors": "^2.8.6",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"minimatch": "^9.0.0",
|
|
79
79
|
"minimist": "^1.2.5",
|
|
80
80
|
"morgan": "^1.10.0",
|
|
81
|
+
"node-fetch": "^2.6.7",
|
|
81
82
|
"node-forge": "^1.3.1",
|
|
82
83
|
"path-to-regexp": "^6.2.1",
|
|
83
84
|
"selfsigned": "^2.0.0",
|
|
@@ -88,8 +89,9 @@
|
|
|
88
89
|
"winston-transport": "^4.5.0"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
|
-
"@backstage/backend-
|
|
92
|
-
"@backstage/
|
|
92
|
+
"@backstage/backend-defaults": "^0.3.0",
|
|
93
|
+
"@backstage/backend-test-utils": "^0.4.0",
|
|
94
|
+
"@backstage/cli": "^0.26.7",
|
|
93
95
|
"@types/compression": "^1.7.0",
|
|
94
96
|
"@types/fs-extra": "^11.0.0",
|
|
95
97
|
"@types/http-errors": "^2.0.0",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 The Backstage Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// @ts-check
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param { import("knex").Knex } knex
|
|
21
|
-
* @returns { Promise<void> }
|
|
22
|
-
*/
|
|
23
|
-
exports.up = async function up(knex) {
|
|
24
|
-
await knex.schema.createTable(
|
|
25
|
-
'backstage_backend_public_keys__keys',
|
|
26
|
-
table => {
|
|
27
|
-
table
|
|
28
|
-
.string('id')
|
|
29
|
-
.primary()
|
|
30
|
-
.notNullable()
|
|
31
|
-
.comment('The unique ID of a public key');
|
|
32
|
-
|
|
33
|
-
table.text('key').notNullable().comment('JSON serialized public key');
|
|
34
|
-
|
|
35
|
-
// Expiration is stored as a string for simplicity, all checks are done client-side
|
|
36
|
-
table
|
|
37
|
-
.string('expires_at')
|
|
38
|
-
.notNullable()
|
|
39
|
-
.comment('The time that the key expires');
|
|
40
|
-
},
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param { import("knex").Knex } knex
|
|
46
|
-
* @returns { Promise<void> }
|
|
47
|
-
*/
|
|
48
|
-
exports.down = async function down(knex) {
|
|
49
|
-
return knex.schema.dropTable('backstage_backend_public_keys__keys');
|
|
50
|
-
};
|