diff --git a/packages/catalog-client/package.json b/packages/catalog-client/package.json index d5bfbda6a9..015af2a8ff 100644 --- a/packages/catalog-client/package.json +++ b/packages/catalog-client/package.json @@ -52,8 +52,7 @@ "@backstage/catalog-model": "workspace:^", "@backstage/errors": "workspace:^", "@backstage/plugin-catalog-common": "workspace:^", - "cross-fetch": "^4.0.0", - "uri-template": "^2.0.0" + "cross-fetch": "^4.0.0" }, "devDependencies": { "@backstage/cli": "workspace:^", diff --git a/packages/cli/config/eslint-factory.js b/packages/cli/config/eslint-factory.js index 856068eef9..312b299fef 100644 --- a/packages/cli/config/eslint-factory.js +++ b/packages/cli/config/eslint-factory.js @@ -167,7 +167,11 @@ function createConfig(dir, extraConfig = {}) { }, }, { - files: ['**/src/generated/**/*.ts'], + files: [ + // old location + '**/src/generated/**/*.ts', + '**/src/schema/openapi/generated/**/*.ts', + ], rules: { ...tsRules, 'no-unused-vars': 'off', diff --git a/packages/repo-tools/cli-report.md b/packages/repo-tools/cli-report.md index 9266957886..68b3dac14d 100644 --- a/packages/repo-tools/cli-report.md +++ b/packages/repo-tools/cli-report.md @@ -145,6 +145,7 @@ Usage: backstage-repo-tools package schema openapi generate [options] Options: --client-package [package] + --server-client-import [import] -h, --help ``` diff --git a/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts b/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts index 919e97a1f7..3317940caa 100644 --- a/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts +++ b/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts @@ -23,11 +23,10 @@ import { decodeCursor } from '../util'; import { parseEntityFilterParams } from './parseEntityFilterParams'; import { parseEntityOrderFieldParams } from './parseEntityOrderFieldParams'; import { parseEntityTransformParams } from './parseEntityTransformParams'; -import { spec } from '../../schema/openapi.generated'; -import { internal } from '@backstage/backend-openapi-utils'; +import { GetEntitiesByQuery } from '@backstage/plugin-catalog-common/client'; export function parseQueryEntitiesParams( - params: internal.QuerySchema, + params: GetEntitiesByQuery['query'], ): Omit { const fields = parseEntityTransformParams(params); diff --git a/plugins/catalog-common/api-report-client.md b/plugins/catalog-common/api-report-client.md new file mode 100644 index 0000000000..0393148a3b --- /dev/null +++ b/plugins/catalog-common/api-report-client.md @@ -0,0 +1,558 @@ +## API Report File for "@backstage/plugin-catalog-common" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +// @public (undocumented) +export type AnalyzeLocation = { + body: AnalyzeLocationRequest; +}; + +// @public (undocumented) +export interface AnalyzeLocationEntityField { + description: string; + field: string; + state: AnalyzeLocationEntityFieldStateEnum; + // (undocumented) + value: string | null; +} + +// @public (undocumented) +export type AnalyzeLocationEntityFieldStateEnum = + | 'analysisSuggestedValue' + | 'analysisSuggestedNoValue' + | 'needsUserInput'; + +// @public +export interface AnalyzeLocationExistingEntity { + // (undocumented) + entity: Entity; + // (undocumented) + isRegistered: boolean; + // (undocumented) + location: LocationSpec; +} + +// @public +export interface AnalyzeLocationGenerateEntity { + // (undocumented) + entity: RecursivePartialEntity; + // (undocumented) + fields: Array; +} + +// @public (undocumented) +export interface AnalyzeLocationRequest { + // (undocumented) + catalogFileName?: string; + // (undocumented) + location: LocationInput; +} + +// @public (undocumented) +export interface AnalyzeLocationResponse { + // (undocumented) + existingEntityFiles: Array; + // (undocumented) + generateEntities: Array; +} + +// @public (undocumented) +export type CreateLocation = { + body: CreateLocationRequest; + query: { + dryRun?: string; + }; +}; + +// @public (undocumented) +export interface CreateLocation201Response { + // (undocumented) + entities: Array; + // (undocumented) + exists?: boolean; + // (undocumented) + location: Location_2; +} + +// @public (undocumented) +export interface CreateLocationRequest { + // (undocumented) + target: string; + // (undocumented) + type: string; +} + +// @public +export class DefaultApiClient { + constructor(options: { + discoveryApi: { + getBaseUrl(pluginId: string): Promise; + }; + fetchApi?: { + fetch: typeof fetch; + }; + }); + analyzeLocation( + request: AnalyzeLocation, + options?: RequestOptions, + ): Promise>; + createLocation( + request: CreateLocation, + options?: RequestOptions, + ): Promise>; + deleteEntityByUid( + request: DeleteEntityByUid, + options?: RequestOptions, + ): Promise>; + deleteLocation( + request: DeleteLocation, + options?: RequestOptions, + ): Promise>; + getEntities( + request: GetEntities, + options?: RequestOptions, + ): Promise>>; + getEntitiesByQuery( + request: GetEntitiesByQuery, + options?: RequestOptions, + ): Promise>; + getEntitiesByRefs( + request: GetEntitiesByRefs, + options?: RequestOptions, + ): Promise>; + getEntityAncestryByName( + request: GetEntityAncestryByName, + options?: RequestOptions, + ): Promise>; + getEntityByName( + request: GetEntityByName, + options?: RequestOptions, + ): Promise>; + getEntityByUid( + request: GetEntityByUid, + options?: RequestOptions, + ): Promise>; + getEntityFacets( + request: GetEntityFacets, + options?: RequestOptions, + ): Promise>; + getLocation( + request: GetLocation, + options?: RequestOptions, + ): Promise>; + getLocationByEntity( + request: GetLocationByEntity, + options?: RequestOptions, + ): Promise>; + getLocations( + request: GetLocations, + options?: RequestOptions, + ): Promise>>; + refreshEntity( + request: RefreshEntity, + options?: RequestOptions, + ): Promise>; + validateEntity( + request: ValidateEntity, + options?: RequestOptions, + ): Promise>; +} + +// @public (undocumented) +export type DeleteEntityByUid = { + path: { + uid: string; + }; +}; + +// @public (undocumented) +export type DeleteLocation = { + path: { + id: string; + }; +}; + +// @public (undocumented) +export interface EntitiesBatchResponse { + items: Array; +} + +// @public (undocumented) +export interface EntitiesQueryResponse { + items: Array; + // (undocumented) + pageInfo: EntitiesQueryResponsePageInfo; + // (undocumented) + totalItems: number; +} + +// @public (undocumented) +export interface EntitiesQueryResponsePageInfo { + nextCursor?: string; + prevCursor?: string; +} + +// @public +export interface Entity { + apiVersion: string; + kind: string; + // (undocumented) + metadata: EntityMeta; + relations?: Array; + spec?: { + [key: string]: any; + }; +} + +// @public (undocumented) +export interface EntityAncestryResponse { + // (undocumented) + items: Array; + // (undocumented) + rootEntityRef: string; +} + +// @public (undocumented) +export interface EntityAncestryResponseItemsInner { + // (undocumented) + entity: Entity; + // (undocumented) + parentEntityRefs: Array; +} + +// @public (undocumented) +export interface EntityFacet { + // (undocumented) + count: number; + // (undocumented) + value: string; +} + +// @public (undocumented) +export interface EntityFacetsResponse { + // (undocumented) + facets: { + [key: string]: Array; + }; +} + +// @public +export interface EntityLink { + icon?: string; + title?: string; + type?: string; + url: string; +} + +// @public +export interface EntityMeta { + // (undocumented) + [key: string]: any; + annotations?: { + [key: string]: string; + }; + description?: string; + etag?: string; + labels?: { + [key: string]: string; + }; + links?: Array; + name: string; + namespace?: string; + tags?: Array; + title?: string; + uid?: string; +} + +// @public +export interface EntityRelation { + targetRef: string; + type: string; +} + +// @public (undocumented) +export interface ErrorError { + // (undocumented) + code?: string; + // (undocumented) + message: string; + // (undocumented) + name: string; + // (undocumented) + stack?: string; +} + +// @public (undocumented) +export interface ErrorRequest { + // (undocumented) + method: string; + // (undocumented) + url: string; +} + +// @public (undocumented) +export interface ErrorResponse { + // (undocumented) + statusCode: number; +} + +// @public (undocumented) +export type GetEntities = { + query: { + fields?: Array; + limit?: number; + filter?: Array; + offset?: number; + after?: string; + order?: Array; + }; +}; + +// @public (undocumented) +export type GetEntitiesByQuery = { + query: { + fields?: Array; + limit?: number; + orderField?: Array; + cursor?: string; + filter?: Array; + fullTextFilterTerm?: string; + fullTextFilterFields?: Array; + }; +}; + +// @public (undocumented) +export type GetEntitiesByRefs = { + body: GetEntitiesByRefsRequest; + query: { + filter?: Array; + }; +}; + +// @public (undocumented) +export interface GetEntitiesByRefsRequest { + // (undocumented) + entityRefs: Array; + // (undocumented) + fields?: Array; +} + +// @public (undocumented) +export type GetEntityAncestryByName = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; + +// @public (undocumented) +export type GetEntityByName = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; + +// @public (undocumented) +export type GetEntityByUid = { + path: { + uid: string; + }; +}; + +// @public (undocumented) +export type GetEntityFacets = { + query: { + facet: Array; + filter?: Array; + }; +}; + +// @public (undocumented) +export type GetLocation = { + path: { + id: string; + }; +}; + +// @public (undocumented) +export type GetLocationByEntity = { + path: { + kind: string; + namespace: string; + name: string; + }; +}; + +// @public (undocumented) +export type GetLocations = {}; + +// @public (undocumented) +export interface GetLocations200ResponseInner { + // (undocumented) + data: Location_2; +} + +// @public +interface Location_2 { + // (undocumented) + id: string; + // (undocumented) + target: string; + // (undocumented) + type: string; +} +export { Location_2 as Location }; + +// @public (undocumented) +export interface LocationInput { + // (undocumented) + target: string; + // (undocumented) + type: string; +} + +// @public +export interface LocationSpec { + // (undocumented) + target: string; + // (undocumented) + type: string; +} + +// @public (undocumented) +export interface ModelError { + // (undocumented) + [key: string]: any; + // (undocumented) + error: ErrorError; + // (undocumented) + request?: ErrorRequest; + // (undocumented) + response: ErrorResponse; +} + +// @public +export type NullableEntity = { + relations?: Array; + spec?: { + [key: string]: any; + }; + metadata: EntityMeta; + kind: string; + apiVersion: string; +} | null; + +// @public +export interface RecursivePartialEntity { + apiVersion?: string; + kind?: string; + // (undocumented) + metadata?: RecursivePartialEntityMeta; + relations?: Array; + spec?: { + [key: string]: any; + }; +} + +// @public (undocumented) +export interface RecursivePartialEntityMeta { + annotations?: { + [key: string]: string; + }; + description?: string; + etag?: string; + labels?: { + [key: string]: string; + }; + links?: Array; + name?: string; + namespace?: string; + tags?: Array; + title?: string; + uid?: string; +} + +// @public +export interface RecursivePartialEntityMetaAllOf { + annotations?: { + [key: string]: string; + }; + description?: string; + etag?: string; + labels?: { + [key: string]: string; + }; + links?: Array; + name?: string; + namespace?: string; + tags?: Array; + title?: string; + uid?: string; +} + +// @public +export interface RecursivePartialEntityRelation { + targetRef?: string; + type?: string; +} + +// @public (undocumented) +export type RefreshEntity = { + body: RefreshEntityRequest; +}; + +// @public +export interface RefreshEntityRequest { + // (undocumented) + authorizationToken?: string; + entityRef: string; +} + +// @public +export interface RequestOptions { + // (undocumented) + token?: string; +} + +// @public +export type TypedResponse = Omit & { + json: () => Promise; +}; + +// @public (undocumented) +export type ValidateEntity = { + body: ValidateEntityRequest; +}; + +// @public (undocumented) +export interface ValidateEntity400Response { + // (undocumented) + errors: Array; +} + +// @public (undocumented) +export interface ValidateEntity400ResponseErrorsInner { + // (undocumented) + [key: string]: any; + // (undocumented) + message: string; + // (undocumented) + name: string; +} + +// @public (undocumented) +export interface ValidateEntityRequest { + // (undocumented) + entity: { + [key: string]: any; + }; + // (undocumented) + location: string; +} + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts b/plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts index a466dccd8c..a450fe18c8 100644 --- a/plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts +++ b/plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts @@ -36,7 +36,6 @@ import { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.mod import { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model'; import { Location } from '../models/Location.model'; import { RefreshEntityRequest } from '../models/RefreshEntityRequest.model'; -import { ValidateEntity400Response } from '../models/ValidateEntity400Response.model'; import { ValidateEntityRequest } from '../models/ValidateEntityRequest.model'; /** diff --git a/yarn.lock b/yarn.lock index a09a4ed29b..2fbc0f876b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3863,7 +3863,6 @@ __metadata: "@backstage/plugin-catalog-common": "workspace:^" cross-fetch: ^4.0.0 msw: ^1.0.0 - uri-template: ^2.0.0 languageName: unknown linkType: soft