@backstage/backend-app-api 0.4.0-next.2 → 0.4.1-next.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 CHANGED
@@ -1,5 +1,55 @@
1
1
  # @backstage/backend-app-api
2
2
 
3
+ ## 0.4.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 928a12a9b3: Internal refactor of `/alpha` exports.
8
+ - Updated dependencies
9
+ - @backstage/backend-tasks@0.4.4-next.0
10
+ - @backstage/backend-plugin-api@0.4.1-next.0
11
+ - @backstage/backend-common@0.18.3-next.0
12
+ - @backstage/cli-common@0.1.11
13
+ - @backstage/config@1.0.6
14
+ - @backstage/config-loader@1.1.8
15
+ - @backstage/errors@1.1.4
16
+ - @backstage/types@1.0.2
17
+ - @backstage/plugin-auth-node@0.2.12-next.0
18
+ - @backstage/plugin-permission-node@0.7.6-next.0
19
+
20
+ ## 0.4.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 01a075ec1d: **BREAKING**: Renamed `RootHttpRouterConfigureOptions` to `RootHttpRouterConfigureContext`, and removed the unused type `ServiceOrExtensionPoint`.
25
+ - 4ae71b7f2e: **BREAKING** Renaming `*Factory` exports to `*ServiceFactory` instead. For example `configFactory` now is exported as `configServiceFactory`.
26
+ - d31d8e00b3: **BREAKING** `HttpServerCertificateOptions` when specified with a `key` and `cert` should also have the `type: 'pem'` instead of `type: 'plain'`
27
+
28
+ ### Patch Changes
29
+
30
+ - a18da2f8b5: Fixed an issue were the log redaction didn't properly escape RegExp characters.
31
+ - 5febb216fe: Updated to match the new `CacheService` interface.
32
+ - e716946103: Updated usage of the lifecycle service.
33
+ - f60cca9da1: Updated database factory to pass service deps required for restoring database state during development.
34
+ - 610d65e143: Updates to match new `BackendFeature` type.
35
+ - 725383f69d: Tweaked messaging in the README.
36
+ - b86efa2d04: Updated usage of `ServiceFactory`.
37
+ - ab22515647: The shutdown signal handlers are now installed as part of the backend instance rather than the lifecycle service, and explicitly cause the process to exit.
38
+ - b729f9f31f: Moved the options of the `config` and `rootHttpRouter` services out to the factories themselves, where they belong
39
+ - ed8b5967d7: `HttpRouterFactoryOptions.getPath` is now optional as a default value is always provided in the factory.
40
+ - 71a5ec0f06: Updated usages of `LogMeta`.
41
+ - Updated dependencies
42
+ - @backstage/backend-plugin-api@0.4.0
43
+ - @backstage/backend-common@0.18.2
44
+ - @backstage/backend-tasks@0.4.3
45
+ - @backstage/cli-common@0.1.11
46
+ - @backstage/config@1.0.6
47
+ - @backstage/config-loader@1.1.8
48
+ - @backstage/errors@1.1.4
49
+ - @backstage/types@1.0.2
50
+ - @backstage/plugin-auth-node@0.2.11
51
+ - @backstage/plugin-permission-node@0.7.5
52
+
3
53
  ## 0.4.0-next.2
4
54
 
5
55
  ### Minor Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @backstage/backend-app-api
2
2
 
3
- **This package is HIGHLY EXPERIMENTAL, do not use this for production**
3
+ **This package is EXPERIMENTAL, we recommend against using it for production deployments**
4
4
 
5
5
  This package provides the core API used by Backstage backend apps.
6
6
 
@@ -17,3 +17,4 @@ yarn add --cwd packages/backend @backstage/backend-app-api
17
17
 
18
18
  - [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md)
