@backstage/core-app-api 0.1.24 → 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 +46 -0
- package/dist/index.d.ts +15 -14
- package/dist/index.esm.js +220 -211
- package/dist/index.esm.js.map +1 -1
- package/package.json +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
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
|
+
|
|
3
49
|
## 0.1.24
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
@@ -189,7 +189,7 @@ declare type AuthApiCreateOptions = {
|
|
|
189
189
|
*/
|
|
190
190
|
declare class GithubAuth implements OAuthApi, SessionApi {
|
|
191
191
|
private readonly sessionManager;
|
|
192
|
-
static create(
|
|
192
|
+
static create(options: OAuthApiCreateOptions): GithubAuth;
|
|
193
193
|
/**
|
|
194
194
|
* @deprecated will be made private in the future. Use create method instead.
|
|
195
195
|
*/
|
|
@@ -209,7 +209,7 @@ declare class GithubAuth implements OAuthApi, SessionApi {
|
|
|
209
209
|
* @public
|
|
210
210
|
*/
|
|
211
211
|
declare class GitlabAuth {
|
|
212
|
-
static create(
|
|
212
|
+
static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/**
|
|
@@ -218,7 +218,7 @@ declare class GitlabAuth {
|
|
|
218
218
|
* @public
|
|
219
219
|
*/
|
|
220
220
|
declare class GoogleAuth {
|
|
221
|
-
static create(
|
|
221
|
+
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
|
@@ -250,7 +250,7 @@ declare type OAuth2CreateOptions = OAuthApiCreateOptions & {
|
|
|
250
250
|
* @public
|
|
251
251
|
*/
|
|
252
252
|
declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
253
|
-
static create(
|
|
253
|
+
static create(options: OAuth2CreateOptions): OAuth2;
|
|
254
254
|
private readonly sessionManager;
|
|
255
255
|
private readonly scopeTransform;
|
|
256
256
|
/**
|
|
@@ -276,7 +276,7 @@ declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, Back
|
|
|
276
276
|
* @public
|
|
277
277
|
*/
|
|
278
278
|
declare class OktaAuth {
|
|
279
|
-
static create(
|
|
279
|
+
static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
/**
|
|
@@ -297,7 +297,7 @@ declare type SamlSession = {
|
|
|
297
297
|
*/
|
|
298
298
|
declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
299
299
|
private readonly sessionManager;
|
|
300
|
-
static create(
|
|
300
|
+
static create(options: AuthApiCreateOptions): SamlAuth;
|
|
301
301
|
sessionState$(): Observable<SessionState>;
|
|
302
302
|
/**
|
|
303
303
|
* @deprecated will be made private in the future. Use create method instead.
|
|
@@ -315,7 +315,7 @@ declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionA
|
|
|
315
315
|
* @public
|
|
316
316
|
*/
|
|
317
317
|
declare class Auth0Auth {
|
|
318
|
-
static create(
|
|
318
|
+
static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
/**
|
|
@@ -324,7 +324,7 @@ declare class Auth0Auth {
|
|
|
324
324
|
* @public
|
|
325
325
|
*/
|
|
326
326
|
declare class MicrosoftAuth {
|
|
327
|
-
static create(
|
|
327
|
+
static create(options: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
|
@@ -345,7 +345,7 @@ declare type OneLoginAuthCreateOptions = {
|
|
|
345
345
|
* @public
|
|
346
346
|
*/
|
|
347
347
|
declare class OneLoginAuth {
|
|
348
|
-
static create(
|
|
348
|
+
static create(options: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T;
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/**
|
|
@@ -369,7 +369,7 @@ declare type BitbucketSession = {
|
|
|
369
369
|
* @public
|
|
370
370
|
*/
|
|
371
371
|
declare class BitbucketAuth {
|
|
372
|
-
static create(
|
|
372
|
+
static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
/**
|
|
@@ -378,7 +378,7 @@ declare class BitbucketAuth {
|
|
|
378
378
|
* @public
|
|
379
379
|
*/
|
|
380
380
|
declare class AtlassianAuth {
|
|
381
|
-
static create(
|
|
381
|
+
static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
/**
|
|
@@ -553,6 +553,7 @@ declare type BootErrorPageProps = {
|
|
|
553
553
|
* The outcome of signing in on the sign-in page.
|
|
554
554
|
*
|
|
555
555
|
* @public
|
|
556
|
+
* @deprecated replaced by passing the {@link @backstage/core-plugin-api#IdentityApi} to the {@link SignInPageProps.onSignInSuccess} instead.
|
|
556
557
|
*/
|
|
557
558
|
declare type SignInResult = {
|
|
558
559
|
/**
|
|
@@ -576,9 +577,9 @@ declare type SignInResult = {
|
|
|
576
577
|
*/
|
|
577
578
|
declare type SignInPageProps = {
|
|
578
579
|
/**
|
|
579
|
-
* Set the
|
|
580
|
+
* Set the IdentityApi on successful sign in. This should only be called once.
|
|
580
581
|
*/
|
|
581
|
-
|
|
582
|
+
onSignInSuccess(identityApi: IdentityApi): void;
|
|
582
583
|
};
|
|
583
584
|
/**
|
|
584
585
|
* Props for the fallback error boundary.
|