@backstage/backend-plugin-api 1.5.0 → 1.6.0-next.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 +31 -0
- package/dist/alpha/refs.cjs.js +5 -4
- package/dist/alpha/refs.cjs.js.map +1 -1
- package/dist/alpha.cjs.js +1 -1
- package/dist/alpha.d.ts +14 -17
- package/dist/index.d.ts +138 -137
- package/dist/testUtils.d.ts +2 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @backstage/backend-plugin-api
|
|
2
2
|
|
|
3
|
+
## 1.6.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2a0c4b0: Adds a new experimental `RootSystemMetadataService` for tracking the collection of Backstage instances that may be deployed at any one time. It currently offers a single API, `getInstalledPlugins` that returns a list of installed plugins based on config you have set up in `discovery.endpoints` as well as the plugins installed on the instance you're calling the API with. It does not handle wildcard values or fallback values. The intention is for this plugin to provide plugin authors with a simple interface to fetch a trustworthy list of all installed plugins.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/plugin-auth-node@0.6.10-next.1
|
|
13
|
+
- @backstage/plugin-permission-node@0.10.7-next.1
|
|
14
|
+
- @backstage/cli-common@0.1.16-next.2
|
|
15
|
+
- @backstage/config@1.3.6
|
|
16
|
+
- @backstage/errors@1.2.7
|
|
17
|
+
- @backstage/types@1.2.2
|
|
18
|
+
- @backstage/plugin-permission-common@0.9.3
|
|
19
|
+
|
|
20
|
+
## 1.5.1-next.0
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- d9759a1: **BREAKING ALPHA**: The old `instanceMetadataService` has been removed from alpha. Please switch over to using the stable `coreServices.rootInstanceMetadata` and related types instead, available from `@backstage/backend-plugin-api`.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @backstage/plugin-auth-node@0.6.10-next.0
|
|
27
|
+
- @backstage/cli-common@0.1.16-next.0
|
|
28
|
+
- @backstage/plugin-permission-node@0.10.7-next.0
|
|
29
|
+
- @backstage/config@1.3.6
|
|
30
|
+
- @backstage/errors@1.2.7
|
|
31
|
+
- @backstage/types@1.2.2
|
|
32
|
+
- @backstage/plugin-permission-common@0.9.3
|
|
33
|
+
|
|
3
34
|
## 1.5.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/dist/alpha/refs.cjs.js
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
4
|
|
|
5
|
-
const instanceMetadataServiceRef = backendPluginApi.createServiceRef({
|
|
6
|
-
id: "core.instanceMetadata"
|
|
7
|
-
});
|
|
8
5
|
const actionsServiceRef = backendPluginApi.createServiceRef({
|
|
9
6
|
id: "alpha.core.actions"
|
|
10
7
|
});
|
|
11
8
|
const actionsRegistryServiceRef = backendPluginApi.createServiceRef({
|
|
12
9
|
id: "alpha.core.actionsRegistry"
|
|
13
10
|
});
|
|
11
|
+
const rootSystemMetadataServiceRef = backendPluginApi.createServiceRef({
|
|
12
|
+
id: "alpha.core.rootSystemMetadata",
|
|
13
|
+
scope: "root"
|
|
14
|
+
});
|
|
14
15
|
|
|
15
16
|
exports.actionsRegistryServiceRef = actionsRegistryServiceRef;
|
|
16
17
|
exports.actionsServiceRef = actionsServiceRef;
|
|
17
|
-
exports.
|
|
18
|
+
exports.rootSystemMetadataServiceRef = rootSystemMetadataServiceRef;
|
|
18
19
|
//# 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 *
|
|
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 * Read information about your current Backstage deployment.\n * @alpha\n */\nexport const rootSystemMetadataServiceRef = createServiceRef<\n import('./RootSystemMetadataService').RootSystemMetadataService\n>({\n id: 'alpha.core.rootSystemMetadata',\n scope: 'root',\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;AAMM,MAAM,+BAA+BA,iCAAA,CAE1C;AAAA,EACA,EAAA,EAAI,+BAAA;AAAA,EACJ,KAAA,EAAO;AACT,CAAC;;;;;;"}
|
package/dist/alpha.cjs.js
CHANGED
|
@@ -6,5 +6,5 @@ var refs = require('./alpha/refs.cjs.js');
|
|
|
6
6
|
|
|
7
7
|
exports.actionsRegistryServiceRef = refs.actionsRegistryServiceRef;
|
|
8
8
|
exports.actionsServiceRef = refs.actionsServiceRef;
|
|
9
|
-
exports.
|
|
9
|
+
exports.rootSystemMetadataServiceRef = refs.rootSystemMetadataServiceRef;
|
|
10
10
|
//# sourceMappingURL=alpha.cjs.js.map
|
package/dist/alpha.d.ts
CHANGED
|
@@ -4,18 +4,13 @@ import { LoggerService, BackstageCredentials } from '@backstage/backend-plugin-a
|
|
|
4
4
|
import { JsonObject, JsonValue } from '@backstage/types';
|
|
5
5
|
import { JSONSchema7 } from 'json-schema';
|
|
6
6
|
|
|
7
|
-
/** @
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
moduleId: string;
|
|
15
|
-
};
|
|
16
|
-
/** @alpha */
|
|
17
|
-
interface InstanceMetadataService {
|
|
18
|
-
getInstalledFeatures: () => BackendFeatureMeta[];
|
|
7
|
+
/** @public */
|
|
8
|
+
interface RootSystemMetadataServicePluginInfo {
|
|
9
|
+
readonly pluginId: string;
|
|
10
|
+
}
|
|
11
|
+
/** @public */
|
|
12
|
+
interface RootSystemMetadataService {
|
|
13
|
+
getInstalledPlugins: () => Promise<ReadonlyArray<RootSystemMetadataServicePluginInfo>>;
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
/**
|
|
@@ -89,10 +84,6 @@ interface ActionsService {
|
|
|
89
84
|
}>;
|
|
90
85
|
}
|
|
91
86
|
|
|
92
|
-
/**
|
|
93
|
-
* @alpha
|
|
94
|
-
*/
|
|
95
|
-
declare const instanceMetadataServiceRef: _backstage_backend_plugin_api.ServiceRef<InstanceMetadataService, "plugin", "singleton">;
|
|
96
87
|
/**
|
|
97
88
|
* Service for calling distributed actions
|
|
98
89
|
*
|
|
@@ -113,5 +104,11 @@ declare const actionsServiceRef: _backstage_backend_plugin_api.ServiceRef<Action
|
|
|
113
104
|
* @alpha
|
|
114
105
|
*/
|
|
115
106
|
declare const actionsRegistryServiceRef: _backstage_backend_plugin_api.ServiceRef<ActionsRegistryService, "plugin", "singleton">;
|
|
107
|
+
/**
|
|
108
|
+
* Read information about your current Backstage deployment.
|
|
109
|
+
* @alpha
|
|
110
|
+
*/
|
|
111
|
+
declare const rootSystemMetadataServiceRef: _backstage_backend_plugin_api.ServiceRef<RootSystemMetadataService, "root", "singleton">;
|
|
116
112
|
|
|
117
|
-
export {
|
|
113
|
+
export { actionsRegistryServiceRef, actionsServiceRef, rootSystemMetadataServiceRef };
|
|
114
|
+
export type { ActionsRegistryActionContext, ActionsRegistryActionOptions, ActionsRegistryService, ActionsService, ActionsServiceAction, RootSystemMetadataService, RootSystemMetadataServicePluginInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1515,142 +1515,6 @@ interface RootInstanceMetadataService {
|
|
|
1515
1515
|
getInstalledPlugins: () => Promise<ReadonlyArray<RootInstanceMetadataServicePluginInfo>>;
|
|
1516
1516
|
}
|
|
1517
1517
|
|
|
1518
|
-
/** @public */
|
|
1519
|
-
interface BackendFeature {
|
|
1520
|
-
$$type: '@backstage/BackendFeature';
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
/**
|
|
1524
|
-
* A reference to a backend service. You can use these references to mark
|
|
1525
|
-
* dependencies on services and having their implementations injected
|
|
1526
|
-
* automatically.
|
|
1527
|
-
*
|
|
1528
|
-
* @public
|
|
1529
|
-
*/
|
|
1530
|
-
type ServiceRef<TService, TScope extends 'root' | 'plugin' = 'root' | 'plugin', TInstances extends 'singleton' | 'multiton' = 'singleton' | 'multiton'> = {
|
|
1531
|
-
id: string;
|
|
1532
|
-
/**
|
|
1533
|
-
* This determines the scope at which this service is available.
|
|
1534
|
-
*
|
|
1535
|
-
* Root scoped services are available to all other services but
|
|
1536
|
-
* may only depend on other root scoped services.
|
|
1537
|
-
*
|
|
1538
|
-
* Plugin scoped services are only available to other plugin scoped
|
|
1539
|
-
* services but may depend on all other services.
|
|
1540
|
-
*/
|
|
1541
|
-
scope: TScope;
|
|
1542
|
-
/**
|
|
1543
|
-
* Marks whether the service is a multiton or not. Multiton services the
|
|
1544
|
-
* opposite of singletons - they can be provided many times, and when depended
|
|
1545
|
-
* on, you receive an array of all provided instances.
|
|
1546
|
-
*/
|
|
1547
|
-
multiton?: TInstances extends 'multiton' ? true : false;
|
|
1548
|
-
/**
|
|
1549
|
-
* Utility for getting the type of the service, using `typeof serviceRef.T`.
|
|
1550
|
-
* Attempting to actually read this value will result in an exception.
|
|
1551
|
-
*/
|
|
1552
|
-
T: TService;
|
|
1553
|
-
$$type: '@backstage/ServiceRef';
|
|
1554
|
-
};
|
|
1555
|
-
/** @public */
|
|
1556
|
-
interface ServiceFactory<TService = unknown, TScope extends 'plugin' | 'root' = 'plugin' | 'root', TInstances extends 'singleton' | 'multiton' = 'singleton' | 'multiton'> extends BackendFeature {
|
|
1557
|
-
service: ServiceRef<TService, TScope, TInstances>;
|
|
1558
|
-
}
|
|
1559
|
-
/** @public */
|
|
1560
|
-
interface ServiceRefOptions<TService, TScope extends 'root' | 'plugin', TInstances extends 'singleton' | 'multiton'> {
|
|
1561
|
-
id: string;
|
|
1562
|
-
scope?: TScope;
|
|
1563
|
-
multiton?: TInstances extends 'multiton' ? true : false;
|
|
1564
|
-
defaultFactory?(service: ServiceRef<TService, TScope>): Promise<ServiceFactory>;
|
|
1565
|
-
}
|
|
1566
|
-
/**
|
|
1567
|
-
* Creates a new service definition. This overload is used to create plugin scoped services.
|
|
1568
|
-
*
|
|
1569
|
-
* @public
|
|
1570
|
-
*/
|
|
1571
|
-
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'plugin', 'singleton'>): ServiceRef<TService, 'plugin', 'singleton'>;
|
|
1572
|
-
/**
|
|
1573
|
-
* Creates a new service definition. This overload is used to create root scoped services.
|
|
1574
|
-
*
|
|
1575
|
-
* @public
|
|
1576
|
-
*/
|
|
1577
|
-
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'root', 'singleton'>): ServiceRef<TService, 'root', 'singleton'>;
|
|
1578
|
-
/**
|
|
1579
|
-
* Creates a new service definition. This overload is used to create plugin scoped services.
|
|
1580
|
-
*
|
|
1581
|
-
* @public
|
|
1582
|
-
*/
|
|
1583
|
-
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'plugin', 'multiton'>): ServiceRef<TService, 'plugin', 'multiton'>;
|
|
1584
|
-
/**
|
|
1585
|
-
* Creates a new service definition. This overload is used to create root scoped services.
|
|
1586
|
-
*
|
|
1587
|
-
* @public
|
|
1588
|
-
*/
|
|
1589
|
-
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'root', 'multiton'>): ServiceRef<TService, 'root', 'multiton'>;
|
|
1590
|
-
/** @ignore */
|
|
1591
|
-
type ServiceRefsToInstances<T extends {
|
|
1592
|
-
[key in string]: ServiceRef<unknown>;
|
|
1593
|
-
}, TScope extends 'root' | 'plugin' = 'root' | 'plugin'> = {
|
|
1594
|
-
[key in keyof T as T[key]['scope'] extends TScope ? key : never]: T[key]['multiton'] extends true | undefined ? Array<T[key]['T']> : T[key]['T'];
|
|
1595
|
-
};
|
|
1596
|
-
/** @public */
|
|
1597
|
-
interface RootServiceFactoryOptions<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
1598
|
-
[name in string]: ServiceRef<unknown>;
|
|
1599
|
-
}> {
|
|
1600
|
-
/**
|
|
1601
|
-
* The initialization strategy for the service factory. This service is root scoped and will use `always` by default.
|
|
1602
|
-
*
|
|
1603
|
-
* @remarks
|
|
1604
|
-
*
|
|
1605
|
-
* - `always` - The service will always be initialized regardless if it is used or not.
|
|
1606
|
-
* - `lazy` - The service will only be initialized if it is depended on by a different service or feature.
|
|
1607
|
-
*
|
|
1608
|
-
* Service factories for root scoped services use `always` as the default, while plugin scoped services use `lazy`.
|
|
1609
|
-
*/
|
|
1610
|
-
initialization?: 'always' | 'lazy';
|
|
1611
|
-
service: ServiceRef<TService, 'root', TInstances>;
|
|
1612
|
-
deps: TDeps;
|
|
1613
|
-
factory(deps: ServiceRefsToInstances<TDeps, 'root'>): TImpl | Promise<TImpl>;
|
|
1614
|
-
}
|
|
1615
|
-
/** @public */
|
|
1616
|
-
interface PluginServiceFactoryOptions<TService, TInstances extends 'singleton' | 'multiton', TContext, TImpl extends TService, TDeps extends {
|
|
1617
|
-
[name in string]: ServiceRef<unknown>;
|
|
1618
|
-
}> {
|
|
1619
|
-
/**
|
|
1620
|
-
* The initialization strategy for the service factory. This service is plugin scoped and will use `lazy` by default.
|
|
1621
|
-
*
|
|
1622
|
-
* @remarks
|
|
1623
|
-
*
|
|
1624
|
-
* - `always` - The service will always be initialized regardless if it is used or not.
|
|
1625
|
-
* - `lazy` - The service will only be initialized if it is depended on by a different service or feature.
|
|
1626
|
-
*
|
|
1627
|
-
* Service factories for root scoped services use `always` as the default, while plugin scoped services use `lazy`.
|
|
1628
|
-
*/
|
|
1629
|
-
initialization?: 'always' | 'lazy';
|
|
1630
|
-
service: ServiceRef<TService, 'plugin', TInstances>;
|
|
1631
|
-
deps: TDeps;
|
|
1632
|
-
createRootContext?(deps: ServiceRefsToInstances<TDeps, 'root'>): TContext | Promise<TContext>;
|
|
1633
|
-
factory(deps: ServiceRefsToInstances<TDeps>, context: TContext): TImpl | Promise<TImpl>;
|
|
1634
|
-
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Creates a root scoped service factory without options.
|
|
1637
|
-
*
|
|
1638
|
-
* @public
|
|
1639
|
-
* @param options - The service factory configuration.
|
|
1640
|
-
*/
|
|
1641
|
-
declare function createServiceFactory<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
1642
|
-
[name in string]: ServiceRef<unknown, 'root'>;
|
|
1643
|
-
}>(options: RootServiceFactoryOptions<TService, TInstances, TImpl, TDeps>): ServiceFactory<TService, 'root', TInstances>;
|
|
1644
|
-
/**
|
|
1645
|
-
* Creates a plugin scoped service factory without options.
|
|
1646
|
-
*
|
|
1647
|
-
* @public
|
|
1648
|
-
* @param options - The service factory configuration.
|
|
1649
|
-
*/
|
|
1650
|
-
declare function createServiceFactory<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
1651
|
-
[name in string]: ServiceRef<unknown>;
|
|
1652
|
-
}, TContext = undefined>(options: PluginServiceFactoryOptions<TService, TInstances, TContext, TImpl, TDeps>): ServiceFactory<TService, 'plugin', TInstances>;
|
|
1653
|
-
|
|
1654
1518
|
/**
|
|
1655
1519
|
* All core services references
|
|
1656
1520
|
*
|
|
@@ -1859,6 +1723,142 @@ declare namespace coreServices {
|
|
|
1859
1723
|
const rootInstanceMetadata: ServiceRef<RootInstanceMetadataService, "root", "singleton">;
|
|
1860
1724
|
}
|
|
1861
1725
|
|
|
1726
|
+
/** @public */
|
|
1727
|
+
interface BackendFeature {
|
|
1728
|
+
$$type: '@backstage/BackendFeature';
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
/**
|
|
1732
|
+
* A reference to a backend service. You can use these references to mark
|
|
1733
|
+
* dependencies on services and having their implementations injected
|
|
1734
|
+
* automatically.
|
|
1735
|
+
*
|
|
1736
|
+
* @public
|
|
1737
|
+
*/
|
|
1738
|
+
type ServiceRef<TService, TScope extends 'root' | 'plugin' = 'root' | 'plugin', TInstances extends 'singleton' | 'multiton' = 'singleton' | 'multiton'> = {
|
|
1739
|
+
id: string;
|
|
1740
|
+
/**
|
|
1741
|
+
* This determines the scope at which this service is available.
|
|
1742
|
+
*
|
|
1743
|
+
* Root scoped services are available to all other services but
|
|
1744
|
+
* may only depend on other root scoped services.
|
|
1745
|
+
*
|
|
1746
|
+
* Plugin scoped services are only available to other plugin scoped
|
|
1747
|
+
* services but may depend on all other services.
|
|
1748
|
+
*/
|
|
1749
|
+
scope: TScope;
|
|
1750
|
+
/**
|
|
1751
|
+
* Marks whether the service is a multiton or not. Multiton services the
|
|
1752
|
+
* opposite of singletons - they can be provided many times, and when depended
|
|
1753
|
+
* on, you receive an array of all provided instances.
|
|
1754
|
+
*/
|
|
1755
|
+
multiton?: TInstances extends 'multiton' ? true : false;
|
|
1756
|
+
/**
|
|
1757
|
+
* Utility for getting the type of the service, using `typeof serviceRef.T`.
|
|
1758
|
+
* Attempting to actually read this value will result in an exception.
|
|
1759
|
+
*/
|
|
1760
|
+
T: TService;
|
|
1761
|
+
$$type: '@backstage/ServiceRef';
|
|
1762
|
+
};
|
|
1763
|
+
/** @public */
|
|
1764
|
+
interface ServiceFactory<TService = unknown, TScope extends 'plugin' | 'root' = 'plugin' | 'root', TInstances extends 'singleton' | 'multiton' = 'singleton' | 'multiton'> extends BackendFeature {
|
|
1765
|
+
service: ServiceRef<TService, TScope, TInstances>;
|
|
1766
|
+
}
|
|
1767
|
+
/** @public */
|
|
1768
|
+
interface ServiceRefOptions<TService, TScope extends 'root' | 'plugin', TInstances extends 'singleton' | 'multiton'> {
|
|
1769
|
+
id: string;
|
|
1770
|
+
scope?: TScope;
|
|
1771
|
+
multiton?: TInstances extends 'multiton' ? true : false;
|
|
1772
|
+
defaultFactory?(service: ServiceRef<TService, TScope>): Promise<ServiceFactory>;
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Creates a new service definition. This overload is used to create plugin scoped services.
|
|
1776
|
+
*
|
|
1777
|
+
* @public
|
|
1778
|
+
*/
|
|
1779
|
+
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'plugin', 'singleton'>): ServiceRef<TService, 'plugin', 'singleton'>;
|
|
1780
|
+
/**
|
|
1781
|
+
* Creates a new service definition. This overload is used to create root scoped services.
|
|
1782
|
+
*
|
|
1783
|
+
* @public
|
|
1784
|
+
*/
|
|
1785
|
+
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'root', 'singleton'>): ServiceRef<TService, 'root', 'singleton'>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Creates a new service definition. This overload is used to create plugin scoped services.
|
|
1788
|
+
*
|
|
1789
|
+
* @public
|
|
1790
|
+
*/
|
|
1791
|
+
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'plugin', 'multiton'>): ServiceRef<TService, 'plugin', 'multiton'>;
|
|
1792
|
+
/**
|
|
1793
|
+
* Creates a new service definition. This overload is used to create root scoped services.
|
|
1794
|
+
*
|
|
1795
|
+
* @public
|
|
1796
|
+
*/
|
|
1797
|
+
declare function createServiceRef<TService>(options: ServiceRefOptions<TService, 'root', 'multiton'>): ServiceRef<TService, 'root', 'multiton'>;
|
|
1798
|
+
/** @ignore */
|
|
1799
|
+
type ServiceRefsToInstances<T extends {
|
|
1800
|
+
[key in string]: ServiceRef<unknown>;
|
|
1801
|
+
}, TScope extends 'root' | 'plugin' = 'root' | 'plugin'> = {
|
|
1802
|
+
[key in keyof T as T[key]['scope'] extends TScope ? key : never]: T[key]['multiton'] extends true | undefined ? Array<T[key]['T']> : T[key]['T'];
|
|
1803
|
+
};
|
|
1804
|
+
/** @public */
|
|
1805
|
+
interface RootServiceFactoryOptions<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
1806
|
+
[name in string]: ServiceRef<unknown>;
|
|
1807
|
+
}> {
|
|
1808
|
+
/**
|
|
1809
|
+
* The initialization strategy for the service factory. This service is root scoped and will use `always` by default.
|
|
1810
|
+
*
|
|
1811
|
+
* @remarks
|
|
1812
|
+
*
|
|
1813
|
+
* - `always` - The service will always be initialized regardless if it is used or not.
|
|
1814
|
+
* - `lazy` - The service will only be initialized if it is depended on by a different service or feature.
|
|
1815
|
+
*
|
|
1816
|
+
* Service factories for root scoped services use `always` as the default, while plugin scoped services use `lazy`.
|
|
1817
|
+
*/
|
|
1818
|
+
initialization?: 'always' | 'lazy';
|
|
1819
|
+
service: ServiceRef<TService, 'root', TInstances>;
|
|
1820
|
+
deps: TDeps;
|
|
1821
|
+
factory(deps: ServiceRefsToInstances<TDeps, 'root'>): TImpl | Promise<TImpl>;
|
|
1822
|
+
}
|
|
1823
|
+
/** @public */
|
|
1824
|
+
interface PluginServiceFactoryOptions<TService, TInstances extends 'singleton' | 'multiton', TContext, TImpl extends TService, TDeps extends {
|
|
1825
|
+
[name in string]: ServiceRef<unknown>;
|
|
1826
|
+
}> {
|
|
1827
|
+
/**
|
|
1828
|
+
* The initialization strategy for the service factory. This service is plugin scoped and will use `lazy` by default.
|
|
1829
|
+
*
|
|
1830
|
+
* @remarks
|
|
1831
|
+
*
|
|
1832
|
+
* - `always` - The service will always be initialized regardless if it is used or not.
|
|
1833
|
+
* - `lazy` - The service will only be initialized if it is depended on by a different service or feature.
|
|
1834
|
+
*
|
|
1835
|
+
* Service factories for root scoped services use `always` as the default, while plugin scoped services use `lazy`.
|
|
1836
|
+
*/
|
|
1837
|
+
initialization?: 'always' | 'lazy';
|
|
1838
|
+
service: ServiceRef<TService, 'plugin', TInstances>;
|
|
1839
|
+
deps: TDeps;
|
|
1840
|
+
createRootContext?(deps: ServiceRefsToInstances<TDeps, 'root'>): TContext | Promise<TContext>;
|
|
1841
|
+
factory(deps: ServiceRefsToInstances<TDeps>, context: TContext): TImpl | Promise<TImpl>;
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Creates a root scoped service factory without options.
|
|
1845
|
+
*
|
|
1846
|
+
* @public
|
|
1847
|
+
* @param options - The service factory configuration.
|
|
1848
|
+
*/
|
|
1849
|
+
declare function createServiceFactory<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
1850
|
+
[name in string]: ServiceRef<unknown, 'root'>;
|
|
1851
|
+
}>(options: RootServiceFactoryOptions<TService, TInstances, TImpl, TDeps>): ServiceFactory<TService, 'root', TInstances>;
|
|
1852
|
+
/**
|
|
1853
|
+
* Creates a plugin scoped service factory without options.
|
|
1854
|
+
*
|
|
1855
|
+
* @public
|
|
1856
|
+
* @param options - The service factory configuration.
|
|
1857
|
+
*/
|
|
1858
|
+
declare function createServiceFactory<TService, TInstances extends 'singleton' | 'multiton', TImpl extends TService, TDeps extends {
|
|
1859
|
+
[name in string]: ServiceRef<unknown>;
|
|
1860
|
+
}, TContext = undefined>(options: PluginServiceFactoryOptions<TService, TInstances, TContext, TImpl, TDeps>): ServiceFactory<TService, 'plugin', TInstances>;
|
|
1861
|
+
|
|
1862
1862
|
/**
|
|
1863
1863
|
* Tries to deduce whether a thrown error is a database conflict.
|
|
1864
1864
|
*
|
|
@@ -2045,4 +2045,5 @@ declare function createBackendFeatureLoader<TDeps extends {
|
|
|
2045
2045
|
[name in string]: unknown;
|
|
2046
2046
|
}>(options: CreateBackendFeatureLoaderOptions<TDeps>): BackendFeature;
|
|
2047
2047
|
|
|
2048
|
-
export {
|
|
2048
|
+
export { coreServices, createBackendFeatureLoader, createBackendModule, createBackendPlugin, createExtensionPoint, createServiceFactory, createServiceRef, isDatabaseConflictError, readSchedulerServiceTaskScheduleDefinitionFromConfig, resolvePackagePath, resolveSafeChildPath };
|
|
2049
|
+
export type { AuditorService, AuditorServiceCreateEventOptions, AuditorServiceEvent, AuditorServiceEventSeverityLevel, AuthService, BackendFeature, BackendModuleRegistrationPoints, BackendPluginRegistrationPoints, BackstageCredentials, BackstageNonePrincipal, BackstagePrincipalAccessRestrictions, BackstagePrincipalTypes, BackstageServicePrincipal, BackstageUserInfo, BackstageUserPrincipal, CacheService, CacheServiceOptions, CacheServiceSetOptions, CreateBackendFeatureLoaderOptions, CreateBackendModuleOptions, CreateBackendPluginOptions, CreateExtensionPointOptions, DatabaseService, DiscoveryService, ExtensionPoint, HttpAuthService, HttpRouterService, HttpRouterServiceAuthPolicy, LifecycleService, LifecycleServiceShutdownHook, LifecycleServiceShutdownOptions, LifecycleServiceStartupHook, LifecycleServiceStartupOptions, LoggerService, PermissionsRegistryService, PermissionsRegistryServiceAddResourceTypeOptions, PermissionsService, PermissionsServiceRequestOptions, PluginMetadataService, PluginServiceFactoryOptions, RootConfigService, RootHealthService, RootHttpRouterService, RootInstanceMetadataService, RootInstanceMetadataServicePluginInfo, RootLifecycleService, RootLoggerService, RootServiceFactoryOptions, SchedulerService, SchedulerServiceTaskDescriptor, SchedulerServiceTaskFunction, SchedulerServiceTaskInvocationDefinition, SchedulerServiceTaskRunner, SchedulerServiceTaskScheduleDefinition, SchedulerServiceTaskScheduleDefinitionConfig, ServiceFactory, ServiceRef, ServiceRefOptions, UrlReaderService, UrlReaderServiceReadTreeOptions, UrlReaderServiceReadTreeResponse, UrlReaderServiceReadTreeResponseDirOptions, UrlReaderServiceReadTreeResponseFile, UrlReaderServiceReadUrlOptions, UrlReaderServiceReadUrlResponse, UrlReaderServiceSearchOptions, UrlReaderServiceSearchResponse, UrlReaderServiceSearchResponseFile, UserInfoService };
|
package/dist/testUtils.d.ts
CHANGED
|
@@ -27,4 +27,5 @@ interface OverridePackagePathResolutionOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
declare function overridePackagePathResolution(options: OverridePackagePathResolutionOptions): PackagePathResolutionOverride;
|
|
29
29
|
|
|
30
|
-
export {
|
|
30
|
+
export { overridePackagePathResolution };
|
|
31
|
+
export type { OverridePackagePathResolutionOptions, PackagePathResolutionOverride };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-plugin-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-next.1",
|
|
4
4
|
"description": "Core API used by Backstage backend plugins",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"test": "backstage-cli package test"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@backstage/cli-common": "
|
|
69
|
-
"@backstage/config": "
|
|
70
|
-
"@backstage/errors": "
|
|
71
|
-
"@backstage/plugin-auth-node": "
|
|
72
|
-
"@backstage/plugin-permission-common": "
|
|
73
|
-
"@backstage/plugin-permission-node": "
|
|
74
|
-
"@backstage/types": "
|
|
68
|
+
"@backstage/cli-common": "0.1.16-next.2",
|
|
69
|
+
"@backstage/config": "1.3.6",
|
|
70
|
+
"@backstage/errors": "1.2.7",
|
|
71
|
+
"@backstage/plugin-auth-node": "0.6.10-next.1",
|
|
72
|
+
"@backstage/plugin-permission-common": "0.9.3",
|
|
73
|
+
"@backstage/plugin-permission-node": "0.10.7-next.1",
|
|
74
|
+
"@backstage/types": "1.2.2",
|
|
75
75
|
"@types/express": "^4.17.6",
|
|
76
76
|
"@types/json-schema": "^7.0.6",
|
|
77
77
|
"@types/luxon": "^3.0.0",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"zod": "^3.22.4"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@backstage/backend-test-utils": "
|
|
85
|
-
"@backstage/cli": "
|
|
84
|
+
"@backstage/backend-test-utils": "1.10.2-next.1",
|
|
85
|
+
"@backstage/cli": "0.35.0-next.2"
|
|
86
86
|
},
|
|
87
87
|
"configSchema": "config.d.ts"
|
|
88
88
|
}
|