19
19
  - [Backstage Documentation](https://github.com/backstage/backstage/blob/master/docs/README.md)
20
+ - [Backstage Backend System](https://backstage.io/docs/backend-system/)
package/dist/index.cjs.js CHANGED
@@ -1147,6 +1147,23 @@ var __privateMethod$1 = (obj, member, method) => {
1147
1147
  return method;
1148
1148
  };
1149
1149
  var _providedFactories, _loadedDefaultFactories, _implementations, _rootServiceImplementations, _resolveFactory, resolveFactory_fn, _checkForMissingDeps, checkForMissingDeps_fn;
1150
+ function toInternalServiceFactory(factory) {
1151
+ const f = factory;
1152
+ if (f.$$type !== "@backstage/ServiceFactory") {
1153
+ throw new Error(`Invalid service factory, bad type '${f.$$type}'`);
1154
+ }
1155
+ if (f.version !== "v1") {
1156
+ throw new Error(`Invalid service factory, bad version '${f.version}'`);
1157
+ }
1158
+ return f;
1159
+ }
1160
+ const pluginMetadataServiceFactory = backendPluginApi.createServiceFactory(
1161
+ (options) => ({
1162
+ service: backendPluginApi.coreServices.pluginMetadata,
1163
+ deps: {},
1164
+ factory: async () => ({ getId: () => options.pluginId })
1165
+ })
1166
+ );
1150
1167
  class ServiceRegistry {
1151
1168
  constructor(factories) {
1152
1169
  __privateAdd$2(this, _resolveFactory);
@@ -1155,7 +1172,9 @@ class ServiceRegistry {
1155
1172
  __privateAdd$2(this, _loadedDefaultFactories, void 0);
1156
1173
  __privateAdd$2(this, _implementations, void 0);
1157
1174
  __privateAdd$2(this, _rootServiceImplementations, /* @__PURE__ */ new Map());
1158
- __privateSet$2(this, _providedFactories, new Map(factories.map((f) => [f.service.id, f])));
1175
+ __privateSet$2(this, _providedFactories, new Map(
1176
+ factories.map((sf) => [sf.service.id, toInternalServiceFactory(sf)])
1177
+ ));
1159
1178
  __privateSet$2(this, _loadedDefaultFactories, /* @__PURE__ */ new Map());
1160
1179
  __privateSet$2(this, _implementations, /* @__PURE__ */ new Map());
1161
1180
  }
@@ -1165,7 +1184,7 @@ class ServiceRegistry {
1165
1184
  get(ref, pluginId) {
1166
1185
  var _a;
1167
1186
  return (_a = __privateMethod$1(this, _resolveFactory, resolveFactory_fn).call(this, ref, pluginId)) == null ? void 0 : _a.then((factory) => {
1168
- if (factory.scope === "root") {
1187
+ if (factory.service.scope === "root") {
1169
1188
  let existing = __privateGet$2(this, _rootServiceImplementations).get(factory);
1170
1189
  if (!existing) {
1171
1190
  __privateMethod$1(this, _checkForMissingDeps, checkForMissingDeps_fn).call(this, factory, pluginId);
@@ -1180,7 +1199,7 @@ class ServiceRegistry {
1180
1199
  rootDeps.push(target.then((impl) => [name, impl]));
1181
1200
  }
1182
1201
  existing = Promise.all(rootDeps).then(
1183
- (entries) => factory.factory(Object.fromEntries(entries))
1202
+ (entries) => factory.factory(Object.fromEntries(entries), void 0)
1184
1203
  );
1185
1204
  __privateGet$2(this, _rootServiceImplementations).set(factory, existing);
1186
1205
  }
@@ -1242,12 +1261,9 @@ _rootServiceImplementations = new WeakMap();
1242
1261
  _resolveFactory = new WeakSet();
1243
1262
  resolveFactory_fn = function(ref, pluginId) {
1244
1263
  if (ref.id === backendPluginApi.coreServices.pluginMetadata.id) {
1245
- return Promise.resolve({
1246
- scope: "plugin",
1247
- service: backendPluginApi.coreServices.pluginMetadata,
1248
- deps: {},
1249
- factory: async () => ({ getId: () => pluginId })
1250
- });
1264
+ return Promise.resolve(
1265
+ toInternalServiceFactory(pluginMetadataServiceFactory({ pluginId }))
1266
+ );
1251
1267
  }
1252
1268
  let resolvedFactory = __privateGet$2(this, _providedFactories).get(ref.id);
1253
1269
  const { __defaultFactory: defaultFactory } = ref;
@@ -1258,7 +1274,7 @@ resolveFactory_fn = function(ref, pluginId) {
1258
1274
  let loadedFactory = __privateGet$2(this, _loadedDefaultFactories).get(defaultFactory);
1259
1275
  if (!loadedFactory) {
1260
1276
  loadedFactory = Promise.resolve().then(() => defaultFactory(ref)).then(
1261
- (f) => typeof f === "function" ? f() : f
1277
+ (f) => toInternalServiceFactory(typeof f === "function" ? f() : f)
1262
1278
  );
1263
1279
  __privateGet$2(this, _loadedDefaultFactories).set(defaultFactory, loadedFactory);
1264
1280
  }
@@ -1365,7 +1381,7 @@ const cacheServiceFactory = backendPluginApi.createServiceFactory({
1365
1381
  return backendCommon.CacheManager.fromConfig(config);
1366
1382
  },
1367
1383
  async factory({ plugin }, manager) {
1368
- return manager.forPlugin(plugin.getId());
1384
+ return manager.forPlugin(plugin.getId()).getClient();
1369
1385
  }
1370
1386
  });
1371
1387