@backstage/core-app-api 0.5.4 → 1.0.1-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 CHANGED
@@ -1,5 +1,42 @@
1
1
  # @backstage/core-app-api
2
2
 
3
+ ## 1.0.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - a7bb762dab: fixed empty body issue for POST requests using FetchAPI with 'plugin://' prefix
8
+ - c47509e1a0: Implemented changes suggested by Deepsource.io including multiple double non-null assertion operators and unexpected awaits for non-promise values.
9
+
10
+ ## 1.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - b58c70c223: This package has been promoted to v1.0! To understand how this change affects the package, please check out our [versioning policy](https://backstage.io/docs/overview/versioning-policy).
15
+
16
+ ### Patch Changes
17
+
18
+ - a422d7ce5e: chore(deps): bump `@testing-library/react` from 11.2.6 to 12.1.3
19
+ - f24ef7864e: Minor typo fixes
20
+ - Updated dependencies
21
+ - @backstage/core-plugin-api@1.0.0
22
+ - @backstage/version-bridge@1.0.0
23
+ - @backstage/config@1.0.0
24
+ - @backstage/types@1.0.0
25
+
26
+ ## 0.6.0
27
+
28
+ ### Minor Changes
29
+
30
+ - bb2bb36651: **BREAKING**: Removed the deprecated `get` method from `StorageAPI` and its implementations, this method has been replaced by the `snapshot` method. The return value from snapshot no longer includes `newValue` which has been replaced by `value`. For getting notified when a value changes, use `observe# @backstage/core-app-api.
31
+ - f3cce3dcf7: **BREAKING**: Removed export of `GithubSession` and `SamlSession` which are only used internally.
32
+ - af5eaa87f4: **BREAKING**: Removed deprecated `auth0AuthApiRef`, `oauth2ApiRef`, `samlAuthApiRef` and `oidcAuthApiRef` as these APIs are too generic to be useful. Instructions for how to migrate can be found at [https://backstage.io/docs/api/deprecations#generic-auth-api-refs](https://backstage.io/docs/api/deprecations#generic-auth-api-refs).
33
+ - dbf84eee55: **BREAKING**: Removed the deprecated `GithubAuth.normalizeScopes` method.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies
38
+ - @backstage/core-plugin-api@0.8.0
39
+
3
40
  ## 0.5.4
4
41
 
5
42
  ### 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, BackstageIdentityResponse, OAuthRequestApi, DiscoveryApi, AuthProviderInfo, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi, SessionState, AuthRequestOptions, 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, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
3
+ import { ApiHolder, ApiRef, ApiFactory, AnyApiRef, OAuthRequestApi, DiscoveryApi, AuthProviderInfo, githubAuthApiRef, gitlabAuthApiRef, googleAuthApiRef, OAuthApi, OpenIdConnectApi, ProfileInfoApi, BackstageIdentityApi, SessionApi, SessionState, AuthRequestOptions, BackstageIdentityResponse, ProfileInfo, oktaAuthApiRef, 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, RouteRef, SubRouteRef } from '@backstage/core-plugin-api';
4
4
  import * as _backstage_types from '@backstage/types';
5
5
  import { Observable, JsonValue } from '@backstage/types';
6
6
  import { Config, AppConfig } from '@backstage/config';
@@ -91,22 +91,6 @@ declare class ApiFactoryRegistry implements ApiFactoryHolder {
91
91
  getAllApis(): Set<AnyApiRef>;
92
92
  }
93
93
 
94
- /**
95
- * Session information for GitHub auth.
96
- *
97
- * @public
98
- * @deprecated This type is internal and will be removed
99
- */
100
- declare type GithubSession = {
101
- providerInfo: {
102
- accessToken: string;
103
- scopes: Set<string>;
104
- expiresAt?: Date;
105
- };
106
- profile: ProfileInfo;
107
- backstageIdentity: BackstageIdentityResponse;
108
- };
109
-
110
94
  /**
111
95
  * Create options for OAuth APIs.
112
96
  * @public
@@ -132,10 +116,6 @@ declare type AuthApiCreateOptions = {
132
116
  */
133
117
  declare class GithubAuth {
134
118
  static create(options: OAuthApiCreateOptions): typeof githubAuthApiRef.T;
135
- /**
136
- * @deprecated This method is deprecated and will be removed in a future release.
137
- */
138
- static normalizeScope(scope?: string): Set<string>;
139
119
  }
140
120
 
141
121
  /**
@@ -224,44 +204,6 @@ declare class SamlAuth implements ProfileInfoApi, BackstageIdentityApi, SessionA
224
204
  getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
225
205
  }
226
206
 
227
- /**
228
- * Session information for SAML auth.
229
- *
230
- * @public
231
- * @deprecated This type is internal and will be removed
232
- */
233
- declare type ExportedSamlSession = {
234
- userId: string;
235
- profile: ProfileInfo;
236
- backstageIdentity: BackstageIdentityResponse;
237
- };
238
-
239
- /**
240
- * Implements the OAuth flow to Auth0 products.
241
- *
242
- * @public
243
- * @deprecated Use {@link OAuth2} instead
244
- *
245
- * @example
246
- *
247
- * ```ts
248
- * OAuth2.create({
249
- * discoveryApi,
250
- * oauthRequestApi,
251
- * provider: {
252
- * id: 'auth0',
253
- * title: 'Auth0',
254
- * icon: () => null,
255
- * },
256
- * defaultScopes: ['openid', 'email', 'profile'],
257
- * environment: configApi.getOptionalString('auth.environment'),
258
- * })
259
- * ```
260
- */
261
- declare class Auth0Auth {
262
- static create(options: OAuthApiCreateOptions): typeof auth0AuthApiRef.T;
263
- }
264
-
265
207
  /**
266
208
  * Implements the OAuth flow to Microsoft products.
267
209
  *
@@ -706,7 +648,7 @@ declare type AppOptions = {
706
648
  apis?: Iterable<AnyApiFactory>;
707
649
  /**
708
650
  * A collection of ApiFactories to register in the application as default APIs.
709
- * Theses APIs can not be overridden by plugin factories, but can be overridden
651
+ * These APIs cannot be overridden by plugin factories, but can be overridden
710
652
  * by plugin APIs provided through the
711
653
  * A collection of ApiFactories to register in the application to either
712
654
  * add new ones, or override factories provided by default or by plugins.
@@ -913,4 +855,4 @@ declare type FeatureFlaggedProps = {
913
855
  */
914
856
  declare const FeatureFlagged: (props: FeatureFlaggedProps) => JSX.Element;
915
857
 
916
- export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiFactoryScope, ApiProvider, ApiProviderProps, 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, ExportedSamlSession as SamlSession, SignInPageProps, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
858
+ export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiFactoryScope, ApiProvider, ApiProviderProps, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppIcons, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, AuthApiCreateOptions, BackstageApp, BitbucketAuth, BitbucketSession, BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, ErrorBoundaryFallbackProps, FeatureFlagged, FeatureFlaggedProps, FetchMiddleware, FetchMiddlewares, FlatRoutes, FlatRoutesProps, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuth2CreateOptions, OAuth2Session, OAuthApiCreateOptions, OAuthRequestManager, OktaAuth, OneLoginAuth, OneLoginAuthCreateOptions, SamlAuth, SignInPageProps, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
package/dist/index.esm.js CHANGED
@@ -725,7 +725,7 @@ class AuthSessionStore {
725
725
  }
726
726
  }
727
727
 
728
- const DEFAULT_PROVIDER$a = {
728
+ const DEFAULT_PROVIDER$9 = {
729
729
  id: "oauth2",
730
730
  title: "Your Identity Provider",
731
731
  icon: () => null
@@ -735,7 +735,7 @@ class OAuth2 {
735
735
  const {
736
736
  discoveryApi,
737
737
  environment = "development",
738
- provider = DEFAULT_PROVIDER$a,
738
+ provider = DEFAULT_PROVIDER$9,
739
739
  oauthRequestApi,
740
740
  defaultScopes = [],
741
741
  scopeTransform = (x) => x
@@ -812,7 +812,7 @@ class OAuth2 {
812
812
  }
813
813
  }
814
814
 
815
- const DEFAULT_PROVIDER$9 = {
815
+ const DEFAULT_PROVIDER$8 = {
816
816
  id: "github",
817
817
  title: "GitHub",
818
818
  icon: () => null
@@ -822,7 +822,7 @@ class GithubAuth {
822
822
  const {
823
823
  discoveryApi,
824
824
  environment = "development",
825
- provider = DEFAULT_PROVIDER$9,
825
+ provider = DEFAULT_PROVIDER$8,
826
826
  oauthRequestApi,
827
827
  defaultScopes = ["read:user"]
828
828
  } = options;
@@ -834,16 +834,9 @@ class GithubAuth {
834
834
  defaultScopes
835
835
  });
836
836
  }
837
- static normalizeScope(scope) {
838
- if (!scope) {
839
- return /* @__PURE__ */ new Set();
840
- }
841
- const scopeList = Array.isArray(scope) ? scope : scope.split(/[\s|,]/).filter(Boolean);
842
- return new Set(scopeList);
843
- }
844
837
  }
845
838
 
846
- const DEFAULT_PROVIDER$8 = {
839
+ const DEFAULT_PROVIDER$7 = {
847
840
  id: "gitlab",
848
841
  title: "GitLab",
849
842
  icon: () => null
@@ -853,7 +846,7 @@ class GitlabAuth {
853
846
  const {
854
847
  discoveryApi,
855
848
  environment = "development",
856
- provider = DEFAULT_PROVIDER$8,
849
+ provider = DEFAULT_PROVIDER$7,
857
850
  oauthRequestApi,
858
851
  defaultScopes = ["read_user"]
859
852
  } = options;
@@ -867,7 +860,7 @@ class GitlabAuth {
867
860
  }
868
861
  }
869
862
 
870
- const DEFAULT_PROVIDER$7 = {
863
+ const DEFAULT_PROVIDER$6 = {
871
864
  id: "google",
872
865
  title: "Google",
873
866
  icon: () => null
@@ -879,7 +872,7 @@ class GoogleAuth {
879
872
  discoveryApi,
880
873
  oauthRequestApi,
881
874
  environment = "development",
882
- provider = DEFAULT_PROVIDER$7,
875
+ provider = DEFAULT_PROVIDER$6,
883
876
  defaultScopes = [
884
877
  "openid",
885
878
  `${SCOPE_PREFIX$1}userinfo.email`,
@@ -910,7 +903,7 @@ class GoogleAuth {
910
903
  }
911
904
  }
912
905
 
913
- const DEFAULT_PROVIDER$6 = {
906
+ const DEFAULT_PROVIDER$5 = {
914
907
  id: "okta",
915
908
  title: "Okta",
916
909
  icon: () => null
@@ -930,7 +923,7 @@ class OktaAuth {
930
923
  const {
931
924
  discoveryApi,
932
925
  environment = "development",
933
- provider = DEFAULT_PROVIDER$6,
926
+ provider = DEFAULT_PROVIDER$5,
934
927
  oauthRequestApi,
935
928
  defaultScopes = ["openid", "email", "profile", "offline_access"]
936
929
  } = options;
@@ -972,7 +965,7 @@ const samlSessionSchema = z.object({
972
965
  })
973
966
  });
974
967
 
975
- const DEFAULT_PROVIDER$5 = {
968
+ const DEFAULT_PROVIDER$4 = {
976
969
  id: "saml",
977
970
  title: "SAML",
978
971
  icon: () => null
@@ -985,7 +978,7 @@ class SamlAuth {
985
978
  const {
986
979
  discoveryApi,
987
980
  environment = "development",
988
- provider = DEFAULT_PROVIDER$5
981
+ provider = DEFAULT_PROVIDER$4
989
982
  } = options;
990
983
  const connector = new DirectAuthConnector({
991
984
  discoveryApi,
@@ -1021,30 +1014,6 @@ class SamlAuth {
1021
1014
  }
1022
1015
  }
1023
1016
 
1024
- const DEFAULT_PROVIDER$4 = {
1025
- id: "auth0",
1026
- title: "Auth0",
1027
- icon: () => null
1028
- };
1029
- class Auth0Auth {
1030
- static create(options) {
1031
- const {
1032
- discoveryApi,
1033
- environment = "development",
1034
- provider = DEFAULT_PROVIDER$4,
1035
- oauthRequestApi,
1036
- defaultScopes = ["openid", `email`, `profile`]
1037
- } = options;
1038
- return OAuth2.create({
1039
- discoveryApi,
1040
- oauthRequestApi,
1041
- provider,
1042
- environment,
1043
- defaultScopes
1044
- });
1045
- }
1046
- }
1047
-
1048
1017
  const DEFAULT_PROVIDER$3 = {
1049
1018
  id: "microsoft",
1050
1019
  title: "Microsoft",
@@ -1433,7 +1402,7 @@ class PluginProtocolResolverFetchMiddleware {
1433
1402
  base = `${baseUrl.protocol}//${authority}${baseUrl.host}${baseUrl.pathname}`;
