@backstage/backend-plugin-api 0.0.0-nightly-20251201025645 → 0.0.0-nightly-20251203024610

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,14 +1,14 @@
1
1
  # @backstage/backend-plugin-api
2
2
 
3
- ## 0.0.0-nightly-20251201025645
3
+ ## 0.0.0-nightly-20251203024610
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - 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`.
8
8
  - Updated dependencies
9
- - @backstage/plugin-auth-node@0.0.0-nightly-20251201025645
10
- - @backstage/cli-common@0.0.0-nightly-20251201025645
11
- - @backstage/plugin-permission-node@0.0.0-nightly-20251201025645
9
+ - @backstage/plugin-auth-node@0.0.0-nightly-20251203024610
10
+ - @backstage/plugin-permission-node@0.0.0-nightly-20251203024610
11
+ - @backstage/cli-common@0.0.0-nightly-20251203024610
12
12
  - @backstage/config@1.3.6
13
13
  - @backstage/errors@1.2.7
14
14
  - @backstage/types@1.2.2
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
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-plugin-api",
3
- "version": "0.0.0-nightly-20251201025645",
3
+ "version": "0.0.0-nightly-20251203024610",
4
4
  "description": "Core API used by Backstage backend plugins",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -65,12 +65,12 @@
65
65
  "test": "backstage-cli package test"
66
66
  },
67
67
  "dependencies": {
68
- "@backstage/cli-common": "0.0.0-nightly-20251201025645",
68
+ "@backstage/cli-common": "0.0.0-nightly-20251203024610",
69
69
  "@backstage/config": "1.3.6",
70
70
  "@backstage/errors": "1.2.7",
71
- "@backstage/plugin-auth-node": "0.0.0-nightly-20251201025645",
71
+ "@backstage/plugin-auth-node": "0.0.0-nightly-20251203024610",
72
72
  "@backstage/plugin-permission-common": "0.9.3",
73
- "@backstage/plugin-permission-node": "0.0.0-nightly-20251201025645",
73
+ "@backstage/plugin-permission-node": "0.0.0-nightly-20251203024610",
74
74
  "@backstage/types": "1.2.2",
75
75
  "@types/express": "^4.17.6",
76
76
  "@types/json-schema": "^7.0.6",
@@ -81,8 +81,8 @@
81
81
  "zod": "^3.22.4"
82
82
  },
83
83
  "devDependencies": {
84
- "@backstage/backend-test-utils": "0.0.0-nightly-20251201025645",
85
- "@backstage/cli": "0.0.0-nightly-20251201025645"
84
+ "@backstage/backend-test-utils": "0.0.0-nightly-20251203024610",
85
+ "@backstage/cli": "0.0.0-nightly-20251203024610"
86
86
  },
87
87
  "configSchema": "config.d.ts"
88
88
  }