@@ -53,16 +53,6 @@ export { ApiEntityV1alpha1 };
|
||||
// @public
|
||||
export const apiEntityV1alpha1Validator: KindValidator;
|
||||
|
||||
// @public (undocumented)
|
||||
export function areGroupEntities(
|
||||
entities: Entity[],
|
||||
): entities is GroupEntityV1alpha1[];
|
||||
|
||||
// @public (undocumented)
|
||||
export function areUserEntities(
|
||||
entities: Entity[],
|
||||
): entities is UserEntityV1alpha1[];
|
||||
|
||||
// @public
|
||||
export class CommonValidatorFunctions {
|
||||
static isJsonSafe(value: unknown): boolean;
|
||||
|
||||
@@ -50,14 +50,6 @@ export function isDomainEntity(entity: Entity): entity is DomainEntity {
|
||||
export function isGroupEntity(entity: Entity): entity is GroupEntity {
|
||||
return entity.kind.toLocaleUpperCase('en-US') === 'GROUP';
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function areGroupEntities(
|
||||
entities: Entity[],
|
||||
): entities is GroupEntity[] {
|
||||
return entities.every(e => isGroupEntity(e));
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
@@ -82,9 +74,3 @@ export function isSystemEntity(entity: Entity): entity is SystemEntity {
|
||||
export function isUserEntity(entity: Entity): entity is UserEntity {
|
||||
return entity.kind.toLocaleUpperCase('en-US') === 'USER';
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function areUserEntities(entities: Entity[]): entities is UserEntity[] {
|
||||
return entities.every(e => isUserEntity(e));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
Entity,
|
||||
GroupEntity,
|
||||
UserEntity,
|
||||
isGroupEntity,
|
||||
isUserEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
|
||||
export function areGroupEntities(
|
||||
entities: Entity[],
|
||||
): entities is GroupEntity[] {
|
||||
return entities.every(e => isGroupEntity(e));
|
||||
}
|
||||
|
||||
export function areUserEntities(entities: Entity[]): entities is UserEntity[] {
|
||||
return entities.every(e => isUserEntity(e));
|
||||
}
|
||||
+1
-2
@@ -17,8 +17,6 @@
|
||||
import {
|
||||
DEFAULT_NAMESPACE,
|
||||
Entity,
|
||||
areGroupEntities,
|
||||
areUserEntities,
|
||||
isGroupEntity,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
@@ -51,6 +49,7 @@ import {
|
||||
TeamTransformer,
|
||||
UserTransformer,
|
||||
} from '../lib';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
|
||||
/**
|
||||
* Extracts teams and users out of a multiple GitHub orgs namespaced per org.
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
getOrganizationUsers,
|
||||
parseGithubOrgUrl,
|
||||
} from '../lib';
|
||||
import { areGroupEntities, areUserEntities } from '@backstage/catalog-model';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
|
||||
type GraphQL = typeof graphql;
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ import { TaskRunner } from '@backstage/backend-tasks';
|
||||
import {
|
||||
ANNOTATION_LOCATION,
|
||||
ANNOTATION_ORIGIN_LOCATION,
|
||||
areGroupEntities,
|
||||
areUserEntities,
|
||||
DEFAULT_NAMESPACE,
|
||||
Entity,
|
||||
isGroupEntity,
|
||||
@@ -80,6 +78,7 @@ import {
|
||||
getOrganizationTeamsFromUsers,
|
||||
} from '../lib/github';
|
||||
import { splitTeamSlug } from '../lib/util';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
|
||||
/**
|
||||
* Options for {@link GithubMultiOrgEntityProvider}.
|
||||
|
||||
@@ -19,8 +19,6 @@ import {
|
||||
ANNOTATION_LOCATION,
|
||||
ANNOTATION_ORIGIN_LOCATION,
|
||||
Entity,
|
||||
areGroupEntities,
|
||||
areUserEntities,
|
||||
isGroupEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
@@ -71,6 +69,7 @@ import {
|
||||
} from '../lib/github';
|
||||
import { assignGroupsToUsers, buildOrgHierarchy } from '../lib/org';
|
||||
import { parseGithubOrgUrl, splitTeamSlug } from '../lib/util';
|
||||
import { areGroupEntities, areUserEntities } from '../lib/guards';
|
||||
|
||||
/**
|
||||
* Options for {@link GithubOrgEntityProvider}.
|
||||
|
||||
Reference in New Issue
Block a user