@backstage/backend-plugin-api 1.11.0-next.1 → 1.11.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @backstage/backend-plugin-api
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e956084: **BREAKING PRODUCERS**: Added an instance ID to the root instance metadata service. Custom implementations and mocks must now provide a globally unique ID that remains stable for the lifetime of the running backend instance.
8
+ - f6054ac: Added experimental `declareConnection` and `connectionsServiceRef` exports to `@backstage/backend-plugin-api/alpha`. Plugins and modules can declare connection dependencies and request the connections service without importing private packages.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+ - @backstage/config@1.3.10
14
+ - @backstage/errors@1.3.2
15
+ - @backstage/connections@0.4.1
16
+ - @backstage/plugin-auth-node@0.7.7
17
+ - @backstage/cli-common@0.3.2
18
+ - @backstage/plugin-permission-common@0.9.12
19
+ - @backstage/plugin-permission-node@0.11.5
20
+
21
+ ## 1.11.0-next.2
22
+
23
+ ### Minor Changes
24
+
25
+ - f6054ac: Added experimental `declareConnection` and `connectionsServiceRef` exports to `@backstage/backend-plugin-api/alpha`. Plugins and modules can declare connection dependencies and request the connections service without importing private packages.
26
+
3
27
  ## 1.11.0-next.1
4
28
 
5
29
  ### Minor Changes
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ function declareConnection(reg, registration) {
4
+ const internal = reg;
5
+ if (typeof internal.registerConnection !== "function") {
6
+ throw new Error(
7
+ "declareConnection: the provided registration points object does not support registerConnection. Make sure you are calling this inside a createBackendPlugin or createBackendModule register callback."
8
+ );
9
+ }
10
+ internal.registerConnection(registration);
11
+ }
12
+
13
+ exports.declareConnection = declareConnection;
14
+ //# sourceMappingURL=declareConnection.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declareConnection.cjs.js","sources":["../../src/alpha/declareConnection.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type {\n BackendModuleRegistrationPoints,\n BackendPluginRegistrationPoints,\n} from '@backstage/backend-plugin-api';\n\nimport type { ConnectionRegistration } from '../wiring/types';\n\n/**\n * Declares that a plugin or module uses a particular connection type.\n * Must be called inside the `register` callback, before `registerInit`.\n *\n * @alpha\n */\nexport function declareConnection(\n reg: BackendPluginRegistrationPoints | BackendModuleRegistrationPoints,\n registration: ConnectionRegistration,\n): void {\n const internal = reg as {\n registerConnection?: (registration: ConnectionRegistration) => void;\n };\n if (typeof internal.registerConnection !== 'function') {\n throw new Error(\n 'declareConnection: the provided registration points object does not support registerConnection. ' +\n 'Make sure you are calling this inside a createBackendPlugin or createBackendModule register callback.',\n );\n }\n internal.registerConnection(registration);\n}\n"],"names":[],"mappings":";;AA4BO,SAAS,iBAAA,CACd,KACA,YAAA,EACM;AACN,EAAA,MAAM,QAAA,GAAW,GAAA;AAGjB,EAAA,IAAI,OAAO,QAAA,CAAS,kBAAA,KAAuB,UAAA,EAAY;AACrD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KAEF;AAAA,EACF;AACA,EAAA,QAAA,CAAS,mBAAmB,YAAY,CAAA;AAC1C;;"}
@@ -2,6 +2,10 @@
2
2
 
3
3
  var backendPluginApi = require('@backstage/backend-plugin-api');
4
4
 
5
+ const connectionsServiceRef = backendPluginApi.createServiceRef({
6
+ id: "alpha.core.connections",
7
+ scope: "plugin"
8
+ });
5
9
  const actionsServiceRef = backendPluginApi.createServiceRef({
6
10
  id: "alpha.core.actions"
7
11
  });
