@backstage/backend-plugin-api 0.8.0-next.3 → 0.8.1

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,126 @@
1
1
  # @backstage/backend-plugin-api
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/plugin-auth-node@0.5.1
9
+
10
+ ## 0.8.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 389f5a4: **BREAKING** Deleted the following deprecated `UrlReader` exports
15
+
16
+ - ReadUrlOptions: Use `UrlReaderServiceReadUrlOptions` instead;
17
+ - ReadUrlResponse: Use `UrlReaderServiceReadUrlResponse` instead;
18
+ - ReadTreeOptions: Use `UrlReaderServiceReadTreeOptions` instead;
19
+ - ReadTreeResponse: Use `UrlReaderServiceReadTreeResponse` instead;
20
+ - ReadTreeResponseFile: Use `UrlReaderServiceReadTreeResponseFile` instead;
21
+ - ReadTreeResponseDirOptions: Use `UrlReaderServiceReadTreeResponseDirOptions` instead;
22
+ - SearchOptions: Use `UrlReaderServiceSearchOptions` instead;
23
+ - SearchResponse: Use `UrlReaderServiceSearchResponse` instead;
24
+ - SearchResponseFile: Use `UrlReaderServiceSearchResponseFile` instead.
25
+
26
+ - 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.
27
+
28
+ We're looking for ways to make it possible to augment services without the need to replace the entire service.
29
+
30
+ 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:
31
+
32
+ ```diff
33
+ // @backstage/backend-defaults
34
+
35
+ + export const urlReaderFactoriesServiceRef = createServiceRef<ReaderFactory>({
36
+ + id: 'core.urlReader.factories',
37
+ + scope: 'plugin',
38
+ + multiton: true,
39
+ + });
40
+
41
+ ...
42
+
43
+ export const urlReaderServiceFactory = createServiceFactory({
44
+ service: coreServices.urlReader,
45
+ deps: {
46
+ config: coreServices.rootConfig,
47
+ logger: coreServices.logger,
48
+ + factories: urlReaderFactoriesServiceRef,
49
+ },
50
+ - async factory({ config, logger }) {
51
+ + async factory({ config, logger, factories }) {
52
+ return UrlReaders.default({
53
+ config,
54
+ logger,
55
+ + factories,
56
+ });
57
+ },
58
+ });
59
+ ```
60
+
61
+ With that, you can then add more custom `UrlReader` factories by installing more implementations of the `urlReaderFactoriesServiceRef` in your backend instance. Something like:
62
+
63
+ ```ts
64
+ // packages/backend/index.ts
65
+ import { createServiceFactory } from '@backstage/backend-plugin-api';
66
+ import { urlReaderFactoriesServiceRef } from '@backstage/backend-defaults';
67
+ ...
68
+
69
+ backend.add(createServiceFactory({
70
+ service: urlReaderFactoriesServiceRef,
71
+ deps: {},
72
+ async factory() {
73
+ return CustomUrlReader.factory;
74
+ },
75
+ }));
76
+
77
+ ...
78
+
79
+ ```
80
+
81
+ - c99c620: **BREAKING** Removed the following deprecated types:
82
+
83
+ - `ServiceRefConfig` use `ServiceRefOptions`
84
+ - `RootServiceFactoryConfig` use `RootServiceFactoryOptions`
85
+ - `PluginServiceFactoryConfig` use `PluginServiceFactoryOptions`
86
+
87
+ ### Patch Changes
88
+
89
+ - 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.
90
+ - 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`.
91
+ - 8b13183: Added `createBackendFeatureLoader`, which can be used to programmatically select and install backend features.
92
+
93
+ 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.
94
+
95
+ 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.
96
+
97
+ ```ts
98
+ const searchLoader = createBackendFeatureLoader({
99
+ deps: {
100
+ config: coreServices.rootConfig,
101
+ },
102
+ *loader({ config }) {
103
+ // Example of a custom config flag to enable search
104
+ if (config.getOptionalString('customFeatureToggle.search')) {
105
+ yield import('@backstage/plugin-search-backend/alpha');
106
+ yield import('@backstage/plugin-search-backend-module-catalog/alpha');
107
+ yield import('@backstage/plugin-search-backend-module-explore/alpha');
108
+ yield import('@backstage/plugin-search-backend-module-techdocs/alpha');
109
+ }
110
+ },
111
+ });
112
+ ```
113
+
114
+ - ddde5fe: Fixed a type issue where plugin and modules depending on multiton services would not receive the correct type.
115
+ - f011d1b: fix typo in `getPluginRequestToken` comments
116
+ - Updated dependencies
117
+ - @backstage/plugin-permission-common@0.8.1
118
+ - @backstage/plugin-auth-node@0.5.0
119
+ - @backstage/cli-common@0.1.14
120
+ - @backstage/config@1.2.0
121
+ - @backstage/errors@1.2.4
122
+ - @backstage/types@1.1.1
123
+
3
124
  ## 0.8.0-next.3
4
125
 
5
126
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api__alpha",
3
- "version": "0.8.0-next.3",
3
+ "version": "0.8.1",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
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-next.3",
3
+ "version": "0.8.1",
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-next.3",
60
- "@backstage/plugin-permission-common": "^0.8.1-next.1",
59
+ "@backstage/plugin-auth-node": "^0.5.1",
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.4.5-next.3",
70
- "@backstage/cli": "^0.27.0-next.4"
69
+ "@backstage/backend-test-utils": "^0.5.1",
70
+ "@backstage/cli": "^0.27.0"
71
71
  }
72
72
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api__testutils",
3
- "version": "0.8.0-next.3",
3
+ "version": "0.8.1",
4
4
  "main": "../dist/testUtils.cjs.js",
5
5
  "types": "../dist/testUtils.d.ts"
6
6
  }