deprecate the filter types and move to catalog-node
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-node': minor
|
||||
---
|
||||
|
||||
Added `EntitiesSearchFilter` and `EntityFilter` from `@backstage/plugin-catalog-backend`, for reuse
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Deprecated `EntitiesSearchFilter` and `EntityFilter`, which can now be imported from `@backstage/plugin-catalog-node` instead
|
||||
@@ -6,6 +6,7 @@
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { ConditionalPolicyDecision } from '@backstage/plugin-permission-common';
|
||||
import { Conditions } from '@backstage/plugin-permission-node';
|
||||
import { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { PermissionCondition } from '@backstage/plugin-permission-common';
|
||||
import { PermissionCriteria } from '@backstage/plugin-permission-common';
|
||||
@@ -90,12 +91,6 @@ export const createCatalogPermissionRule: <
|
||||
rule: PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>,
|
||||
) => PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
|
||||
|
||||
// @public
|
||||
export type EntitiesSearchFilter = {
|
||||
key: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export const permissionRules: {
|
||||
hasAnnotation: PermissionRule<
|
||||
|
||||
@@ -28,7 +28,9 @@ import { Config } from '@backstage/config';
|
||||
import { DefaultCatalogCollatorFactory as DefaultCatalogCollatorFactory_2 } from '@backstage/plugin-search-backend-module-catalog';
|
||||
import type { DefaultCatalogCollatorFactoryOptions as DefaultCatalogCollatorFactoryOptions_2 } from '@backstage/plugin-search-backend-module-catalog';
|
||||
import { DeferredEntity as DeferredEntity_2 } from '@backstage/plugin-catalog-node';
|
||||
import { EntitiesSearchFilter as EntitiesSearchFilter_2 } from '@backstage/plugin-catalog-node';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityFilter as EntityFilter_2 } from '@backstage/plugin-catalog-node';
|
||||
import { EntityPolicy } from '@backstage/catalog-model';
|
||||
import { EntityProvider as EntityProvider_2 } from '@backstage/plugin-catalog-node';
|
||||
import { EntityProviderConnection as EntityProviderConnection_2 } from '@backstage/plugin-catalog-node';
|
||||
@@ -191,7 +193,7 @@ export type CatalogEnvironment = {
|
||||
// @public
|
||||
export type CatalogPermissionRuleInput<
|
||||
TParams extends PermissionRuleParams = PermissionRuleParams,
|
||||
> = PermissionRule<Entity, EntitiesSearchFilter, 'catalog-entity', TParams>;
|
||||
> = PermissionRule<Entity, EntitiesSearchFilter_2, 'catalog-entity', TParams>;
|
||||
|
||||
// @public
|
||||
export interface CatalogProcessingEngine {
|
||||
@@ -313,24 +315,11 @@ export type DefaultCatalogCollatorFactoryOptions =
|
||||
// @public @deprecated (undocumented)
|
||||
export type DeferredEntity = DeferredEntity_2;
|
||||
|
||||
// @public
|
||||
export type EntitiesSearchFilter = {
|
||||
key: string;
|
||||
values?: string[];
|
||||
};
|
||||
// @public @deprecated (undocumented)
|
||||
export type EntitiesSearchFilter = EntitiesSearchFilter_2;
|
||||
|
||||
// @public
|
||||
export type EntityFilter =
|
||||
| {
|
||||
allOf: EntityFilter[];
|
||||
}
|
||||
| {
|
||||
anyOf: EntityFilter[];
|
||||
}
|
||||
| {
|
||||
not: EntityFilter;
|
||||
}
|
||||
| EntitiesSearchFilter;
|
||||
// @public @deprecated (undocumented)
|
||||
export type EntityFilter = EntityFilter_2;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export type EntityProvider = EntityProvider_2;
|
||||
|
||||
@@ -14,11 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// TODO(Rugvip): Re-exported for alpha types as the API report will otherwise
|
||||
// produce warnings due to the indirect dependency. Would be nice to avoid.
|
||||
import type { EntitiesSearchFilter } from './catalog/types';
|
||||
|
||||
export type { /** @alpha */ EntitiesSearchFilter };
|
||||
|
||||
export * from './permissions';
|
||||
export { catalogPlugin as default } from './service/CatalogPlugin';
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 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.
|
||||
*/
|
||||
|
||||
export type { EntitiesSearchFilter, EntityFilter } from './types';
|
||||
@@ -15,19 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
/**
|
||||
* A filter expression for entities.
|
||||
*
|
||||
* Any (at least one) of the outer sets must match, within which all of the
|
||||
* individual filters must match.
|
||||
* @public
|
||||
*/
|
||||
export type EntityFilter =
|
||||
| { allOf: EntityFilter[] }
|
||||
| { anyOf: EntityFilter[] }
|
||||
| { not: EntityFilter }
|
||||
| EntitiesSearchFilter;
|
||||
import { EntityFilter } from '@backstage/plugin-catalog-node';
|
||||
|
||||
/**
|
||||
* A pagination rule for entities.
|
||||
@@ -46,27 +34,6 @@ export type EntityOrder = {
|
||||
order: 'asc' | 'desc';
|
||||
};
|
||||
|
||||
/**
|
||||
* Matches rows in the search table.
|
||||
* @public
|
||||
*/
|
||||
export type EntitiesSearchFilter = {
|
||||
/**
|
||||
* The key to match on.
|
||||
*
|
||||
* Matches are always case insensitive.
|
||||
*/
|
||||
key: string;
|
||||
|
||||
/**
|
||||
* Match on plain equality of values.
|
||||
*
|
||||
* Match on values that are equal to any of the given array items. Matches are
|
||||
* always case insensitive.
|
||||
*/
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
export type PageInfo =
|
||||
| {
|
||||
hasNextPage: false;
|
||||
|
||||
@@ -18,6 +18,8 @@ import {
|
||||
locationSpecToMetadataName as _locationSpecToMetadataName,
|
||||
locationSpecToLocationEntity as _locationSpecToLocationEntity,
|
||||
processingResult as _processingResult,
|
||||
type EntitiesSearchFilter as _EntitiesSearchFilter,
|
||||
type EntityFilter as _EntityFilter,
|
||||
type DeferredEntity as _DeferredEntity,
|
||||
type EntityRelationSpec as _EntityRelationSpec,
|
||||
type CatalogProcessor as _CatalogProcessor,
|
||||
@@ -53,6 +55,16 @@ export const locationSpecToLocationEntity = _locationSpecToLocationEntity;
|
||||
* @deprecated import from `@backstage/plugin-catalog-node` instead
|
||||
*/
|
||||
export const processingResult = _processingResult;
|
||||
/**
|
||||
* @public
|
||||
* @deprecated import from `@backstage/plugin-catalog-node` instead
|
||||
*/
|
||||
export type EntitiesSearchFilter = _EntitiesSearchFilter;
|
||||
/**
|
||||
* @public
|
||||
* @deprecated import from `@backstage/plugin-catalog-node` instead
|
||||
*/
|
||||
export type EntityFilter = _EntityFilter;
|
||||
/**
|
||||
* @public
|
||||
* @deprecated import from `@backstage/plugin-catalog-node` instead
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
export * from './catalog';
|
||||
export * from './ingestion';
|
||||
export * from './modules';
|
||||
export * from './processing';
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';
|
||||
import { z } from 'zod';
|
||||
import { EntitiesSearchFilter } from '../../catalog/types';
|
||||
import { createCatalogPermissionRule } from './util';
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ export const isEntityKind = createCatalogPermissionRule({
|
||||
const resourceKind = resource.kind.toLocaleLowerCase('en-US');
|
||||
return kinds.some(kind => kind.toLocaleLowerCase('en-US') === resourceKind);
|
||||
},
|
||||
toQuery({ kinds }): EntitiesSearchFilter {
|
||||
toQuery({ kinds }) {
|
||||
return {
|
||||
key: 'kind',
|
||||
values: kinds.map(kind => kind.toLocaleLowerCase('en-US')),
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common/alpha';
|
||||
import { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
|
||||
import { PermissionRuleParams } from '@backstage/plugin-permission-common';
|
||||
import {
|
||||
makeCreatePermissionRule,
|
||||
PermissionRule,
|
||||
} from '@backstage/plugin-permission-node';
|
||||
import { EntitiesSearchFilter } from '../../catalog/types';
|
||||
|
||||
/**
|
||||
* Convenience type for {@link @backstage/plugin-permission-node#PermissionRule}
|
||||
|
||||
@@ -20,8 +20,9 @@ import { createConditionTransformer } from '@backstage/plugin-permission-node';
|
||||
import { isEntityKind } from '../permissions/rules/isEntityKind';
|
||||
import { CatalogPermissionRule } from '../permissions/rules';
|
||||
import { AuthorizedEntitiesCatalog } from './AuthorizedEntitiesCatalog';
|
||||
import { Cursor, EntityFilter, QueryEntitiesResponse } from '../catalog/types';
|
||||
import { Cursor, QueryEntitiesResponse } from '../catalog/types';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityFilter } from '@backstage/plugin-catalog-node';
|
||||
|
||||
describe('AuthorizedEntitiesCatalog', () => {
|
||||
const fakeCatalog = {
|
||||
|
||||
@@ -35,12 +35,12 @@ import {
|
||||
EntityAncestryResponse,
|
||||
EntityFacetsRequest,
|
||||
EntityFacetsResponse,
|
||||
EntityFilter,
|
||||
QueryEntitiesRequest,
|
||||
QueryEntitiesResponse,
|
||||
} from '../catalog/types';
|
||||
import { basicEntityFilter } from './request/basicEntityFilter';
|
||||
import { isQueryEntitiesCursorRequest } from './util';
|
||||
import { EntityFilter } from '@backstage/plugin-catalog-node';
|
||||
|
||||
export class AuthorizedEntitiesCatalog implements EntitiesCatalog {
|
||||
constructor(
|
||||
|
||||
@@ -37,6 +37,7 @@ import lodash, { keyBy } from 'lodash';
|
||||
import {
|
||||
CatalogProcessor,
|
||||
CatalogProcessorParser,
|
||||
EntitiesSearchFilter,
|
||||
EntityProvider,
|
||||
ScmLocationAnalyzer,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
@@ -79,7 +80,6 @@ import { Config, readDurationFromConfig } from '@backstage/config';
|
||||
import { Logger } from 'winston';
|
||||
import { connectEntityProviders } from '../processing/connectEntityProviders';
|
||||
import { PermissionRuleParams } from '@backstage/plugin-permission-common';
|
||||
import { EntitiesSearchFilter } from '../catalog/types';
|
||||
import { permissionRules as catalogPermissionRules } from '../permissions/rules';
|
||||
import { PermissionRule } from '@backstage/plugin-permission-node';
|
||||
import {
|
||||
|
||||
@@ -31,11 +31,9 @@ import {
|
||||
EntitiesCatalog,
|
||||
EntitiesRequest,
|
||||
EntitiesResponse,
|
||||
EntitiesSearchFilter,
|
||||
EntityAncestryResponse,
|
||||
EntityFacetsRequest,
|
||||
EntityFacetsResponse,
|
||||
EntityFilter,
|
||||
EntityPagination,
|
||||
QueryEntitiesRequest,
|
||||
QueryEntitiesResponse,
|
||||
@@ -55,6 +53,10 @@ import {
|
||||
isQueryEntitiesCursorRequest,
|
||||
isQueryEntitiesInitialRequest,
|
||||
} from './util';
|
||||
import {
|
||||
EntitiesSearchFilter,
|
||||
EntityFilter,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
|
||||
const defaultSortField: EntityOrder = {
|
||||
field: 'metadata.uid',
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { EntitiesSearchFilter, EntityFilter } from '../../catalog';
|
||||
import {
|
||||
EntitiesSearchFilter,
|
||||
EntityFilter,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
|
||||
/**
|
||||
* Forms a full EntityFilter based on a single key-value(s) object.
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
*/
|
||||
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { EntitiesSearchFilter, EntityFilter } from '../../catalog';
|
||||
import { parseStringsParam } from './common';
|
||||
import {
|
||||
EntitiesSearchFilter,
|
||||
EntityFilter,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
|
||||
/**
|
||||
* Parses the filtering part of a query, like
|
||||
|
||||
@@ -20,11 +20,11 @@ import lodash from 'lodash';
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
Cursor,
|
||||
EntityFilter,
|
||||
QueryEntitiesCursorRequest,
|
||||
QueryEntitiesInitialRequest,
|
||||
QueryEntitiesRequest,
|
||||
} from '../catalog/types';
|
||||
import { EntityFilter } from '@backstage/plugin-catalog-node';
|
||||
|
||||
export async function requireRequestBody(req: Request): Promise<unknown> {
|
||||
const contentType = req.header('content-type');
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
```ts
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { CatalogProcessor } from '@backstage/plugin-catalog-node';
|
||||
import { EntitiesSearchFilter } from '@backstage/plugin-catalog-node';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-node';
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
@@ -61,11 +62,5 @@ export const catalogProcessingExtensionPoint: ExtensionPoint<CatalogProcessingEx
|
||||
// @alpha
|
||||
export const catalogServiceRef: ServiceRef<CatalogApi, 'plugin'>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type EntitiesSearchFilter = {
|
||||
key: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
|
||||
@@ -105,6 +105,25 @@ export type DeferredEntity = {
|
||||
locationKey?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type EntitiesSearchFilter = {
|
||||
key: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export type EntityFilter =
|
||||
| {
|
||||
allOf: EntityFilter[];
|
||||
}
|
||||
| {
|
||||
anyOf: EntityFilter[];
|
||||
}
|
||||
| {
|
||||
not: EntityFilter;
|
||||
}
|
||||
| EntitiesSearchFilter;
|
||||
|
||||
// @public
|
||||
export interface EntityProvider {
|
||||
connect(connection: EntityProviderConnection): Promise<void>;
|
||||
|
||||
@@ -19,9 +19,6 @@ export type { CatalogProcessingExtensionPoint } from './extensions';
|
||||
export { catalogProcessingExtensionPoint } from './extensions';
|
||||
export type { CatalogAnalysisExtensionPoint } from './extensions';
|
||||
export { catalogAnalysisExtensionPoint } from './extensions';
|
||||
export type {
|
||||
EntitiesSearchFilter,
|
||||
CatalogPermissionRuleInput,
|
||||
} from './extensions';
|
||||
export type { CatalogPermissionRuleInput } from './extensions';
|
||||
export type { CatalogPermissionExtensionPoint } from './extensions';
|
||||
export { catalogPermissionExtensionPoint } from './extensions';
|
||||
|
||||
@@ -52,3 +52,36 @@ export type EntityRelationSpec = {
|
||||
*/
|
||||
target: CompoundEntityRef;
|
||||
};
|
||||
|
||||
/**
|
||||
* A filter expression for entities.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type EntityFilter =
|
||||
| { allOf: EntityFilter[] }
|
||||
| { anyOf: EntityFilter[] }
|
||||
| { not: EntityFilter }
|
||||
| EntitiesSearchFilter;
|
||||
|
||||
/**
|
||||
* Matches rows in the search table.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type EntitiesSearchFilter = {
|
||||
/**
|
||||
* The key to match on.
|
||||
*
|
||||
* Matches are always case insensitive.
|
||||
*/
|
||||
key: string;
|
||||
|
||||
/**
|
||||
* Match on plain equality of values.
|
||||
*
|
||||
* Match on values that are equal to any of the given array items. Matches are
|
||||
* always case insensitive.
|
||||
*/
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
@@ -15,7 +15,12 @@
|
||||
*/
|
||||
|
||||
export { processingResult } from './processingResult';
|
||||
export type { EntityRelationSpec, LocationSpec } from './common';
|
||||
export type {
|
||||
EntityRelationSpec,
|
||||
LocationSpec,
|
||||
EntitiesSearchFilter,
|
||||
EntityFilter,
|
||||
} from './common';
|
||||
export type {
|
||||
CatalogProcessor,
|
||||
CatalogProcessorParser,
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import {
|
||||
EntityProvider,
|
||||
CatalogProcessor,
|
||||
EntitiesSearchFilter,
|
||||
EntityProvider,
|
||||
PlaceholderResolver,
|
||||
ScmLocationAnalyzer,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { PermissionRuleParams } from '@backstage/plugin-permission-common';
|
||||
import { PermissionRule } from '@backstage/plugin-permission-node';
|
||||
|
||||
@@ -60,14 +62,6 @@ export const catalogAnalysisExtensionPoint =
|
||||
id: 'catalog.analysis',
|
||||
});
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export type EntitiesSearchFilter = {
|
||||
key: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user