move type to common package

Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
Kiss Miklos
2022-10-07 12:52:33 +02:00
parent 4cc3dccc26
commit 64dea77ede
11 changed files with 77 additions and 38 deletions
+11 -10
View File
@@ -15,23 +15,23 @@
*/
import {
AnalyzeLocationRequest as ExaltedAnalyzeLocationRequest,
AnalyzeLocationResponse as ExaltedAnalyzeLocationResponse,
AnalyzeLocationExistingEntity as ExaltedAnalyzeLocationExistingEntity,
AnalyzeLocationGenerateEntity as ExaltedAnalyzeLocationGenerateEntity,
AnalyzeLocationEntityField as ExaltedAnalyzeLocationEntityField,
AnalyzeLocationRequest as NonDeprecatedAnalyzeLocationRequest,
AnalyzeLocationResponse as NonDeprecatedAnalyzeLocationResponse,
AnalyzeLocationExistingEntity as NonDeprecatedAnalyzeLocationExistingEntity,
AnalyzeLocationGenerateEntity as NonDeprecatedAnalyzeLocationGenerateEntity,
AnalyzeLocationEntityField as NonDeprecatedAnalyzeLocationEntityField,
} from '@backstage/plugin-catalog-common';
/**
* @public
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
*/
export type AnalyzeLocationRequest = ExaltedAnalyzeLocationRequest;
export type AnalyzeLocationRequest = NonDeprecatedAnalyzeLocationRequest;
/**
* @public
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
*/
export type AnalyzeLocationResponse = ExaltedAnalyzeLocationResponse;
export type AnalyzeLocationResponse = NonDeprecatedAnalyzeLocationResponse;
/**
* If the folder pointed to already contained catalog info yaml files, they are
@@ -42,7 +42,7 @@ export type AnalyzeLocationResponse = ExaltedAnalyzeLocationResponse;
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
*/
export type AnalyzeLocationExistingEntity =
ExaltedAnalyzeLocationExistingEntity;
NonDeprecatedAnalyzeLocationExistingEntity;
/**
* This is some form of representation of what the analyzer could deduce.
* We should probably have a chat about how this can best be conveyed to
@@ -53,7 +53,7 @@ export type AnalyzeLocationExistingEntity =
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
*/
export type AnalyzeLocationGenerateEntity =
ExaltedAnalyzeLocationGenerateEntity;
NonDeprecatedAnalyzeLocationGenerateEntity;
/**
*
@@ -63,7 +63,8 @@ export type AnalyzeLocationGenerateEntity =
* @public
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
*/
export type AnalyzeLocationEntityField = ExaltedAnalyzeLocationEntityField;
export type AnalyzeLocationEntityField =
NonDeprecatedAnalyzeLocationEntityField;
/** @public */
export type LocationAnalyzer = {
+7 -1
View File
@@ -6,7 +6,6 @@
import { BasicPermission } from '@backstage/plugin-permission-common';
import { Entity } from '@backstage/catalog-model';
import { IndexableDocument } from '@backstage/plugin-search-common';
import { LocationSpec } from '@backstage/plugin-catalog-node';
import { ResourcePermission } from '@backstage/plugin-permission-common';
// @public (undocumented)
@@ -93,6 +92,13 @@ export const catalogPermissions: (
| ResourcePermission<'catalog-entity'>
)[];
// @public
export type LocationSpec = {
type: string;
target: string;
presence?: 'optional' | 'required';
};
// @alpha
export const RESOURCE_TYPE_CATALOG_ENTITY = 'catalog-entity';
```
+32
View File
@@ -0,0 +1,32 @@
/*
* Copyright 2022 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.
*/
/**
* Holds the entity location information.
*
* @remarks
*
* `presence` flag: when using repo importer plugin, location is being created before the component yaml file is merged to the main branch.
* This flag is then set to indicate that the file can be not present.
* default value: 'required'.
*
* @public
*/
export type LocationSpec = {
type: string;
target: string;
presence?: 'optional' | 'required';
};
+1
View File
@@ -36,3 +36,4 @@ export type { CatalogEntityPermission } from './permissions';
export * from './search';
export * from './ingestion';
export type { LocationSpec } from './common';
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { LocationSpec } from '@backstage/plugin-catalog-node';
import { LocationSpec } from '../common';
import { Entity } from '@backstage/catalog-model';
import { RecursivePartial } from './RecursivePartial';
+16 -19
View File
@@ -10,6 +10,7 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
import { Entity } from '@backstage/catalog-model';
import { ExtensionPoint } from '@backstage/backend-plugin-api';
import { JsonValue } from '@backstage/types';
import { LocationSpec as LocationSpec_2 } from '@backstage/plugin-catalog-common';
import { ServiceRef } from '@backstage/backend-plugin-api';
// @alpha (undocumented)
@@ -31,7 +32,7 @@ export const catalogProcessingExtensionPoint: ExtensionPoint<CatalogProcessingEx
export type CatalogProcessor = {
getProcessorName(): string;
readLocation?(
location: LocationSpec,
location: LocationSpec_2,
optional: boolean,
emit: CatalogProcessorEmit,
parser: CatalogProcessorParser,
@@ -39,15 +40,15 @@ export type CatalogProcessor = {
): Promise<boolean>;
preProcessEntity?(
entity: Entity,
location: LocationSpec,
location: LocationSpec_2,
emit: CatalogProcessorEmit,
originLocation: LocationSpec,
originLocation: LocationSpec_2,
cache: CatalogProcessorCache,
): Promise<Entity>;
validateEntityKind?(entity: Entity): Promise<boolean>;
postProcessEntity?(
entity: Entity,
location: LocationSpec,
location: LocationSpec_2,
emit: CatalogProcessorEmit,
cache: CatalogProcessorCache,
): Promise<Entity>;
@@ -66,26 +67,26 @@ export type CatalogProcessorEmit = (generated: CatalogProcessorResult) => void;
export type CatalogProcessorEntityResult = {
type: 'entity';
entity: Entity;
location: LocationSpec;
location: LocationSpec_2;
};
// @public (undocumented)
export type CatalogProcessorErrorResult = {
type: 'error';
error: Error;
location: LocationSpec;
location: LocationSpec_2;
};
// @public (undocumented)
export type CatalogProcessorLocationResult = {
type: 'location';
location: LocationSpec;
location: LocationSpec_2;
};
// @public
export type CatalogProcessorParser = (options: {
data: Buffer;
location: LocationSpec;
location: LocationSpec_2;
}) => AsyncIterable<CatalogProcessorResult>;
// @public (undocumented)
@@ -153,30 +154,26 @@ export type EntityRelationSpec = {
target: CompoundEntityRef;
};
// @public
export type LocationSpec = {
type: string;
target: string;
presence?: 'optional' | 'required';
};
// @public @deprecated
export type LocationSpec = LocationSpec_2;
// @public
export const processingResult: Readonly<{
readonly notFoundError: (
atLocation: LocationSpec,
atLocation: LocationSpec_2,
message: string,
) => CatalogProcessorResult;
readonly inputError: (
atLocation: LocationSpec,
atLocation: LocationSpec_2,
message: string,
) => CatalogProcessorResult;
readonly generalError: (
atLocation: LocationSpec,
atLocation: LocationSpec_2,
message: string,
) => CatalogProcessorResult;
readonly location: (newLocation: LocationSpec) => CatalogProcessorResult;
readonly location: (newLocation: LocationSpec_2) => CatalogProcessorResult;
readonly entity: (
atLocation: LocationSpec,
atLocation: LocationSpec_2,
newEntity: Entity,
) => CatalogProcessorResult;
readonly relation: (spec: EntityRelationSpec) => CatalogProcessorResult;
+1
View File
@@ -28,6 +28,7 @@
"@backstage/catalog-client": "workspace:^",
"@backstage/catalog-model": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-catalog-common": "workspace:^",
"@backstage/types": "workspace:^"
},
"devDependencies": {
+3 -5
View File
@@ -15,6 +15,7 @@
*/
import { CompoundEntityRef } from '@backstage/catalog-model';
import { LocationSpec as NonDeprecatedLocationSpec } from '@backstage/plugin-catalog-common';
/**
* Holds the entity location information.
@@ -26,12 +27,9 @@ import { CompoundEntityRef } from '@backstage/catalog-model';
* default value: 'required'.
*
* @public
* @deprecated use the same type from `@backstage/plugin-catalog-common` instead
*/
export type LocationSpec = {
type: string;
target: string;
presence?: 'optional' | 'required';
};
export type LocationSpec = NonDeprecatedLocationSpec;
/**
* Holds the relation data for entities.
@@ -17,7 +17,8 @@
import { InputError, NotFoundError } from '@backstage/errors';
import { Entity } from '@backstage/catalog-model';
import { CatalogProcessorResult } from './processor';
import { EntityRelationSpec, LocationSpec } from './common';
import { EntityRelationSpec } from './common';
import { LocationSpec } from '@backstage/plugin-catalog-common';
/**
* Factory functions for the standard processing result types.
+2 -1
View File
@@ -16,7 +16,8 @@
import { Entity } from '@backstage/catalog-model';
import { JsonValue } from '@backstage/types';
import { EntityRelationSpec, LocationSpec } from './common';
import { EntityRelationSpec } from './common';
import { LocationSpec } from '@backstage/plugin-catalog-common';
/**
* @public
+1
View File
@@ -4838,6 +4838,7 @@ __metadata:
"@backstage/catalog-model": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/plugin-catalog-common": "workspace:^"
"@backstage/types": "workspace:^"
languageName: unknown
linkType: soft