@backstage/core-app-api 0.1.21 → 0.2.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 +143 -0
- package/dist/index.d.ts +19 -17
- package/dist/index.esm.js +258 -220
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,148 @@
|
|
|
1
1
|
# @backstage/core-app-api
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a036b65c2f: **BREAKING CHANGE**
|
|
8
|
+
|
|
9
|
+
The app `SignInPage` component has been updated to switch out the `onResult` callback for a new `onSignInSuccess` callback. This is an immediate breaking change without any deprecation period, as it was deemed to be the way of making this change that had the lowest impact.
|
|
10
|
+
|
|
11
|
+
The new `onSignInSuccess` callback directly accepts an implementation of an `IdentityApi`, rather than a `SignInResult`. The `SignInPage` from `@backstage/core-component` has been updated to fit this new API, and as long as you pass on `props` directly you should not see any breakage.
|
|
12
|
+
|
|
13
|
+
However, if you implement your own custom `SignInPage`, then this will be a breaking change and you need to migrate over to using the new callback. While doing so you can take advantage of the `UserIdentity.fromLegacy` helper from `@backstage/core-components` to make the migration simpler by still using the `SignInResult` type. This helper is also deprecated though and is only provided for immediate migration. Long-term it will be necessary to build the `IdentityApi` using for example `UserIdentity.create` instead.
|
|
14
|
+
|
|
15
|
+
The following is an example of how you can migrate existing usage immediately using `UserIdentity.fromLegacy`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
onResult(signInResult);
|
|
19
|
+
// becomes
|
|
20
|
+
onSignInSuccess(UserIdentity.fromLegacy(signInResult));
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The following is an example of how implement the new `onSignInSuccess` callback of the `SignInPage` using `UserIdentity.create`:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const identityResponse = await authApi.getBackstageIdentity();
|
|
27
|
+
// Profile is optional and will be removed, but allows the
|
|
28
|
+
// synchronous getProfile method of the IdentityApi to be used.
|
|
29
|
+
const profile = await authApi.getProfile();
|
|
30
|
+
onSignInSuccess(
|
|
31
|
+
UserIdentity.create({
|
|
32
|
+
identity: identityResponse.identity,
|
|
33
|
+
authApi,
|
|
34
|
+
profile,
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- cd450844f6: Moved React dependencies to `peerDependencies` and allow both React v16 and v17 to be used.
|
|
42
|
+
- dcd1a0c3f4: Minor improvement to the API reports, by not unpacking arguments directly
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- @backstage/core-components@0.8.0
|
|
45
|
+
- @backstage/core-plugin-api@0.3.0
|
|
46
|
+
- @backstage/app-defaults@0.1.2
|
|
47
|
+
- @backstage/version-bridge@0.1.1
|
|
48
|
+
|
|
49
|
+
## 0.1.24
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- 0e7f256034: Fixed a bug where `useRouteRef` would fail in situations where relative navigation was needed and the app was is mounted on a sub-path. This would typically show up as a failure to navigate to a tab on an entity page.
|
|
54
|
+
- Updated dependencies
|
|
55
|
+
- @backstage/core-components@0.7.6
|
|
56
|
+
- @backstage/theme@0.2.14
|
|
57
|
+
- @backstage/core-plugin-api@0.2.2
|
|
58
|
+
|
|
59
|
+
## 0.1.23
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- bab752e2b3: Change default port of backend from 7000 to 7007.
|
|
64
|
+
|
|
65
|
+
This is due to the AirPlay Receiver process occupying port 7000 and preventing local Backstage instances on MacOS to start.
|
|
66
|
+
|
|
67
|
+
You can change the port back to 7000 or any other value by providing an `app-config.yaml` with the following values:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
backend:
|
|
71
|
+
listen: 0.0.0.0:7123
|
|
72
|
+
baseUrl: http://localhost:7123
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
More information can be found here: https://backstage.io/docs/conf/writing
|
|
76
|
+
|
|
77
|
+
- 000190de69: The `ApiRegistry` from `@backstage/core-app-api` class has been deprecated and will be removed in a future release. To replace it, we have introduced two new helpers that are exported from `@backstage/test-utils`, namely `TestApiProvider` and `TestApiRegistry`.
|
|
78
|
+
|
|
79
|
+
These two new helpers are more tailored for writing tests and development setups, as they allow for partial implementations of each of the APIs.
|
|
80
|
+
|
|
81
|
+
When migrating existing code it is typically best to prefer usage of `TestApiProvider` when possible, so for example the following code:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
render(
|
|
85
|
+
<ApiProvider
|
|
86
|
+
apis={ApiRegistry.from([
|
|
87
|
+
[identityApiRef, mockIdentityApi as unknown as IdentityApi]
|
|
88
|
+
])}
|
|
89
|
+
>
|
|
90
|
+
{...}
|
|
91
|
+
</ApiProvider>
|
|
92
|
+
)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Would be migrated to this:
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
render(
|
|
99
|
+
<TestApiProvider apis={[[identityApiRef, mockIdentityApi]]}>
|
|
100
|
+
{...}
|
|
101
|
+
</TestApiProvider>
|
|
102
|
+
)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
In cases where the `ApiProvider` is used in a more standalone way, for example to reuse a set of APIs across multiple tests, the `TestApiRegistry` can be used instead. Note that the `TestApiRegistry` only has a single static factory method, `.from()`, and it is slightly different from the existing `.from()` method on `ApiRegistry` in that it doesn't require the API pairs to be wrapped in an outer array.
|
|
106
|
+
|
|
107
|
+
Usage that looks like this:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const apis = ApiRegistry.with(
|
|
111
|
+
identityApiRef,
|
|
112
|
+
mockIdentityApi as unknown as IdentityApi,
|
|
113
|
+
).with(configApiRef, new ConfigReader({}));
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
OR like this:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
const apis = ApiRegistry.from([
|
|
120
|
+
[identityApiRef, mockIdentityApi as unknown as IdentityApi],
|
|
121
|
+
[configApiRef, new ConfigReader({})],
|
|
122
|
+
]);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Would be migrated to this:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
const apis = TestApiRegistry.from(
|
|
129
|
+
[identityApiRef, mockIdentityApi],
|
|
130
|
+
[configApiRef, new ConfigReader({})],
|
|
131
|
+
);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
If your app is still using the `ApiRegistry` to construct the `apis` for `createApp`, we recommend that you move over to use the new method of supplying API factories instead, using `createApiFactory`.
|
|
135
|
+
|
|
136
|
+
- Updated dependencies
|
|
137
|
+
- @backstage/core-plugin-api@0.2.1
|
|
138
|
+
- @backstage/core-components@0.7.5
|
|
139
|
+
|
|
140
|
+
## 0.1.22
|
|
141
|
+
|
|
142
|
+
### Patch Changes
|
|
143
|
+
|
|
144
|
+
- Reverted the `createApp` TypeScript type to match the one before version `0.1.21`, as it was an accidental breaking change.
|
|
145
|
+
|
|
3
146
|
## 0.1.21
|
|
4
147
|
|
|
5
148
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactNode, PropsWithChildren, ComponentType } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, ProfileInfo, BackstageIdentity, SessionState, OAuthRequestApi, DiscoveryApi, AuthProvider, OAuthApi, SessionApi, AuthRequestOptions, gitlabAuthApiRef, googleAuthApiRef, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, oktaAuthApiRef, auth0AuthApiRef, microsoftAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, atlassianAuthApiRef, AlertApi, AlertMessage, AnalyticsApi, AnalyticsEvent, AppThemeApi, AppTheme, ErrorApi, ErrorApiError, ErrorApiErrorContext, FeatureFlagsApi, FeatureFlag, FeatureFlagsSaveOptions, AuthRequesterOptions, AuthRequester, PendingAuthRequest, StorageApi, StorageValueChange, BackstagePlugin, IconComponent, ExternalRouteRef, PluginOutput, AnyApiFactory, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
|
|
3
|
+
import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, ProfileInfo, BackstageIdentity, SessionState, OAuthRequestApi, DiscoveryApi, AuthProvider, OAuthApi, SessionApi, AuthRequestOptions, gitlabAuthApiRef, googleAuthApiRef, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, oktaAuthApiRef, auth0AuthApiRef, microsoftAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, atlassianAuthApiRef, AlertApi, AlertMessage, AnalyticsApi, AnalyticsEvent, AppThemeApi, AppTheme, ErrorApi, ErrorApiError, ErrorApiErrorContext, FeatureFlagsApi, FeatureFlag, FeatureFlagsSaveOptions, AuthRequesterOptions, AuthRequester, PendingAuthRequest, StorageApi, StorageValueChange, IdentityApi, BackstagePlugin, IconComponent, ExternalRouteRef, PluginOutput, AnyApiFactory, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
|
|
4
4
|
import * as _backstage_types from '@backstage/types';
|
|
5
5
|
import { Observable } from '@backstage/types';
|
|
6
6
|
import { AppConfig } from '@backstage/config';
|
|
7
7
|
export { ConfigReader } from '@backstage/config';
|
|
8
|
-
import {
|
|
8
|
+
import { createApp as createApp$1 } from '@backstage/app-defaults';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Prop types for the ApiProvider component.
|
|
@@ -41,6 +41,7 @@ declare class ApiRegistryBuilder {
|
|
|
41
41
|
* A registry for utility APIs.
|
|
42
42
|
*
|
|
43
43
|
* @public
|
|
44
|
+
* @deprecated Will be removed, use {@link @backstage/test-utils#TestApiProvider} or {@link @backstage/test-utils#TestApiRegistry} instead.
|
|
44
45
|
*/
|
|
45
46
|
declare class ApiRegistry implements ApiHolder {
|
|
46
47
|
private readonly apis;
|
|
@@ -188,7 +189,7 @@ declare type AuthApiCreateOptions = {
|
|
|
188
189
|
*/
|
|
189
190
|
declare class GithubAuth implements OAuthApi, SessionApi {
|
|
190
191
|
private readonly sessionManager;
|
|
191
|
-
static create(
|
|
192
|
+
static create(options: OAuthApiCreateOptions): GithubAuth;
|
|
192
193
|
/**
|
|
193
194
|
* @deprecated will be made private in the future. Use create method instead.
|
|
194
195
|
*/
|
|
@@ -208,7 +209,7 @@ declare class GithubAuth implements OAuthApi, SessionApi {
|
|
|
208
209
|
* @public
|
|
209
210
|
*/
|
|
210
211
|
declare class GitlabAuth {
|
|
211
|
-
static create(
|
|
212
|
+
static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
/**
|
|
@@ -217,7 +218,7 @@ declare class GitlabAuth {
|
|
|
217
218
|
* @public
|
|
218
219
|
*/
|
|
219
220
|
declare class GoogleAuth {
|
|
220
|
-
static create(
|
|
221
|
+
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
/**
|
|
@@ -249,7 +250,7 @@ declare type OAuth2CreateOptions = OAuthApiCreateOptions & {
|
|
|
249
250
|
* @public
|
|
250
251
|
*/
|
|
251
252
|
declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
252
|
-
static create(
|
|
253
|
+
static create(options: OAuth2CreateOptions): OAuth2;
|
|
253
254
|
private readonly sessionManager;
|
|
254
255
|
private readonly scopeTransform;
|
|
255
256
|
/**
|
|
@@ -275,7 +276,7 @@ declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, Back
|
|
|
275
276
|
* @public
|
|
276
277
|
*/
|
|
277
278
|
declare class OktaAuth {
|
|
278
|
-
static create(
|
|
279
|
+
static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
/**
|
|
@@ -296,7 +297,7 @@ declare type SamlSession = {
|
|
|
296
297
|
*/
|
|
297
298
|
declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
298
299
|
private readonly sessionManager;
|
|
299
|
-
static create(
|
|
300
|
+
static create(options: AuthApiCreateOptions): SamlAuth;
|
|
300
301
|
sessionState$(): Observable<SessionState>;
|
|
301
302
|
/**
|
|
302
303
|
* @deprecated will be made private in the future. Use create method instead.
|
|
@@ -314,7 +315,7 @@ declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionA
|
|
|
314
315
|
* @public
|
|
315
316
|
*/
|
|
316
317
|
declare class Auth0Auth {
|
|
317
|
-
static create(
|
|
318
|
+
static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
|
318
319
|
}
|
|
319
320
|
|
|
320
321
|
/**
|
|
@@ -323,7 +324,7 @@ declare class Auth0Auth {
|
|
|
323
324
|
* @public
|
|
324
325
|
*/
|
|
325
326
|
declare class MicrosoftAuth {
|
|
326
|
-
static create(
|
|
327
|
+
static create(options: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
/**
|
|
@@ -344,7 +345,7 @@ declare type OneLoginAuthCreateOptions = {
|
|
|
344
345
|
* @public
|
|
345
346
|
*/
|
|
346
347
|
declare class OneLoginAuth {
|
|
347
|
-
static create(
|
|
348
|
+
static create(options: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T;
|
|
348
349
|
}
|
|
349
350
|
|
|
350
351
|
/**
|
|
@@ -368,7 +369,7 @@ declare type BitbucketSession = {
|
|
|
368
369
|
* @public
|
|
369
370
|
*/
|
|
370
371
|
declare class BitbucketAuth {
|
|
371
|
-
static create(
|
|
372
|
+
static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
|
372
373
|
}
|
|
373
374
|
|
|
374
375
|
/**
|
|
@@ -377,7 +378,7 @@ declare class BitbucketAuth {
|
|
|
377
378
|
* @public
|
|
378
379
|
*/
|
|
379
380
|
declare class AtlassianAuth {
|
|
380
|
-
static create(
|
|
381
|
+
static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
/**
|
|
@@ -431,7 +432,7 @@ declare class UrlPatternDiscovery implements DiscoveryApi {
|
|
|
431
432
|
* interpolation done for the template is to replace instances of `{{pluginId}}`
|
|
432
433
|
* with the ID of the plugin being requested.
|
|
433
434
|
*
|
|
434
|
-
* Example pattern: `http://localhost:
|
|
435
|
+
* Example pattern: `http://localhost:7007/api/{{ pluginId }}`
|
|
435
436
|
*/
|
|
436
437
|
static compile(pattern: string): UrlPatternDiscovery;
|
|
437
438
|
private constructor();
|
|
@@ -552,6 +553,7 @@ declare type BootErrorPageProps = {
|
|
|
552
553
|
* The outcome of signing in on the sign-in page.
|
|
553
554
|
*
|
|
554
555
|
* @public
|
|
556
|
+
* @deprecated replaced by passing the {@link @backstage/core-plugin-api#IdentityApi} to the {@link SignInPageProps.onSignInSuccess} instead.
|
|
555
557
|
*/
|
|
556
558
|
declare type SignInResult = {
|
|
557
559
|
/**
|
|
@@ -575,9 +577,9 @@ declare type SignInResult = {
|
|
|
575
577
|
*/
|
|
576
578
|
declare type SignInPageProps = {
|
|
577
579
|
/**
|
|
578
|
-
* Set the
|
|
580
|
+
* Set the IdentityApi on successful sign in. This should only be called once.
|
|
579
581
|
*/
|
|
580
|
-
|
|
582
|
+
onSignInSuccess(identityApi: IdentityApi): void;
|
|
581
583
|
};
|
|
582
584
|
/**
|
|
583
585
|
* Props for the fallback error boundary.
|
|
@@ -860,7 +862,7 @@ declare type AppContext = {
|
|
|
860
862
|
* @param options - A set of options for creating the app
|
|
861
863
|
* @public
|
|
862
864
|
*/
|
|
863
|
-
declare function createApp(options?:
|
|
865
|
+
declare function createApp(options?: Parameters<typeof createApp$1>[0]): BackstageApp & AppContext;
|
|
864
866
|
|
|
865
867
|
/**
|
|
866
868
|
* Creates a new Backstage App where the full set of options are required.
|