@backstage/core-app-api 0.1.22 → 0.2.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 +147 -0
- package/dist/index.d.ts +38 -23
- package/dist/index.esm.js +261 -220
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,152 @@
|
|
|
1
1
|
# @backstage/core-app-api
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c11ce4f552: Deprecated `Auth0Auth`, pointing to using `OAuth2` directly instead.
|
|
8
|
+
- 9d6503e86c: Switched out usage of deprecated `OAuthRequestApi` types from `@backstage/core-plugin-api`.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/core-plugin-api@0.3.1
|
|
11
|
+
- @backstage/core-components@0.8.1
|
|
12
|
+
|
|
13
|
+
## 0.2.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- a036b65c2f: **BREAKING CHANGE**
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
The following is an example of how you can migrate existing usage immediately using `UserIdentity.fromLegacy`:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
onResult(signInResult);
|
|
29
|
+
// becomes
|
|
30
|
+
onSignInSuccess(UserIdentity.fromLegacy(signInResult));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The following is an example of how implement the new `onSignInSuccess` callback of the `SignInPage` using `UserIdentity.create`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
const identityResponse = await authApi.getBackstageIdentity();
|
|
37
|
+
// Profile is optional and will be removed, but allows the
|
|
38
|
+
// synchronous getProfile method of the IdentityApi to be used.
|
|
39
|
+
const profile = await authApi.getProfile();
|
|
40
|
+
onSignInSuccess(
|
|
41
|
+
UserIdentity.create({
|
|
42
|
+
identity: identityResponse.identity,
|
|
43
|
+
authApi,
|
|
44
|
+
profile,
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- cd450844f6: Moved React dependencies to `peerDependencies` and allow both React v16 and v17 to be used.
|
|
52
|
+
- dcd1a0c3f4: Minor improvement to the API reports, by not unpacking arguments directly
|
|
53
|
+
- Updated dependencies
|
|
54
|
+
- @backstage/core-components@0.8.0
|
|
55
|
+
- @backstage/core-plugin-api@0.3.0
|
|
56
|
+
- @backstage/app-defaults@0.1.2
|
|
57
|
+
- @backstage/version-bridge@0.1.1
|
|
58
|
+
|
|
59
|
+
## 0.1.24
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- 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.
|
|
64
|
+
- Updated dependencies
|
|
65
|
+
- @backstage/core-components@0.7.6
|
|
66
|
+
- @backstage/theme@0.2.14
|
|
67
|
+
- @backstage/core-plugin-api@0.2.2
|
|
68
|
+
|
|
69
|
+
## 0.1.23
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- bab752e2b3: Change default port of backend from 7000 to 7007.
|
|
74
|
+
|
|
75
|
+
This is due to the AirPlay Receiver process occupying port 7000 and preventing local Backstage instances on MacOS to start.
|
|
76
|
+
|
|
77
|
+
You can change the port back to 7000 or any other value by providing an `app-config.yaml` with the following values:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
backend:
|
|
81
|
+
listen: 0.0.0.0:7123
|
|
82
|
+
baseUrl: http://localhost:7123
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
More information can be found here: https://backstage.io/docs/conf/writing
|
|
86
|
+
|
|
87
|
+
- 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`.
|
|
88
|
+
|
|
89
|
+
These two new helpers are more tailored for writing tests and development setups, as they allow for partial implementations of each of the APIs.
|
|
90
|
+
|
|
91
|
+
When migrating existing code it is typically best to prefer usage of `TestApiProvider` when possible, so for example the following code:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
render(
|
|
95
|
+
<ApiProvider
|
|
96
|
+
apis={ApiRegistry.from([
|
|
97
|
+
[identityApiRef, mockIdentityApi as unknown as IdentityApi]
|
|
98
|
+
])}
|
|
99
|
+
>
|
|
100
|
+
{...}
|
|
101
|
+
</ApiProvider>
|
|
102
|
+
)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Would be migrated to this:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
render(
|
|
109
|
+
<TestApiProvider apis={[[identityApiRef, mockIdentityApi]]}>
|
|
110
|
+
{...}
|
|
111
|
+
</TestApiProvider>
|
|
112
|
+
)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
117
|
+
Usage that looks like this:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const apis = ApiRegistry.with(
|
|
121
|
+
identityApiRef,
|
|
122
|
+
mockIdentityApi as unknown as IdentityApi,
|
|
123
|
+
).with(configApiRef, new ConfigReader({}));
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
OR like this:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const apis = ApiRegistry.from([
|
|
130
|
+
[identityApiRef, mockIdentityApi as unknown as IdentityApi],
|
|
131
|
+
[configApiRef, new ConfigReader({})],
|
|
132
|
+
]);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Would be migrated to this:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
const apis = TestApiRegistry.from(
|
|
139
|
+
[identityApiRef, mockIdentityApi],
|
|
140
|
+
[configApiRef, new ConfigReader({})],
|
|
141
|
+
);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
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`.
|
|
145
|
+
|
|
146
|
+
- Updated dependencies
|
|
147
|
+
- @backstage/core-plugin-api@0.2.1
|
|
148
|
+
- @backstage/core-components@0.7.5
|
|
149
|
+
|
|
3
150
|
## 0.1.22
|
|
4
151
|
|
|
5
152
|
### 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,
|
|
3
|
+
import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, ProfileInfo, BackstageIdentity, SessionState, OAuthRequestApi, DiscoveryApi, AuthProviderInfo, 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, OAuthRequesterOptions, OAuthRequester, PendingOAuthRequest, 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';
|
|
@@ -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;
|
|
@@ -176,9 +177,7 @@ declare type OAuthApiCreateOptions = AuthApiCreateOptions & {
|
|
|
176
177
|
declare type AuthApiCreateOptions = {
|
|
177
178
|
discoveryApi: DiscoveryApi;
|
|
178
179
|
environment?: string;
|
|
179
|
-
provider?:
|
|
180
|
-
id: string;
|
|
181
|
-
};
|
|
180
|
+
provider?: AuthProviderInfo;
|
|
182
181
|
};
|
|
183
182
|
|
|
184
183
|
/**
|
|
@@ -188,7 +187,7 @@ declare type AuthApiCreateOptions = {
|
|
|
188
187
|
*/
|
|
189
188
|
declare class GithubAuth implements OAuthApi, SessionApi {
|
|
190
189
|
private readonly sessionManager;
|
|
191
|
-
static create(
|
|
190
|
+
static create(options: OAuthApiCreateOptions): GithubAuth;
|
|
192
191
|
/**
|
|
193
192
|
* @deprecated will be made private in the future. Use create method instead.
|
|
194
193
|
*/
|
|
@@ -208,7 +207,7 @@ declare class GithubAuth implements OAuthApi, SessionApi {
|
|
|
208
207
|
* @public
|
|
209
208
|
*/
|
|
210
209
|
declare class GitlabAuth {
|
|
211
|
-
static create(
|
|
210
|
+
static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
|
212
211
|
}
|
|
213
212
|
|
|
214
213
|
/**
|
|
@@ -217,7 +216,7 @@ declare class GitlabAuth {
|
|
|
217
216
|
* @public
|
|
218
217
|
*/
|
|
219
218
|
declare class GoogleAuth {
|
|
220
|
-
static create(
|
|
219
|
+
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
|
221
220
|
}
|
|
222
221
|
|
|
223
222
|
/**
|
|
@@ -249,7 +248,7 @@ declare type OAuth2CreateOptions = OAuthApiCreateOptions & {
|
|
|
249
248
|
* @public
|
|
250
249
|
*/
|
|
251
250
|
declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
252
|
-
static create(
|
|
251
|
+
static create(options: OAuth2CreateOptions): OAuth2;
|
|
253
252
|
private readonly sessionManager;
|
|
254
253
|
private readonly scopeTransform;
|
|
255
254
|
/**
|
|
@@ -275,7 +274,7 @@ declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, Back
|
|
|
275
274
|
* @public
|
|
276
275
|
*/
|
|
277
276
|
declare class OktaAuth {
|
|
278
|
-
static create(
|
|
277
|
+
static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
/**
|
|
@@ -296,7 +295,7 @@ declare type SamlSession = {
|
|
|
296
295
|
*/
|
|
297
296
|
declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
298
297
|
private readonly sessionManager;
|
|
299
|
-
static create(
|
|
298
|
+
static create(options: AuthApiCreateOptions): SamlAuth;
|
|
300
299
|
sessionState$(): Observable<SessionState>;
|
|
301
300
|
/**
|
|
302
301
|
* @deprecated will be made private in the future. Use create method instead.
|
|
@@ -312,9 +311,26 @@ declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionA
|
|
|
312
311
|
* Implements the OAuth flow to Auth0 products.
|
|
313
312
|
*
|
|
314
313
|
* @public
|
|
314
|
+
* @deprecated Use {@link OAuth2} instead
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
*
|
|
318
|
+
* ```ts
|
|
319
|
+
* OAuth2.create({
|
|
320
|
+
* discoveryApi,
|
|
321
|
+
* oauthRequestApi,
|
|
322
|
+
* provider: {
|
|
323
|
+
* id: 'auth0',
|
|
324
|
+
* title: 'Auth0',
|
|
325
|
+
* icon: () => null,
|
|
326
|
+
* },
|
|
327
|
+
* defaultScopes: ['openid', 'email', 'profile'],
|
|
328
|
+
* environment: configApi.getOptionalString('auth.environment'),
|
|
329
|
+
* })
|
|
330
|
+
* ```
|
|
315
331
|
*/
|
|
316
332
|
declare class Auth0Auth {
|
|
317
|
-
static create(
|
|
333
|
+
static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
|
318
334
|
}
|
|
319
335
|
|
|
320
336
|
/**
|
|
@@ -323,7 +339,7 @@ declare class Auth0Auth {
|
|
|
323
339
|
* @public
|
|
324
340
|
*/
|
|
325
341
|
declare class MicrosoftAuth {
|
|
326
|
-
static create(
|
|
342
|
+
static create(options: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
|
327
343
|
}
|
|
328
344
|
|
|
329
345
|
/**
|
|
@@ -334,9 +350,7 @@ declare type OneLoginAuthCreateOptions = {
|
|
|
334
350
|
discoveryApi: DiscoveryApi;
|
|
335
351
|
oauthRequestApi: OAuthRequestApi;
|
|
336
352
|
environment?: string;
|
|
337
|
-
provider?:
|
|
338
|
-
id: string;
|
|
339
|
-
};
|
|
353
|
+
provider?: AuthProviderInfo;
|
|
340
354
|
};
|
|
341
355
|
/**
|
|
342
356
|
* Implements a OneLogin OAuth flow.
|
|
@@ -344,7 +358,7 @@ declare type OneLoginAuthCreateOptions = {
|
|
|
344
358
|
* @public
|
|
345
359
|
*/
|
|
346
360
|
declare class OneLoginAuth {
|
|
347
|
-
static create(
|
|
361
|
+
static create(options: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T;
|
|
348
362
|
}
|
|
349
363
|
|
|
350
364
|
/**
|
|
@@ -368,7 +382,7 @@ declare type BitbucketSession = {
|
|
|
368
382
|
* @public
|
|
369
383
|
*/
|
|
370
384
|
declare class BitbucketAuth {
|
|
371
|
-
static create(
|
|
385
|
+
static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
|
372
386
|
}
|
|
373
387
|
|
|
374
388
|
/**
|
|
@@ -377,7 +391,7 @@ declare class BitbucketAuth {
|
|
|
377
391
|
* @public
|
|
378
392
|
*/
|
|
379
393
|
declare class AtlassianAuth {
|
|
380
|
-
static create(
|
|
394
|
+
static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
|
381
395
|
}
|
|
382
396
|
|
|
383
397
|
/**
|
|
@@ -431,7 +445,7 @@ declare class UrlPatternDiscovery implements DiscoveryApi {
|
|
|
431
445
|
* interpolation done for the template is to replace instances of `{{pluginId}}`
|
|
432
446
|
* with the ID of the plugin being requested.
|
|
433
447
|
*
|
|
434
|
-
* Example pattern: `http://localhost:
|
|
448
|
+
* Example pattern: `http://localhost:7007/api/{{ pluginId }}`
|
|
435
449
|
*/
|
|
436
450
|
static compile(pattern: string): UrlPatternDiscovery;
|
|
437
451
|
private constructor();
|
|
@@ -510,9 +524,9 @@ declare class OAuthRequestManager implements OAuthRequestApi {
|
|
|
510
524
|
private readonly subject;
|
|
511
525
|
private currentRequests;
|
|
512
526
|
private handlerCount;
|
|
513
|
-
createAuthRequester<T>(options:
|
|
527
|
+
createAuthRequester<T>(options: OAuthRequesterOptions<T>): OAuthRequester<T>;
|
|
514
528
|
private makeAuthRequest;
|
|
515
|
-
authRequest$(): Observable<
|
|
529
|
+
authRequest$(): Observable<PendingOAuthRequest[]>;
|
|
516
530
|
}
|
|
517
531
|
|
|
518
532
|
/**
|
|
@@ -552,6 +566,7 @@ declare type BootErrorPageProps = {
|
|
|
552
566
|
* The outcome of signing in on the sign-in page.
|
|
553
567
|
*
|
|
554
568
|
* @public
|
|
569
|
+
* @deprecated replaced by passing the {@link @backstage/core-plugin-api#IdentityApi} to the {@link SignInPageProps.onSignInSuccess} instead.
|
|
555
570
|
*/
|
|
556
571
|
declare type SignInResult = {
|
|
557
572
|
/**
|
|
@@ -575,9 +590,9 @@ declare type SignInResult = {
|
|
|
575
590
|
*/
|
|
576
591
|
declare type SignInPageProps = {
|
|
577
592
|
/**
|
|
578
|
-
* Set the
|
|
593
|
+
* Set the IdentityApi on successful sign in. This should only be called once.
|
|
579
594
|
*/
|
|
580
|
-
|
|
595
|
+
onSignInSuccess(identityApi: IdentityApi): void;
|
|
581
596
|
};
|
|
582
597
|
/**
|
|
583
598
|
* Props for the fallback error boundary.
|