@backstage/core-plugin-api 0.3.1 → 0.6.0-next.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 +84 -0
- package/dist/index.d.ts +87 -216
- package/dist/index.esm.js +11 -56
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
1
|
# @backstage/core-plugin-api
|
|
2
2
|
|
|
3
|
+
## 0.6.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ceebe25391: Removed deprecated `IdentityApi` methods: `getUserId`, `getIdToken`, and `getProfile`.
|
|
8
|
+
|
|
9
|
+
Existing usage of `getUserId` can be replaced by `getBackstageIdentity`, more precisely the equivalent of the previous `userId` can be retrieved like this:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { parseEntityRef } from '@backstage/catalog-model';
|
|
13
|
+
|
|
14
|
+
const identity = await identityApi.getBackstageIdentity();
|
|
15
|
+
const { name: userId } = parseEntityRef(identity.userEntityRef);
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Note that it is recommended to consume the entire `userEntityRef` rather than parsing out just the name, in order to support namespaces.
|
|
19
|
+
|
|
20
|
+
Existing usage of `getIdToken` can be replaced by `getCredentials`, like this:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
const { token } = await identityApi.getCredentials();
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
And existing usage of `getProfile` is replaced by `getProfileInfo`, which returns the same profile object, but is now async.
|
|
27
|
+
|
|
28
|
+
- ceebe25391: Removed deprecated `SignInResult` type, which was replaced with the new `onSignInSuccess` callback.
|
|
29
|
+
- d879072b0c: Removed the deprecated `id` field of `BackstageIdentityResponse`.
|
|
30
|
+
|
|
31
|
+
Existing usage can be replaced by parsing the `name` of the `identity.userEntityRef` with `parseEntityRef` from `@backstage/catalog-model`, although note that it is recommended to consume the entire `userEntityRef` in order to support namespaces.
|
|
32
|
+
|
|
33
|
+
- 94c02b4246: Removed deprecated `BackstageIdentity` type, which was replaced by `BackstageIdentityResponse`.
|
|
34
|
+
- 234a36405b: Removed deprecated `OAuthRequestApi` types: `AuthProvider`, `AuthRequesterOptions`, `AuthRequester`, and `PendingAuthRequest`.
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
- @backstage/config@0.1.13-next.0
|
|
40
|
+
|
|
41
|
+
## 0.5.0
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- 784d8078ab: Removed the deprecated `OldIconComponent` type.
|
|
46
|
+
- e2eb92c109: Removed previously deprecated exports: `PluginHooks`, `PluginOutput`, and `FeatureFlagOutput`.
|
|
47
|
+
|
|
48
|
+
The deprecated `register` method of `PluginConfig` has been removed, as well as the deprecated `output` method of `BackstagePlugin`.
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- 784d8078ab: Removed direct and transitive MUI dependencies.
|
|
53
|
+
- Updated dependencies
|
|
54
|
+
- @backstage/config@0.1.12
|
|
55
|
+
|
|
56
|
+
## 0.4.1
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- c534ef2242: Deprecated `OldIconComponent`. Existing usage should be replaced with `IconComponent`.
|
|
61
|
+
|
|
62
|
+
## 0.4.0
|
|
63
|
+
|
|
64
|
+
### Minor Changes
|
|
65
|
+
|
|
66
|
+
- a195284c7b: **BREAKING CHANGE** The `StorageApi` has received several updates that fills in gaps for some use-cases and makes it easier to avoid mistakes:
|
|
67
|
+
|
|
68
|
+
- The `StorageValueChange` type has been renamed to `StorageValueSnapshot`, the `newValue` property has been renamed to `value`, the stored value type has been narrowed to `JsonValue`, and it has received a new `presence` property that is `'unknown'`, `'absent'`, or `'present'`.
|
|
69
|
+
- The `get` method has been deprecated in favor of a new `snapshot` method, which returns a `StorageValueSnapshot`.
|
|
70
|
+
- The `observe# @backstage/core-plugin-api method has had its contract changed. It should now emit values when the`presence`of a key changes, this may for example happen when remotely stored values are requested on page load and the presence switches from`'unknown'`to either`'absent'`or`'present'`.
|
|
71
|
+
|
|
72
|
+
The above changes have been made with deprecations in place to maintain much of the backwards compatibility for consumers of the `StorageApi`. The only breaking change is the narrowing of the stored value type, which may in some cases require the addition of an explicit type parameter to the `get` and `observe# @backstage/core-plugin-api methods.
|
|
73
|
+
|
|
74
|
+
- f6722d2458: - Removed deprecated option `description` from `ApiRefConfig`
|
|
75
|
+
- Removed descriptions from all plugin API refs
|
|
76
|
+
- Removed deprecated parameters `path`, `icon`, and `title` in `createRouteRef`
|
|
77
|
+
- Removed deprecated types `Error` and `ErrorContext` from `ErrorApi`
|
|
78
|
+
- 68f8b10ccd: - Removed deprecation configuration option `theme` from `AppTheme` of the `AppThemeApi`
|
|
79
|
+
- Removed reference to `theme` in the `app-defaults` default `AppTheme`
|
|
80
|
+
- Removed logic in `AppThemeProvider` that creates `ThemeProvider` from `appTheme.theme`
|
|
81
|
+
- 6b69b44862: Removed deprecated types `ApiRefType` and `ApiRefsToTypes`
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- 7927005152: Add `FetchApi` and related `fetchApiRef` which implement fetch, with an added Backstage token header when available.
|
|
86
|
+
|
|
3
87
|
## 0.3.1
|
|
4
88
|
|
|
5
89
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React$1, { ReactNode, ComponentType, ReactElement } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { Observable as Observable$1, Observer as Observer$1, Subscription as Subscription$1 } from '@backstage/types';
|
|
5
|
-
import { BackstageTheme } from '@backstage/theme';
|
|
3
|
+
import { Observable, JsonValue } from '@backstage/types';
|
|
6
4
|
import { Config } from '@backstage/config';
|
|
7
|
-
import {
|
|
5
|
+
import { IdentityApi as IdentityApi$1, BackstagePlugin as BackstagePlugin$1, IconComponent as IconComponent$1 } from '@backstage/core-plugin-api';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Common analytics context attributes.
|
|
@@ -74,34 +72,14 @@ declare type ApiRef<T> = {
|
|
|
74
72
|
* @public
|
|
75
73
|
*/
|
|
76
74
|
declare type AnyApiRef = ApiRef<unknown>;
|
|
77
|
-
/**
|
|
78
|
-
* Transforms ApiRef type into its inner API type.
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
* @deprecated unused type.
|
|
82
|
-
*/
|
|
83
|
-
declare type ApiRefType<T> = T extends ApiRef<infer U> ? U : never;
|
|
84
75
|
/**
|
|
85
76
|
* Wraps a type with API properties into a type holding their respective {@link ApiRef}s.
|
|
86
|
-
* Reverse type transform of {@link ApiRefsToTypes}.
|
|
87
77
|
*
|
|
88
78
|
* @public
|
|
89
79
|
*/
|
|
90
80
|
declare type TypesToApiRefs<T> = {
|
|
91
81
|
[key in keyof T]: ApiRef<T[key]>;
|
|
92
82
|
};
|
|
93
|
-
/**
|
|
94
|
-
* Unwraps type with {@link ApiRef} properties into a type holding their respective API types.
|
|
95
|
-
* Reverse type transform of {@link TypesToApiRefs}.
|
|
96
|
-
*
|
|
97
|
-
* @public
|
|
98
|
-
* @deprecated unused type.
|
|
99
|
-
*/
|
|
100
|
-
declare type ApiRefsToTypes<T extends {
|
|
101
|
-
[key in string]: ApiRef<unknown>;
|
|
102
|
-
}> = {
|
|
103
|
-
[key in keyof T]: ApiRefType<T[key]>;
|
|
104
|
-
};
|
|
105
83
|
/**
|
|
106
84
|
* Provides lookup of APIs through their {@link ApiRef}s.
|
|
107
85
|
*
|
|
@@ -162,10 +140,6 @@ declare function withApis<T>(apis: TypesToApiRefs<T>): <P extends T>(WrappedComp
|
|
|
162
140
|
*/
|
|
163
141
|
declare type ApiRefConfig = {
|
|
164
142
|
id: string;
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated Will be removed in the future
|
|
167
|
-
*/
|
|
168
|
-
description?: string;
|
|
169
143
|
};
|
|
170
144
|
/**
|
|
171
145
|
* Creates a reference to an API.
|
|
@@ -218,14 +192,6 @@ declare function createApiFactory<Api, Impl extends Api>(api: ApiRef<Api>, insta
|
|
|
218
192
|
declare type IconComponent = ComponentType<{
|
|
219
193
|
fontSize?: 'default' | 'small' | 'large';
|
|
220
194
|
}>;
|
|
221
|
-
/**
|
|
222
|
-
* This exists for backwards compatibility with the old core package.
|
|
223
|
-
* It's used in some parts of this package in order to smooth out the
|
|
224
|
-
* migration, but it is not exported.
|
|
225
|
-
*
|
|
226
|
-
* @public
|
|
227
|
-
*/
|
|
228
|
-
declare type OldIconComponent = ComponentType<SvgIconProps>;
|
|
229
195
|
|
|
230
196
|
/**
|
|
231
197
|
* This file contains declarations for common interfaces of auth-related APIs.
|
|
@@ -411,12 +377,6 @@ declare type BackstageUserIdentity = {
|
|
|
411
377
|
* @public
|
|
412
378
|
*/
|
|
413
379
|
declare type BackstageIdentityResponse = {
|
|
414
|
-
/**
|
|
415
|
-
* The backstage user ID.
|
|
416
|
-
*
|
|
417
|
-
* @deprecated The identity is now provided via the `identity` field instead.
|
|
418
|
-
*/
|
|
419
|
-
id: string;
|
|
420
380
|
/**
|
|
421
381
|
* The token used to authenticate the user within Backstage.
|
|
422
382
|
*/
|
|
@@ -426,13 +386,6 @@ declare type BackstageIdentityResponse = {
|
|
|
426
386
|
*/
|
|
427
387
|
identity: BackstageUserIdentity;
|
|
428
388
|
};
|
|
429
|
-
/**
|
|
430
|
-
* The old exported symbol for {@link BackstageIdentityResponse}.
|
|
431
|
-
*
|
|
432
|
-
* @public
|
|
433
|
-
* @deprecated use {@link BackstageIdentityResponse} instead.
|
|
434
|
-
*/
|
|
435
|
-
declare type BackstageIdentity = BackstageIdentityResponse;
|
|
436
389
|
/**
|
|
437
390
|
* Profile information of the user.
|
|
438
391
|
*
|
|
@@ -484,7 +437,7 @@ declare type SessionApi = {
|
|
|
484
437
|
/**
|
|
485
438
|
* Observe the current state of the auth session. Emits the current state on subscription.
|
|
486
439
|
*/
|
|
487
|
-
sessionState$(): Observable
|
|
440
|
+
sessionState$(): Observable<SessionState>;
|
|
488
441
|
};
|
|
489
442
|
/**
|
|
490
443
|
* Provides authentication towards Google APIs and identities.
|
|
@@ -626,7 +579,7 @@ declare type AlertApi = {
|
|
|
626
579
|
/**
|
|
627
580
|
* Observe alerts posted by other parts of the application.
|
|
628
581
|
*/
|
|
629
|
-
alert$(): Observable
|
|
582
|
+
alert$(): Observable<AlertMessage>;
|
|
630
583
|
};
|
|
631
584
|
/**
|
|
632
585
|
* The {@link ApiRef} of {@link AlertApi}.
|
|
@@ -756,16 +709,11 @@ declare type AppTheme = {
|
|
|
756
709
|
* Theme variant
|
|
757
710
|
*/
|
|
758
711
|
variant: 'light' | 'dark';
|
|
759
|
-
/**
|
|
760
|
-
* The specialized MaterialUI theme instance.
|
|
761
|
-
* @deprecated use Provider instead, see https://backstage.io/docs/api/deprecations#app-theme
|
|
762
|
-
*/
|
|
763
|
-
theme: BackstageTheme;
|
|
764
712
|
/**
|
|
765
713
|
* An Icon for the theme mode setting.
|
|
766
714
|
*/
|
|
767
715
|
icon?: React.ReactElement;
|
|
768
|
-
Provider
|
|
716
|
+
Provider(props: {
|
|
769
717
|
children: ReactNode;
|
|
770
718
|
}): JSX.Element | null;
|
|
771
719
|
};
|
|
@@ -783,7 +731,7 @@ declare type AppThemeApi = {
|
|
|
783
731
|
/**
|
|
784
732
|
* Observe the currently selected theme. A value of undefined means no specific theme has been selected.
|
|
785
733
|
*/
|
|
786
|
-
activeThemeId$(): Observable
|
|
734
|
+
activeThemeId$(): Observable<string | undefined>;
|
|
787
735
|
/**
|
|
788
736
|
* Get the current theme ID. Returns undefined if no specific theme is selected.
|
|
789
737
|
*/
|
|
@@ -863,11 +811,6 @@ declare type ErrorApiError = {
|
|
|
863
811
|
message: string;
|
|
864
812
|
stack?: string;
|
|
865
813
|
};
|
|
866
|
-
/**
|
|
867
|
-
* @public
|
|
868
|
-
* @deprecated Use ErrorApiError instead
|
|
869
|
-
*/
|
|
870
|
-
declare type Error$1 = ErrorApiError;
|
|
871
814
|
/**
|
|
872
815
|
* Provides additional information about an error that was posted to the application.
|
|
873
816
|
*
|
|
@@ -885,11 +828,6 @@ declare type ErrorApiErrorContext = {
|
|
|
885
828
|
*/
|
|
886
829
|
hidden?: boolean;
|
|
887
830
|
};
|
|
888
|
-
/**
|
|
889
|
-
* @public
|
|
890
|
-
* @deprecated Use ErrorApiErrorContext instead
|
|
891
|
-
*/
|
|
892
|
-
declare type ErrorContext = ErrorApiErrorContext;
|
|
893
831
|
/**
|
|
894
832
|
* The error API is used to report errors to the app, and display them to the user.
|
|
895
833
|
*
|
|
@@ -917,7 +855,7 @@ declare type ErrorApi = {
|
|
|
917
855
|
/**
|
|
918
856
|
* Observe errors posted by other parts of the application.
|
|
919
857
|
*/
|
|
920
|
-
error$(): Observable
|
|
858
|
+
error$(): Observable<{
|
|
921
859
|
error: ErrorApiError;
|
|
922
860
|
context?: ErrorApiErrorContext;
|
|
923
861
|
}>;
|
|
@@ -1011,34 +949,33 @@ interface FeatureFlagsApi {
|
|
|
1011
949
|
*/
|
|
1012
950
|
declare const featureFlagsApiRef: ApiRef<FeatureFlagsApi>;
|
|
1013
951
|
|
|
952
|
+
/**
|
|
953
|
+
* A wrapper for the fetch API, that has additional behaviors such as the
|
|
954
|
+
* ability to automatically inject auth information where necessary.
|
|
955
|
+
*
|
|
956
|
+
* @public
|
|
957
|
+
*/
|
|
958
|
+
declare type FetchApi = {
|
|
959
|
+
fetch: typeof fetch;
|
|
960
|
+
};
|
|
961
|
+
/**
|
|
962
|
+
* The {@link ApiRef} of {@link FetchApi}.
|
|
963
|
+
*
|
|
964
|
+
* @remarks
|
|
965
|
+
*
|
|
966
|
+
* This is a wrapper for the fetch API, that has additional behaviors such as
|
|
967
|
+
* the ability to automatically inject auth information where necessary.
|
|
968
|
+
*
|
|
969
|
+
* @public
|
|
970
|
+
*/
|
|
971
|
+
declare const fetchApiRef: ApiRef<FetchApi>;
|
|
972
|
+
|
|
1014
973
|
/**
|
|
1015
974
|
* The Identity API used to identify and get information about the signed in user.
|
|
1016
975
|
*
|
|
1017
976
|
* @public
|
|
1018
977
|
*/
|
|
1019
978
|
declare type IdentityApi = {
|
|
1020
|
-
/**
|
|
1021
|
-
* The ID of the signed in user. This ID is not meant to be presented to the user, but used
|
|
1022
|
-
* as an opaque string to pass on to backends or use in frontend logic.
|
|
1023
|
-
*
|
|
1024
|
-
* @deprecated use {@link IdentityApi.getBackstageIdentity} instead.
|
|
1025
|
-
*/
|
|
1026
|
-
getUserId(): string;
|
|
1027
|
-
/**
|
|
1028
|
-
* An OpenID Connect ID Token which proves the identity of the signed in user.
|
|
1029
|
-
*
|
|
1030
|
-
* The ID token will be undefined if the signed in user does not have a verified
|
|
1031
|
-
* identity, such as a demo user or mocked user for e2e tests.
|
|
1032
|
-
*
|
|
1033
|
-
* @deprecated use {@link IdentityApi.getCredentials} instead.
|
|
1034
|
-
*/
|
|
1035
|
-
getIdToken(): Promise<string | undefined>;
|
|
1036
|
-
/**
|
|
1037
|
-
* The profile of the signed in user.
|
|
1038
|
-
*
|
|
1039
|
-
* @deprecated use {@link IdentityApi.getProfileInfo} instead.
|
|
1040
|
-
*/
|
|
1041
|
-
getProfile(): ProfileInfo;
|
|
1042
979
|
/**
|
|
1043
980
|
* The profile of the signed in user.
|
|
1044
981
|
*/
|
|
@@ -1068,11 +1005,6 @@ declare type IdentityApi = {
|
|
|
1068
1005
|
*/
|
|
1069
1006
|
declare const identityApiRef: ApiRef<IdentityApi>;
|
|
1070
1007
|
|
|
1071
|
-
/**
|
|
1072
|
-
* @public
|
|
1073
|
-
* @deprecated Use AuthProviderInfo instead
|
|
1074
|
-
*/
|
|
1075
|
-
declare type AuthProvider = Omit<AuthProviderInfo, 'id'>;
|
|
1076
1008
|
/**
|
|
1077
1009
|
* Describes how to handle auth requests. Both how to show them to the user, and what to do when
|
|
1078
1010
|
* the user accesses the auth request.
|
|
@@ -1094,11 +1026,6 @@ declare type OAuthRequesterOptions<TOAuthResponse> = {
|
|
|
1094
1026
|
*/
|
|
1095
1027
|
onAuthRequest(scopes: Set<string>): Promise<TOAuthResponse>;
|
|
1096
1028
|
};
|
|
1097
|
-
/**
|
|
1098
|
-
* @public
|
|
1099
|
-
* @deprecated Use OAuthRequesterOptions instead
|
|
1100
|
-
*/
|
|
1101
|
-
declare type AuthRequesterOptions<T> = OAuthRequesterOptions<T>;
|
|
1102
1029
|
/**
|
|
1103
1030
|
* Function used to trigger new auth requests for a set of scopes.
|
|
1104
1031
|
*
|
|
@@ -1114,11 +1041,6 @@ declare type AuthRequesterOptions<T> = OAuthRequesterOptions<T>;
|
|
|
1114
1041
|
* @public
|
|
1115
1042
|
*/
|
|
1116
1043
|
declare type OAuthRequester<TAuthResponse> = (scopes: Set<string>) => Promise<TAuthResponse>;
|
|
1117
|
-
/**
|
|
1118
|
-
* @public
|
|
1119
|
-
* @deprecated Use OAuthRequester instead
|
|
1120
|
-
*/
|
|
1121
|
-
declare type AuthRequester<T> = OAuthRequester<T>;
|
|
1122
1044
|
/**
|
|
1123
1045
|
* An pending auth request for a single auth provider. The request will remain in this pending
|
|
1124
1046
|
* state until either reject() or trigger() is called.
|
|
@@ -1150,11 +1072,6 @@ declare type PendingOAuthRequest = {
|
|
|
1150
1072
|
*/
|
|
1151
1073
|
trigger(): Promise<void>;
|
|
1152
1074
|
};
|
|
1153
|
-
/**
|
|
1154
|
-
* @public
|
|
1155
|
-
* @deprecated Use PendingOAuthRequest instead
|
|
1156
|
-
*/
|
|
1157
|
-
declare type PendingAuthRequest = PendingOAuthRequest;
|
|
1158
1075
|
/**
|
|
1159
1076
|
* Provides helpers for implemented OAuth login flows within Backstage.
|
|
1160
1077
|
*
|
|
@@ -1185,7 +1102,7 @@ declare type OAuthRequestApi = {
|
|
|
1185
1102
|
* If a auth is triggered, and the auth handler resolves successfully, then all currently pending
|
|
1186
1103
|
* AuthRequester calls will resolve to the value returned by the onAuthRequest call.
|
|
1187
1104
|
*/
|
|
1188
|
-
authRequest$(): Observable
|
|
1105
|
+
authRequest$(): Observable<PendingOAuthRequest[]>;
|
|
1189
1106
|
};
|
|
1190
1107
|
/**
|
|
1191
1108
|
* The {@link ApiRef} of {@link OAuthRequestApi}.
|
|
@@ -1195,47 +1112,93 @@ declare type OAuthRequestApi = {
|
|
|
1195
1112
|
declare const oauthRequestApiRef: ApiRef<OAuthRequestApi>;
|
|
1196
1113
|
|
|
1197
1114
|
/**
|
|
1198
|
-
*
|
|
1115
|
+
* A snapshot in time of the current known value of a storage key.
|
|
1199
1116
|
*
|
|
1200
1117
|
* @public
|
|
1201
1118
|
*/
|
|
1202
|
-
declare type
|
|
1119
|
+
declare type StorageValueSnapshot<TValue extends JsonValue> = {
|
|
1203
1120
|
key: string;
|
|
1204
|
-
|
|
1121
|
+
presence: 'unknown' | 'absent';
|
|
1122
|
+
value?: undefined;
|
|
1123
|
+
/** @deprecated Use `value` instead */
|
|
1124
|
+
newValue?: undefined;
|
|
1125
|
+
} | {
|
|
1126
|
+
key: string;
|
|
1127
|
+
presence: 'present';
|
|
1128
|
+
value: TValue;
|
|
1129
|
+
/** @deprecated Use `value` instead */
|
|
1130
|
+
newValue?: TValue;
|
|
1205
1131
|
};
|
|
1206
1132
|
/**
|
|
1207
|
-
*
|
|
1133
|
+
* @public
|
|
1134
|
+
* @deprecated Use StorageValueSnapshot instead
|
|
1135
|
+
*/
|
|
1136
|
+
declare type StorageValueChange<TValue extends JsonValue> = StorageValueSnapshot<TValue>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Provides a key-value persistence API.
|
|
1208
1139
|
*
|
|
1209
1140
|
* @public
|
|
1210
1141
|
*/
|
|
1211
1142
|
interface StorageApi {
|
|
1212
1143
|
/**
|
|
1213
1144
|
* Create a bucket to store data in.
|
|
1145
|
+
*
|
|
1214
1146
|
* @param name - Namespace for the storage to be stored under,
|
|
1215
|
-
*
|
|
1147
|
+
* will inherit previous namespaces too
|
|
1216
1148
|
*/
|
|
1217
1149
|
forBucket(name: string): StorageApi;
|
|
1218
1150
|
/**
|
|
1219
1151
|
* Get the current value for persistent data, use observe$ to be notified of updates.
|
|
1152
|
+
*
|
|
1153
|
+
* @deprecated Use `snapshot` instead.
|
|
1220
1154
|
* @param key - Unique key associated with the data.
|
|
1221
1155
|
*/
|
|
1222
|
-
get<T>(key: string): T | undefined;
|
|
1156
|
+
get<T extends JsonValue>(key: string): T | undefined;
|
|
1223
1157
|
/**
|
|
1224
1158
|
* Remove persistent data.
|
|
1159
|
+
*
|
|
1225
1160
|
* @param key - Unique key associated with the data.
|
|
1226
1161
|
*/
|
|
1227
1162
|
remove(key: string): Promise<void>;
|
|
1228
1163
|
/**
|
|
1229
|
-
* Save persistent data, and emit messages to anyone that is using
|
|
1164
|
+
* Save persistent data, and emit messages to anyone that is using
|
|
1165
|
+
* {@link StorageApi.observe$} for this key.
|
|
1166
|
+
*
|
|
1230
1167
|
* @param key - Unique key associated with the data.
|
|
1231
1168
|
* @param data - The data to be stored under the key.
|
|
1232
1169
|
*/
|
|
1233
|
-
set(key: string, data:
|
|
1170
|
+
set<T extends JsonValue>(key: string, data: T): Promise<void>;
|
|
1234
1171
|
/**
|
|
1235
|
-
* Observe
|
|
1172
|
+
* Observe the value over time for a particular key in the current bucket.
|
|
1173
|
+
*
|
|
1174
|
+
* @remarks
|
|
1175
|
+
*
|
|
1176
|
+
* The observable will only emit values when the value changes in the underlying
|
|
1177
|
+
* storage, although multiple values with the same shape may be emitted in a row.
|
|
1178
|
+
*
|
|
1179
|
+
* If a {@link StorageApi.snapshot} of a key is retrieved and the presence is
|
|
1180
|
+
* `'unknown'`, then you are guaranteed to receive a snapshot with a known
|
|
1181
|
+
* presence, as long as you observe the key within the same tick.
|
|
1182
|
+
*
|
|
1183
|
+
* Since the emitted values are shared across all subscribers, it is important
|
|
1184
|
+
* not to mutate the returned values. The values may be frozen as a precaution.
|
|
1185
|
+
*
|
|
1236
1186
|
* @param key - Unique key associated with the data
|
|
1237
1187
|
*/
|
|
1238
|
-
observe$<T>(key: string): Observable
|
|
1188
|
+
observe$<T extends JsonValue>(key: string): Observable<StorageValueSnapshot<T>>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Returns an immediate snapshot value for the given key, if possible.
|
|
1191
|
+
*
|
|
1192
|
+
* @remarks
|
|
1193
|
+
*
|
|
1194
|
+
* Combine with {@link StorageApi.observe$} to get notified of value changes.
|
|
1195
|
+
*
|
|
1196
|
+
* Note that this method is synchronous, and some underlying storages may be
|
|
1197
|
+
* unable to retrieve a value using this method - the result may or may not
|
|
1198
|
+
* consistently have a presence of 'unknown'. Use {@link StorageApi.observe$}
|
|
1199
|
+
* to be sure to receive an actual value eventually.
|
|
1200
|
+
*/
|
|
1201
|
+
snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T>;
|
|
1239
1202
|
}
|
|
1240
1203
|
/**
|
|
1241
1204
|
* The {@link ApiRef} of {@link StorageApi}.
|
|
@@ -1260,27 +1223,6 @@ declare type BootErrorPageProps = {
|
|
|
1260
1223
|
step: 'load-config' | 'load-chunk';
|
|
1261
1224
|
error: Error;
|
|
1262
1225
|
};
|
|
1263
|
-
/**
|
|
1264
|
-
* The outcome of signing in on the sign-in page.
|
|
1265
|
-
*
|
|
1266
|
-
* @public
|
|
1267
|
-
* @deprecated replaced by passing the {@link @backstage/core-plugin-api#IdentityApi} to the {@link SignInPageProps.onSignInSuccess} instead.
|
|
1268
|
-
*/
|
|
1269
|
-
declare type SignInResult = {
|
|
1270
|
-
/**
|
|
1271
|
-
* User ID that will be returned by the IdentityApi
|
|
1272
|
-
*/
|
|
1273
|
-
userId: string;
|
|
1274
|
-
profile: ProfileInfo$1;
|
|
1275
|
-
/**
|
|
1276
|
-
* Function used to retrieve an ID token for the signed in user.
|
|
1277
|
-
*/
|
|
1278
|
-
getIdToken?: () => Promise<string>;
|
|
1279
|
-
/**
|
|
1280
|
-
* Sign out handler that will be called if the user requests to sign out.
|
|
1281
|
-
*/
|
|
1282
|
-
signOut?: () => Promise<void>;
|
|
1283
|
-
};
|
|
1284
1226
|
/**
|
|
1285
1227
|
* Props for the `SignInPage` component of {@link AppComponents}.
|
|
1286
1228
|
*
|
|
@@ -1428,12 +1370,6 @@ declare type RouteFunc<Params extends AnyParams> = (...[params]: Params extends
|
|
|
1428
1370
|
declare type RouteRef<Params extends AnyParams = any> = {
|
|
1429
1371
|
$$routeRefType: 'absolute';
|
|
1430
1372
|
params: ParamKeys<Params>;
|
|
1431
|
-
/** @deprecated paths are no longer accessed directly from RouteRefs, use useRouteRef instead */
|
|
1432
|
-
path: string;
|
|
1433
|
-
/** @deprecated icons are no longer accessed via RouteRefs */
|
|
1434
|
-
icon?: OldIconComponent;
|
|
1435
|
-
/** @deprecated titles are no longer accessed via RouteRefs */
|
|
1436
|
-
title?: string;
|
|
1437
1373
|
};
|
|
1438
1374
|
/**
|
|
1439
1375
|
* Descriptor of a route relative to an absolute {@link RouteRef}.
|
|
@@ -1475,15 +1411,9 @@ declare function createRouteRef<Params extends {
|
|
|
1475
1411
|
[param in ParamKey]: string;
|
|
1476
1412
|
}, ParamKey extends string = never>(config: {
|
|
1477
1413
|
/** The id of the route ref, used to identify it when printed */
|
|
1478
|
-
id
|
|
1414
|
+
id: string;
|
|
1479
1415
|
/** A list of parameter names that the path that this route ref is bound to must contain */
|
|
1480
1416
|
params?: ParamKey[];
|
|
1481
|
-
/** @deprecated Route refs no longer decide their own path */
|
|
1482
|
-
path?: string;
|
|
1483
|
-
/** @deprecated Route refs no longer decide their own icon */
|
|
1484
|
-
icon?: OldIconComponent;
|
|
1485
|
-
/** @deprecated Route refs no longer decide their own title */
|
|
1486
|
-
title?: string;
|
|
1487
1417
|
}): RouteRef<OptionalParams<Params>>;
|
|
1488
1418
|
|
|
1489
1419
|
/**
|
|
@@ -1594,22 +1524,6 @@ declare function useRouteRef<Params extends AnyParams>(routeRef: RouteRef<Params
|
|
|
1594
1524
|
*/
|
|
1595
1525
|
declare function useRouteRefParams<Params extends AnyParams>(_routeRef: RouteRef<Params> | SubRouteRef<Params>): Params;
|
|
1596
1526
|
|
|
1597
|
-
/**
|
|
1598
|
-
* Replace with using {@link RouteRef}s.
|
|
1599
|
-
* @deprecated will be removed
|
|
1600
|
-
* @public
|
|
1601
|
-
*/
|
|
1602
|
-
declare type FeatureFlagOutput = {
|
|
1603
|
-
type: 'feature-flag';
|
|
1604
|
-
name: string;
|
|
1605
|
-
};
|
|
1606
|
-
/**
|
|
1607
|
-
* {@link FeatureFlagOutput} type.
|
|
1608
|
-
*
|
|
1609
|
-
* @public
|
|
1610
|
-
* @deprecated Use {@link BackstagePlugin.getFeatureFlags} instead.
|
|
1611
|
-
*/
|
|
1612
|
-
declare type PluginOutput = FeatureFlagOutput;
|
|
1613
1527
|
/**
|
|
1614
1528
|
* Plugin extension type.
|
|
1615
1529
|
*
|
|
@@ -1645,10 +1559,6 @@ declare type AnyExternalRoutes = {
|
|
|
1645
1559
|
*/
|
|
1646
1560
|
declare type BackstagePlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}> = {
|
|
1647
1561
|
getId(): string;
|
|
1648
|
-
/**
|
|
1649
|
-
* @deprecated use getFeatureFlags instead.
|
|
1650
|
-
* */
|
|
1651
|
-
output(): PluginOutput[];
|
|
1652
1562
|
getApis(): Iterable<AnyApiFactory>;
|
|
1653
1563
|
/**
|
|
1654
1564
|
* Returns all registered feature flags for this plugin.
|
|
@@ -1675,21 +1585,10 @@ declare type PluginFeatureFlagConfig = {
|
|
|
1675
1585
|
declare type PluginConfig<Routes extends AnyRoutes, ExternalRoutes extends AnyExternalRoutes> = {
|
|
1676
1586
|
id: string;
|
|
1677
1587
|
apis?: Iterable<AnyApiFactory>;
|
|
1678
|
-
/** @deprecated use featureFlags property instead for defining feature flags */
|
|
1679
|
-
register?(hooks: PluginHooks): void;
|
|
1680
1588
|
routes?: Routes;
|
|
1681
1589
|
externalRoutes?: ExternalRoutes;
|
|
1682
1590
|
featureFlags?: PluginFeatureFlagConfig[];
|
|
1683
1591
|
};
|
|
1684
|
-
/**
|
|
1685
|
-
* Holds hooks registered by the plugin.
|
|
1686
|
-
*
|
|
1687
|
-
* @deprecated - feature flags are now registered in plugin config under featureFlags
|
|
1688
|
-
* @public
|
|
1689
|
-
*/
|
|
1690
|
-
declare type PluginHooks = {
|
|
1691
|
-
featureFlags: FeatureFlagsHooks;
|
|
1692
|
-
};
|
|
1693
1592
|
/**
|
|
1694
1593
|
* Interface for registering feature flags hooks.
|
|
1695
1594
|
*
|
|
@@ -1890,32 +1789,4 @@ declare function useElementFilter<T>(node: ReactNode, filterFn: (arg: ElementCol
|
|
|
1890
1789
|
*/
|
|
1891
1790
|
declare function createPlugin<Routes extends AnyRoutes = {}, ExternalRoutes extends AnyExternalRoutes = {}>(config: PluginConfig<Routes, ExternalRoutes>): BackstagePlugin<Routes, ExternalRoutes>;
|
|
1892
1791
|
|
|
1893
|
-
|
|
1894
|
-
* Observer interface for consuming an Observer, see TC39.
|
|
1895
|
-
*
|
|
1896
|
-
* @public
|
|
1897
|
-
* @deprecated Please use the same type from `@backstage/types` instead
|
|
1898
|
-
*/
|
|
1899
|
-
declare type Observer<T> = Observer$1<T>;
|
|
1900
|
-
/**
|
|
1901
|
-
* Subscription returned when subscribing to an Observable, see TC39.
|
|
1902
|
-
*
|
|
1903
|
-
* @public
|
|
1904
|
-
* @deprecated Please use the same type from `@backstage/types` instead
|
|
1905
|
-
*/
|
|
1906
|
-
declare type Subscription = Subscription$1;
|
|
1907
|
-
/**
|
|
1908
|
-
* Observable sequence of values and errors, see TC39.
|
|
1909
|
-
*
|
|
1910
|
-
* @remarks
|
|
1911
|
-
*
|
|
1912
|
-
* {@link https://github.com/tc39/proposal-observable}
|
|
1913
|
-
* This is used as a common return type for observable values and can be created
|
|
1914
|
-
* using many different observable implementations, such as zen-observable or RxJS 5.
|
|
1915
|
-
*
|
|
1916
|
-
* @public
|
|
1917
|
-
* @deprecated Please use the same type from `@backstage/types` instead
|
|
1918
|
-
*/
|
|
1919
|
-
declare type Observable<T> = Observable$1<T>;
|
|
1920
|
-
|
|
1921
|
-
export { AlertApi, AlertMessage, AnalyticsApi, AnalyticsContext, AnalyticsContextValue, AnalyticsEvent, AnalyticsEventAttributes, AnalyticsTracker, AnyAnalyticsContext, AnyApiFactory, AnyApiRef, AnyExternalRoutes, AnyParams, AnyRoutes, ApiFactory, ApiHolder, ApiRef, ApiRefConfig, ApiRefType, ApiRefsToTypes, AppComponents, AppContext, AppTheme, AppThemeApi, AuthProvider, AuthProviderInfo, AuthRequestOptions, AuthRequester, AuthRequesterOptions, BackstageIdentity, BackstageIdentityApi, BackstageIdentityResponse, BackstagePlugin, BackstageUserIdentity, BootErrorPageProps, CommonAnalyticsContext, ComponentLoader, ConfigApi, DiscoveryApi, ElementCollection, Error$1 as Error, ErrorApi, ErrorApiError, ErrorApiErrorContext, ErrorBoundaryFallbackProps, ErrorContext, Extension, ExternalRouteRef, FeatureFlag, FeatureFlagOutput, FeatureFlagState, FeatureFlagsApi, FeatureFlagsHooks, FeatureFlagsSaveOptions, IconComponent, IdentityApi, MakeSubRouteRef, MergeParams, OAuthApi, OAuthRequestApi, OAuthRequester, OAuthRequesterOptions, OAuthScope, Observable, Observer, OldIconComponent, OpenIdConnectApi, OptionalParams, ParamKeys, ParamNames, ParamPart, PathParams, PendingAuthRequest, PendingOAuthRequest, PluginConfig, PluginFeatureFlagConfig, PluginHooks, PluginOutput, ProfileInfo, ProfileInfoApi, RouteFunc, RouteRef, SessionApi, SessionState, SignInPageProps, SignInResult, StorageApi, StorageValueChange, SubRouteRef, Subscription, TypesToApiRefs, alertApiRef, analyticsApiRef, appThemeApiRef, atlassianAuthApiRef, attachComponentData, auth0AuthApiRef, bitbucketAuthApiRef, configApiRef, createApiFactory, createApiRef, createComponentExtension, createExternalRouteRef, createPlugin, createReactExtension, createRoutableExtension, createRouteRef, createSubRouteRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, getComponentData, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, identityApiRef, microsoftAuthApiRef, oauth2ApiRef, oauthRequestApiRef, oidcAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, samlAuthApiRef, storageApiRef, useAnalytics, useApi, useApiHolder, useApp, useElementFilter, useRouteRef, useRouteRefParams, withApis };
|
|
1792
|
+
export { AlertApi, AlertMessage, AnalyticsApi, AnalyticsContext, AnalyticsContextValue, AnalyticsEvent, AnalyticsEventAttributes, AnalyticsTracker, AnyAnalyticsContext, AnyApiFactory, AnyApiRef, AnyExternalRoutes, AnyParams, AnyRoutes, ApiFactory, ApiHolder, ApiRef, ApiRefConfig, AppComponents, AppContext, AppTheme, AppThemeApi, AuthProviderInfo, AuthRequestOptions, BackstageIdentityApi, BackstageIdentityResponse, BackstagePlugin, BackstageUserIdentity, BootErrorPageProps, CommonAnalyticsContext, ComponentLoader, ConfigApi, DiscoveryApi, ElementCollection, ErrorApi, ErrorApiError, ErrorApiErrorContext, ErrorBoundaryFallbackProps, Extension, ExternalRouteRef, FeatureFlag, FeatureFlagState, FeatureFlagsApi, FeatureFlagsHooks, FeatureFlagsSaveOptions, FetchApi, IconComponent, IdentityApi, MakeSubRouteRef, MergeParams, OAuthApi, OAuthRequestApi, OAuthRequester, OAuthRequesterOptions, OAuthScope, OpenIdConnectApi, OptionalParams, ParamKeys, ParamNames, ParamPart, PathParams, PendingOAuthRequest, PluginConfig, PluginFeatureFlagConfig, ProfileInfo, ProfileInfoApi, RouteFunc, RouteRef, SessionApi, SessionState, SignInPageProps, StorageApi, StorageValueChange, StorageValueSnapshot, SubRouteRef, TypesToApiRefs, alertApiRef, analyticsApiRef, appThemeApiRef, atlassianAuthApiRef, attachComponentData, auth0AuthApiRef, bitbucketAuthApiRef, configApiRef, createApiFactory, createApiRef, createComponentExtension, createExternalRouteRef, createPlugin, createReactExtension, createRoutableExtension, createRouteRef, createSubRouteRef, discoveryApiRef, errorApiRef, featureFlagsApiRef, fetchApiRef, getComponentData, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, identityApiRef, microsoftAuthApiRef, oauth2ApiRef, oauthRequestApiRef, oidcAuthApiRef, oktaAuthApiRef, oneloginAuthApiRef, samlAuthApiRef, storageApiRef, useAnalytics, useApi, useApiHolder, useApp, useElementFilter, useRouteRef, useRouteRefParams, withApis };
|