@backstage/backend-plugin-api 0.8.0-next.3 → 0.8.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.
- package/CHANGELOG.md +114 -0
- package/alpha/package.json +1 -1
- package/dist/index.d.ts +1 -66
- package/package.json +5 -5
- package/testUtils/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
# @backstage/backend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 389f5a4: **BREAKING** Deleted the following deprecated `UrlReader` exports
|
|
8
|
+
|
|
9
|
+
- ReadUrlOptions: Use `UrlReaderServiceReadUrlOptions` instead;
|
|
10
|
+
- ReadUrlResponse: Use `UrlReaderServiceReadUrlResponse` instead;
|
|
11
|
+
- ReadTreeOptions: Use `UrlReaderServiceReadTreeOptions` instead;
|
|
12
|
+
- ReadTreeResponse: Use `UrlReaderServiceReadTreeResponse` instead;
|
|
13
|
+
- ReadTreeResponseFile: Use `UrlReaderServiceReadTreeResponseFile` instead;
|
|
14
|
+
- ReadTreeResponseDirOptions: Use `UrlReaderServiceReadTreeResponseDirOptions` instead;
|
|
15
|
+
- SearchOptions: Use `UrlReaderServiceSearchOptions` instead;
|
|
16
|
+
- SearchResponse: Use `UrlReaderServiceSearchResponse` instead;
|
|
17
|
+
- SearchResponseFile: Use `UrlReaderServiceSearchResponseFile` instead.
|
|
18
|
+
|
|
19
|
+
- 7c5f3b0: The `createServiceRef` function now accepts a new boolean `multiple` option. The `multiple` option defaults to `false` and when set to `true`, it enables that multiple implementation are installed for the created service ref.
|
|
20
|
+
|
|
21
|
+
We're looking for ways to make it possible to augment services without the need to replace the entire service.
|
|
22
|
+
|
|
23
|
+
Typical example of that being the ability to install support for additional targets for the `UrlReader` service without replacing the service itself. This achieves that by allowing us to define services that can have multiple simultaneous implementation, allowing the `UrlReader` implementation to depend on such a service to collect all possible implementation of support for external targets:
|
|
24
|
+
|
|
25
|
+
```diff
|
|
26
|
+
// @backstage/backend-defaults
|
|
27
|
+
|
|
28
|
+
+ export const urlReaderFactoriesServiceRef = createServiceRef<ReaderFactory>({
|
|
29
|
+
+ id: 'core.urlReader.factories',
|
|
30
|
+
+ scope: 'plugin',
|
|
31
|
+
+ multiton: true,
|
|
32
|
+
+ });
|
|
33
|
+
|
|
34
|
+
...
|
|
35
|
+
|
|
36
|
+
export const urlReaderServiceFactory = createServiceFactory({
|
|
37
|
+
service: coreServices.urlReader,
|
|
38
|
+
deps: {
|
|
39
|
+
config: coreServices.rootConfig,
|
|
40
|
+
logger: coreServices.logger,
|
|
41
|
+
+ factories: urlReaderFactoriesServiceRef,
|
|
42
|
+
},
|
|
43
|
+
- async factory({ config, logger }) {
|
|
44
|
+
+ async factory({ config, logger, factories }) {
|
|
45
|
+
return UrlReaders.default({
|
|
46
|
+
config,
|
|
47
|
+
logger,
|
|
48
|
+
+ factories,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
With that, you can then add more custom `UrlReader` factories by installing more implementations of the `urlReaderFactoriesServiceRef` in your backend instance. Something like:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// packages/backend/index.ts
|
|
58
|
+
import { createServiceFactory } from '@backstage/backend-plugin-api';
|
|
59
|
+
import { urlReaderFactoriesServiceRef } from '@backstage/backend-defaults';
|
|
60
|
+
...
|
|
61
|
+
|
|
62
|
+
backend.add(createServiceFactory({
|
|
63
|
+
service: urlReaderFactoriesServiceRef,
|
|
64
|
+
deps: {},
|
|
65
|
+
async factory() {
|
|
66
|
+
return CustomUrlReader.factory;
|
|
67
|
+
},
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
...
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- c99c620: **BREAKING** Removed the following deprecated types:
|
|
75
|
+
|
|
76
|
+
- `ServiceRefConfig` use `ServiceRefOptions`
|
|
77
|
+
- `RootServiceFactoryConfig` use `RootServiceFactoryOptions`
|
|
78
|
+
- `PluginServiceFactoryConfig` use `PluginServiceFactoryOptions`
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- 6061061: Added `createBackendFeatureLoader`, which can be used to create an installable backend feature that can in turn load in additional backend features in a dynamic way.
|
|
83
|
+
- ba9abf4: The `SchedulerService` now allows tasks with `frequency: { trigger: 'manual' }`. This means that the task will not be scheduled, but rather run only when manually triggered with `SchedulerService.triggerTask`.
|
|
84
|
+
- 8b13183: Added `createBackendFeatureLoader`, which can be used to programmatically select and install backend features.
|
|
85
|
+
|
|
86
|
+
A feature loader can return an list of features to be installed, for example in the form on an `Array` or other for of iterable, which allows for the loader to be defined as a generator function. Both synchronous and asynchronous loaders are supported.
|
|
87
|
+
|
|
88
|
+
Additionally, a loader can depend on services in its implementation, with the restriction that it can only depend on root-scoped services, and it may not override services that have already been instantiated.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
const searchLoader = createBackendFeatureLoader({
|
|
92
|
+
deps: {
|
|
93
|
+
config: coreServices.rootConfig,
|
|
94
|
+
},
|
|
95
|
+
*loader({ config }) {
|
|
96
|
+
// Example of a custom config flag to enable search
|
|
97
|
+
if (config.getOptionalString('customFeatureToggle.search')) {
|
|
98
|
+
yield import('@backstage/plugin-search-backend/alpha');
|
|
99
|
+
yield import('@backstage/plugin-search-backend-module-catalog/alpha');
|
|
100
|
+
yield import('@backstage/plugin-search-backend-module-explore/alpha');
|
|
101
|
+
yield import('@backstage/plugin-search-backend-module-techdocs/alpha');
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- ddde5fe: Fixed a type issue where plugin and modules depending on multiton services would not receive the correct type.
|
|
108
|
+
- f011d1b: fix typo in `getPluginRequestToken` comments
|
|
109
|
+
- Updated dependencies
|
|
110
|
+
- @backstage/plugin-permission-common@0.8.1
|
|
111
|
+
- @backstage/plugin-auth-node@0.5.0
|
|
112
|
+
- @backstage/cli-common@0.1.14
|
|
113
|
+
- @backstage/config@1.2.0
|
|
114
|
+
- @backstage/errors@1.2.4
|
|
115
|
+
- @backstage/types@1.1.1
|
|
116
|
+
|
|
3
117
|
## 0.8.0-next.3
|
|
4
118
|
|
|
5
119
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -335,51 +335,6 @@ type UrlReaderServiceSearchResponseFile = {
|
|
|
335
335
|
*/
|
|
336
336
|
lastModifiedAt?: Date;
|
|
337
337
|
};
|
|
338
|
-
/**
|
|
339
|
-
* @public
|
|
340
|
-
* @deprecated Use `UrlReaderServiceReadTreeOptions` instead
|
|
341
|
-
*/
|
|
342
|
-
type ReadTreeOptions = UrlReaderServiceReadTreeOptions;
|
|
343
|
-
/**
|
|
344
|
-
* @public
|
|
345
|
-
* @deprecated Use `UrlReaderServiceReadTreeResponse` instead
|
|
346
|
-
*/
|
|
347
|
-
type ReadTreeResponse = UrlReaderServiceReadTreeResponse;
|
|
348
|
-
/**
|
|
349
|
-
* @public
|
|
350
|
-
* @deprecated Use `UrlReaderServiceReadTreeResponseDirOptions` instead
|
|
351
|
-
*/
|
|
352
|
-
type ReadTreeResponseDirOptions = UrlReaderServiceReadTreeResponseDirOptions;
|
|
353
|
-
/**
|
|
354
|
-
* @public
|
|
355
|
-
* @deprecated Use `UrlReaderServiceReadTreeResponseFile` instead
|
|
356
|
-
*/
|
|
357
|
-
type ReadTreeResponseFile = UrlReaderServiceReadTreeResponseFile;
|
|
358
|
-
/**
|
|
359
|
-
* @public
|
|
360
|
-
* @deprecated Use `UrlReaderServiceReadUrlResponse` instead
|
|
361
|
-
*/
|
|
362
|
-
type ReadUrlResponse = UrlReaderServiceReadUrlResponse;
|
|
363
|
-
/**
|
|
364
|
-
* @public
|
|
365
|
-
* @deprecated Use `UrlReaderServiceReadUrlOptions` instead
|
|
366
|
-
*/
|
|
367
|
-
type ReadUrlOptions = UrlReaderServiceReadUrlOptions;
|
|
368
|
-
/**
|
|
369
|
-
* @public
|
|
370
|
-
* @deprecated Use `UrlReaderServiceSearchOptions` instead
|
|
371
|
-
*/
|
|
372
|
-
type SearchOptions = UrlReaderServiceSearchOptions;
|
|
373
|
-
/**
|
|
374
|
-
* @public
|
|
375
|
-
* @deprecated Use `UrlReaderServiceSearchResponse` instead
|
|
376
|
-
*/
|
|
377
|
-
type SearchResponse = UrlReaderServiceSearchResponse;
|
|
378
|
-
/**
|
|
379
|
-
* @public
|
|
380
|
-
* @deprecated Use `UrlReaderServiceSearchResponseFile` instead
|
|
381
|
-
*/
|
|
382
|
-
type SearchResponseFile = UrlReaderServiceSearchResponseFile;
|
|
383
338
|
|
|
384
339
|
/**
|
|
385
340
|
* This is the legacy service for creating and validating tokens. Please migrate to the new `coreServices.auth`, `coreServices.httpAuth`, and `coreServices.userInfo` services as needed instead.
|
|
@@ -2018,24 +1973,4 @@ type BackendModuleConfig = CreateBackendModuleOptions;
|
|
|
2018
1973
|
*/
|
|
2019
1974
|
type ExtensionPointConfig = CreateExtensionPointOptions;
|
|
2020
1975
|
|
|
2021
|
-
|
|
2022
|
-
* @public
|
|
2023
|
-
* @deprecated Use {@link ServiceRefOptions} instead
|
|
2024
|
-
*/
|
|
2025
|
-
type ServiceRefConfig<TService, TScope extends 'root' | 'plugin', TInstances extends 'singleton' | 'multiton'> = ServiceRefOptions<TService, TScope, TInstances>;
|
|
2026
|
-
/**
|
|
2027
|
-
* @public
|
|
2028
|
-
* @deprecated Use {@link RootServiceFactoryOptions} instead
|
|
2029
|
-
*/
|
|
2030
|
-
type RootServiceFactoryConfig<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
2031
|
-
[name in string]: ServiceRef<unknown>;
|
|
2032
|
-
}> = RootServiceFactoryOptions<TService, TInstances, TImpl, TDeps>;
|
|
2033
|
-
/**
|
|
2034
|
-
* @public
|
|
2035
|
-
* @deprecated Use {@link PluginServiceFactoryOptions} instead
|
|
2036
|
-
*/
|
|
2037
|
-
type PluginServiceFactoryConfig<TService, TInstances extends 'singleton' | 'multiton', TContext, TImpl extends TService, TDeps extends {
|
|
2038
|
-
[name in string]: ServiceRef<unknown>;
|
|
2039
|
-
}> = PluginServiceFactoryOptions<TService, TInstances, TContext, TImpl, TDeps>;
|
|
2040
|
-
|
|
2041
|
-
export { type AuthService, type BackendFeature, type BackendFeatureCompat, type BackendModuleConfig, type BackendModuleRegistrationPoints, type BackendPluginConfig, type BackendPluginRegistrationPoints, type BackstageCredentials, type BackstageNonePrincipal, type BackstagePrincipalAccessRestrictions, type BackstagePrincipalTypes, type BackstageServicePrincipal, type BackstageUserInfo, type BackstageUserPrincipal, type CacheService, type CacheServiceOptions, type CacheServiceSetOptions, type CreateBackendFeatureLoaderOptions, type CreateBackendModuleOptions, type CreateBackendPluginOptions, type CreateExtensionPointOptions, type DatabaseService, type DiscoveryService, type ExtensionPoint, type ExtensionPointConfig, type HttpAuthService, type HttpRouterService, type HttpRouterServiceAuthPolicy, type IdentityService, type LifecycleService, type LifecycleServiceShutdownHook, type LifecycleServiceShutdownOptions, type LifecycleServiceStartupHook, type LifecycleServiceStartupOptions, type LoggerService, type PermissionsService, type PermissionsServiceRequestOptions, type PluginMetadataService, type PluginServiceFactoryConfig, type PluginServiceFactoryOptions, type ReadTreeOptions, type ReadTreeResponse, type ReadTreeResponseDirOptions, type ReadTreeResponseFile, type ReadUrlOptions, type ReadUrlResponse, type RootConfigService, type RootHealthService, type RootHttpRouterService, type RootLifecycleService, type RootLoggerService, type RootServiceFactoryConfig, type RootServiceFactoryOptions, type SchedulerService, type SchedulerServiceTaskDescriptor, type SchedulerServiceTaskFunction, type SchedulerServiceTaskInvocationDefinition, type SchedulerServiceTaskRunner, type SchedulerServiceTaskScheduleDefinition, type SchedulerServiceTaskScheduleDefinitionConfig, type SearchOptions, type SearchResponse, type SearchResponseFile, type ServiceFactory, type ServiceFactoryCompat, type ServiceFactoryOrFunction, type ServiceRef, type ServiceRefConfig, type ServiceRefOptions, type TokenManagerService, type UrlReaderService, type UrlReaderServiceReadTreeOptions, type UrlReaderServiceReadTreeResponse, type UrlReaderServiceReadTreeResponseDirOptions, type UrlReaderServiceReadTreeResponseFile, type UrlReaderServiceReadUrlOptions, type UrlReaderServiceReadUrlResponse, type UrlReaderServiceSearchOptions, type UrlReaderServiceSearchResponse, type UrlReaderServiceSearchResponseFile, type UserInfoService, coreServices, createBackendFeatureLoader, createBackendModule, createBackendPlugin, createExtensionPoint, createServiceFactory, createServiceRef, isDatabaseConflictError, readSchedulerServiceTaskScheduleDefinitionFromConfig, resolvePackagePath, resolveSafeChildPath };
|
|
1976
|
+
export { type AuthService, type BackendFeature, type BackendFeatureCompat, type BackendModuleConfig, type BackendModuleRegistrationPoints, type BackendPluginConfig, type BackendPluginRegistrationPoints, type BackstageCredentials, type BackstageNonePrincipal, type BackstagePrincipalAccessRestrictions, type BackstagePrincipalTypes, type BackstageServicePrincipal, type BackstageUserInfo, type BackstageUserPrincipal, type CacheService, type CacheServiceOptions, type CacheServiceSetOptions, type CreateBackendFeatureLoaderOptions, type CreateBackendModuleOptions, type CreateBackendPluginOptions, type CreateExtensionPointOptions, type DatabaseService, type DiscoveryService, type ExtensionPoint, type ExtensionPointConfig, type HttpAuthService, type HttpRouterService, type HttpRouterServiceAuthPolicy, type IdentityService, type LifecycleService, type LifecycleServiceShutdownHook, type LifecycleServiceShutdownOptions, type LifecycleServiceStartupHook, type LifecycleServiceStartupOptions, type LoggerService, type PermissionsService, type PermissionsServiceRequestOptions, type PluginMetadataService, type PluginServiceFactoryOptions, type RootConfigService, type RootHealthService, type RootHttpRouterService, type RootLifecycleService, type RootLoggerService, type RootServiceFactoryOptions, type SchedulerService, type SchedulerServiceTaskDescriptor, type SchedulerServiceTaskFunction, type SchedulerServiceTaskInvocationDefinition, type SchedulerServiceTaskRunner, type SchedulerServiceTaskScheduleDefinition, type SchedulerServiceTaskScheduleDefinitionConfig, type ServiceFactory, type ServiceFactoryCompat, type ServiceFactoryOrFunction, type ServiceRef, type ServiceRefOptions, type TokenManagerService, type UrlReaderService, type UrlReaderServiceReadTreeOptions, type UrlReaderServiceReadTreeResponse, type UrlReaderServiceReadTreeResponseDirOptions, type UrlReaderServiceReadTreeResponseFile, type UrlReaderServiceReadUrlOptions, type UrlReaderServiceReadUrlResponse, type UrlReaderServiceSearchOptions, type UrlReaderServiceSearchResponse, type UrlReaderServiceSearchResponseFile, type UserInfoService, coreServices, createBackendFeatureLoader, createBackendModule, createBackendPlugin, createExtensionPoint, createServiceFactory, createServiceRef, isDatabaseConflictError, readSchedulerServiceTaskScheduleDefinitionFromConfig, resolvePackagePath, resolveSafeChildPath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-plugin-api",
|
|
3
|
-
"version": "0.8.0
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Core API used by Backstage backend plugins",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@backstage/cli-common": "^0.1.14",
|
|
57
57
|
"@backstage/config": "^1.2.0",
|
|
58
58
|
"@backstage/errors": "^1.2.4",
|
|
59
|
-
"@backstage/plugin-auth-node": "^0.5.0
|
|
60
|
-
"@backstage/plugin-permission-common": "^0.8.1
|
|
59
|
+
"@backstage/plugin-auth-node": "^0.5.0",
|
|
60
|
+
"@backstage/plugin-permission-common": "^0.8.1",
|
|
61
61
|
"@backstage/types": "^1.1.1",
|
|
62
62
|
"@types/express": "^4.17.6",
|
|
63
63
|
"@types/luxon": "^3.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"luxon": "^3.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@backstage/backend-test-utils": "^0.
|
|
70
|
-
"@backstage/cli": "^0.27.0
|
|
69
|
+
"@backstage/backend-test-utils": "^0.5.0",
|
|
70
|
+
"@backstage/cli": "^0.27.0"
|
|
71
71
|
}
|
|
72
72
|
}
|