@backstage/core-app-api 0.1.23 → 0.3.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 +87 -0
- package/dist/index.d.ts +160 -116
- package/dist/index.esm.js +421 -248
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# @backstage/core-app-api
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a195284c7b: Updated `WebStorageApi` to reflect the `StorageApi` changes in `@backstage/core-plugin-api`.
|
|
8
|
+
- b3605da81c: - Removed deprecated definition `createApp` from `@backstage/core-app-api` which has been replaced by `@backstage/app-defaults#createApp`
|
|
9
|
+
- Removed deprecated type `BackstagePluginWithAnyOutput`
|
|
10
|
+
- Removed deprecated constructors for `GithubAuth`, `OAuth2`, and `SamlAuth` as the `create` method should be used instead
|
|
11
|
+
- 68f8b10ccd: - Removed deprecation configuration option `theme` from `AppTheme` of the `AppThemeApi`
|
|
12
|
+
- Removed reference to `theme` in the `app-defaults` default `AppTheme`
|
|
13
|
+
- Removed logic in `AppThemeProvider` that creates `ThemeProvider` from `appTheme.theme`
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 7927005152: Add `FetchApi` and related `fetchApiRef` which implement fetch, with an added Backstage token header when available.
|
|
18
|
+
- 518ddc00bc: Schema-validate local storage cached session info on load
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/app-defaults@0.1.3
|
|
21
|
+
- @backstage/core-plugin-api@0.4.0
|
|
22
|
+
- @backstage/core-components@0.8.2
|
|
23
|
+
|
|
24
|
+
## 0.2.1
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- c11ce4f552: Deprecated `Auth0Auth`, pointing to using `OAuth2` directly instead.
|
|
29
|
+
- 9d6503e86c: Switched out usage of deprecated `OAuthRequestApi` types from `@backstage/core-plugin-api`.
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
- @backstage/core-plugin-api@0.3.1
|
|
32
|
+
- @backstage/core-components@0.8.1
|
|
33
|
+
|
|
34
|
+
## 0.2.0
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- a036b65c2f: **BREAKING CHANGE**
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
The following is an example of how you can migrate existing usage immediately using `UserIdentity.fromLegacy`:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
onResult(signInResult);
|
|
50
|
+
// becomes
|
|
51
|
+
onSignInSuccess(UserIdentity.fromLegacy(signInResult));
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The following is an example of how implement the new `onSignInSuccess` callback of the `SignInPage` using `UserIdentity.create`:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const identityResponse = await authApi.getBackstageIdentity();
|
|
58
|
+
// Profile is optional and will be removed, but allows the
|
|
59
|
+
// synchronous getProfile method of the IdentityApi to be used.
|
|
60
|
+
const profile = await authApi.getProfile();
|
|
61
|
+
onSignInSuccess(
|
|
62
|
+
UserIdentity.create({
|
|
63
|
+
identity: identityResponse.identity,
|
|
64
|
+
authApi,
|
|
65
|
+
profile,
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- cd450844f6: Moved React dependencies to `peerDependencies` and allow both React v16 and v17 to be used.
|
|
73
|
+
- dcd1a0c3f4: Minor improvement to the API reports, by not unpacking arguments directly
|
|
74
|
+
- Updated dependencies
|
|
75
|
+
- @backstage/core-components@0.8.0
|
|
76
|
+
- @backstage/core-plugin-api@0.3.0
|
|
77
|
+
- @backstage/app-defaults@0.1.2
|
|
78
|
+
- @backstage/version-bridge@0.1.1
|
|
79
|
+
|
|
80
|
+
## 0.1.24
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- 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.
|
|
85
|
+
- Updated dependencies
|
|
86
|
+
- @backstage/core-components@0.7.6
|
|
87
|
+
- @backstage/theme@0.2.14
|
|
88
|
+
- @backstage/core-plugin-api@0.2.2
|
|
89
|
+
|
|
3
90
|
## 0.1.23
|
|
4
91
|
|
|
5
92
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ReactNode, PropsWithChildren, ComponentType } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, ProfileInfo, BackstageIdentity,
|
|
3
|
+
import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, ProfileInfo, BackstageIdentity, OAuthRequestApi, DiscoveryApi, AuthProviderInfo, OAuthApi, SessionApi, SessionState, AuthRequestOptions, gitlabAuthApiRef, googleAuthApiRef, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, oktaAuthApiRef, auth0AuthApiRef, microsoftAuthApiRef, oneloginAuthApiRef, bitbucketAuthApiRef, atlassianAuthApiRef, AlertApi, AlertMessage, AnalyticsApi, AnalyticsEvent, AppThemeApi, AppTheme, ErrorApi, ErrorApiError, ErrorApiErrorContext, FeatureFlagsApi, FeatureFlag, FeatureFlagsSaveOptions, FetchApi, IdentityApi, OAuthRequesterOptions, OAuthRequester, PendingOAuthRequest, StorageApi, StorageValueSnapshot, BackstagePlugin, IconComponent, ExternalRouteRef, AnyApiFactory, PluginOutput, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
|
|
4
4
|
import * as _backstage_types from '@backstage/types';
|
|
5
|
-
import { Observable } from '@backstage/types';
|
|
6
|
-
import { AppConfig } from '@backstage/config';
|
|
5
|
+
import { Observable, JsonValue } from '@backstage/types';
|
|
6
|
+
import { Config, AppConfig } from '@backstage/config';
|
|
7
7
|
export { ConfigReader } from '@backstage/config';
|
|
8
|
-
import { createApp as createApp$1 } from '@backstage/app-defaults';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Prop types for the ApiProvider component.
|
|
@@ -146,22 +145,6 @@ declare type GithubSession = {
|
|
|
146
145
|
backstageIdentity: BackstageIdentity;
|
|
147
146
|
};
|
|
148
147
|
|
|
149
|
-
declare type GetSessionOptions = {
|
|
150
|
-
optional?: boolean;
|
|
151
|
-
instantPopup?: boolean;
|
|
152
|
-
scopes?: Set<string>;
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* A sessions manager keeps track of the current session and makes sure that
|
|
156
|
-
* multiple simultaneous requests for sessions with different scope are handled
|
|
157
|
-
* in a correct way.
|
|
158
|
-
*/
|
|
159
|
-
declare type SessionManager<T> = {
|
|
160
|
-
getSession(options: GetSessionOptions): Promise<T | undefined>;
|
|
161
|
-
removeSession(): Promise<void>;
|
|
162
|
-
sessionState$(): Observable<SessionState>;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
148
|
/**
|
|
166
149
|
* Create options for OAuth APIs.
|
|
167
150
|
* @public
|
|
@@ -177,9 +160,7 @@ declare type OAuthApiCreateOptions = AuthApiCreateOptions & {
|
|
|
177
160
|
declare type AuthApiCreateOptions = {
|
|
178
161
|
discoveryApi: DiscoveryApi;
|
|
179
162
|
environment?: string;
|
|
180
|
-
provider?:
|
|
181
|
-
id: string;
|
|
182
|
-
};
|
|
163
|
+
provider?: AuthProviderInfo;
|
|
183
164
|
};
|
|
184
165
|
|
|
185
166
|
/**
|
|
@@ -189,11 +170,8 @@ declare type AuthApiCreateOptions = {
|
|
|
189
170
|
*/
|
|
190
171
|
declare class GithubAuth implements OAuthApi, SessionApi {
|
|
191
172
|
private readonly sessionManager;
|
|
192
|
-
static create(
|
|
193
|
-
|
|
194
|
-
* @deprecated will be made private in the future. Use create method instead.
|
|
195
|
-
*/
|
|
196
|
-
constructor(sessionManager: SessionManager<GithubSession>);
|
|
173
|
+
static create(options: OAuthApiCreateOptions): GithubAuth;
|
|
174
|
+
private constructor();
|
|
197
175
|
signIn(): Promise<void>;
|
|
198
176
|
signOut(): Promise<void>;
|
|
199
177
|
sessionState$(): Observable<SessionState>;
|
|
@@ -209,7 +187,7 @@ declare class GithubAuth implements OAuthApi, SessionApi {
|
|
|
209
187
|
* @public
|
|
210
188
|
*/
|
|
211
189
|
declare class GitlabAuth {
|
|
212
|
-
static create(
|
|
190
|
+
static create(options: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
|
213
191
|
}
|
|
214
192
|
|
|
215
193
|
/**
|
|
@@ -218,25 +196,9 @@ declare class GitlabAuth {
|
|
|
218
196
|
* @public
|
|
219
197
|
*/
|
|
220
198
|
declare class GoogleAuth {
|
|
221
|
-
static create(
|
|
199
|
+
static create(options: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
|
222
200
|
}
|
|
223
201
|
|
|
224
|
-
/**
|
|
225
|
-
* Session information for generic OAuth2 auth.
|
|
226
|
-
*
|
|
227
|
-
* @public
|
|
228
|
-
*/
|
|
229
|
-
declare type OAuth2Session = {
|
|
230
|
-
providerInfo: {
|
|
231
|
-
idToken: string;
|
|
232
|
-
accessToken: string;
|
|
233
|
-
scopes: Set<string>;
|
|
234
|
-
expiresAt: Date;
|
|
235
|
-
};
|
|
236
|
-
profile: ProfileInfo;
|
|
237
|
-
backstageIdentity: BackstageIdentity;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
202
|
/**
|
|
241
203
|
* OAuth2 create options.
|
|
242
204
|
* @public
|
|
@@ -250,16 +212,10 @@ declare type OAuth2CreateOptions = OAuthApiCreateOptions & {
|
|
|
250
212
|
* @public
|
|
251
213
|
*/
|
|
252
214
|
declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
253
|
-
static create(
|
|
215
|
+
static create(options: OAuth2CreateOptions): OAuth2;
|
|
254
216
|
private readonly sessionManager;
|
|
255
217
|
private readonly scopeTransform;
|
|
256
|
-
|
|
257
|
-
* @deprecated will be made private in the future. Use create method instead.
|
|
258
|
-
*/
|
|
259
|
-
constructor(options: {
|
|
260
|
-
sessionManager: SessionManager<OAuth2Session>;
|
|
261
|
-
scopeTransform: (scopes: string[]) => string[];
|
|
262
|
-
});
|
|
218
|
+
private constructor();
|
|
263
219
|
signIn(): Promise<void>;
|
|
264
220
|
signOut(): Promise<void>;
|
|
265
221
|
sessionState$(): Observable<SessionState>;
|
|
@@ -271,24 +227,29 @@ declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, Back
|
|
|
271
227
|
}
|
|
272
228
|
|
|
273
229
|
/**
|
|
274
|
-
*
|
|
230
|
+
* Session information for generic OAuth2 auth.
|
|
275
231
|
*
|
|
276
232
|
* @public
|
|
277
233
|
*/
|
|
278
|
-
declare
|
|
279
|
-
|
|
280
|
-
|
|
234
|
+
declare type OAuth2Session = {
|
|
235
|
+
providerInfo: {
|
|
236
|
+
idToken: string;
|
|
237
|
+
accessToken: string;
|
|
238
|
+
scopes: Set<string>;
|
|
239
|
+
expiresAt: Date;
|
|
240
|
+
};
|
|
241
|
+
profile: ProfileInfo;
|
|
242
|
+
backstageIdentity: BackstageIdentity;
|
|
243
|
+
};
|
|
281
244
|
|
|
282
245
|
/**
|
|
283
|
-
*
|
|
246
|
+
* Implements the OAuth flow to Okta products.
|
|
284
247
|
*
|
|
285
248
|
* @public
|
|
286
249
|
*/
|
|
287
|
-
declare
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
backstageIdentity: BackstageIdentity;
|
|
291
|
-
};
|
|
250
|
+
declare class OktaAuth {
|
|
251
|
+
static create(options: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
|
252
|
+
}
|
|
292
253
|
|
|
293
254
|
/**
|
|
294
255
|
* Implements a general SAML based auth flow.
|
|
@@ -297,25 +258,50 @@ declare type SamlSession = {
|
|
|
297
258
|
*/
|
|
298
259
|
declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
299
260
|
private readonly sessionManager;
|
|
300
|
-
static create(
|
|
261
|
+
static create(options: AuthApiCreateOptions): SamlAuth;
|
|
301
262
|
sessionState$(): Observable<SessionState>;
|
|
302
|
-
|
|
303
|
-
* @deprecated will be made private in the future. Use create method instead.
|
|
304
|
-
*/
|
|
305
|
-
constructor(sessionManager: SessionManager<SamlSession>);
|
|
263
|
+
private constructor();
|
|
306
264
|
signIn(): Promise<void>;
|
|
307
265
|
signOut(): Promise<void>;
|
|
308
266
|
getBackstageIdentity(options?: AuthRequestOptions): Promise<BackstageIdentity | undefined>;
|
|
309
267
|
getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
|
|
310
268
|
}
|
|
311
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Session information for SAML auth.
|
|
272
|
+
*
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
declare type SamlSession = {
|
|
276
|
+
userId: string;
|
|
277
|
+
profile: ProfileInfo;
|
|
278
|
+
backstageIdentity: BackstageIdentity;
|
|
279
|
+
};
|
|
280
|
+
|
|
312
281
|
/**
|
|
313
282
|
* Implements the OAuth flow to Auth0 products.
|
|
314
283
|
*
|
|
315
284
|
* @public
|
|
285
|
+
* @deprecated Use {@link OAuth2} instead
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
*
|
|
289
|
+
* ```ts
|
|
290
|
+
* OAuth2.create({
|
|
291
|
+
* discoveryApi,
|
|
292
|
+
* oauthRequestApi,
|
|
293
|
+
* provider: {
|
|
294
|
+
* id: 'auth0',
|
|
295
|
+
* title: 'Auth0',
|
|
296
|
+
* icon: () => null,
|
|
297
|
+
* },
|
|
298
|
+
* defaultScopes: ['openid', 'email', 'profile'],
|
|
299
|
+
* environment: configApi.getOptionalString('auth.environment'),
|
|
300
|
+
* })
|
|
301
|
+
* ```
|
|
316
302
|
*/
|
|
317
303
|
declare class Auth0Auth {
|
|
318
|
-
static create(
|
|
304
|
+
static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
|
319
305
|
}
|
|
320
306
|
|
|
321
307
|
/**
|
|
@@ -324,7 +310,7 @@ declare class Auth0Auth {
|
|
|
324
310
|
* @public
|
|
325
311
|
*/
|
|
326
312
|
declare class MicrosoftAuth {
|
|
327
|
-
static create(
|
|
313
|
+
static create(options: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
|
328
314
|
}
|
|
329
315
|
|
|
330
316
|
/**
|
|
@@ -335,9 +321,7 @@ declare type OneLoginAuthCreateOptions = {
|
|
|
335
321
|
discoveryApi: DiscoveryApi;
|
|
336
322
|
oauthRequestApi: OAuthRequestApi;
|
|
337
323
|
environment?: string;
|
|
338
|
-
provider?:
|
|
339
|
-
id: string;
|
|
340
|
-
};
|
|
324
|
+
provider?: AuthProviderInfo;
|
|
341
325
|
};
|
|
342
326
|
/**
|
|
343
327
|
* Implements a OneLogin OAuth flow.
|
|
@@ -345,7 +329,7 @@ declare type OneLoginAuthCreateOptions = {
|
|
|
345
329
|
* @public
|
|
346
330
|
*/
|
|
347
331
|
declare class OneLoginAuth {
|
|
348
|
-
static create(
|
|
332
|
+
static create(options: OneLoginAuthCreateOptions): typeof oneloginAuthApiRef.T;
|
|
349
333
|
}
|
|
350
334
|
|
|
351
335
|
/**
|
|
@@ -369,7 +353,7 @@ declare type BitbucketSession = {
|
|
|
369
353
|
* @public
|
|
370
354
|
*/
|
|
371
355
|
declare class BitbucketAuth {
|
|
372
|
-
static create(
|
|
356
|
+
static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
|
373
357
|
}
|
|
374
358
|
|
|
375
359
|
/**
|
|
@@ -378,7 +362,7 @@ declare class BitbucketAuth {
|
|
|
378
362
|
* @public
|
|
379
363
|
*/
|
|
380
364
|
declare class AtlassianAuth {
|
|
381
|
-
static create(
|
|
365
|
+
static create(options: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
|
382
366
|
}
|
|
383
367
|
|
|
384
368
|
/**
|
|
@@ -498,6 +482,87 @@ declare class LocalStorageFeatureFlags implements FeatureFlagsApi {
|
|
|
498
482
|
private load;
|
|
499
483
|
}
|
|
500
484
|
|
|
485
|
+
/**
|
|
486
|
+
* A middleware that modifies the behavior of an ongoing fetch.
|
|
487
|
+
*
|
|
488
|
+
* @public
|
|
489
|
+
*/
|
|
490
|
+
interface FetchMiddleware {
|
|
491
|
+
/**
|
|
492
|
+
* Applies this middleware to an inner implementation.
|
|
493
|
+
*
|
|
494
|
+
* @param next - The next, inner, implementation, that this middleware shall
|
|
495
|
+
* call out to as part of the request cycle.
|
|
496
|
+
*/
|
|
497
|
+
apply(next: typeof fetch): typeof fetch;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Builds a fetch API, based on the builtin fetch wrapped by a set of optional
|
|
502
|
+
* middleware implementations that add behaviors.
|
|
503
|
+
*
|
|
504
|
+
* @remarks
|
|
505
|
+
*
|
|
506
|
+
* The middleware are applied in reverse order, i.e. the last one will be
|
|
507
|
+
* "closest" to the base implementation. Passing in `[M1, M2, M3]` effectively
|
|
508
|
+
* leads to `M1(M2(M3(baseImplementation)))`.
|
|
509
|
+
*
|
|
510
|
+
* @public
|
|
511
|
+
*/
|
|
512
|
+
declare function createFetchApi(options: {
|
|
513
|
+
baseImplementation?: typeof fetch | undefined;
|
|
514
|
+
middleware?: FetchMiddleware | FetchMiddleware[] | undefined;
|
|
515
|
+
}): FetchApi;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* A collection of common middlewares for the FetchApi.
|
|
519
|
+
*
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
522
|
+
declare class FetchMiddlewares {
|
|
523
|
+
/**
|
|
524
|
+
* Handles translation from `plugin://` URLs to concrete http(s) URLs based on
|
|
525
|
+
* the discovery API.
|
|
526
|
+
*
|
|
527
|
+
* @remarks
|
|
528
|
+
*
|
|
529
|
+
* If the request is for `plugin://catalog/entities?filter=x=y`, the discovery
|
|
530
|
+
* API will be queried for `'catalog'`. If it returned
|
|
531
|
+
* `https://backstage.example.net/api/catalog`, the resulting query would be
|
|
532
|
+
* `https://backstage.example.net/api/catalog/entities?filter=x=y`.
|
|
533
|
+
*
|
|
534
|
+
* If the incoming URL protocol was not `plugin`, the request is just passed
|
|
535
|
+
* through verbatim to the underlying implementation.
|
|
536
|
+
*/
|
|
537
|
+
static resolvePluginProtocol(options: {
|
|
538
|
+
discoveryApi: DiscoveryApi;
|
|
539
|
+
}): FetchMiddleware;
|
|
540
|
+
/**
|
|
541
|
+
* Injects a Backstage token header when the user is signed in.
|
|
542
|
+
*
|
|
543
|
+
* @remarks
|
|
544
|
+
*
|
|
545
|
+
* Per default, an `Authorization: Bearer <token>` is generated. This can be
|
|
546
|
+
* customized using the `header` option.
|
|
547
|
+
*
|
|
548
|
+
* The header injection only happens on allowlisted URLs. Per default, if the
|
|
549
|
+
* `config` option is passed in, the `backend.baseUrl` is allowlisted, unless
|
|
550
|
+
* the `urlPrefixAllowlist` option is passed in, in which case it takes
|
|
551
|
+
* precedence. If you pass in neither config nor an allowlist, the middleware
|
|
552
|
+
* will have no effect.
|
|
553
|
+
*/
|
|
554
|
+
static injectIdentityAuth(options: {
|
|
555
|
+
identityApi: IdentityApi;
|
|
556
|
+
config?: Config;
|
|
557
|
+
urlPrefixAllowlist?: string[];
|
|
558
|
+
header?: {
|
|
559
|
+
name: string;
|
|
560
|
+
value: (backstageToken: string) => string;
|
|
561
|
+
};
|
|
562
|
+
}): FetchMiddleware;
|
|
563
|
+
private constructor();
|
|
564
|
+
}
|
|
565
|
+
|
|
501
566
|
/**
|
|
502
567
|
* The OAuthRequestManager is an implementation of the OAuthRequestApi.
|
|
503
568
|
*
|
|
@@ -511,9 +576,9 @@ declare class OAuthRequestManager implements OAuthRequestApi {
|
|
|
511
576
|
private readonly subject;
|
|
512
577
|
private currentRequests;
|
|
513
578
|
private handlerCount;
|
|
514
|
-
createAuthRequester<T>(options:
|
|
579
|
+
createAuthRequester<T>(options: OAuthRequesterOptions<T>): OAuthRequester<T>;
|
|
515
580
|
private makeAuthRequest;
|
|
516
|
-
authRequest$(): Observable<
|
|
581
|
+
authRequest$(): Observable<PendingOAuthRequest[]>;
|
|
517
582
|
}
|
|
518
583
|
|
|
519
584
|
/**
|
|
@@ -530,10 +595,11 @@ declare class WebStorage implements StorageApi {
|
|
|
530
595
|
namespace?: string;
|
|
531
596
|
}): WebStorage;
|
|
532
597
|
get<T>(key: string): T | undefined;
|
|
598
|
+
snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T>;
|
|
533
599
|
forBucket(name: string): WebStorage;
|
|
534
600
|
set<T>(key: string, data: T): Promise<void>;
|
|
535
601
|
remove(key: string): Promise<void>;
|
|
536
|
-
observe$<T>(key: string): Observable<
|
|
602
|
+
observe$<T>(key: string): Observable<StorageValueSnapshot<T>>;
|
|
537
603
|
private getKeyName;
|
|
538
604
|
private notifyChanges;
|
|
539
605
|
private subscribers;
|
|
@@ -553,6 +619,7 @@ declare type BootErrorPageProps = {
|
|
|
553
619
|
* The outcome of signing in on the sign-in page.
|
|
554
620
|
*
|
|
555
621
|
* @public
|
|
622
|
+
* @deprecated replaced by passing the {@link @backstage/core-plugin-api#IdentityApi} to the {@link SignInPageProps.onSignInSuccess} instead.
|
|
556
623
|
*/
|
|
557
624
|
declare type SignInResult = {
|
|
558
625
|
/**
|
|
@@ -576,9 +643,9 @@ declare type SignInResult = {
|
|
|
576
643
|
*/
|
|
577
644
|
declare type SignInPageProps = {
|
|
578
645
|
/**
|
|
579
|
-
* Set the
|
|
646
|
+
* Set the IdentityApi on successful sign in. This should only be called once.
|
|
580
647
|
*/
|
|
581
|
-
|
|
648
|
+
onSignInSuccess(identityApi: IdentityApi): void;
|
|
582
649
|
};
|
|
583
650
|
/**
|
|
584
651
|
* Props for the fallback error boundary.
|
|
@@ -680,7 +747,7 @@ declare type TargetRouteMap<ExternalRoutes extends {
|
|
|
680
747
|
};
|
|
681
748
|
/**
|
|
682
749
|
* A function that can bind from external routes of a given plugin, to concrete
|
|
683
|
-
* routes of other plugins. See {@link
|
|
750
|
+
* routes of other plugins. See {@link createSpecializedApp}.
|
|
684
751
|
*
|
|
685
752
|
* @public
|
|
686
753
|
*/
|
|
@@ -688,28 +755,7 @@ declare type AppRouteBinder = <ExternalRoutes extends {
|
|
|
688
755
|
[name: string]: ExternalRouteRef;
|
|
689
756
|
}>(externalRoutes: ExternalRoutes, targetRoutes: PartialKeys<TargetRouteMap<ExternalRoutes>, KeysWithType<ExternalRoutes, ExternalRouteRef<any, true>>>) => void;
|
|
690
757
|
/**
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
* @public
|
|
694
|
-
* @remarks
|
|
695
|
-
* @deprecated Will be removed
|
|
696
|
-
*
|
|
697
|
-
* The `type: string` type is there to handle output from newer or older plugin
|
|
698
|
-
* API versions that might not be supported by this version of the app API, but
|
|
699
|
-
* we don't want to break at the type checking level. We only use this more
|
|
700
|
-
* permissive type for the `createApp` options, as we otherwise want to stick
|
|
701
|
-
* to using the type for the outputs that we know about in this version of the
|
|
702
|
-
* app api.
|
|
703
|
-
*
|
|
704
|
-
* TODO(freben): This should be marked internal but that's not supported by the api report generation tools yet
|
|
705
|
-
*/
|
|
706
|
-
declare type BackstagePluginWithAnyOutput = Omit<BackstagePlugin<any, any>, 'output'> & {
|
|
707
|
-
output(): (PluginOutput | {
|
|
708
|
-
type: string;
|
|
709
|
-
})[];
|
|
710
|
-
};
|
|
711
|
-
/**
|
|
712
|
-
* The options accepted by {@link createApp}.
|
|
758
|
+
* The options accepted by {@link createSpecializedApp}.
|
|
713
759
|
*
|
|
714
760
|
* @public
|
|
715
761
|
*/
|
|
@@ -809,7 +855,7 @@ declare type AppOptions = {
|
|
|
809
855
|
}): void;
|
|
810
856
|
};
|
|
811
857
|
/**
|
|
812
|
-
* The public API of the output of {@link
|
|
858
|
+
* The public API of the output of {@link createSpecializedApp}.
|
|
813
859
|
*
|
|
814
860
|
* @public
|
|
815
861
|
*/
|
|
@@ -854,21 +900,19 @@ declare type AppContext = {
|
|
|
854
900
|
getComponents(): AppComponents;
|
|
855
901
|
};
|
|
856
902
|
|
|
857
|
-
/**
|
|
858
|
-
* Creates a new Backstage App.
|
|
859
|
-
*
|
|
860
|
-
* @deprecated Use {@link @backstage/app-defaults#createApp} from `@backstage/app-defaults` instead
|
|
861
|
-
* @param options - A set of options for creating the app
|
|
862
|
-
* @public
|
|
863
|
-
*/
|
|
864
|
-
declare function createApp(options?: Parameters<typeof createApp$1>[0]): BackstageApp & AppContext;
|
|
865
|
-
|
|
866
903
|
/**
|
|
867
904
|
* Creates a new Backstage App where the full set of options are required.
|
|
868
905
|
*
|
|
869
906
|
* @public
|
|
870
907
|
* @param options - A set of options for creating the app
|
|
871
908
|
* @returns
|
|
909
|
+
* @remarks
|
|
910
|
+
*
|
|
911
|
+
* You will most likely want to use {@link @backstage/app-defaults#createApp},
|
|
912
|
+
* however, this low-level API allows you to provide a full set of options,
|
|
913
|
+
* including your own `components`, `icons`, `defaultApis`, and `themes`. This
|
|
914
|
+
* is particularly useful if you are not using `@backstage/core-components` or
|
|
915
|
+
* MUI, as it allows you to avoid those dependencies completely.
|
|
872
916
|
*/
|
|
873
917
|
declare function createSpecializedApp(options: AppOptions): BackstageApp;
|
|
874
918
|
|
|
@@ -927,4 +971,4 @@ declare type FeatureFlaggedProps = {
|
|
|
927
971
|
*/
|
|
928
972
|
declare const FeatureFlagged: (props: FeatureFlaggedProps) => JSX.Element;
|
|
929
973
|
|
|
930
|
-
export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiFactoryScope, ApiProvider, ApiProviderProps, ApiRegistry, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppIcons, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, Auth0Auth, AuthApiCreateOptions, BackstageApp,
|
|
974
|
+
export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiFactoryScope, ApiProvider, ApiProviderProps, ApiRegistry, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppIcons, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, Auth0Auth, AuthApiCreateOptions, BackstageApp, BitbucketAuth, BitbucketSession, BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, ErrorBoundaryFallbackProps, FeatureFlagged, FeatureFlaggedProps, FetchMiddleware, FetchMiddlewares, FlatRoutes, FlatRoutesProps, GithubAuth, GithubSession, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuth2CreateOptions, OAuth2Session, OAuthApiCreateOptions, OAuthRequestManager, OktaAuth, OneLoginAuth, OneLoginAuthCreateOptions, SamlAuth, SamlSession, SignInPageProps, SignInResult, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
|