@backstage/core-app-api 0.1.18 → 0.1.19
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 +14 -0
- package/dist/index.d.ts +250 -24
- package/dist/index.esm.js +2 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @backstage/core-app-api
|
|
2
2
|
|
|
3
|
+
## 0.1.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 10615525f3: Switch to use the json and observable types from `@backstage/types`
|
|
8
|
+
- 41c49884d2: Start using the new `@backstage/types` package. Initially, this means using the `Observable` and `Json*` types from there. The types also remain in their old places but deprecated, and will be removed in a future release.
|
|
9
|
+
- 925a967f36: Replace usage of test-utils-core with test-utils
|
|
10
|
+
- 6b615e92c8: Api cleanup, adding `@public` where necessary and tweaking some comments
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/config@0.1.11
|
|
13
|
+
- @backstage/theme@0.2.12
|
|
14
|
+
- @backstage/core-components@0.7.2
|
|
15
|
+
- @backstage/core-plugin-api@0.1.12
|
|
16
|
+
|
|
3
17
|
## 0.1.18
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactNode, ComponentType } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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, ErrorContext, FeatureFlagsApi, FeatureFlag, FeatureFlagsSaveOptions, AuthRequesterOptions, AuthRequester, PendingAuthRequest, StorageApi, StorageValueChange, IconComponent, BackstagePlugin, ExternalRouteRef, PluginOutput, AnyApiFactory, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import * as _backstage_types from '@backstage/types';
|
|
5
|
+
import { Observable } from '@backstage/types';
|
|
5
6
|
import { AppConfig } from '@backstage/config';
|
|
6
7
|
export { ConfigReader } from '@backstage/config';
|
|
7
8
|
|
|
@@ -9,8 +10,14 @@ declare type ApiProviderProps = {
|
|
|
9
10
|
apis: ApiHolder;
|
|
10
11
|
children: ReactNode;
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Provides an {@link @backstage/core-plugin-api#ApiHolder} for consumption in
|
|
15
|
+
* the React tree.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
12
19
|
declare const ApiProvider: {
|
|
13
|
-
(
|
|
20
|
+
(props: PropsWithChildren<ApiProviderProps>): JSX.Element;
|
|
14
21
|
propTypes: {
|
|
15
22
|
apis: PropTypes.Validator<PropTypes.InferProps<{
|
|
16
23
|
get: PropTypes.Validator<(...args: any[]) => any>;
|
|
@@ -25,34 +32,53 @@ declare class ApiRegistryBuilder {
|
|
|
25
32
|
add<T, I extends T>(api: ApiRef<T>, impl: I): I;
|
|
26
33
|
build(): ApiRegistry;
|
|
27
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* A registry for utility APIs.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
28
40
|
declare class ApiRegistry implements ApiHolder {
|
|
29
41
|
private readonly apis;
|
|
30
42
|
static builder(): ApiRegistryBuilder;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new ApiRegistry with a list of API implementations.
|
|
45
|
+
*
|
|
46
|
+
* @param apis - A list of pairs mapping an ApiRef to its respective implementation
|
|
47
|
+
*/
|
|
31
48
|
static from(apis: ApiImpl[]): ApiRegistry;
|
|
32
49
|
/**
|
|
33
50
|
* Creates a new ApiRegistry with a single API implementation.
|
|
34
51
|
*
|
|
35
|
-
* @param api ApiRef for the API to add
|
|
36
|
-
* @param impl Implementation of the API to add
|
|
52
|
+
* @param api - ApiRef for the API to add
|
|
53
|
+
* @param impl - Implementation of the API to add
|
|
37
54
|
*/
|
|
38
55
|
static with<T>(api: ApiRef<T>, impl: T): ApiRegistry;
|
|
39
56
|
constructor(apis: Map<string, unknown>);
|
|
40
57
|
/**
|
|
41
58
|
* Returns a new ApiRegistry with the provided API added to the existing ones.
|
|
42
59
|
*
|
|
43
|
-
* @param api ApiRef for the API to add
|
|
44
|
-
* @param impl Implementation of the API to add
|
|
60
|
+
* @param api - ApiRef for the API to add
|
|
61
|
+
* @param impl - Implementation of the API to add
|
|
45
62
|
*/
|
|
46
63
|
with<T>(api: ApiRef<T>, impl: T): ApiRegistry;
|
|
47
64
|
get<T>(api: ApiRef<T>): T | undefined;
|
|
48
65
|
}
|
|
49
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
50
70
|
declare type ApiFactoryHolder = {
|
|
51
71
|
get<T>(api: ApiRef<T>): ApiFactory<T, T, {
|
|
52
72
|
[key in string]: unknown;
|
|
53
73
|
}> | undefined;
|
|
54
74
|
};
|
|
55
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Handles the actual on-demand instantiation and memoization of APIs out of
|
|
78
|
+
* an {@link ApiFactoryHolder}.
|
|
79
|
+
*
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
56
82
|
declare class ApiResolver implements ApiHolder {
|
|
57
83
|
private readonly factories;
|
|
58
84
|
/**
|
|
@@ -74,6 +100,8 @@ declare type ApiFactoryScope = 'default' | 'app' | 'static';
|
|
|
74
100
|
*
|
|
75
101
|
* Each scope has an assigned priority, where factories registered with
|
|
76
102
|
* higher priority scopes override ones with lower priority.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
77
105
|
*/
|
|
78
106
|
declare class ApiFactoryRegistry implements ApiFactoryHolder {
|
|
79
107
|
private readonly factories;
|
|
@@ -93,6 +121,11 @@ declare class ApiFactoryRegistry implements ApiFactoryHolder {
|
|
|
93
121
|
getAllApis(): Set<AnyApiRef>;
|
|
94
122
|
}
|
|
95
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Session information for GitHub auth.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
96
129
|
declare type GithubSession = {
|
|
97
130
|
providerInfo: {
|
|
98
131
|
accessToken: string;
|
|
@@ -131,6 +164,11 @@ declare type AuthApiCreateOptions = {
|
|
|
131
164
|
};
|
|
132
165
|
};
|
|
133
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Implements the OAuth flow to GitHub products.
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
134
172
|
declare class GithubAuth implements OAuthApi, SessionApi {
|
|
135
173
|
private readonly sessionManager;
|
|
136
174
|
static create({ discoveryApi, environment, provider, oauthRequestApi, defaultScopes, }: OAuthApiCreateOptions): GithubAuth;
|
|
@@ -144,14 +182,29 @@ declare class GithubAuth implements OAuthApi, SessionApi {
|
|
|
144
182
|
static normalizeScope(scope?: string): Set<string>;
|
|
145
183
|
}
|
|
146
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Implements the OAuth flow to GitLab products.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
147
190
|
declare class GitlabAuth {
|
|
148
191
|
static create({ discoveryApi, environment, provider, oauthRequestApi, defaultScopes, }: OAuthApiCreateOptions): typeof gitlabAuthApiRef.T;
|
|
149
192
|
}
|
|
150
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Implements the OAuth flow to Google products.
|
|
196
|
+
*
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
151
199
|
declare class GoogleAuth {
|
|
152
200
|
static create({ discoveryApi, oauthRequestApi, environment, provider, defaultScopes, }: OAuthApiCreateOptions): typeof googleAuthApiRef.T;
|
|
153
201
|
}
|
|
154
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Session information for generic OAuth2 auth.
|
|
205
|
+
*
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
155
208
|
declare type OAuth2Session = {
|
|
156
209
|
providerInfo: {
|
|
157
210
|
idToken: string;
|
|
@@ -163,18 +216,22 @@ declare type OAuth2Session = {
|
|
|
163
216
|
backstageIdentity: BackstageIdentity;
|
|
164
217
|
};
|
|
165
218
|
|
|
166
|
-
declare type Options = {
|
|
167
|
-
sessionManager: SessionManager<OAuth2Session>;
|
|
168
|
-
scopeTransform: (scopes: string[]) => string[];
|
|
169
|
-
};
|
|
170
219
|
declare type CreateOptions$1 = OAuthApiCreateOptions & {
|
|
171
220
|
scopeTransform?: (scopes: string[]) => string[];
|
|
172
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* Implements a generic OAuth2 flow for auth.
|
|
224
|
+
*
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
173
227
|
declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
174
228
|
static create({ discoveryApi, environment, provider, oauthRequestApi, defaultScopes, scopeTransform, }: CreateOptions$1): OAuth2;
|
|
175
229
|
private readonly sessionManager;
|
|
176
230
|
private readonly scopeTransform;
|
|
177
|
-
constructor(options:
|
|
231
|
+
constructor(options: {
|
|
232
|
+
sessionManager: SessionManager<OAuth2Session>;
|
|
233
|
+
scopeTransform: (scopes: string[]) => string[];
|
|
234
|
+
});
|
|
178
235
|
signIn(): Promise<void>;
|
|
179
236
|
signOut(): Promise<void>;
|
|
180
237
|
sessionState$(): Observable<SessionState>;
|
|
@@ -185,16 +242,31 @@ declare class OAuth2 implements OAuthApi, OpenIdConnectApi, ProfileInfoApi, Back
|
|
|
185
242
|
private static normalizeScopes;
|
|
186
243
|
}
|
|
187
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Implements the OAuth flow to Okta products.
|
|
247
|
+
*
|
|
248
|
+
* @public
|
|
249
|
+
*/
|
|
188
250
|
declare class OktaAuth {
|
|
189
251
|
static create({ discoveryApi, environment, provider, oauthRequestApi, defaultScopes, }: OAuthApiCreateOptions): typeof oktaAuthApiRef.T;
|
|
190
252
|
}
|
|
191
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Session information for SAML auth.
|
|
256
|
+
*
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
192
259
|
declare type SamlSession = {
|
|
193
260
|
userId: string;
|
|
194
261
|
profile: ProfileInfo;
|
|
195
262
|
backstageIdentity: BackstageIdentity;
|
|
196
263
|
};
|
|
197
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Implements a general SAML based auth flow.
|
|
267
|
+
*
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
198
270
|
declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionApi {
|
|
199
271
|
private readonly sessionManager;
|
|
200
272
|
static create({ discoveryApi, environment, provider, }: AuthApiCreateOptions): SamlAuth;
|
|
@@ -206,10 +278,20 @@ declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionA
|
|
|
206
278
|
getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
|
|
207
279
|
}
|
|
208
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Implements the OAuth flow to Auth0 products.
|
|
283
|
+
*
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
209
286
|
declare class Auth0Auth {
|
|
210
287
|
static create({ discoveryApi, environment, provider, oauthRequestApi, defaultScopes, }: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
|
|
211
288
|
}
|
|
212
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Implements the OAuth flow to Microsoft products.
|
|
292
|
+
*
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
213
295
|
declare class MicrosoftAuth {
|
|
214
296
|
static create({ environment, provider, oauthRequestApi, discoveryApi, defaultScopes, }: OAuthApiCreateOptions): typeof microsoftAuthApiRef.T;
|
|
215
297
|
}
|
|
@@ -222,10 +304,20 @@ declare type CreateOptions = {
|
|
|
222
304
|
id: string;
|
|
223
305
|
};
|
|
224
306
|
};
|
|
307
|
+
/**
|
|
308
|
+
* Implements a OneLogin OAuth flow.
|
|
309
|
+
*
|
|
310
|
+
* @public
|
|
311
|
+
*/
|
|
225
312
|
declare class OneLoginAuth {
|
|
226
313
|
static create({ discoveryApi, environment, provider, oauthRequestApi, }: CreateOptions): typeof oneloginAuthApiRef.T;
|
|
227
314
|
}
|
|
228
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Session information for Bitbucket auth.
|
|
318
|
+
*
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
229
321
|
declare type BitbucketSession = {
|
|
230
322
|
providerInfo: {
|
|
231
323
|
accessToken: string;
|
|
@@ -236,16 +328,28 @@ declare type BitbucketSession = {
|
|
|
236
328
|
backstageIdentity: BackstageIdentity;
|
|
237
329
|
};
|
|
238
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Implements the OAuth flow to Bitbucket products.
|
|
333
|
+
*
|
|
334
|
+
* @public
|
|
335
|
+
*/
|
|
239
336
|
declare class BitbucketAuth {
|
|
240
337
|
static create({ discoveryApi, environment, provider, oauthRequestApi, defaultScopes, }: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T;
|
|
241
338
|
}
|
|
242
339
|
|
|
340
|
+
/**
|
|
341
|
+
* Implements the OAuth flow to Atlassian products.
|
|
342
|
+
*
|
|
343
|
+
* @public
|
|
344
|
+
*/
|
|
243
345
|
declare class AtlassianAuth {
|
|
244
346
|
static create({ discoveryApi, environment, provider, oauthRequestApi, }: OAuthApiCreateOptions): typeof atlassianAuthApiRef.T;
|
|
245
347
|
}
|
|
246
348
|
|
|
247
349
|
/**
|
|
248
350
|
* Base implementation for the AlertApi that simply forwards alerts to consumers.
|
|
351
|
+
*
|
|
352
|
+
* @public
|
|
249
353
|
*/
|
|
250
354
|
declare class AlertApiForwarder implements AlertApi {
|
|
251
355
|
private readonly subject;
|
|
@@ -255,11 +359,19 @@ declare class AlertApiForwarder implements AlertApi {
|
|
|
255
359
|
|
|
256
360
|
/**
|
|
257
361
|
* Base implementation for the AnalyticsApi that does nothing.
|
|
362
|
+
*
|
|
363
|
+
* @public
|
|
258
364
|
*/
|
|
259
365
|
declare class NoOpAnalyticsApi implements AnalyticsApi {
|
|
260
366
|
captureEvent(_event: AnalyticsEvent): void;
|
|
261
367
|
}
|
|
262
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Exposes the themes installed in the app, and permits switching the currently
|
|
371
|
+
* active theme.
|
|
372
|
+
*
|
|
373
|
+
* @public
|
|
374
|
+
*/
|
|
263
375
|
declare class AppThemeSelector implements AppThemeApi {
|
|
264
376
|
private readonly themes;
|
|
265
377
|
static createWithStorage(themes: AppTheme[]): AppThemeSelector;
|
|
@@ -275,6 +387,8 @@ declare class AppThemeSelector implements AppThemeApi {
|
|
|
275
387
|
/**
|
|
276
388
|
* UrlPatternDiscovery is a lightweight DiscoveryApi implementation.
|
|
277
389
|
* It uses a single template string to construct URLs for each plugin.
|
|
390
|
+
*
|
|
391
|
+
* @public
|
|
278
392
|
*/
|
|
279
393
|
declare class UrlPatternDiscovery implements DiscoveryApi {
|
|
280
394
|
private readonly parts;
|
|
@@ -293,13 +407,15 @@ declare class UrlPatternDiscovery implements DiscoveryApi {
|
|
|
293
407
|
/**
|
|
294
408
|
* Decorates an ErrorApi by also forwarding error messages
|
|
295
409
|
* to the alertApi with an 'error' severity.
|
|
410
|
+
*
|
|
411
|
+
* @public
|
|
296
412
|
*/
|
|
297
413
|
declare class ErrorAlerter implements ErrorApi {
|
|
298
414
|
private readonly alertApi;
|
|
299
415
|
private readonly errorApi;
|
|
300
416
|
constructor(alertApi: AlertApi, errorApi: ErrorApi);
|
|
301
417
|
post(error: Error, context?: ErrorContext): void;
|
|
302
|
-
error$():
|
|
418
|
+
error$(): _backstage_types.Observable<{
|
|
303
419
|
error: {
|
|
304
420
|
name: string;
|
|
305
421
|
message: string;
|
|
@@ -311,6 +427,8 @@ declare class ErrorAlerter implements ErrorApi {
|
|
|
311
427
|
|
|
312
428
|
/**
|
|
313
429
|
* Base implementation for the ErrorApi that simply forwards errors to consumers.
|
|
430
|
+
*
|
|
431
|
+
* @public
|
|
314
432
|
*/
|
|
315
433
|
declare class ErrorApiForwarder implements ErrorApi {
|
|
316
434
|
private readonly subject;
|
|
@@ -321,6 +439,11 @@ declare class ErrorApiForwarder implements ErrorApi {
|
|
|
321
439
|
}>;
|
|
322
440
|
}
|
|
323
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Utility class that helps with error forwarding.
|
|
444
|
+
*
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
324
447
|
declare class UnhandledErrorForwarder {
|
|
325
448
|
/**
|
|
326
449
|
* Add event listener, such that unhandled errors can be forwarded using an given `ErrorApi` instance
|
|
@@ -329,7 +452,10 @@ declare class UnhandledErrorForwarder {
|
|
|
329
452
|
}
|
|
330
453
|
|
|
331
454
|
/**
|
|
332
|
-
*
|
|
455
|
+
* A feature flags implementation that stores the flags in the browser's local
|
|
456
|
+
* storage.
|
|
457
|
+
*
|
|
458
|
+
* @public
|
|
333
459
|
*/
|
|
334
460
|
declare class LocalStorageFeatureFlags implements FeatureFlagsApi {
|
|
335
461
|
private registeredFeatureFlags;
|
|
@@ -347,6 +473,8 @@ declare class LocalStorageFeatureFlags implements FeatureFlagsApi {
|
|
|
347
473
|
* The purpose of this class and the API is to read a stream of incoming requests
|
|
348
474
|
* of OAuth access tokens from different providers with varying scope, and funnel
|
|
349
475
|
* them all together into a single request for each OAuth provider.
|
|
476
|
+
*
|
|
477
|
+
* @public
|
|
350
478
|
*/
|
|
351
479
|
declare class OAuthRequestManager implements OAuthRequestApi {
|
|
352
480
|
private readonly subject;
|
|
@@ -357,15 +485,19 @@ declare class OAuthRequestManager implements OAuthRequestApi {
|
|
|
357
485
|
authRequest$(): Observable<PendingAuthRequest[]>;
|
|
358
486
|
}
|
|
359
487
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
488
|
+
/**
|
|
489
|
+
* An implementation of the storage API, that uses the browser's local storage.
|
|
490
|
+
*
|
|
491
|
+
* @public
|
|
492
|
+
*/
|
|
364
493
|
declare class WebStorage implements StorageApi {
|
|
365
494
|
private readonly namespace;
|
|
366
495
|
private readonly errorApi;
|
|
367
496
|
constructor(namespace: string, errorApi: ErrorApi);
|
|
368
|
-
static create(options:
|
|
497
|
+
static create(options: {
|
|
498
|
+
errorApi: ErrorApi;
|
|
499
|
+
namespace?: string;
|
|
500
|
+
}): WebStorage;
|
|
369
501
|
get<T>(key: string): T | undefined;
|
|
370
502
|
forBucket(name: string): WebStorage;
|
|
371
503
|
set<T>(key: string, data: T): Promise<void>;
|
|
@@ -382,10 +514,20 @@ declare type AppIcons = {
|
|
|
382
514
|
[key in AppIconsKey]: IconComponent;
|
|
383
515
|
};
|
|
384
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Props for the `BootErrorPage` component of {@link AppComponents}.
|
|
519
|
+
*
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
385
522
|
declare type BootErrorPageProps = {
|
|
386
523
|
step: 'load-config' | 'load-chunk';
|
|
387
524
|
error: Error;
|
|
388
525
|
};
|
|
526
|
+
/**
|
|
527
|
+
* The outcome of signing in on the sign-in page.
|
|
528
|
+
*
|
|
529
|
+
* @public
|
|
530
|
+
*/
|
|
389
531
|
declare type SignInResult = {
|
|
390
532
|
/**
|
|
391
533
|
* User ID that will be returned by the IdentityApi
|
|
@@ -401,17 +543,32 @@ declare type SignInResult = {
|
|
|
401
543
|
*/
|
|
402
544
|
signOut?: () => Promise<void>;
|
|
403
545
|
};
|
|
546
|
+
/**
|
|
547
|
+
* Props for the `SignInPage` component of {@link AppComponents}.
|
|
548
|
+
*
|
|
549
|
+
* @public
|
|
550
|
+
*/
|
|
404
551
|
declare type SignInPageProps = {
|
|
405
552
|
/**
|
|
406
553
|
* Set the sign-in result for the app. This should only be called once.
|
|
407
554
|
*/
|
|
408
555
|
onResult(result: SignInResult): void;
|
|
409
556
|
};
|
|
557
|
+
/**
|
|
558
|
+
* Props for the fallback error boundary.
|
|
559
|
+
*
|
|
560
|
+
* @public
|
|
561
|
+
*/
|
|
410
562
|
declare type ErrorBoundaryFallbackProps = {
|
|
411
563
|
plugin?: BackstagePlugin;
|
|
412
564
|
error: Error;
|
|
413
565
|
resetError: () => void;
|
|
414
566
|
};
|
|
567
|
+
/**
|
|
568
|
+
* A set of replaceable core components that are part of every Backstage app.
|
|
569
|
+
*
|
|
570
|
+
* @public
|
|
571
|
+
*/
|
|
415
572
|
declare type AppComponents = {
|
|
416
573
|
NotFoundErrorPage: ComponentType<{}>;
|
|
417
574
|
BootErrorPage: ComponentType<BootErrorPageProps>;
|
|
@@ -435,6 +592,8 @@ declare type AppComponents = {
|
|
|
435
592
|
*
|
|
436
593
|
* If multiple config objects are returned in the array, values in the earlier configs
|
|
437
594
|
* will override later ones.
|
|
595
|
+
*
|
|
596
|
+
* @public
|
|
438
597
|
*/
|
|
439
598
|
declare type AppConfigLoader = () => Promise<AppConfig[]>;
|
|
440
599
|
/**
|
|
@@ -459,15 +618,40 @@ declare type TargetRouteMap<ExternalRoutes extends {
|
|
|
459
618
|
}> = {
|
|
460
619
|
[name in keyof ExternalRoutes]: ExternalRoutes[name] extends ExternalRouteRef<infer Params, any> ? RouteRef<Params> | SubRouteRef<Params> : never;
|
|
461
620
|
};
|
|
621
|
+
/**
|
|
622
|
+
* A function that can bind from external routes of a given plugin, to concrete
|
|
623
|
+
* routes of other plugins. See {@link createApp}.
|
|
624
|
+
*
|
|
625
|
+
* @public
|
|
626
|
+
*/
|
|
462
627
|
declare type AppRouteBinder = <ExternalRoutes extends {
|
|
463
628
|
[name: string]: ExternalRouteRef;
|
|
464
629
|
}>(externalRoutes: ExternalRoutes, targetRoutes: PartialKeys<TargetRouteMap<ExternalRoutes>, KeysWithType<ExternalRoutes, ExternalRouteRef<any, true>>>) => void;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
630
|
+
/**
|
|
631
|
+
* Internal helper type that represents a plugin with any type of output.
|
|
632
|
+
*
|
|
633
|
+
* @public
|
|
634
|
+
* @remarks
|
|
635
|
+
*
|
|
636
|
+
* The `type: string` type is there to handle output from newer or older plugin
|
|
637
|
+
* API versions that might not be supported by this version of the app API, but
|
|
638
|
+
* we don't want to break at the type checking level. We only use this more
|
|
639
|
+
* permissive type for the `createApp` options, as we otherwise want to stick
|
|
640
|
+
* to using the type for the outputs that we know about in this version of the
|
|
641
|
+
* app api.
|
|
642
|
+
*
|
|
643
|
+
* TODO(freben): This should be marked internal but that's not supported by the api report generation tools yet
|
|
644
|
+
*/
|
|
468
645
|
declare type BackstagePluginWithAnyOutput = Omit<BackstagePlugin<any, any>, 'output'> & {
|
|
469
|
-
output(): (PluginOutput |
|
|
646
|
+
output(): (PluginOutput | {
|
|
647
|
+
type: string;
|
|
648
|
+
})[];
|
|
470
649
|
};
|
|
650
|
+
/**
|
|
651
|
+
* The options accepted by {@link createApp}.
|
|
652
|
+
*
|
|
653
|
+
* @public
|
|
654
|
+
*/
|
|
471
655
|
declare type AppOptions = {
|
|
472
656
|
/**
|
|
473
657
|
* A collection of ApiFactories to register in the application to either
|
|
@@ -543,6 +727,11 @@ declare type AppOptions = {
|
|
|
543
727
|
bind: AppRouteBinder;
|
|
544
728
|
}): void;
|
|
545
729
|
};
|
|
730
|
+
/**
|
|
731
|
+
* The public API of the output of {@link createApp}.
|
|
732
|
+
*
|
|
733
|
+
* @public
|
|
734
|
+
*/
|
|
546
735
|
declare type BackstageApp = {
|
|
547
736
|
/**
|
|
548
737
|
* Returns all plugins registered for the app.
|
|
@@ -563,6 +752,12 @@ declare type BackstageApp = {
|
|
|
563
752
|
*/
|
|
564
753
|
getRouter(): ComponentType<{}>;
|
|
565
754
|
};
|
|
755
|
+
/**
|
|
756
|
+
* The central context providing runtime app specific state that plugin views
|
|
757
|
+
* want to consume.
|
|
758
|
+
*
|
|
759
|
+
* @public
|
|
760
|
+
*/
|
|
566
761
|
declare type AppContext = {
|
|
567
762
|
/**
|
|
568
763
|
* Get a list of all plugins that are installed in the app.
|
|
@@ -620,18 +815,43 @@ declare class PrivateAppImpl implements BackstageApp {
|
|
|
620
815
|
* which can be rewritten at runtime to contain an additional JSON config object.
|
|
621
816
|
* If runtime config is present, it will be placed first in the config array, overriding
|
|
622
817
|
* other config values.
|
|
818
|
+
*
|
|
819
|
+
* @public
|
|
623
820
|
*/
|
|
624
821
|
declare const defaultConfigLoader: AppConfigLoader;
|
|
625
822
|
/**
|
|
626
823
|
* Creates a new Backstage App.
|
|
824
|
+
*
|
|
825
|
+
* @public
|
|
627
826
|
*/
|
|
628
827
|
declare function createApp(options?: AppOptions): PrivateAppImpl;
|
|
629
828
|
|
|
829
|
+
/**
|
|
830
|
+
* Props for the {@link FlatRoutes} component.
|
|
831
|
+
*
|
|
832
|
+
* @public
|
|
833
|
+
*/
|
|
630
834
|
declare type FlatRoutesProps = {
|
|
631
835
|
children: ReactNode;
|
|
632
836
|
};
|
|
837
|
+
/**
|
|
838
|
+
* A wrapper around a set of routes.
|
|
839
|
+
*
|
|
840
|
+
* @remarks
|
|
841
|
+
*
|
|
842
|
+
* The root of the routing hierarchy in your app should use this component,
|
|
843
|
+
* instead of the one from `react-router-dom`. This ensures that all of the
|
|
844
|
+
* plugin route and utility API wiring happens under the hood.
|
|
845
|
+
*
|
|
846
|
+
* @public
|
|
847
|
+
*/
|
|
633
848
|
declare const FlatRoutes: (props: FlatRoutesProps) => JSX.Element | null;
|
|
634
849
|
|
|
850
|
+
/**
|
|
851
|
+
* Props for the {@link FeatureFlagged} component.
|
|
852
|
+
*
|
|
853
|
+
* @public
|
|
854
|
+
*/
|
|
635
855
|
declare type FeatureFlaggedProps = {
|
|
636
856
|
children: ReactNode;
|
|
637
857
|
} & ({
|
|
@@ -639,6 +859,12 @@ declare type FeatureFlaggedProps = {
|
|
|
639
859
|
} | {
|
|
640
860
|
without: string;
|
|
641
861
|
});
|
|
862
|
+
/**
|
|
863
|
+
* Enables or disables rendering of its children based on the state of a given
|
|
864
|
+
* feature flag.
|
|
865
|
+
*
|
|
866
|
+
* @public
|
|
867
|
+
*/
|
|
642
868
|
declare const FeatureFlagged: (props: FeatureFlaggedProps) => JSX.Element;
|
|
643
869
|
|
|
644
|
-
export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiProvider, ApiRegistry, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, Auth0Auth, BackstageApp, BackstagePluginWithAnyOutput, BitbucketAuth, BitbucketSession, BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, ErrorBoundaryFallbackProps, FeatureFlagged, FeatureFlaggedProps, FlatRoutes, GithubAuth, GithubSession, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuth2Session, OAuthRequestManager, OktaAuth, OneLoginAuth, SamlAuth, SignInPageProps, SignInResult, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createApp, defaultConfigLoader };
|
|
870
|
+
export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiProvider, ApiRegistry, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, Auth0Auth, BackstageApp, BackstagePluginWithAnyOutput, BitbucketAuth, BitbucketSession, BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, ErrorBoundaryFallbackProps, FeatureFlagged, FeatureFlaggedProps, FlatRoutes, FlatRoutesProps, GithubAuth, GithubSession, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuth2Session, OAuthRequestManager, OktaAuth, OneLoginAuth, SamlAuth, SignInPageProps, SignInResult, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createApp, defaultConfigLoader };
|
package/dist/index.esm.js
CHANGED
|
@@ -49,11 +49,9 @@ class ApiAggregator {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const ApiContext = createVersionedContext("api-context");
|
|
52
|
-
const ApiProvider = ({
|
|
53
|
-
apis,
|
|
54
|
-
children
|
|
55
|
-
}) => {
|
|
52
|
+
const ApiProvider = (props) => {
|
|
56
53
|
var _a;
|
|
54
|
+
const {apis, children} = props;
|
|
57
55
|
const parentHolder = (_a = useContext(ApiContext)) == null ? void 0 : _a.atVersion(1);
|
|
58
56
|
const holder = parentHolder ? new ApiAggregator(apis, parentHolder) : apis;
|
|
59
57
|
return /* @__PURE__ */ React.createElement(ApiContext.Provider, {
|