catalog-backend-module-github: fix defaultUserTransformer typings
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
@@ -270,12 +270,7 @@ const githubOrgProvider = GithubOrgEntityProvider.fromConfig(env.config, {
|
||||
/* highlight-add-start */
|
||||
userTransformer: async (user, ctx) => {
|
||||
const entity = await defaultUserTransformer(user, ctx);
|
||||
if (
|
||||
entity &&
|
||||
isUserEntity(entity) &&
|
||||
entity.spec.profile &&
|
||||
user.organizationVerifiedDomainEmails?.length
|
||||
) {
|
||||
if (entity && user.organizationVerifiedDomainEmails?.length) {
|
||||
entity.spec.profile!.email = user.organizationVerifiedDomainEmails[0];
|
||||
}
|
||||
return entity;
|
||||
|
||||
@@ -24,12 +24,16 @@ import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
import { ScmLocationAnalyzer } from '@backstage/plugin-catalog-backend';
|
||||
import { TaskRunner } from '@backstage/backend-tasks';
|
||||
import { TokenManager } from '@backstage/backend-common';
|
||||
import { UserEntity } from '@backstage/catalog-model';
|
||||
|
||||
// @public
|
||||
export const defaultOrganizationTeamTransformer: TeamTransformer;
|
||||
|
||||
// @public
|
||||
export const defaultUserTransformer: UserTransformer;
|
||||
export const defaultUserTransformer: (
|
||||
item: GithubUser,
|
||||
_ctx: TransformerContext,
|
||||
) => Promise<UserEntity | undefined>;
|
||||
|
||||
// @public
|
||||
export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
|
||||
@@ -58,9 +58,10 @@ export type TeamTransformer = (
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const defaultUserTransformer: UserTransformer = async (
|
||||
export const defaultUserTransformer = async (
|
||||
item: GithubUser,
|
||||
) => {
|
||||
_ctx: TransformerContext,
|
||||
): Promise<UserEntity | undefined> => {
|
||||
const entity: UserEntity = {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
kind: 'User',
|
||||
|
||||
Reference in New Issue
Block a user