From 0bc546a459966e7d6e01dece9fec0b2193d36269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rio=20Val=C3=A9rio?= Date: Thu, 20 Nov 2025 13:05:10 +0200 Subject: [PATCH] Reorder parameters after rebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since a new paramater was introduced in the same function(getOrganizationUsers) Signed-off-by: Valério Valério --- .../src/module.ts | 6 ++-- .../src/lib/github.test.ts | 33 ++++++------------- .../src/lib/github.ts | 3 +- .../GithubMultiOrgReaderProcessor.ts | 1 - .../providers/GithubMultiOrgEntityProvider.ts | 6 ++-- .../src/providers/GithubOrgEntityProvider.ts | 10 ++++-- 6 files changed, 25 insertions(+), 34 deletions(-) diff --git a/plugins/catalog-backend-module-github-org/src/module.ts b/plugins/catalog-backend-module-github-org/src/module.ts index e6179e07f1..26abede133 100644 --- a/plugins/catalog-backend-module-github-org/src/module.ts +++ b/plugins/catalog-backend-module-github-org/src/module.ts @@ -134,13 +134,13 @@ function readDefinitionsFromConfig(rootConfig: Config): Array<{ id: string; githubUrl: string; orgs?: string[]; - excludeSuspendedUsers?: boolean; schedule: SchedulerServiceTaskScheduleDefinition; pageSizes?: { teams?: number; teamMembers?: number; organizationMembers?: number; }; + excludeSuspendedUsers?: boolean; }> { const baseKey = 'catalog.providers.githubOrg'; const baseConfig = rootConfig.getOptional(baseKey); @@ -156,8 +156,6 @@ function readDefinitionsFromConfig(rootConfig: Config): Array<{ id: c.getString('id'), githubUrl: c.getString('githubUrl'), orgs: c.getOptionalStringArray('orgs'), - excludeSuspendedUsers: - c.getOptionalBoolean('excludeSuspendedUsers') ?? false, schedule: readSchedulerServiceTaskScheduleDefinitionFromConfig( c.getConfig('schedule'), ), @@ -170,5 +168,7 @@ function readDefinitionsFromConfig(rootConfig: Config): Array<{ ), } : undefined, + excludeSuspendedUsers: + c.getOptionalBoolean('excludeSuspendedUsers') ?? false, })); } diff --git a/plugins/catalog-backend-module-github/src/lib/github.test.ts b/plugins/catalog-backend-module-github/src/lib/github.test.ts index 3cfb1b523a..6933c9a245 100644 --- a/plugins/catalog-backend-module-github/src/lib/github.test.ts +++ b/plugins/catalog-backend-module-github/src/lib/github.test.ts @@ -211,7 +211,7 @@ describe('github', () => { ); await expect( - getOrganizationUsers(graphql, 'a', 'token', true), + getOrganizationUsers(graphql, 'a', 'token', undefined, undefined, true), ).resolves.toEqual(output); }); }); @@ -274,13 +274,7 @@ describe('github', () => { ); await expect( - getOrganizationUsers( - graphql, - 'a', - 'token', - false, - customUserTransformer, - ), + getOrganizationUsers(graphql, 'a', 'token', customUserTransformer), ).resolves.toEqual(output); }); @@ -327,7 +321,6 @@ describe('github', () => { graphql, 'a', 'token', - false, customUserTransformer, ); @@ -385,8 +378,9 @@ describe('github', () => { graphql, 'a', 'token', - false, customUserTransformer, + undefined, + false, ), ).resolves.toEqual(output); }); @@ -1044,19 +1038,12 @@ describe('github', () => { }), ); - await getOrganizationUsers( - graphql as any, - org, - 'token', - false, - undefined, - { - teams: 10, - teamMembers: 20, - organizationMembers: 30, - repositories: 10, - }, - ); + await getOrganizationUsers(graphql as any, org, 'token', undefined, { + teams: 10, + teamMembers: 20, + organizationMembers: 30, + repositories: 10, + }); }); it('uses custom page sizes for getOrganizationRepositories', async () => { diff --git a/plugins/catalog-backend-module-github/src/lib/github.ts b/plugins/catalog-backend-module-github/src/lib/github.ts index 7f2fd0e08b..030fa93fad 100644 --- a/plugins/catalog-backend-module-github/src/lib/github.ts +++ b/plugins/catalog-backend-module-github/src/lib/github.ts @@ -182,14 +182,15 @@ export type Connection = { * @param tokenType - The type of GitHub credential * @param userTransformer - Optional transformer for user entities * @param pageSizes - Optional page sizes configuration + * @param excludeSuspendedUsers - Optional flag to exclude suspended users (only for GitHub Enterprise instances) */ export async function getOrganizationUsers( client: typeof graphql, org: string, tokenType: GithubCredentialType, - excludeSuspendedUsers: boolean = false, userTransformer: UserTransformer = defaultUserTransformer, pageSizes: GithubPageSizes = DEFAULT_PAGE_SIZES, + excludeSuspendedUsers: boolean = false, ): Promise<{ users: Entity[] }> { const suspendedAtField = excludeSuspendedUsers ? 'suspendedAt,' : ''; const query = ` diff --git a/plugins/catalog-backend-module-github/src/processors/GithubMultiOrgReaderProcessor.ts b/plugins/catalog-backend-module-github/src/processors/GithubMultiOrgReaderProcessor.ts index 058ce2cb6c..8af528dfcf 100644 --- a/plugins/catalog-backend-module-github/src/processors/GithubMultiOrgReaderProcessor.ts +++ b/plugins/catalog-backend-module-github/src/processors/GithubMultiOrgReaderProcessor.ts @@ -148,7 +148,6 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor { client, orgConfig.name, tokenType, - false, async (githubUser, ctx): Promise => { const result = this.options.userTransformer ? await this.options.userTransformer(githubUser, ctx) diff --git a/plugins/catalog-backend-module-github/src/providers/GithubMultiOrgEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GithubMultiOrgEntityProvider.ts index bb0dd84c6f..173da84f58 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubMultiOrgEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubMultiOrgEntityProvider.ts @@ -314,9 +314,9 @@ export class GithubMultiOrgEntityProvider implements EntityProvider { client, org, tokenType, - this.options.excludeSuspendedUsers, this.options.userTransformer, pageSizes, + this.options.excludeSuspendedUsers, ); const { teams } = await getOrganizationTeams( @@ -467,9 +467,9 @@ export class GithubMultiOrgEntityProvider implements EntityProvider { client, org, tokenType, - this.options.excludeSuspendedUsers, this.options.userTransformer, pageSizes, + this.options.excludeSuspendedUsers, ); const { teams } = await getOrganizationTeams( @@ -702,9 +702,9 @@ export class GithubMultiOrgEntityProvider implements EntityProvider { client, org, tokenType, - this.options.excludeSuspendedUsers, this.options.userTransformer, pageSizes, + this.options.excludeSuspendedUsers, ); const usersFromChangedGroup = isGroupEntity(team) diff --git a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts index 31b6dc338b..4758311e83 100644 --- a/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GithubOrgEntityProvider.ts @@ -53,6 +53,7 @@ import { createGraphqlClient, createRemoveEntitiesOperation, createReplaceEntitiesOperation, + DEFAULT_PAGE_SIZES, DeferredEntitiesBuilder, getOrganizationTeam, getOrganizationTeams, @@ -245,8 +246,9 @@ export class GithubOrgEntityProvider implements EntityProvider { client, org, tokenType, - this.options.excludeSuspendedUsers, this.options.userTransformer, + DEFAULT_PAGE_SIZES, + this.options.excludeSuspendedUsers, ); const { teams } = await getOrganizationTeams( client, @@ -374,8 +376,9 @@ export class GithubOrgEntityProvider implements EntityProvider { client, org, tokenType, - this.options.excludeSuspendedUsers, this.options.userTransformer, + DEFAULT_PAGE_SIZES, + this.options.excludeSuspendedUsers, ); if (!isGroupEntity(team)) { @@ -466,8 +469,9 @@ export class GithubOrgEntityProvider implements EntityProvider { client, org, tokenType, - this.options.excludeSuspendedUsers, this.options.userTransformer, + DEFAULT_PAGE_SIZES, + this.options.excludeSuspendedUsers, ); const usersToRebuild = users.filter(u => u.metadata.name === userLogin);