chore: fix up api-reports and fix the export

Co-authored-by: Johan Haals <johan.haals@gmail.com>
Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2021-12-01 10:55:17 +01:00
parent 0bb10226b8
commit 64c3fc492e
6 changed files with 60 additions and 8 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ import {
SubRouteRef,
ExternalRouteRef,
} from '@backstage/core-plugin-api';
import { GuestUserIdentity } from '@backstage/core-components';
import { UserIdentity } from '@backstage/core-components';
import { ApiFactoryRegistry, ApiResolver } from '../apis/system';
import {
childDiscoverer,
@@ -361,7 +361,7 @@ export class AppManager implements BackstageApp {
// If the app hasn't configured a sign-in page, we just continue as guest.
if (!SignInPageComponent) {
this.appIdentityProxy.setTarget(new GuestUserIdentity());
this.appIdentityProxy.setTarget(UserIdentity.createGuest());
return (
<RouterComponent>
+41
View File
@@ -9,6 +9,7 @@ import { ApiRef } from '@backstage/core-plugin-api';
import { BackstageIdentityApi } from '@backstage/core-plugin-api';
import { BackstagePalette } from '@backstage/theme';
import { BackstageTheme } from '@backstage/theme';
import { BackstageUserIdentity } from '@backstage/core-plugin-api';
import { ButtonProps as ButtonProps_2 } from '@material-ui/core/Button';
import { CardHeaderProps } from '@material-ui/core/CardHeader';
import { Column } from '@material-table/core';
@@ -20,6 +21,7 @@ import { CSSProperties } from 'react';
import { ElementType } from 'react';
import { ErrorInfo } from 'react';
import { IconComponent } from '@backstage/core-plugin-api';
import { IdentityApi } from '@backstage/core-plugin-api';
import { LinearProgressProps } from '@material-ui/core/LinearProgress';
import { LinkProps as LinkProps_2 } from '@material-ui/core/Link';
import { LinkProps as LinkProps_3 } from 'react-router-dom';
@@ -27,6 +29,7 @@ import MaterialBreadcrumbs from '@material-ui/core/Breadcrumbs';
import { MaterialTableProps } from '@material-table/core';
import { NavLinkProps } from 'react-router-dom';
import { Overrides } from '@material-ui/core/styles/overrides';
import { ProfileInfo } from '@backstage/core-plugin-api';
import { ProfileInfoApi } from '@backstage/core-plugin-api';
import { PropsWithChildren } from 'react';
import { default as React_2 } from 'react';
@@ -35,6 +38,7 @@ import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { SessionApi } from '@backstage/core-plugin-api';
import { SignInPageProps } from '@backstage/core-plugin-api';
import { SignInResult } from '@backstage/core-plugin-api';
import { SparklinesLineProps } from 'react-sparklines';
import { SparklinesProps } from 'react-sparklines';
import { StyledComponentProps } from '@material-ui/core/styles';
@@ -2317,6 +2321,42 @@ export function useQueryParamState<T>(
// @public (undocumented)
export function UserIcon(props: IconComponentProps): JSX.Element;
// Warning: (ae-missing-release-tag) "UserIdentity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class UserIdentity implements IdentityApi {
// Warning: (ae-forgotten-export) The symbol "GuestUserIdentity" needs to be exported by the entry point index.d.ts
//
// (undocumented)
static createGuest(): GuestUserIdentity;
// (undocumented)
static from(options: {
identity: BackstageUserIdentity;
authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;
profile?: ProfileInfo;
}): UserIdentity;
// Warning: (ae-forgotten-export) The symbol "LegacyUserIdentity" needs to be exported by the entry point index.d.ts
//
// (undocumented)
static fromLegacy({ result }: { result: SignInResult }): LegacyUserIdentity;
// (undocumented)
getBackstageIdentity(): Promise<BackstageUserIdentity>;
// (undocumented)
getCredentials(): Promise<{
token?: string | undefined;
}>;
// (undocumented)
getIdToken(): Promise<string | undefined>;
// (undocumented)
getProfile(): ProfileInfo;
// (undocumented)
getProfileInfo(): Promise<ProfileInfo>;
// (undocumented)
getUserId(): string;
// (undocumented)
signOut(): Promise<void>;
}
// Warning: (ae-missing-release-tag) "useSupportConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -2360,4 +2400,5 @@ export type WarningPanelClassKey =
// src/components/TabbedLayout/RoutedTabs.d.ts:9:5 - (ae-forgotten-export) The symbol "SubRoute" needs to be exported by the entry point index.d.ts
// src/components/Table/Table.d.ts:20:5 - (ae-forgotten-export) The symbol "SelectedFilters" needs to be exported by the entry point index.d.ts
// src/layout/ErrorBoundary/ErrorBoundary.d.ts:8:5 - (ae-forgotten-export) The symbol "SlackChannel" needs to be exported by the entry point index.d.ts
// src/layout/SignInPage/UserIdentity.d.ts:22:9 - (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/core-components" does not have an export "IdentityApi"
```
@@ -21,16 +21,28 @@ import {
BackstageUserIdentity,
BackstageIdentityApi,
SessionApi,
SignInResult,
} from '@backstage/core-plugin-api';
import { GuestUserIdentity } from './GuestUserIdentity';
import { LegacyUserIdentity } from './LegacyUserIdentity';
export class UserIdentity implements IdentityApi {
static createGuest() {
return new GuestUserIdentity();
}
static fromLegacy({ result }: { result: SignInResult }) {
return LegacyUserIdentity.fromResult(result);
}
static from(options: {
identity: BackstageUserIdentity;
authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;
/**
* Passing a profile synchronously allows the deprecated `getProfile` method to be
* called by consumers of the {@link IdentityApi}. If you do not have any consumers
* of that method than this is safe to leave out.
* of that method then this is safe to leave out.
*
* @deprecated Only provide this if you have plugins that call the synchronous `getProfile` method, which is also deprecated.
*/
@@ -18,5 +18,4 @@ export type { SignInProviderConfig } from './types';
export { SignInPage } from './SignInPage';
export type { SignInPageClassKey } from './styles';
export type { CustomProviderClassKey } from './customProvider';
export { GuestUserIdentity } from './GuestUserIdentity';
export { LegacyUserIdentity } from './LegacyUserIdentity';
export { UserIdentity } from './UserIdentity';
@@ -233,7 +233,7 @@ export class OAuthAdapter implements AuthProviderRouteHandlers {
return;
}
if (!(identity.token || identity.token)) {
if (!(identity.token || identity.id)) {
identity.token = await this.options.tokenIssuer.issueToken({
claims: { sub: identity.id },
});
+2 -2
View File
@@ -5,7 +5,7 @@
```ts
import { AuthorizeRequest } from '@backstage/plugin-permission-common';
import { AuthorizeResult } from '@backstage/plugin-permission-common';
import { BackstageIdentity } from '@backstage/plugin-auth-backend';
import { BackstageIdentityResponse } from '@backstage/plugin-auth-backend';
import { PermissionCondition } from '@backstage/plugin-permission-common';
import { PermissionCriteria } from '@backstage/plugin-permission-common';
import { Router } from 'express';
@@ -98,7 +98,7 @@ export interface PermissionPolicy {
// (undocumented)
handle(
request: PolicyAuthorizeRequest,
user?: BackstageIdentity,
user?: BackstageIdentityResponse,
): Promise<PolicyDecision>;
}