diff --git a/packages/backend-openapi-utils/report.api.md b/packages/backend-openapi-utils/report.api.md index 372bdafd19..c2f7d6b778 100644 --- a/packages/backend-openapi-utils/report.api.md +++ b/packages/backend-openapi-utils/report.api.md @@ -278,7 +278,7 @@ type EndpointMap = Record< { query?: object; body?: object; - response?: object; + response?: object | void; path?: object; } >; @@ -929,6 +929,106 @@ type ValueOf = T[keyof T]; // @public export const wrapInOpenApiTestServer: (app: Express_2) => Server | Express_2; +<<<<<<< HEAD // @public export function wrapServer(app: Express_2): Promise; +======= +// Warnings were encountered during analysis: +// +// src/router.d.ts:8:5 - (ae-undocumented) Missing documentation for "get". +// src/router.d.ts:9:5 - (ae-undocumented) Missing documentation for "post". +// src/router.d.ts:10:5 - (ae-undocumented) Missing documentation for "all". +// src/router.d.ts:11:5 - (ae-undocumented) Missing documentation for "put". +// src/router.d.ts:12:5 - (ae-undocumented) Missing documentation for "delete". +// src/router.d.ts:13:5 - (ae-undocumented) Missing documentation for "patch". +// src/router.d.ts:14:5 - (ae-undocumented) Missing documentation for "options". +// src/router.d.ts:15:5 - (ae-undocumented) Missing documentation for "head". +// src/types/common.d.ts:14:1 - (ae-undocumented) Missing documentation for "PathDoc". +// src/types/common.d.ts:60:1 - (ae-undocumented) Missing documentation for "DocPathTemplate". +// src/types/common.d.ts:64:1 - (ae-undocumented) Missing documentation for "DocPathMethod". +// src/types/common.d.ts:68:1 - (ae-undocumented) Missing documentation for "DocPathTemplateMethod". +// src/types/common.d.ts:72:1 - (ae-undocumented) Missing documentation for "MethodAwareDocPath". +// src/types/common.d.ts:78:1 - (ae-undocumented) Missing documentation for "DocOperation". +// src/types/common.d.ts:82:1 - (ae-undocumented) Missing documentation for "ComponentTypes". +// src/types/common.d.ts:86:1 - (ae-undocumented) Missing documentation for "ComponentRef". +// src/types/common.d.ts:92:1 - (ae-undocumented) Missing documentation for "SchemaRef". +// src/types/common.d.ts:100:1 - (ae-undocumented) Missing documentation for "ObjectWithContentSchema". +// src/types/common.d.ts:114:1 - (ae-undocumented) Missing documentation for "LastOf". +// src/types/common.d.ts:118:1 - (ae-undocumented) Missing documentation for "Push". +// src/types/common.d.ts:122:1 - (ae-undocumented) Missing documentation for "TuplifyUnion". +// src/types/common.d.ts:126:1 - (ae-undocumented) Missing documentation for "ConvertAll". +// src/types/common.d.ts:134:1 - (ae-undocumented) Missing documentation for "UnknownIfNever". +// src/types/common.d.ts:138:1 - (ae-undocumented) Missing documentation for "ToTypeSafe". +// src/types/common.d.ts:142:1 - (ae-undocumented) Missing documentation for "DiscriminateUnion". +// src/types/common.d.ts:146:1 - (ae-undocumented) Missing documentation for "MapDiscriminatedUnion". +// src/types/common.d.ts:152:1 - (ae-undocumented) Missing documentation for "PickOptionalKeys". +// src/types/common.d.ts:160:1 - (ae-undocumented) Missing documentation for "PickRequiredKeys". +// src/types/common.d.ts:168:1 - (ae-undocumented) Missing documentation for "OptionalMap". +// src/types/common.d.ts:176:1 - (ae-undocumented) Missing documentation for "RequiredMap". +// src/types/common.d.ts:184:1 - (ae-undocumented) Missing documentation for "FullMap". +// src/types/common.d.ts:190:1 - (ae-undocumented) Missing documentation for "Filter". +// src/types/express.d.ts:21:5 - (ae-undocumented) Missing documentation for "__call". +// src/types/express.d.ts:22:5 - (ae-undocumented) Missing documentation for "__call". +// src/types/generated.d.ts:7:1 - (ae-undocumented) Missing documentation for "EndpointMap". +// src/types/generated.d.ts:16:1 - (ae-undocumented) Missing documentation for "HttpMethods". +// src/types/generated.d.ts:20:1 - (ae-undocumented) Missing documentation for "StaticPathParamsSchema". +// src/types/generated.d.ts:24:1 - (ae-undocumented) Missing documentation for "StaticRequestBodySchema". +// src/types/generated.d.ts:28:1 - (ae-undocumented) Missing documentation for "StaticResponseSchema". +// src/types/generated.d.ts:32:1 - (ae-undocumented) Missing documentation for "StaticQueryParamsSchema". +// src/types/generated.d.ts:46:1 - (ae-undocumented) Missing documentation for "DocEndpoint". +// src/types/generated.d.ts:52:1 - (ae-undocumented) Missing documentation for "DocEndpointMethod". +// src/types/generated.d.ts:58:1 - (ae-undocumented) Missing documentation for "MethodAwareDocEndpoints". +// src/types/generated.d.ts:64:1 - (ae-undocumented) Missing documentation for "DocEndpointTemplate". +// src/types/generated.d.ts:68:1 - (ae-undocumented) Missing documentation for "TemplateToDocEndpoint". +// src/types/generated.d.ts:76:5 - (ae-undocumented) Missing documentation for "__call". +// src/types/generated.d.ts:77:5 - (ae-undocumented) Missing documentation for "__call". +// src/types/generated.d.ts:82:1 - (ae-undocumented) Missing documentation for "TypedRouter". +// src/types/generated.d.ts:83:5 - (ae-undocumented) Missing documentation for "get". +// src/types/generated.d.ts:84:5 - (ae-undocumented) Missing documentation for "post". +// src/types/generated.d.ts:85:5 - (ae-undocumented) Missing documentation for "put". +// src/types/generated.d.ts:86:5 - (ae-undocumented) Missing documentation for "delete". +// src/types/immutable.d.ts:18:1 - (ae-undocumented) Missing documentation for "ImmutableObject". +// src/types/immutable.d.ts:24:1 - (ae-undocumented) Missing documentation for "ImmutableReferenceObject". +// src/types/immutable.d.ts:28:1 - (ae-undocumented) Missing documentation for "ImmutableOpenAPIObject". +// src/types/immutable.d.ts:32:1 - (ae-undocumented) Missing documentation for "ImmutableContentObject". +// src/types/immutable.d.ts:36:1 - (ae-undocumented) Missing documentation for "ImmutableRequestBodyObject". +// src/types/immutable.d.ts:40:1 - (ae-undocumented) Missing documentation for "ImmutableResponseObject". +// src/types/immutable.d.ts:44:1 - (ae-undocumented) Missing documentation for "ImmutableParameterObject". +// src/types/immutable.d.ts:48:1 - (ae-undocumented) Missing documentation for "HeaderObject". +// src/types/immutable.d.ts:49:5 - (ae-undocumented) Missing documentation for "in". +// src/types/immutable.d.ts:50:5 - (ae-undocumented) Missing documentation for "style". +// src/types/immutable.d.ts:55:1 - (ae-undocumented) Missing documentation for "ImmutableHeaderObject". +// src/types/immutable.d.ts:59:1 - (ae-undocumented) Missing documentation for "CookieObject". +// src/types/immutable.d.ts:60:5 - (ae-undocumented) Missing documentation for "in". +// src/types/immutable.d.ts:61:5 - (ae-undocumented) Missing documentation for "style". +// src/types/immutable.d.ts:66:1 - (ae-undocumented) Missing documentation for "ImmutableCookieObject". +// src/types/immutable.d.ts:70:1 - (ae-undocumented) Missing documentation for "QueryObject". +// src/types/immutable.d.ts:71:5 - (ae-undocumented) Missing documentation for "in". +// src/types/immutable.d.ts:72:5 - (ae-undocumented) Missing documentation for "style". +// src/types/immutable.d.ts:77:1 - (ae-undocumented) Missing documentation for "ImmutableQueryObject". +// src/types/immutable.d.ts:81:1 - (ae-undocumented) Missing documentation for "PathObject". +// src/types/immutable.d.ts:82:5 - (ae-undocumented) Missing documentation for "in". +// src/types/immutable.d.ts:83:5 - (ae-undocumented) Missing documentation for "style". +// src/types/immutable.d.ts:88:1 - (ae-undocumented) Missing documentation for "ImmutablePathObject". +// src/types/immutable.d.ts:92:1 - (ae-undocumented) Missing documentation for "ImmutableSchemaObject". +// src/types/params.d.ts:7:1 - (ae-undocumented) Missing documentation for "DocParameter". +// src/types/params.d.ts:16:1 - (ae-undocumented) Missing documentation for "DocParameters". +// src/types/params.d.ts:22:1 - (ae-undocumented) Missing documentation for "ParameterSchema". +// src/types/params.d.ts:26:1 - (ae-undocumented) Missing documentation for "MapToSchema". +// src/types/params.d.ts:32:1 - (ae-undocumented) Missing documentation for "ParametersSchema". +// src/types/params.d.ts:36:1 - (ae-undocumented) Missing documentation for "HeaderSchema". +// src/types/params.d.ts:40:1 - (ae-undocumented) Missing documentation for "CookieSchema". +// src/types/params.d.ts:44:1 - (ae-undocumented) Missing documentation for "PathSchema". +// src/types/params.d.ts:48:1 - (ae-undocumented) Missing documentation for "QuerySchema". +// src/types/requests.d.ts:9:1 - (ae-undocumented) Missing documentation for "RequestBody". +// src/types/requests.d.ts:13:1 - (ae-undocumented) Missing documentation for "RequestBodySchema". +// src/types/responses.d.ts:9:1 - (ae-undocumented) Missing documentation for "Response". +// src/types/responses.d.ts:13:1 - (ae-undocumented) Missing documentation for "ResponseSchemas". +// src/utility.d.ts:5:1 - (ae-undocumented) Missing documentation for "Response". +// src/utility.d.ts:9:1 - (ae-undocumented) Missing documentation for "Request". +// src/utility.d.ts:13:1 - (ae-undocumented) Missing documentation for "HeaderParameters". +// src/utility.d.ts:17:1 - (ae-undocumented) Missing documentation for "CookieParameters". +// src/utility.d.ts:21:1 - (ae-undocumented) Missing documentation for "PathParameters". +// src/utility.d.ts:25:1 - (ae-undocumented) Missing documentation for "QueryParameters". +>>>>>>> 5a23c27e40c70 (fix types and move packages back to catalog-client) ``` diff --git a/packages/backend-openapi-utils/src/types/generated.ts b/packages/backend-openapi-utils/src/types/generated.ts index 992c0f646a..b0b80f45fb 100644 --- a/packages/backend-openapi-utils/src/types/generated.ts +++ b/packages/backend-openapi-utils/src/types/generated.ts @@ -22,7 +22,7 @@ import { PathTemplate, ValueOf } from './common'; */ export type EndpointMap = Record< string, - { query?: object; body?: object; response?: object; path?: object } + { query?: object; body?: object; response?: object | void; path?: object } >; // OpenAPI generator doesn't emit regular lowercase 'delete'. diff --git a/packages/catalog-client/package.json b/packages/catalog-client/package.json index 015af2a8ff..d5bfbda6a9 100644 --- a/packages/catalog-client/package.json +++ b/packages/catalog-client/package.json @@ -52,7 +52,8 @@ "@backstage/catalog-model": "workspace:^", "@backstage/errors": "workspace:^", "@backstage/plugin-catalog-common": "workspace:^", - "cross-fetch": "^4.0.0" + "cross-fetch": "^4.0.0", + "uri-template": "^2.0.0" }, "devDependencies": { "@backstage/cli": "workspace:^", diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index ff3429f81b..ed5b3c049f 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -42,7 +42,7 @@ import { ValidateEntityResponse, } from './types/api'; import { isQueryEntitiesInitialRequest, splitRefsIntoChunks } from './utils'; -import { DefaultApiClient, TypedResponse } from './generated'; +import { DefaultApiClient, TypedResponse } from './schema/openapi/generated'; /** * A frontend and backend compatible client for communicating with the Backstage diff --git a/plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts b/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts similarity index 98% rename from plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts rename to packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts index 06b5eacaaa..11fa561e19 100644 --- a/plugins/catalog-common/src/schema/openapi/generated/apis/DefaultApi.client.ts +++ b/packages/catalog-client/src/schema/openapi/generated/apis/DefaultApi.client.ts @@ -217,6 +217,7 @@ export class DefaultApiClient { * @param analyzeLocationRequest - */ public async analyzeLocation( + // @ts-ignore request: AnalyzeLocation, options?: RequestOptions, ): Promise> { @@ -242,6 +243,7 @@ export class DefaultApiClient { * @param dryRun - */ public async createLocation( + // @ts-ignore request: CreateLocation, options?: RequestOptions, ): Promise> { @@ -268,6 +270,7 @@ export class DefaultApiClient { * @param uid - */ public async deleteEntityByUid( + // @ts-ignore request: DeleteEntityByUid, options?: RequestOptions, ): Promise> { @@ -293,6 +296,7 @@ export class DefaultApiClient { * @param id - */ public async deleteLocation( + // @ts-ignore request: DeleteLocation, options?: RequestOptions, ): Promise> { @@ -323,6 +327,7 @@ export class DefaultApiClient { * @param order - */ public async getEntities( + // @ts-ignore request: GetEntities, options?: RequestOptions, ): Promise>> { @@ -355,6 +360,7 @@ export class DefaultApiClient { * @param fullTextFilterFields - A comma separated list of fields to sort returned results by. */ public async getEntitiesByQuery( + // @ts-ignore request: GetEntitiesByQuery, options?: RequestOptions, ): Promise> { @@ -381,6 +387,7 @@ export class DefaultApiClient { * @param getEntitiesByRefsRequest - */ public async getEntitiesByRefs( + // @ts-ignore request: GetEntitiesByRefs, options?: RequestOptions, ): Promise> { @@ -409,6 +416,7 @@ export class DefaultApiClient { * @param name - */ public async getEntityAncestryByName( + // @ts-ignore request: GetEntityAncestryByName, options?: RequestOptions, ): Promise> { @@ -438,6 +446,7 @@ export class DefaultApiClient { * @param name - */ public async getEntityByName( + // @ts-ignore request: GetEntityByName, options?: RequestOptions, ): Promise> { @@ -465,6 +474,7 @@ export class DefaultApiClient { * @param uid - */ public async getEntityByUid( + // @ts-ignore request: GetEntityByUid, options?: RequestOptions, ): Promise> { @@ -491,6 +501,7 @@ export class DefaultApiClient { * @param filter - Filter for just the entities defined by this filter. */ public async getEntityFacets( + // @ts-ignore request: GetEntityFacets, options?: RequestOptions, ): Promise> { @@ -516,6 +527,7 @@ export class DefaultApiClient { * @param id - */ public async getLocation( + // @ts-ignore request: GetLocation, options?: RequestOptions, ): Promise> { @@ -543,6 +555,7 @@ export class DefaultApiClient { * @param name - */ public async getLocationByEntity( + // @ts-ignore request: GetLocationByEntity, options?: RequestOptions, ): Promise> { @@ -569,6 +582,7 @@ export class DefaultApiClient { * Get all locations */ public async getLocations( + // @ts-ignore request: GetLocations, options?: RequestOptions, ): Promise>> { @@ -592,6 +606,7 @@ export class DefaultApiClient { * @param refreshEntityRequest - */ public async refreshEntity( + // @ts-ignore request: RefreshEntity, options?: RequestOptions, ): Promise> { @@ -616,6 +631,7 @@ export class DefaultApiClient { * @param validateEntityRequest - */ public async validateEntity( + // @ts-ignore request: ValidateEntity, options?: RequestOptions, ): Promise> { diff --git a/plugins/catalog-common/src/schema/openapi/generated/apis/index.ts b/packages/catalog-client/src/schema/openapi/generated/apis/index.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/apis/index.ts rename to packages/catalog-client/src/schema/openapi/generated/apis/index.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/index.ts b/packages/catalog-client/src/schema/openapi/generated/index.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/index.ts rename to packages/catalog-client/src/schema/openapi/generated/index.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationEntityField.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationEntityField.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationEntityField.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationEntityField.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationExistingEntity.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationExistingEntity.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationExistingEntity.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationExistingEntity.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationGenerateEntity.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationGenerateEntity.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationGenerateEntity.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationGenerateEntity.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationRequest.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationRequest.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationRequest.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationRequest.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationResponse.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationResponse.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/AnalyzeLocationResponse.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/AnalyzeLocationResponse.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/CreateLocation201Response.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/CreateLocation201Response.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/CreateLocation201Response.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/CreateLocation201Response.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/CreateLocationRequest.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/CreateLocationRequest.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/CreateLocationRequest.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/CreateLocationRequest.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntitiesBatchResponse.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntitiesBatchResponse.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntitiesBatchResponse.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntitiesBatchResponse.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntitiesQueryResponse.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntitiesQueryResponse.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntitiesQueryResponse.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntitiesQueryResponse.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntitiesQueryResponsePageInfo.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntitiesQueryResponsePageInfo.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntitiesQueryResponsePageInfo.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntitiesQueryResponsePageInfo.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/Entity.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/Entity.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/Entity.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/Entity.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityAncestryResponse.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityAncestryResponse.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityAncestryResponse.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityAncestryResponse.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityAncestryResponseItemsInner.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityAncestryResponseItemsInner.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityAncestryResponseItemsInner.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityAncestryResponseItemsInner.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityFacet.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityFacet.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityFacet.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityFacet.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityFacetsResponse.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityFacetsResponse.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityFacetsResponse.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityFacetsResponse.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityLink.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityLink.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityLink.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityLink.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityMeta.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityMeta.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityMeta.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityMeta.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/EntityRelation.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/EntityRelation.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/EntityRelation.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/EntityRelation.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ErrorError.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ErrorError.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ErrorError.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ErrorError.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ErrorRequest.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ErrorRequest.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ErrorRequest.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ErrorRequest.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ErrorResponse.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ErrorResponse.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ErrorResponse.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ErrorResponse.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/GetEntitiesByRefsRequest.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/GetEntitiesByRefsRequest.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/GetEntitiesByRefsRequest.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/GetEntitiesByRefsRequest.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/GetLocations200ResponseInner.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/GetLocations200ResponseInner.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/GetLocations200ResponseInner.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/GetLocations200ResponseInner.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/Location.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/Location.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/Location.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/Location.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/LocationInput.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/LocationInput.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/LocationInput.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/LocationInput.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/LocationSpec.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/LocationSpec.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/LocationSpec.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/LocationSpec.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ModelError.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ModelError.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ModelError.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ModelError.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/NullableEntity.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/NullableEntity.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/NullableEntity.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/NullableEntity.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntity.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntity.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntity.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntity.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntityMeta.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntityMeta.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntityMeta.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntityMeta.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntityMetaAllOf.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntityMetaAllOf.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntityMetaAllOf.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntityMetaAllOf.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntityRelation.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntityRelation.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/RecursivePartialEntityRelation.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/RecursivePartialEntityRelation.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/RefreshEntityRequest.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/RefreshEntityRequest.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/RefreshEntityRequest.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/RefreshEntityRequest.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ValidateEntity400Response.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ValidateEntity400Response.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ValidateEntity400Response.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ValidateEntity400Response.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ValidateEntity400ResponseErrorsInner.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ValidateEntity400ResponseErrorsInner.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ValidateEntity400ResponseErrorsInner.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ValidateEntity400ResponseErrorsInner.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/ValidateEntityRequest.model.ts b/packages/catalog-client/src/schema/openapi/generated/models/ValidateEntityRequest.model.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/ValidateEntityRequest.model.ts rename to packages/catalog-client/src/schema/openapi/generated/models/ValidateEntityRequest.model.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/models/index.ts b/packages/catalog-client/src/schema/openapi/generated/models/index.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/models/index.ts rename to packages/catalog-client/src/schema/openapi/generated/models/index.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/pluginId.ts b/packages/catalog-client/src/schema/openapi/generated/pluginId.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/pluginId.ts rename to packages/catalog-client/src/schema/openapi/generated/pluginId.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/types/discovery.ts b/packages/catalog-client/src/schema/openapi/generated/types/discovery.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/types/discovery.ts rename to packages/catalog-client/src/schema/openapi/generated/types/discovery.ts diff --git a/plugins/catalog-common/src/schema/openapi/generated/types/fetch.ts b/packages/catalog-client/src/schema/openapi/generated/types/fetch.ts similarity index 100% rename from plugins/catalog-common/src/schema/openapi/generated/types/fetch.ts rename to packages/catalog-client/src/schema/openapi/generated/types/fetch.ts diff --git a/packages/repo-tools/cli-report.md b/packages/repo-tools/cli-report.md index 68b3dac14d..9266957886 100644 --- a/packages/repo-tools/cli-report.md +++ b/packages/repo-tools/cli-report.md @@ -145,7 +145,6 @@ Usage: backstage-repo-tools package schema openapi generate [options] Options: --client-package [package] - --server-client-import [import] -h, --help ``` diff --git a/packages/repo-tools/templates/typescript-backstage-client/api.mustache b/packages/repo-tools/templates/typescript-backstage-client/api.mustache index 36a200e5d7..ee8ea4d17e 100644 --- a/packages/repo-tools/templates/typescript-backstage-client/api.mustache +++ b/packages/repo-tools/templates/typescript-backstage-client/api.mustache @@ -92,6 +92,7 @@ export class {{classname}}Client { {{/allParams}} */ public async {{nickname}}( + // @ts-ignore request: {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}}, options?: RequestOptions ): Promise> { diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 8ef809923d..12ca1a7be5 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -53,7 +53,7 @@ "clean": "backstage-cli package clean", "diff": "backstage-repo-tools package schema openapi diff", "fuzz": "backstage-repo-tools package schema openapi fuzz --exclude-checks response_schema_conformance", - "generate": "backstage-repo-tools package schema openapi generate --server --client-package plugins/catalog-common", + "generate": "backstage-repo-tools package schema openapi generate --server --client-package packages/catalog-client", "lint": "backstage-cli package lint", "prepack": "backstage-cli package prepack", "postpack": "backstage-cli package postpack", diff --git a/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts b/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts index 3317940caa..aef28c0b32 100644 --- a/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts +++ b/plugins/catalog-backend/src/service/request/parseQueryEntitiesParams.ts @@ -23,7 +23,7 @@ import { decodeCursor } from '../util'; import { parseEntityFilterParams } from './parseEntityFilterParams'; import { parseEntityOrderFieldParams } from './parseEntityOrderFieldParams'; import { parseEntityTransformParams } from './parseEntityTransformParams'; -import { GetEntitiesByQuery } from '@backstage/plugin-catalog-common/client'; +import { GetEntitiesByQuery } from '../../schema/openapi'; export function parseQueryEntitiesParams( params: GetEntitiesByQuery['query'], diff --git a/plugins/catalog-common/api-report-client.md b/plugins/catalog-common/api-report-client.md deleted file mode 100644 index 0393148a3b..0000000000 --- a/plugins/catalog-common/api-report-client.md +++ /dev/null @@ -1,558 +0,0 @@ -## 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/package.json b/plugins/catalog-common/package.json index bf80779bf0..f38c238ca2 100644 --- a/plugins/catalog-common/package.json +++ b/plugins/catalog-common/package.json @@ -30,7 +30,6 @@ "exports": { ".": "./src/index.ts", "./alpha": "./src/alpha.ts", - "./client": "./src/client.ts", "./package.json": "./package.json" }, "main": "src/index.ts", @@ -40,9 +39,6 @@ "alpha": [ "src/alpha.ts" ], - "client": [ - "src/client.ts" - ], "package.json": [ "package.json" ] diff --git a/plugins/catalog-common/src/client.ts b/plugins/catalog-common/src/client.ts deleted file mode 100644 index 3d15650c24..0000000000 --- a/plugins/catalog-common/src/client.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2024 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 * from './schema/openapi/generated'; diff --git a/plugins/search-backend/package.json b/plugins/search-backend/package.json index acd564d996..52688fe512 100644 --- a/plugins/search-backend/package.json +++ b/plugins/search-backend/package.json @@ -48,7 +48,7 @@ "build": "backstage-cli package build", "clean": "backstage-cli package clean", "fuzz": "backstage-repo-tools package schema openapi fuzz", - "generate": "backstage-repo-tools package schema openapi generate --server --client-package plugins/search-common", + "generate": "backstage-repo-tools package schema openapi generate --server", "lint": "backstage-cli package lint", "prepack": "backstage-cli package prepack", "postpack": "backstage-cli package postpack", diff --git a/plugins/search-common/api-report-client.md b/plugins/search-common/api-report-client.md deleted file mode 100644 index 6e997b63bb..0000000000 --- a/plugins/search-common/api-report-client.md +++ /dev/null @@ -1,107 +0,0 @@ -## API Report File for "@backstage/plugin-search-common" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -// @public -export class DefaultApiClient { - constructor(options: { - discoveryApi: { - getBaseUrl(pluginId: string): Promise; - }; - fetchApi?: { - fetch: typeof fetch; - }; - }); - query( - request: Query, - options?: RequestOptions, - ): Promise>; -} - -// @public (undocumented) -export interface ErrorError { - // (undocumented) - message: string; - // (undocumented) - name: string; -} - -// @public (undocumented) -export interface ErrorRequest { - // (undocumented) - method: string; - // (undocumented) - url: string; -} - -// @public (undocumented) -export interface ErrorResponse { - // (undocumented) - statusCode: number; -} - -// @public (undocumented) -export interface ModelError { - // (undocumented) - error: ErrorError; - // (undocumented) - request: ErrorRequest; - // (undocumented) - response: ErrorResponse; -} - -// @public (undocumented) -export type Query = { - query: { - term?: string; - filters?: { - [key: string]: any; - }; - types?: Array; - pageCursor?: string; - pageLimit?: number; - }; -}; - -// @public (undocumented) -export interface Query200Response { - // (undocumented) - nextPageCursor?: string; - // (undocumented) - numberOfResults?: number; - // (undocumented) - previousPageCursor?: string; - // (undocumented) - results: Array; -} - -// @public (undocumented) -export interface Query200ResponseResultsInner { - // (undocumented) - document: Query200ResponseResultsInnerDocument; - highlight?: any; - rank?: number; - type: string; -} - -// @public -export interface Query200ResponseResultsInnerDocument { - location?: string; - text?: string; - title?: string; -} - -// @public -export interface RequestOptions { - // (undocumented) - token?: string; -} - -// @public -export type TypedResponse = Omit & { - json: () => Promise; -}; - -// (No @packageDocumentation comment for this package) -``` diff --git a/plugins/search-common/package.json b/plugins/search-common/package.json index 750565cf03..eec177cec7 100644 --- a/plugins/search-common/package.json +++ b/plugins/search-common/package.json @@ -33,16 +33,12 @@ "sideEffects": false, "exports": { ".": "./src/index.ts", - "./client": "./src/client.ts", "./package.json": "./package.json" }, "main": "src/index.ts", "types": "src/index.ts", "typesVersions": { "*": { - "client": [ - "src/client.ts" - ], "package.json": [ "package.json" ] diff --git a/plugins/search-common/src/client.ts b/plugins/search-common/src/client.ts deleted file mode 100644 index a46b762ba7..0000000000 --- a/plugins/search-common/src/client.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2024 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 * from './schema/openapi/generated'; diff --git a/plugins/search-common/src/schema/openapi/generated/apis/DefaultApi.client.ts b/plugins/search-common/src/schema/openapi/generated/apis/DefaultApi.client.ts deleted file mode 100644 index 6abb955794..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/apis/DefaultApi.client.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { DiscoveryApi } from '../types/discovery'; -import { FetchApi } from '../types/fetch'; -import crossFetch from 'cross-fetch'; -import { pluginId } from '../pluginId'; -import * as parser from 'uri-template'; - -import { Query200Response } from '../models/Query200Response.model'; - -/** - * Wraps the Response type to convey a type on the json call. - * - * @public - */ -export type TypedResponse = Omit & { - json: () => Promise; -}; - -/** - * Options you can pass into a request for additional information. - * - * @public - */ -export interface RequestOptions { - token?: string; -} - -/** - * @public - */ -export type Query = { - query: { - term?: string; - filters?: { [key: string]: any }; - types?: Array; - pageCursor?: string; - pageLimit?: number; - }; -}; - -/** - * no description - * @public - */ -export class DefaultApiClient { - private readonly discoveryApi: DiscoveryApi; - private readonly fetchApi: FetchApi; - - constructor(options: { - discoveryApi: { getBaseUrl(pluginId: string): Promise }; - fetchApi?: { fetch: typeof fetch }; - }) { - this.discoveryApi = options.discoveryApi; - this.fetchApi = options.fetchApi || { fetch: crossFetch }; - } - - /** - * Query documents with a given filter. - * @param term - - * @param filters - - * @param types - - * @param pageCursor - - * @param pageLimit - - */ - public async query( - request: Query, - options?: RequestOptions, - ): Promise> { - const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - - const uriTemplate = `/query{?term,filters,types*,pageCursor,pageLimit}`; - - const uri = parser.parse(uriTemplate).expand({ - ...request.query, - }); - - return await this.fetchApi.fetch(`${baseUrl}${uri}`, { - headers: { - 'Content-Type': 'application/json', - ...(options?.token && { Authorization: `Bearer ${options?.token}` }), - }, - method: 'GET', - }); - } -} diff --git a/plugins/search-common/src/schema/openapi/generated/apis/index.ts b/plugins/search-common/src/schema/openapi/generated/apis/index.ts deleted file mode 100644 index 51dcca33fe..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/apis/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2024 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 * from './DefaultApi.client'; diff --git a/plugins/search-common/src/schema/openapi/generated/index.ts b/plugins/search-common/src/schema/openapi/generated/index.ts deleted file mode 100644 index bb399e97a0..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2024 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 * from './apis'; -export * from './models'; diff --git a/plugins/search-common/src/schema/openapi/generated/models/ErrorError.model.ts b/plugins/search-common/src/schema/openapi/generated/models/ErrorError.model.ts deleted file mode 100644 index 0a51c67fef..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/ErrorError.model.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export interface ErrorError { - name: string; - message: string; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/ErrorRequest.model.ts b/plugins/search-common/src/schema/openapi/generated/models/ErrorRequest.model.ts deleted file mode 100644 index d44dcb66d9..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/ErrorRequest.model.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export interface ErrorRequest { - method: string; - url: string; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/ErrorResponse.model.ts b/plugins/search-common/src/schema/openapi/generated/models/ErrorResponse.model.ts deleted file mode 100644 index 91c120483d..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/ErrorResponse.model.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * @public - */ -export interface ErrorResponse { - statusCode: number; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/ModelError.model.ts b/plugins/search-common/src/schema/openapi/generated/models/ModelError.model.ts deleted file mode 100644 index 3e6af947ec..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/ModelError.model.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { ErrorError } from '../models/ErrorError.model'; -import { ErrorRequest } from '../models/ErrorRequest.model'; -import { ErrorResponse } from '../models/ErrorResponse.model'; - -/** - * @public - */ -export interface ModelError { - error: ErrorError; - request: ErrorRequest; - response: ErrorResponse; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/Query200Response.model.ts b/plugins/search-common/src/schema/openapi/generated/models/Query200Response.model.ts deleted file mode 100644 index 8ddb2a0b63..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/Query200Response.model.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Query200ResponseResultsInner } from '../models/Query200ResponseResultsInner.model'; - -/** - * @public - */ -export interface Query200Response { - results: Array; - nextPageCursor?: string; - previousPageCursor?: string; - numberOfResults?: number; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/Query200ResponseResultsInner.model.ts b/plugins/search-common/src/schema/openapi/generated/models/Query200ResponseResultsInner.model.ts deleted file mode 100644 index ec635c8e5b..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/Query200ResponseResultsInner.model.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** -import { Query200ResponseResultsInnerDocument } from '../models/Query200ResponseResultsInnerDocument.model'; - -/** - * @public - */ -export interface Query200ResponseResultsInner { - /** - * The \"type\" of the given document. - */ - type: string; - document: Query200ResponseResultsInnerDocument; - /** - * Optional result highlight. Useful for improving the search result display/experience. - */ - highlight?: any; - /** - * Optional result rank, where 1 is the first/top result returned. Useful for understanding search effectiveness in analytics. - */ - rank?: number; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/Query200ResponseResultsInnerDocument.model.ts b/plugins/search-common/src/schema/openapi/generated/models/Query200ResponseResultsInnerDocument.model.ts deleted file mode 100644 index 9e82274aa7..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/Query200ResponseResultsInnerDocument.model.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2024 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. - */ - -// ****************************************************************** -// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * -// ****************************************************************** - -/** - * The raw value of the document, as indexed. - * @public - */ -export interface Query200ResponseResultsInnerDocument { - /** - * The primary name of the document (e.g. name, title, identifier, etc). - */ - title?: string; - /** - * Free-form text of the document (e.g. description, content, etc). - */ - text?: string; - /** - * The relative or absolute URL of the document (target when a search result is clicked). - */ - location?: string; -} diff --git a/plugins/search-common/src/schema/openapi/generated/models/index.ts b/plugins/search-common/src/schema/openapi/generated/models/index.ts deleted file mode 100644 index d38087bf8c..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/models/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2024 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 * from '../models/ErrorError.model'; -export * from '../models/ErrorRequest.model'; -export * from '../models/ErrorResponse.model'; -export * from '../models/ModelError.model'; -export * from '../models/Query200Response.model'; -export * from '../models/Query200ResponseResultsInner.model'; -export * from '../models/Query200ResponseResultsInnerDocument.model'; diff --git a/plugins/search-common/src/schema/openapi/generated/pluginId.ts b/plugins/search-common/src/schema/openapi/generated/pluginId.ts deleted file mode 100644 index 13046254c7..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/pluginId.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2024 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 const pluginId = 'search'; diff --git a/plugins/search-common/src/schema/openapi/generated/types/discovery.ts b/plugins/search-common/src/schema/openapi/generated/types/discovery.ts deleted file mode 100644 index a7f87d3780..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/types/discovery.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -/** - * This is a copy of the DiscoveryApi, to avoid importing core-plugin-api. - */ -export type DiscoveryApi = { - getBaseUrl(pluginId: string): Promise; -}; diff --git a/plugins/search-common/src/schema/openapi/generated/types/fetch.ts b/plugins/search-common/src/schema/openapi/generated/types/fetch.ts deleted file mode 100644 index 3de56c028e..0000000000 --- a/plugins/search-common/src/schema/openapi/generated/types/fetch.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -/** - * This is a copy of FetchApi, to avoid importing core-plugin-api. - */ -export type FetchApi = { - fetch: typeof fetch; -}; diff --git a/yarn.lock b/yarn.lock index 084de4607a..ffe8cff6e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3863,6 +3863,7 @@ __metadata: "@backstage/plugin-catalog-common": "workspace:^" cross-fetch: ^4.0.0 msw: ^1.0.0 + uri-template: ^2.0.0 languageName: unknown linkType: soft