1434
1403
  }
1435
1404
  const target = `${join(base, pathname)}${search}${hash}`;
1436
- return next(target, request);
1405
+ return next(target, typeof input === "string" ? init : input);
1437
1406
  };
1438
1407
  }
1439
1408
  }
@@ -1520,9 +1489,6 @@ class OAuthRequestManager {
1520
1489
  this.handlerCount = 0;
1521
1490
  }
1522
1491
  createAuthRequester(options) {
1523
- if (!options.provider.id) {
1524
- console.warn("DEPRECATION WARNING: Not passing a provider id to createAuthRequester is deprecated, it will be required in the future");
1525
- }
1526
1492
  const handler = new OAuthPendingRequests();
1527
1493
  const index = this.handlerCount;
1528
1494
  this.handlerCount++;
@@ -1603,7 +1569,7 @@ class WebStorage {
1603
1569
  } catch (e) {
1604
1570
  this.errorApi.post(new Error(`Error when parsing JSON config from storage for: ${key}`));
1605
1571
  }
1606
- return { key, value, newValue: value, presence };
1572
+ return { key, value, presence };
1607
1573
  }
1608
1574
  forBucket(name) {
1609
1575
  const bucketPath = `${this.namespace}/${name}`;
@@ -2591,5 +2557,5 @@ const FlatRoutes = (props) => {
2591
2557
  return useRoutes(routes);
2592
2558
  };
2593
2559
 
2594
- export { AlertApiForwarder, ApiFactoryRegistry, ApiProvider, ApiResolver, AppThemeSelector, AtlassianAuth, Auth0Auth, BitbucketAuth, ErrorAlerter, ErrorApiForwarder, FeatureFlagged, FetchMiddlewares, FlatRoutes, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuthRequestManager, OktaAuth, OneLoginAuth, SamlAuth, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
2560
+ export { AlertApiForwarder, ApiFactoryRegistry, ApiProvider, ApiResolver, AppThemeSelector, AtlassianAuth, BitbucketAuth, ErrorAlerter, ErrorApiForwarder, FeatureFlagged, FetchMiddlewares, FlatRoutes, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuthRequestManager, OktaAuth, OneLoginAuth, SamlAuth, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
2595
2561
  //# sourceMappingURL=index.esm.js.map