From d19c77cc4140f774989a81a4ba78f78323e9db16 Mon Sep 17 00:00:00 2001 From: Katharina Sick Date: Tue, 7 Feb 2023 08:55:10 +0100 Subject: [PATCH] fixed API report errors and regenerated the reports Signed-off-by: Katharina Sick --- packages/core-app-api/api-report.md | 20 +++++++++++++++++++ packages/core-plugin-api/api-report.md | 5 +++++ plugins/auth-backend/api-report.md | 9 +-------- .../src/providers/bitbucketServer/provider.ts | 18 +++++++++++------ 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index 133ac22e5b..37f7a98de0 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -22,6 +22,7 @@ import { BackstageIdentityApi } from '@backstage/core-plugin-api'; import { BackstageIdentityResponse } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; import { bitbucketAuthApiRef } from '@backstage/core-plugin-api'; +import { bitbucketServerAuthApiRef } from '@backstage/core-plugin-api'; import { ComponentType } from 'react'; import { Config } from '@backstage/config'; import { ConfigReader } from '@backstage/config'; @@ -280,6 +281,25 @@ export class BitbucketAuth { static create(options: OAuthApiCreateOptions): typeof bitbucketAuthApiRef.T; } +// @public +export class BitbucketServerAuth { + // (undocumented) + static create( + options: OAuthApiCreateOptions, + ): typeof bitbucketServerAuthApiRef.T; +} + +// @public +export type BitbucketServerSession = { + providerInfo: { + accessToken: string; + scopes: Set; + expiresAt?: Date; + }; + profile: ProfileInfo; + backstageIdentity: BackstageIdentityResponse; +}; + // @public export type BitbucketSession = { providerInfo: { diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index dc7aa9eb5f..91f05921bf 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -241,6 +241,11 @@ export const bitbucketAuthApiRef: ApiRef< OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi >; +// @public +export const bitbucketServerAuthApiRef: ApiRef< + OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi +>; + // @public export type BootErrorPageProps = { step: 'load-config' | 'load-chunk'; diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index e25ed18dfe..8df6079b9f 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -16,7 +16,6 @@ import { GetEntitiesRequest } from '@backstage/catalog-client'; import { IncomingHttpHeaders } from 'http'; import { JsonValue } from '@backstage/types'; import { Logger } from 'winston'; -import passport from 'passport'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { Profile } from 'passport'; @@ -133,11 +132,9 @@ export type BitbucketPassportProfile = Profile & { }; }; -// Warning: (ae-missing-release-tag) "BitbucketServerOAuthResult" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// // @public (undocumented) export type BitbucketServerOAuthResult = { - fullProfile: PassportProfile; + fullProfile: Profile; params: { scope: string; access_token?: string; @@ -763,8 +760,4 @@ export type WebMessageResponse = type: 'authorization_response'; error: Error; }; - -// Warnings were encountered during analysis: -// -// src/providers/bitbucketServer/provider.d.ts:6:5 - (ae-forgotten-export) The symbol "PassportProfile" needs to be exported by the entry point index.d.ts ``` diff --git a/plugins/auth-backend/src/providers/bitbucketServer/provider.ts b/plugins/auth-backend/src/providers/bitbucketServer/provider.ts index 397f63733f..305f07c9d5 100644 --- a/plugins/auth-backend/src/providers/bitbucketServer/provider.ts +++ b/plugins/auth-backend/src/providers/bitbucketServer/provider.ts @@ -40,13 +40,14 @@ import { } from '../types'; import express from 'express'; import { createAuthProviderIntegration } from '../createAuthProviderIntegration'; -import { PassportProfile } from '../../lib/passport/types'; +import { Profile as PassportProfile } from 'passport'; import { commonByEmailResolver } from '../resolvers'; type PrivateInfo = { refreshToken: string; }; +/** @public */ export type BitbucketServerOAuthResult = { fullProfile: PassportProfile; params: { @@ -216,7 +217,7 @@ export class BitbucketServerAuthProvider implements OAuthHandlers { const user = await userResponse.json(); - return { + const passportProfile = { provider: 'bitbucketServer', id: user.id.toString(), displayName: user.displayName, @@ -226,10 +227,15 @@ export class BitbucketServerAuthProvider implements OAuthHandlers { value: user.emailAddress, }, ], - avatarUrl: user.avatarUrl - ? `https://${this.host}${user.avatarUrl}` - : undefined, - }; + } as PassportProfile; + + if (user.avatarUrl) { + passportProfile.photos = [ + { value: `https://${this.host}${user.avatarUrl}` }, + ]; + } + + return passportProfile; } }