@@ -17,6 +21,7 @@ const tracingServiceRef = backendPluginApi.createServiceRef({
17
21
 
18
22
  exports.actionsRegistryServiceRef = actionsRegistryServiceRef;
19
23
  exports.actionsServiceRef = actionsServiceRef;
24
+ exports.connectionsServiceRef = connectionsServiceRef;
20
25
  exports.metricsServiceRef = metricsServiceRef;
21
26
  exports.tracingServiceRef = tracingServiceRef;
22
27
  //# sourceMappingURL=refs.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs.cjs.js","sources":["../../src/alpha/refs.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createServiceRef } from '@backstage/backend-plugin-api';\n\n/**\n * Service for calling distributed actions\n *\n * See {@link ActionsService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsServiceRef = createServiceRef<\n import('./ActionsService').ActionsService\n>({\n id: 'alpha.core.actions',\n});\n\n/**\n * Service for registering and managing distributed actions.\n *\n * See {@link ActionsRegistryService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions-registry | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsRegistryServiceRef = createServiceRef<\n import('./ActionsRegistryService').ActionsRegistryService\n>({\n id: 'alpha.core.actionsRegistry',\n});\n\n/**\n * Service for managing metrics.\n *\n * @alpha\n */\nexport const metricsServiceRef = createServiceRef<\n import('./MetricsService').MetricsService\n>({\n id: 'alpha.core.metrics',\n});\n\n/**\n * Service for managing trace spans.\n *\n * See `TracingService` for the API surface.\n *\n * @alpha\n */\nexport const tracingServiceRef = createServiceRef<\n import('./TracingService').TracingService\n>({\n id: 'alpha.core.tracing',\n});\n"],"names":["createServiceRef"],"mappings":";;;;AA2BO,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAA4BA,iCAAA,CAEvC;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAOM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AASM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;;;;;"}
1
+ {"version":3,"file":"refs.cjs.js","sources":["../../src/alpha/refs.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createServiceRef } from '@backstage/backend-plugin-api';\n\n/**\n * Service for looking up plugin-scoped connections to external systems.\n * Declare consumed connection types with `declareConnection` before requesting this service.\n *\n * @alpha\n */\nexport const connectionsServiceRef = createServiceRef<\n import('@backstage/connections').ConnectionsService\n>({\n id: 'alpha.core.connections',\n scope: 'plugin',\n});\n\n/**\n * Service for calling distributed actions\n *\n * See {@link ActionsService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsServiceRef = createServiceRef<\n import('./ActionsService').ActionsService\n>({\n id: 'alpha.core.actions',\n});\n\n/**\n * Service for registering and managing distributed actions.\n *\n * See {@link ActionsRegistryService}\n * and {@link https://backstage.io/docs/backend-system/core-services/actions-registry | the service docs}\n * for more information.\n *\n * @alpha\n */\nexport const actionsRegistryServiceRef = createServiceRef<\n import('./ActionsRegistryService').ActionsRegistryService\n>({\n id: 'alpha.core.actionsRegistry',\n});\n\n/**\n * Service for managing metrics.\n *\n * @alpha\n */\nexport const metricsServiceRef = createServiceRef<\n import('./MetricsService').MetricsService\n>({\n id: 'alpha.core.metrics',\n});\n\n/**\n * Service for managing trace spans.\n *\n * See `TracingService` for the API surface.\n *\n * @alpha\n */\nexport const tracingServiceRef = createServiceRef<\n import('./TracingService').TracingService\n>({\n id: 'alpha.core.tracing',\n});\n"],"names":["createServiceRef"],"mappings":";;;;AAwBO,MAAM,wBAAwBA,iCAAA,CAEnC;AAAA,EACA,EAAA,EAAI,wBAAA;AAAA,EACJ,KAAA,EAAO;AACT,CAAC;AAWM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAWM,MAAM,4BAA4BA,iCAAA,CAEvC;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AAOM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;AASM,MAAM,oBAAoBA,iCAAA,CAE/B;AAAA,EACA,EAAA,EAAI;AACN,CAAC;;;;;;"}
package/dist/alpha.cjs.js CHANGED
@@ -1,11 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var refs = require('./alpha/refs.cjs.js');
4
+ var declareConnection = require('./alpha/declareConnection.cjs.js');
4
5
 
5
6
 
6
7
 
7
8
  exports.actionsRegistryServiceRef = refs.actionsRegistryServiceRef;
8
9
  exports.actionsServiceRef = refs.actionsServiceRef;
10
+ exports.connectionsServiceRef = refs.connectionsServiceRef;
9
11
  exports.metricsServiceRef = refs.metricsServiceRef;
10
12
  exports.tracingServiceRef = refs.tracingServiceRef;
13
+ exports.declareConnection = declareConnection.declareConnection;
11
14
  //# sourceMappingURL=alpha.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"alpha.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { AnyZodObject, z } from 'zod/v3';
2
2
  import { BasicPermission } from '@backstage/plugin-permission-common';
3
3
  import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
4
- import { LoggerService, BackstageCredentials } from '@backstage/backend-plugin-api';
4
+ import { LoggerService, BackstageCredentials, BackendPluginRegistrationPoints, BackendModuleRegistrationPoints } from '@backstage/backend-plugin-api';
5
5
  import { JsonObject, JsonValue } from '@backstage/types';
6
6
  import { JSONSchema7 } from 'json-schema';
7
7
  import { Request } from 'express';
8
- export { C as ConnectionRegistration } from './types/types.d-DPPAZhPl.js';
8
+ import * as _backstage_connections from '@backstage/connections';
9
+ import { C as ConnectionRegistration } from './types/types.d-CEuefyTb.js';
9
10
 
10
11
  /**
11
12
  * @alpha
@@ -445,6 +446,13 @@ interface TracingServiceBaggageEntry {
445
446
  value: string;
446
447
  }
447
448
 
449
+ /**
450
+ * Service for looking up plugin-scoped connections to external systems.
451
+ * Declare consumed connection types with `declareConnection` before requesting this service.
452
+ *
453
+ * @alpha
454
+ */
455
+ declare const connectionsServiceRef: _backstage_backend_plugin_api.ServiceRef<_backstage_connections.ConnectionsService, "plugin", "singleton">;
448
456
  /**
449
457
  * Service for calling distributed actions
450
458
  *
@@ -480,5 +488,13 @@ declare const metricsServiceRef: _backstage_backend_plugin_api.ServiceRef<Metric
480
488
  */
481
489
  declare const tracingServiceRef: _backstage_backend_plugin_api.ServiceRef<TracingService, "plugin", "singleton">;
482
490
 
483
- export { actionsRegistryServiceRef, actionsServiceRef, metricsServiceRef, tracingServiceRef };
491
+ /**
492
+ * Declares that a plugin or module uses a particular connection type.
493
+ * Must be called inside the `register` callback, before `registerInit`.
494
+ *
495
+ * @alpha
496
+ */
497
+ declare function declareConnection(reg: BackendPluginRegistrationPoints | BackendModuleRegistrationPoints, registration: ConnectionRegistration): void;
498
+
499
+ export { ConnectionRegistration, actionsRegistryServiceRef, actionsServiceRef, connectionsServiceRef, declareConnection, metricsServiceRef, tracingServiceRef };
484
500
  export type { ActionsRegistryActionContext, ActionsRegistryActionExample, ActionsRegistryActionOptions, ActionsRegistryService, ActionsService, ActionsServiceAction, MetricAdvice, MetricAttributeValue, MetricAttributes, MetricOptions, MetricsService, MetricsServiceCounter, MetricsServiceGauge, MetricsServiceHistogram, MetricsServiceObservable, MetricsServiceObservableCallback, MetricsServiceObservableCounter, MetricsServiceObservableGauge, MetricsServiceObservableResult, MetricsServiceObservableUpDownCounter, MetricsServiceUpDownCounter, TracingService, TracingServiceAttributeValue, TracingServiceAttributes, TracingServiceBaggage, TracingServiceBaggageEntry, TracingServiceContext, TracingServiceContextAPI, TracingServicePropagationAPI, TracingServiceSpan, TracingServiceSpanKind, TracingServiceSpanOptions, TracingServiceSpanStatus };
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ import { PermissionRule, PermissionResourceRef, PermissionRuleset } from '@backs
6
6
  import { Config } from '@backstage/config';
7
7
  import { Duration } from 'luxon';
8
8
  import { Readable } from 'node:stream';
9
- import { S as ServiceRef, B as BackendModuleRegistrationPoints, a as BackendFeature, b as BackendPluginRegistrationPoints, E as ExtensionPoint } from './types/types.d-DPPAZhPl.js';
10
- export { c as ExtensionPointFactoryContext, P as PluginServiceFactoryOptions, R as RootServiceFactoryOptions, d as ServiceFactory, e as ServiceRefOptions, f as createServiceFactory, g as createServiceRef } from './types/types.d-DPPAZhPl.js';
9
+ import { S as ServiceRef, B as BackendModuleRegistrationPoints, a as BackendFeature, b as BackendPluginRegistrationPoints, E as ExtensionPoint } from './types/types.d-CEuefyTb.js';
10
+ export { c as ExtensionPointFactoryContext, P as PluginServiceFactoryOptions, R as RootServiceFactoryOptions, d as ServiceFactory, e as ServiceRefOptions, f as createServiceFactory, g as createServiceRef } from './types/types.d-CEuefyTb.js';
11
11
  export { isChildPath } from '@backstage/cli-common';
12
12
 
13
13
  /**
@@ -178,13 +178,13 @@ type DepsToInstances<TDeps extends {
178
178
  interface ConnectionRegistration {
179
179
  /**
180
180
  * The connection type identifier, matching the `type` field in connections
181
- * config and in calls to `find` / `findOptional` on the connections service.
181
+ * config and in calls to `find` on the connections service.
182
182
  */
183
183
  type: string;
184
184
  /**
185
185
  * Whether the connection is essential for the plugin or module to function.
186
- * If true, the backend will fail to start if no matching connection is
187
- * configured. Defaults to false.
186
+ * Informational metadata; this does not enforce connection availability
187
+ * at startup. Defaults to false.
188
188
  */
189
189
  required?: boolean;
190
190
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api",
3
- "version": "1.11.0-next.1",
3
+ "version": "1.11.0",
4
4
  "description": "Core API used by Backstage backend plugins",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -65,13 +65,14 @@
65
65
  "test": "backstage-cli package test"
66
66
  },
67
67
  "dependencies": {
68
- "@backstage/cli-common": "0.3.2-next.0",
69
- "@backstage/config": "1.3.10-next.0",
70
- "@backstage/errors": "1.3.2-next.0",
71
- "@backstage/plugin-auth-node": "0.7.7-next.1",
72
- "@backstage/plugin-permission-common": "0.9.12-next.0",
73
- "@backstage/plugin-permission-node": "0.11.5-next.1",
74
- "@backstage/types": "1.2.2",
68
+ "@backstage/cli-common": "^0.3.2",
69
+ "@backstage/config": "^1.3.10",
70
+ "@backstage/connections": "^0.4.1",
71
+ "@backstage/errors": "^1.3.2",
72
+ "@backstage/plugin-auth-node": "^0.7.7",
73
+ "@backstage/plugin-permission-common": "^0.9.12",
74
+ "@backstage/plugin-permission-node": "^0.11.5",
75
+ "@backstage/types": "^1.2.2",
75
76
  "@types/express": "^4.17.6",
76
77
  "@types/json-schema": "^7.0.6",
77
78
  "@types/luxon": "^3.0.0",
@@ -80,8 +81,8 @@
80
81
  "zod": "^3.25.76 || ^4.0.0"
81
82
  },
82
83
  "devDependencies": {
83
- "@backstage/backend-test-utils": "1.11.8-next.1",
84
- "@backstage/cli": "0.36.7-next.0"
84
+ "@backstage/backend-test-utils": "^1.11.8",
85
+ "@backstage/cli": "^0.36.7"
85
86
  },
86
87
  "configSchema": "config.schema.json"
87
88
  }