fix types and move packages back to catalog-client

Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
aramissennyeydd
2024-09-24 20:25:54 -04:00
parent 02e7cd3c45
commit 9c86cc5f66
73 changed files with 126 additions and 1154 deletions
+101 -1
View File
@@ -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> = T[keyof T];
// @public
export const wrapInOpenApiTestServer: (app: Express_2) => Server | Express_2;
<<<<<<< HEAD
// @public
export function wrapServer(app: Express_2): Promise<Server>;
=======
// 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)
```
@@ -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'.
+2 -1
View File
@@ -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:^",
+1 -1
View File
@@ -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
@@ -217,6 +217,7 @@ export class DefaultApiClient {
* @param analyzeLocationRequest -
*/
public async analyzeLocation(
// @ts-ignore
request: AnalyzeLocation,
options?: RequestOptions,
): Promise<TypedResponse<AnalyzeLocationResponse>> {
@@ -242,6 +243,7 @@ export class DefaultApiClient {
* @param dryRun -
*/
public async createLocation(
// @ts-ignore
request: CreateLocation,
options?: RequestOptions,
): Promise<TypedResponse<CreateLocation201Response>> {
@@ -268,6 +270,7 @@ export class DefaultApiClient {
* @param uid -
*/
public async deleteEntityByUid(
// @ts-ignore
request: DeleteEntityByUid,
options?: RequestOptions,
): Promise<TypedResponse<void>> {
@@ -293,6 +296,7 @@ export class DefaultApiClient {
* @param id -
*/
public async deleteLocation(
// @ts-ignore
request: DeleteLocation,
options?: RequestOptions,
): Promise<TypedResponse<void>> {
@@ -323,6 +327,7 @@ export class DefaultApiClient {
* @param order -
*/
public async getEntities(
// @ts-ignore
request: GetEntities,
options?: RequestOptions,
): Promise<TypedResponse<Array<Entity>>> {
@@ -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<TypedResponse<EntitiesQueryResponse>> {
@@ -381,6 +387,7 @@ export class DefaultApiClient {
* @param getEntitiesByRefsRequest -
*/
public async getEntitiesByRefs(
// @ts-ignore
request: GetEntitiesByRefs,
options?: RequestOptions,
): Promise<TypedResponse<EntitiesBatchResponse>> {
@@ -409,6 +416,7 @@ export class DefaultApiClient {
* @param name -
*/
public async getEntityAncestryByName(
// @ts-ignore
request: GetEntityAncestryByName,
options?: RequestOptions,
): Promise<TypedResponse<EntityAncestryResponse>> {
@@ -438,6 +446,7 @@ export class DefaultApiClient {
* @param name -
*/
public async getEntityByName(
// @ts-ignore
request: GetEntityByName,
options?: RequestOptions,
): Promise<TypedResponse<Entity>> {
@@ -465,6 +474,7 @@ export class DefaultApiClient {
* @param uid -
*/
public async getEntityByUid(
// @ts-ignore
request: GetEntityByUid,
options?: RequestOptions,
): Promise<TypedResponse<Entity>> {
@@ -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<TypedResponse<EntityFacetsResponse>> {
@@ -516,6 +527,7 @@ export class DefaultApiClient {
* @param id -
*/
public async getLocation(
// @ts-ignore
request: GetLocation,
options?: RequestOptions,
): Promise<TypedResponse<Location>> {
@@ -543,6 +555,7 @@ export class DefaultApiClient {
* @param name -
*/
public async getLocationByEntity(
// @ts-ignore
request: GetLocationByEntity,
options?: RequestOptions,
): Promise<TypedResponse<Location>> {
@@ -569,6 +582,7 @@ export class DefaultApiClient {
* Get all locations
*/
public async getLocations(
// @ts-ignore
request: GetLocations,
options?: RequestOptions,
): Promise<TypedResponse<Array<GetLocations200ResponseInner>>> {
@@ -592,6 +606,7 @@ export class DefaultApiClient {
* @param refreshEntityRequest -
*/
public async refreshEntity(
// @ts-ignore
request: RefreshEntity,
options?: RequestOptions,
): Promise<TypedResponse<void>> {
@@ -616,6 +631,7 @@ export class DefaultApiClient {
* @param validateEntityRequest -
*/
public async validateEntity(
// @ts-ignore
request: ValidateEntity,
options?: RequestOptions,
): Promise<TypedResponse<void>> {
-1
View File
@@ -145,7 +145,6 @@ Usage: backstage-repo-tools package schema openapi generate [options]
Options:
--client-package [package]
--server-client-import [import]
-h, --help
```
@@ -92,6 +92,7 @@ export class {{classname}}Client {
{{/allParams}}
*/
public async {{nickname}}(
// @ts-ignore
request: {{#lambda.pascalcase}}{{nickname}}{{/lambda.pascalcase}},
options?: RequestOptions
): Promise<TypedResponse<{{{returnType}}} {{^returnType}}void{{/returnType}}>> {
+1 -1
View File
@@ -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",
@@ -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'],
-558
View File
@@ -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<AnalyzeLocationEntityField>;
}
// @public (undocumented)
export interface AnalyzeLocationRequest {
// (undocumented)
catalogFileName?: string;
// (undocumented)
location: LocationInput;
}
// @public (undocumented)
export interface AnalyzeLocationResponse {
// (undocumented)
existingEntityFiles: Array<AnalyzeLocationExistingEntity>;
// (undocumented)
generateEntities: Array<AnalyzeLocationGenerateEntity>;
}
// @public (undocumented)
export type CreateLocation = {
body: CreateLocationRequest;
query: {
dryRun?: string;
};
};
// @public (undocumented)
export interface CreateLocation201Response {
// (undocumented)
entities: Array<Entity>;
// (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<string>;
};
fetchApi?: {
fetch: typeof fetch;
};
});
analyzeLocation(
request: AnalyzeLocation,
options?: RequestOptions,
): Promise<TypedResponse<AnalyzeLocationResponse>>;
createLocation(
request: CreateLocation,
options?: RequestOptions,
): Promise<TypedResponse<CreateLocation201Response>>;
deleteEntityByUid(
request: DeleteEntityByUid,
options?: RequestOptions,
): Promise<TypedResponse<void>>;
deleteLocation(
request: DeleteLocation,
options?: RequestOptions,
): Promise<TypedResponse<void>>;
getEntities(
request: GetEntities,
options?: RequestOptions,
): Promise<TypedResponse<Array<Entity>>>;
getEntitiesByQuery(
request: GetEntitiesByQuery,
options?: RequestOptions,
): Promise<TypedResponse<EntitiesQueryResponse>>;
getEntitiesByRefs(
request: GetEntitiesByRefs,
options?: RequestOptions,
): Promise<TypedResponse<EntitiesBatchResponse>>;
getEntityAncestryByName(
request: GetEntityAncestryByName,
options?: RequestOptions,
): Promise<TypedResponse<EntityAncestryResponse>>;
getEntityByName(
request: GetEntityByName,
options?: RequestOptions,
): Promise<TypedResponse<Entity>>;
getEntityByUid(
request: GetEntityByUid,
options?: RequestOptions,
): Promise<TypedResponse<Entity>>;
getEntityFacets(
request: GetEntityFacets,
options?: RequestOptions,
): Promise<TypedResponse<EntityFacetsResponse>>;
getLocation(
request: GetLocation,
options?: RequestOptions,
): Promise<TypedResponse<Location_2>>;
getLocationByEntity(
request: GetLocationByEntity,
options?: RequestOptions,
): Promise<TypedResponse<Location_2>>;
getLocations(
request: GetLocations,
options?: RequestOptions,
): Promise<TypedResponse<Array<GetLocations200ResponseInner>>>;
refreshEntity(
request: RefreshEntity,
options?: RequestOptions,
): Promise<TypedResponse<void>>;
validateEntity(
request: ValidateEntity,
options?: RequestOptions,
): Promise<TypedResponse<void>>;
}
// @public (undocumented)
export type DeleteEntityByUid = {
path: {
uid: string;
};
};
// @public (undocumented)
export type DeleteLocation = {
path: {
id: string;
};
};
// @public (undocumented)
export interface EntitiesBatchResponse {
items: Array<NullableEntity>;
}
// @public (undocumented)
export interface EntitiesQueryResponse {
items: Array<Entity>;
// (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<EntityRelation>;
spec?: {
[key: string]: any;
};
}
// @public (undocumented)
export interface EntityAncestryResponse {
// (undocumented)
items: Array<EntityAncestryResponseItemsInner>;
// (undocumented)
rootEntityRef: string;
}
// @public (undocumented)
export interface EntityAncestryResponseItemsInner {
// (undocumented)
entity: Entity;
// (undocumented)
parentEntityRefs: Array<string>;
}
// @public (undocumented)
export interface EntityFacet {
// (undocumented)
count: number;
// (undocumented)
value: string;
}
// @public (undocumented)
export interface EntityFacetsResponse {
// (undocumented)
facets: {
[key: string]: Array<EntityFacet>;
};
}
// @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<EntityLink>;
name: string;
namespace?: string;
tags?: Array<string>;
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<string>;
limit?: number;
filter?: Array<string>;
offset?: number;
after?: string;
order?: Array<string>;
};
};
// @public (undocumented)
export type GetEntitiesByQuery = {
query: {
fields?: Array<string>;
limit?: number;
orderField?: Array<string>;
cursor?: string;
filter?: Array<string>;
fullTextFilterTerm?: string;
fullTextFilterFields?: Array<string>;
};
};
// @public (undocumented)
export type GetEntitiesByRefs = {
body: GetEntitiesByRefsRequest;
query: {
filter?: Array<string>;
};
};
// @public (undocumented)
export interface GetEntitiesByRefsRequest {
// (undocumented)
entityRefs: Array<string>;
// (undocumented)
fields?: Array<string>;
}
// @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<string>;
filter?: Array<string>;
};
};
// @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<EntityRelation>;
spec?: {
[key: string]: any;
};
metadata: EntityMeta;
kind: string;
apiVersion: string;
} | null;
// @public
export interface RecursivePartialEntity {
apiVersion?: string;
kind?: string;
// (undocumented)
metadata?: RecursivePartialEntityMeta;
relations?: Array<RecursivePartialEntityRelation>;
spec?: {
[key: string]: any;
};
}
// @public (undocumented)
export interface RecursivePartialEntityMeta {
annotations?: {
[key: string]: string;
};
description?: string;
etag?: string;
labels?: {
[key: string]: string;
};
links?: Array<EntityLink>;
name?: string;
namespace?: string;
tags?: Array<string>;
title?: string;
uid?: string;
}
// @public
export interface RecursivePartialEntityMetaAllOf {
annotations?: {
[key: string]: string;
};
description?: string;
etag?: string;
labels?: {
[key: string]: string;
};
links?: Array<EntityLink>;
name?: string;
namespace?: string;
tags?: Array<string>;
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<T> = Omit<Response, 'json'> & {
json: () => Promise<T>;
};
// @public (undocumented)
export type ValidateEntity = {
body: ValidateEntityRequest;
};
// @public (undocumented)
export interface ValidateEntity400Response {
// (undocumented)
errors: Array<ValidateEntity400ResponseErrorsInner>;
}
// @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)
```
-4
View File
@@ -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"
]
-17
View File
@@ -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';
+1 -1
View File
@@ -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",
-107
View File
@@ -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<string>;
};
fetchApi?: {
fetch: typeof fetch;
};
});
query(
request: Query,
options?: RequestOptions,
): Promise<TypedResponse<Query200Response>>;
}
// @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<string>;
pageCursor?: string;
pageLimit?: number;
};
};
// @public (undocumented)
export interface Query200Response {
// (undocumented)
nextPageCursor?: string;
// (undocumented)
numberOfResults?: number;
// (undocumented)
previousPageCursor?: string;
// (undocumented)
results: Array<Query200ResponseResultsInner>;
}
// @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<T> = Omit<Response, 'json'> & {
json: () => Promise<T>;
};
// (No @packageDocumentation comment for this package)
```
-4
View File
@@ -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"
]
-16
View File
@@ -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';
@@ -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<T> = Omit<Response, 'json'> & {
json: () => Promise<T>;
};
/**
* 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<string>;
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<string> };
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<TypedResponse<Query200Response>> {
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',
});
}
}
@@ -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';
@@ -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';
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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<Query200ResponseResultsInner>;
nextPageCursor?: string;
previousPageCursor?: string;
numberOfResults?: number;
}
@@ -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;
}
@@ -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;
}
@@ -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';
@@ -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';
@@ -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<string>;
};
@@ -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;
};
+1
View File
@@ -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