Reorder parameters after rebase

Since a new paramater was introduced in the same
function(getOrganizationUsers)

Signed-off-by: Valério Valério <vdv100@gmail.com>
This commit is contained in:
Valério Valério
2025-11-20 13:05:10 +02:00
parent bad559c1f9
commit 0bc546a459
6 changed files with 25 additions and 34 deletions
@@ -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,
}));
}
@@ -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 () => {
@@ -182,14 +182,15 @@ export type Connection<T> = {
* @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 = `
@@ -148,7 +148,6 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
client,
orgConfig.name,
tokenType,
false,
async (githubUser, ctx): Promise<Entity | undefined> => {
const result = this.options.userTransformer
? await this.options.userTransformer(githubUser, ctx)
@@ -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)
@@ -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);