@backstage/backend-app-api 0.5.5 → 0.5.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.
Potentially problematic release.
This version of @backstage/backend-app-api might be problematic. Click here for more details.
- package/CHANGELOG.md +62 -14
- package/alpha/package.json +1 -1
- package/config.d.ts +37 -0
- package/dist/index.cjs.js +87 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +51 -3
- package/package.json +15 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, LifecycleService, RootHttpRouterService, RootLifecycleService } from '@backstage/backend-plugin-api';
|
|
3
|
+
import { LoggerService, RootConfigService, RootLoggerService, BackendFeature, ServiceFactoryOrFunction, DiscoveryService, LifecycleService, RootHttpRouterService, RootLifecycleService } from '@backstage/backend-plugin-api';
|
|
4
4
|
import { LoadConfigOptionsRemote, RemoteConfigSourceOptions } from '@backstage/config-loader';
|
|
5
5
|
import { Config, AppConfig } from '@backstage/config';
|
|
6
6
|
import * as http from 'http';
|
|
@@ -29,6 +29,7 @@ declare function loadBackendConfig(options: {
|
|
|
29
29
|
remote?: LoadConfigOptionsRemote;
|
|
30
30
|
argv: string[];
|
|
31
31
|
additionalConfigs?: AppConfig[];
|
|
32
|
+
watch?: boolean;
|
|
32
33
|
}): Promise<{
|
|
33
34
|
config: Config;
|
|
34
35
|
}>;
|
|
@@ -328,7 +329,54 @@ declare const rootConfigServiceFactory: (options?: RootConfigFactoryOptions | un
|
|
|
328
329
|
declare const databaseServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_common.PluginDatabaseManager, "plugin">;
|
|
329
330
|
|
|
330
331
|
/** @public */
|
|
331
|
-
declare const discoveryServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<
|
|
332
|
+
declare const discoveryServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_plugin_api.DiscoveryService, "plugin">;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* HostDiscovery is a basic PluginEndpointDiscovery implementation
|
|
336
|
+
* that can handle plugins that are hosted in a single or multiple deployments.
|
|
337
|
+
*
|
|
338
|
+
* The deployment may be scaled horizontally, as long as the external URL
|
|
339
|
+
* is the same for all instances. However, internal URLs will always be
|
|
340
|
+
* resolved to the same host, so there won't be any balancing of internal traffic.
|
|
341
|
+
*
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
declare class HostDiscovery implements DiscoveryService {
|
|
345
|
+
private readonly internalBaseUrl;
|
|
346
|
+
private readonly externalBaseUrl;
|
|
347
|
+
private readonly discoveryConfig;
|
|
348
|
+
/**
|
|
349
|
+
* Creates a new HostDiscovery discovery instance by reading
|
|
350
|
+
* from the `backend` config section, specifically the `.baseUrl` for
|
|
351
|
+
* discovering the external URL, and the `.listen` and `.https` config
|
|
352
|
+
* for the internal one.
|
|
353
|
+
*
|
|
354
|
+
* Can be overridden in config by providing a target and corresponding plugins in `discovery.endpoints`.
|
|
355
|
+
* eg.
|
|
356
|
+
* ```yaml
|
|
357
|
+
* discovery:
|
|
358
|
+
* endpoints:
|
|
359
|
+
* - target: https://internal.example.com/internal-catalog
|
|
360
|
+
* plugins: [catalog]
|
|
361
|
+
* - target: https://internal.example.com/secure/api/{{pluginId}}
|
|
362
|
+
* plugins: [auth, permission]
|
|
363
|
+
* - target:
|
|
364
|
+
* internal: https://internal.example.com/search
|
|
365
|
+
* external: https://example.com/search
|
|
366
|
+
* plugins: [search]
|
|
367
|
+
* ```
|
|
368
|
+
*
|
|
369
|
+
* The basePath defaults to `/api`, meaning the default full internal
|
|
370
|
+
* path for the `catalog` plugin will be `http://localhost:7007/api/catalog`.
|
|
371
|
+
*/
|
|
372
|
+
static fromConfig(config: Config, options?: {
|
|
373
|
+
basePath?: string;
|
|
374
|
+
}): HostDiscovery;
|
|
375
|
+
private constructor();
|
|
376
|
+
private getTargetFromConfig;
|
|
377
|
+
getBaseUrl(pluginId: string): Promise<string>;
|
|
378
|
+
getExternalBaseUrl(pluginId: string): Promise<string>;
|
|
379
|
+
}
|
|
332
380
|
|
|
333
381
|
/**
|
|
334
382
|
* @public
|
|
@@ -467,4 +515,4 @@ declare const tokenManagerServiceFactory: () => _backstage_backend_plugin_api.Se
|
|
|
467
515
|
/** @public */
|
|
468
516
|
declare const urlReaderServiceFactory: () => _backstage_backend_plugin_api.ServiceFactory<_backstage_backend_common.UrlReader, "plugin">;
|
|
469
517
|
|
|
470
|
-
export { Backend, CreateSpecializedBackendOptions, DefaultRootHttpRouter, DefaultRootHttpRouterOptions, ExtendedHttpServer, HttpRouterFactoryOptions, HttpServerCertificateOptions, HttpServerOptions, IdentityFactoryOptions, LifecycleMiddlewareOptions, MiddlewareFactory, MiddlewareFactoryErrorOptions, MiddlewareFactoryOptions, RootConfigFactoryOptions, RootHttpRouterConfigureContext, RootHttpRouterFactoryOptions, WinstonLogger, WinstonLoggerOptions, cacheServiceFactory, createConfigSecretEnumerator, createHttpServer, createLifecycleMiddleware, createSpecializedBackend, databaseServiceFactory, discoveryServiceFactory, httpRouterServiceFactory, identityServiceFactory, lifecycleServiceFactory, loadBackendConfig, loggerServiceFactory, permissionsServiceFactory, readCorsOptions, readHelmetOptions, readHttpServerOptions, rootConfigServiceFactory, rootHttpRouterServiceFactory, rootLifecycleServiceFactory, rootLoggerServiceFactory, schedulerServiceFactory, tokenManagerServiceFactory, urlReaderServiceFactory };
|
|
518
|
+
export { Backend, CreateSpecializedBackendOptions, DefaultRootHttpRouter, DefaultRootHttpRouterOptions, ExtendedHttpServer, HostDiscovery, HttpRouterFactoryOptions, HttpServerCertificateOptions, HttpServerOptions, IdentityFactoryOptions, LifecycleMiddlewareOptions, MiddlewareFactory, MiddlewareFactoryErrorOptions, MiddlewareFactoryOptions, RootConfigFactoryOptions, RootHttpRouterConfigureContext, RootHttpRouterFactoryOptions, WinstonLogger, WinstonLoggerOptions, cacheServiceFactory, createConfigSecretEnumerator, createHttpServer, createLifecycleMiddleware, createSpecializedBackend, databaseServiceFactory, discoveryServiceFactory, httpRouterServiceFactory, identityServiceFactory, lifecycleServiceFactory, loadBackendConfig, loggerServiceFactory, permissionsServiceFactory, readCorsOptions, readHelmetOptions, readHttpServerOptions, rootConfigServiceFactory, rootHttpRouterServiceFactory, rootLifecycleServiceFactory, rootLoggerServiceFactory, schedulerServiceFactory, tokenManagerServiceFactory, urlReaderServiceFactory };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-app-api",
|
|
3
3
|
"description": "Core API used by Backstage backend apps",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.6",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"start": "backstage-cli package start"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@backstage/backend-common": "^0.19.
|
|
47
|
-
"@backstage/backend-plugin-api": "^0.6.
|
|
48
|
-
"@backstage/backend-tasks": "^0.5.
|
|
49
|
-
"@backstage/cli-common": "^0.1.
|
|
50
|
-
"@backstage/cli-node": "^0.1.
|
|
51
|
-
"@backstage/config": "^1.1.
|
|
52
|
-
"@backstage/config-loader": "^1.5.
|
|
53
|
-
"@backstage/errors": "^1.2.
|
|
54
|
-
"@backstage/plugin-auth-node": "^0.
|
|
55
|
-
"@backstage/plugin-permission-node": "^0.7.
|
|
46
|
+
"@backstage/backend-common": "^0.19.8",
|
|
47
|
+
"@backstage/backend-plugin-api": "^0.6.6",
|
|
48
|
+
"@backstage/backend-tasks": "^0.5.11",
|
|
49
|
+
"@backstage/cli-common": "^0.1.13",
|
|
50
|
+
"@backstage/cli-node": "^0.1.5",
|
|
51
|
+
"@backstage/config": "^1.1.1",
|
|
52
|
+
"@backstage/config-loader": "^1.5.1",
|
|
53
|
+
"@backstage/errors": "^1.2.3",
|
|
54
|
+
"@backstage/plugin-auth-node": "^0.4.0",
|
|
55
|
+
"@backstage/plugin-permission-node": "^0.7.17",
|
|
56
56
|
"@backstage/types": "^1.1.1",
|
|
57
57
|
"@manypkg/get-packages": "^1.1.3",
|
|
58
58
|
"@types/cors": "^2.8.6",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"winston-transport": "^4.5.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@backstage/backend-test-utils": "^0.2.
|
|
79
|
-
"@backstage/cli": "^0.
|
|
78
|
+
"@backstage/backend-test-utils": "^0.2.7",
|
|
79
|
+
"@backstage/cli": "^0.23.0",
|
|
80
80
|
"@types/compression": "^1.7.0",
|
|
81
81
|
"@types/fs-extra": "^9.0.3",
|
|
82
82
|
"@types/http-errors": "^2.0.0",
|
|
@@ -85,11 +85,12 @@
|
|
|
85
85
|
"@types/node-forge": "^1.3.0",
|
|
86
86
|
"@types/stoppable": "^1.1.0",
|
|
87
87
|
"http-errors": "^2.0.0",
|
|
88
|
-
"mock-fs": "^5.2.0",
|
|
89
88
|
"supertest": "^6.1.3"
|
|
90
89
|
},
|
|
90
|
+
"configSchema": "config.d.ts",
|
|
91
91
|
"files": [
|
|
92
92
|
"dist",
|
|
93
|
+
"config.d.ts",
|
|
93
94
|
"alpha"
|
|
94
95
|
]
|
|
95
96
|
}
|