catalog-model: migrate to use exports

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-16 10:57:00 +01:00
parent 7b76628a6a
commit 4a12dbbc45
7 changed files with 111 additions and 62 deletions
@@ -0,0 +1,34 @@
## API Report File for "@backstage/catalog-model"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { JsonObject } from '@backstage/types';
import { SerializedError } from '@backstage/errors';
// Warning: (ae-forgotten-export) The symbol "Entity" needs to be exported by the entry point alpha.d.ts
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@backstage/catalog-model" does not have an export "Entity"
//
// @alpha
export interface AlphaEntity extends Entity {
status?: EntityStatus;
}
// @alpha
export type EntityStatus = {
items?: EntityStatusItem[];
};
// @alpha
export type EntityStatusItem = {
type: string;
level: EntityStatusLevel;
message: string;
error?: SerializedError;
};
// @alpha
export type EntityStatusLevel = 'info' | 'warning' | 'error';
// (No @packageDocumentation comment for this package)
```
-22
View File
@@ -4,12 +4,6 @@
```ts
import { JsonObject } from '@backstage/types';
import { SerializedError } from '@backstage/errors';
// @alpha
export interface AlphaEntity extends Entity {
status?: EntityStatus;
}
// @public
export const ANNOTATION_EDIT_URL = 'backstage.io/edit-url';
@@ -209,22 +203,6 @@ export function entitySchemaValidator<T extends Entity = Entity>(
schema?: unknown,
): (data: unknown) => T;
// @alpha
export type EntityStatus = {
items?: EntityStatusItem[];
};
// @alpha
export type EntityStatusItem = {
type: string;
level: EntityStatusLevel;
message: string;
error?: SerializedError;
};
// @alpha
export type EntityStatusLevel = 'info' | 'warning' | 'error';
// @public
export class FieldFormatEntityPolicy implements EntityPolicy {
constructor(validators?: Validators);
+17 -8
View File
@@ -6,11 +6,21 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"alphaTypes": "dist/index.alpha.d.ts"
"access": "public"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts"
},
"typesVersions": {
"*": {
"*": [
"src/index.ts"
],
"alpha": [
"src/alpha.ts"
]
}
},
"backstage": {
"role": "common-library"
@@ -25,7 +35,7 @@
"backstage"
],
"scripts": {
"build": "backstage-cli package build --experimental-type-build",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
@@ -48,7 +58,6 @@
"yaml": "^2.0.0"
},
"files": [
"dist",
"alpha"
"dist"
]
}
+22
View File
@@ -0,0 +1,22 @@
/*
* 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.
*/
export type {
EntityStatus,
EntityStatusItem,
EntityStatusLevel,
} from './entity/EntityStatus';
export type { AlphaEntity } from './entity/AlphaEntity';
@@ -0,0 +1,37 @@
/*
* 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.
*/
import { Entity } from './Entity';
import { EntityStatus } from './EntityStatus';
/**
* A version of the {@link Entity} type that contains unstable alpha fields.
*
* @remarks
*
* Available via the `@backstage/catalog-model/alpha` import.
*
* @alpha
*/
export interface AlphaEntity extends Entity {
/**
* The current status of the entity, as claimed by various sources.
*
* The keys are implementation defined and the values can be any JSON object
* with semantics that match that implementation.
*/
status?: EntityStatus;
}
@@ -15,7 +15,6 @@
*/
import { JsonObject } from '@backstage/types';
import { EntityStatus } from './EntityStatus';
/**
* The parts of the format that's common to all versions/kinds of entity.
@@ -54,25 +53,6 @@ export type Entity = {
relations?: EntityRelation[];
};
/**
* A version of the {@link Entity} type that contains unstable alpha fields.
*
* @remarks
*
* Available via the `@backstage/catalog-model/alpha` import.
*
* @alpha
*/
export interface AlphaEntity extends Entity {
/**
* The current status of the entity, as claimed by various sources.
*
* The keys are implementation defined and the values can be any JSON object
* with semantics that match that implementation.
*/
status?: EntityStatus;
}
/**
* Metadata fields common to all versions/kinds of entity.
*
+1 -12
View File
@@ -16,19 +16,8 @@
export * from './conditions';
export * from './constants';
export type {
AlphaEntity,
Entity,
EntityLink,
EntityMeta,
EntityRelation,
} from './Entity';
export type { Entity, EntityLink, EntityMeta, EntityRelation } from './Entity';
export type { EntityEnvelope } from './EntityEnvelope';
export type {
EntityStatus,
EntityStatusItem,
EntityStatusLevel,
} from './EntityStatus';
export * from './policies';
export {
getCompoundEntityRef,