@backstage/catalog-client 1.14.0-next.1 → 1.14.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/CatalogClient.cjs.js +5 -2
- package/dist/CatalogClient.cjs.js.map +1 -1
- package/dist/CatalogClient.esm.js +5 -2
- package/dist/CatalogClient.esm.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/schema/openapi/generated/apis/Api.client.cjs.js +2 -1
- package/dist/schema/openapi/generated/apis/Api.client.cjs.js.map +1 -1
- package/dist/schema/openapi/generated/apis/Api.client.esm.js +2 -1
- package/dist/schema/openapi/generated/apis/Api.client.esm.js.map +1 -1
- package/dist/types/api.cjs.js.map +1 -1
- package/dist/types/api.esm.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -385,11 +385,14 @@ class CatalogClient {
|
|
|
385
385
|
* {@inheritdoc CatalogApi.addLocation}
|
|
386
386
|
*/
|
|
387
387
|
async addLocation(request, options) {
|
|
388
|
-
const { type = "url", target, dryRun } = request;
|
|
388
|
+
const { type = "url", target, dryRun, onConflict } = request;
|
|
389
389
|
const response = await this.apiClient.createLocation(
|
|
390
390
|
{
|
|
391
391
|
body: { type, target },
|
|
392
|
-
query: {
|
|
392
|
+
query: {
|
|
393
|
+
dryRun: dryRun ? "true" : void 0,
|
|
394
|
+
onConflict
|
|
395
|
+
}
|
|
393
396
|
},
|
|
394
397
|
options
|
|
395
398
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogClient.cjs.js","sources":["../src/CatalogClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CompoundEntityRef,\n Entity,\n parseEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { InputError, ResponseError } from '@backstage/errors';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CATALOG_FILTER_EXISTS,\n CatalogApi,\n CatalogRequestOptions,\n EntityFilterQuery,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n GetLocationsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n QueryLocationsInitialRequest,\n QueryLocationsRequest,\n QueryLocationsResponse,\n StreamEntitiesRequest,\n ValidateEntityResponse,\n} from './types/api';\nimport {\n convertFilterToPredicate,\n isQueryEntitiesInitialRequest,\n splitRefsIntoChunks,\n cursorContainsQuery,\n} from './utils';\nimport {\n DefaultApiClient,\n GetEntitiesByQuery,\n GetLocationsByQueryRequest,\n QueryEntitiesByPredicateRequest,\n TypedResponse,\n} from './schema/openapi';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport {\n DEFAULT_STREAM_ENTITIES_LIMIT,\n DEFAULT_STREAM_LOCATIONS_LIMIT,\n} from './constants';\n\n/**\n * A frontend and backend compatible client for communicating with the Backstage\n * software catalog.\n *\n * @public\n */\nexport class CatalogClient implements CatalogApi {\n private readonly apiClient: DefaultApiClient;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.apiClient = new DefaultApiClient(options);\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityAncestors}\n */\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return await this.requestRequired(\n await this.apiClient.getEntityAncestryByName(\n { path: parseEntityRef(request.entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocations}\n */\n async getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocations(request ?? {}, options),\n );\n return {\n items: res.map(item => item.data),\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryLocations}\n */\n async queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocationsByQuery(\n { body: (request ?? {}) as unknown as GetLocationsByQueryRequest },\n options,\n ),\n );\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.streamLocations}\n */\n async *streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]> {\n let response = await this.queryLocations(\n { limit: DEFAULT_STREAM_LOCATIONS_LIMIT, ...request },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n\n while (response.pageInfo.nextCursor) {\n response = await this.queryLocations(\n { cursor: response.pageInfo.nextCursor },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationById}\n */\n async getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByEntity}\n */\n async getLocationByEntity(\n entityRef: CompoundEntityRef | string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocationByEntity(\n { path: parseEntityRef(entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntities}\n */\n async getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse> {\n const {\n filter = [],\n fields = [],\n order,\n offset,\n limit,\n after,\n } = request ?? {};\n const encodedOrder = [];\n if (order) {\n for (const directive of [order].flat()) {\n if (directive) {\n encodedOrder.push(`${directive.order}:${directive.field}`);\n }\n }\n }\n\n const entities = await this.requestRequired(\n await this.apiClient.getEntities(\n {\n query: {\n fields,\n limit,\n filter: this.getFilterValue(filter),\n offset,\n after,\n order: order ? encodedOrder : undefined,\n },\n },\n options,\n ),\n );\n return { items: entities };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntitiesByRefs}\n */\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n const { filter, query } = request;\n\n // Only convert and merge if both filter and query are provided, or if\n // query alone is provided. When only filter is given, preserve the old\n // query-parameter behavior for backward compatibility.\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = { $all: [filterPredicate, converted] };\n }\n }\n\n const getOneChunk = async (refs: string[]) => {\n const response = await this.apiClient.getEntitiesByRefs(\n {\n body: {\n entityRefs: refs,\n fields: request.fields,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n query: filterPredicate\n ? {}\n : { filter: this.getFilterValue(request.filter) },\n },\n options,\n );\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const body = (await response.json()) as {\n items: Array<Entity | null>;\n };\n return body.items.map(i => i ?? undefined);\n };\n\n let result: Array<Entity | undefined> | undefined;\n for (const refs of splitRefsIntoChunks(request.entityRefs)) {\n const entities = await getOneChunk(refs);\n if (!result) {\n result = entities;\n } else {\n result.push(...entities);\n }\n }\n\n return { items: result ?? [] };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryEntities}\n */\n async queryEntities(\n request: QueryEntitiesRequest = {},\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const isInitialRequest = isQueryEntitiesInitialRequest(request);\n\n // Route to POST endpoint if query predicate is provided (initial request)\n if (isInitialRequest && request.query) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n // Route to POST endpoint if cursor contains a query predicate (pagination)\n // TODO(freben): It's costly and non-opaque to have to introspect the cursor\n // like this. It should be refactored in the future to not need this.\n // Suggestion: make the GET and POST endpoints understand the same cursor\n // format, and pick which one to call ONLY based on whether the cursor size\n // risks hitting url length limits\n if (!isInitialRequest && cursorContainsQuery(request.cursor)) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n const params: Partial<GetEntitiesByQuery['query']> = {};\n\n if (isInitialRequest) {\n const {\n fields = [],\n filter,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n } = request;\n params.filter = this.getFilterValue(filter);\n\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (offset !== undefined) {\n params.offset = offset;\n }\n if (orderFields !== undefined) {\n params.orderField = (\n Array.isArray(orderFields) ? orderFields : [orderFields]\n ).map(({ field, order }) => `${field},${order}`);\n }\n if (fields.length) {\n params.fields = fields;\n }\n\n const normalizedFullTextFilterTerm = fullTextFilter?.term?.trim();\n if (normalizedFullTextFilterTerm) {\n params.fullTextFilterTerm = normalizedFullTextFilterTerm;\n }\n if (fullTextFilter?.fields?.length) {\n params.fullTextFilterFields = fullTextFilter.fields;\n }\n } else {\n const { fields = [], limit, cursor } = request;\n\n params.cursor = cursor;\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (fields.length) {\n params.fields = fields;\n }\n }\n\n return this.requestRequired(\n await this.apiClient.getEntitiesByQuery({ query: params }, options),\n );\n }\n\n /**\n * Query entities using predicate-based filters (POST endpoint).\n * @internal\n */\n private async queryEntitiesByPredicate(\n request: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const body: QueryEntitiesByPredicateRequest = {};\n\n if (isQueryEntitiesInitialRequest(request)) {\n const {\n filter,\n query,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n fields,\n } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (\n typeof query !== 'object' ||\n query === null ||\n Array.isArray(query)\n ) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n if (filterPredicate !== undefined) {\n body.query = filterPredicate as unknown as { [key: string]: any };\n }\n\n if (limit !== undefined) {\n body.limit = limit;\n }\n if (offset !== undefined) {\n body.offset = offset;\n }\n if (orderFields !== undefined) {\n body.orderBy = [orderFields].flat();\n }\n if (fullTextFilter) {\n body.fullTextFilter = fullTextFilter;\n }\n if (fields?.length) {\n body.fields = fields;\n }\n } else {\n body.cursor = request.cursor;\n if (request.limit !== undefined) {\n body.limit = request.limit;\n }\n if (request.fields?.length) {\n body.fields = request.fields;\n }\n }\n\n const res = await this.requestRequired(\n await this.apiClient.queryEntitiesByPredicate({ body }, options),\n );\n\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityByRef}\n */\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n {\n path: parseEntityRef(entityRef),\n },\n options,\n ),\n );\n }\n\n // NOTE(freben): When we deprecate getEntityByName from the interface, we may\n // still want to leave this implementation in place for quite some time\n // longer, to minimize the risk for breakages. Suggested date for removal:\n // August 2022\n /**\n * @deprecated Use getEntityByRef instead\n */\n async getEntityByName(\n compoundName: CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n const { kind, namespace = 'default', name } = compoundName;\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n { path: { kind, namespace, name } },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.refreshEntity}\n */\n async refreshEntity(entityRef: string, options?: CatalogRequestOptions) {\n const response = await this.apiClient.refreshEntity(\n { body: { entityRef } },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityFacets}\n */\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter = [], query, facets } = request;\n\n // Route to POST endpoint if query predicate is provided\n if (query) {\n return this.getEntityFacetsByPredicate(request, options);\n }\n\n return await this.requestOptional(\n await this.apiClient.getEntityFacets(\n {\n query: { facet: facets, filter: this.getFilterValue(filter) },\n },\n options,\n ),\n );\n }\n\n /**\n * Get entity facets using predicate-based filters (POST endpoint).\n * @internal\n */\n private async getEntityFacetsByPredicate(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter, query, facets } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n\n return await this.requestOptional(\n await this.apiClient.queryEntityFacetsByPredicate(\n {\n body: {\n facets,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.addLocation}\n */\n async addLocation(\n request: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse> {\n const { type = 'url', target, dryRun } = request;\n\n const response = await this.apiClient.createLocation(\n {\n body: { type, target },\n query: { dryRun: dryRun ? 'true' : undefined },\n },\n options,\n );\n\n if (response.status !== 201) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { location, entities, exists } = await response.json();\n\n if (!location) {\n throw new Error(`Location wasn't added: ${target}`);\n }\n\n return {\n location,\n entities,\n exists,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByRef}\n */\n async getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n const all = await this.requestRequired(\n await this.apiClient.getLocations({}, options),\n );\n return all\n .map(r => r.data)\n .find(l => locationRef === stringifyLocationRef(l));\n }\n\n /**\n * {@inheritdoc CatalogApi.removeLocationById}\n */\n async removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.removeEntityByUid}\n */\n async removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteEntityByUid({ path: { uid } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.validateEntity}\n */\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse> {\n const response = await this.apiClient.validateEntity(\n { body: { entity, location: locationRef } },\n options,\n );\n\n if (response.ok) {\n return {\n valid: true,\n };\n }\n\n if (response.status !== 400) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { errors = [] } = (await response.json()) as any;\n\n return {\n valid: false,\n errors,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.analyzeLocation}\n */\n async analyzeLocation(\n request: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse> {\n const response = await this.apiClient.analyzeLocation(\n {\n body: request,\n },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json() as Promise<AnalyzeLocationResponse>;\n }\n\n /**\n * {@inheritdoc CatalogApi.streamEntities}\n */\n async *streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]> {\n let cursor: string | undefined = undefined;\n const limit = request?.pageSize ?? DEFAULT_STREAM_ENTITIES_LIMIT;\n do {\n const res = await this.queryEntities(\n cursor ? { ...request, cursor, limit } : { ...request, limit },\n options,\n );\n\n yield res.items;\n\n cursor = res.pageInfo.nextCursor;\n } while (cursor);\n }\n\n // #region Private methods\n\n private async requestIgnored(response: Response): Promise<void> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n private async requestRequired<T>(response: TypedResponse<T>): Promise<T> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n\n private async requestOptional(response: Response): Promise<any | undefined> {\n if (!response.ok) {\n if (response.status === 404) {\n return undefined;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n private getFilterValue(filter: EntityFilterQuery = []) {\n const filters: string[] = [];\n // filter param can occur multiple times, for example\n // /api/catalog/entities?filter=metadata.name=wayback-search,kind=component&filter=metadata.name=www-artist,kind=component'\n // the \"outer array\" defined by `filter` occurrences corresponds to \"anyOf\" filters\n // the \"inner array\" defined within a `filter` param corresponds to \"allOf\" filters\n for (const filterItem of [filter].flat()) {\n const filterParts: string[] = [];\n for (const [key, value] of Object.entries(filterItem)) {\n for (const v of [value].flat()) {\n if (v === CATALOG_FILTER_EXISTS) {\n filterParts.push(key);\n } else if (typeof v === 'string') {\n filterParts.push(`${key}=${v}`);\n }\n }\n }\n\n if (filterParts.length) {\n filters.push(filterParts.join(','));\n }\n }\n return filters;\n }\n\n // #endregion\n}\n"],"names":["DefaultApiClient","parseEntityRef","DEFAULT_STREAM_LOCATIONS_LIMIT","InputError","convertFilterToPredicate","ResponseError","splitRefsIntoChunks","isQueryEntitiesInitialRequest","cursorContainsQuery","stringifyLocationRef","errors","DEFAULT_STREAM_ENTITIES_LIMIT","CATALOG_FILTER_EXISTS"],"mappings":";;;;;;;;;AA6EO,MAAM,aAAA,CAAoC;AAAA,EAC9B,SAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,SAAA,GAAY,IAAIA,2BAAA,CAAiB,OAAO,CAAA;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAA,CACJ,OAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,MAAM,IAAA,CAAK,eAAA;AAAA,MAChB,MAAM,KAAK,SAAA,CAAU,uBAAA;AAAA,QACnB,EAAE,IAAA,EAAMC,2BAAA,CAAe,OAAA,CAAQ,SAAS,CAAA,EAAE;AAAA,QAC1C;AAAA;AACF,KACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YAAA,CACJ,OAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,eAAA;AAAA,MACrB,MAAM,IAAA,CAAK,SAAA,CAAU,aAAa,OAAA,IAAW,IAAI,OAAO;AAAA,KAC1D;AACA,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,GAAA,CAAI,GAAA,CAAI,CAAA,IAAA,KAAQ,KAAK,IAAI;AAAA,KAClC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,cAAA,CACJ,OAAA,EACA,OAAA,EACiC;AACjC,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,eAAA;AAAA,MACrB,MAAM,KAAK,SAAA,CAAU,mBAAA;AAAA,QACnB,EAAE,IAAA,EAAO,OAAA,IAAW,EAAC,EAA4C;AAAA,QACjE;AAAA;AACF,KACF;AACA,IAAA,OAAO;AAAA,MACL,OAAO,GAAA,CAAI,KAAA;AAAA,MACX,YAAY,GAAA,CAAI,UA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Client.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CompoundEntityRef,\n Entity,\n parseEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { InputError, ResponseError } from '@backstage/errors';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CATALOG_FILTER_EXISTS,\n CatalogApi,\n CatalogRequestOptions,\n EntityFilterQuery,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n GetLocationsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n QueryLocationsInitialRequest,\n QueryLocationsRequest,\n QueryLocationsResponse,\n StreamEntitiesRequest,\n ValidateEntityResponse,\n} from './types/api';\nimport {\n convertFilterToPredicate,\n isQueryEntitiesInitialRequest,\n splitRefsIntoChunks,\n cursorContainsQuery,\n} from './utils';\nimport {\n DefaultApiClient,\n GetEntitiesByQuery,\n GetLocationsByQueryRequest,\n QueryEntitiesByPredicateRequest,\n TypedResponse,\n} from './schema/openapi';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport {\n DEFAULT_STREAM_ENTITIES_LIMIT,\n DEFAULT_STREAM_LOCATIONS_LIMIT,\n} from './constants';\n\n/**\n * A frontend and backend compatible client for communicating with the Backstage\n * software catalog.\n *\n * @public\n */\nexport class CatalogClient implements CatalogApi {\n private readonly apiClient: DefaultApiClient;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.apiClient = new DefaultApiClient(options);\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityAncestors}\n */\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return await this.requestRequired(\n await this.apiClient.getEntityAncestryByName(\n { path: parseEntityRef(request.entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocations}\n */\n async getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocations(request ?? {}, options),\n );\n return {\n items: res.map(item => item.data),\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryLocations}\n */\n async queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocationsByQuery(\n { body: (request ?? {}) as unknown as GetLocationsByQueryRequest },\n options,\n ),\n );\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.streamLocations}\n */\n async *streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]> {\n let response = await this.queryLocations(\n { limit: DEFAULT_STREAM_LOCATIONS_LIMIT, ...request },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n\n while (response.pageInfo.nextCursor) {\n response = await this.queryLocations(\n { cursor: response.pageInfo.nextCursor },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationById}\n */\n async getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByEntity}\n */\n async getLocationByEntity(\n entityRef: CompoundEntityRef | string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocationByEntity(\n { path: parseEntityRef(entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntities}\n */\n async getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse> {\n const {\n filter = [],\n fields = [],\n order,\n offset,\n limit,\n after,\n } = request ?? {};\n const encodedOrder = [];\n if (order) {\n for (const directive of [order].flat()) {\n if (directive) {\n encodedOrder.push(`${directive.order}:${directive.field}`);\n }\n }\n }\n\n const entities = await this.requestRequired(\n await this.apiClient.getEntities(\n {\n query: {\n fields,\n limit,\n filter: this.getFilterValue(filter),\n offset,\n after,\n order: order ? encodedOrder : undefined,\n },\n },\n options,\n ),\n );\n return { items: entities };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntitiesByRefs}\n */\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n const { filter, query } = request;\n\n // Only convert and merge if both filter and query are provided, or if\n // query alone is provided. When only filter is given, preserve the old\n // query-parameter behavior for backward compatibility.\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = { $all: [filterPredicate, converted] };\n }\n }\n\n const getOneChunk = async (refs: string[]) => {\n const response = await this.apiClient.getEntitiesByRefs(\n {\n body: {\n entityRefs: refs,\n fields: request.fields,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n query: filterPredicate\n ? {}\n : { filter: this.getFilterValue(request.filter) },\n },\n options,\n );\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const body = (await response.json()) as {\n items: Array<Entity | null>;\n };\n return body.items.map(i => i ?? undefined);\n };\n\n let result: Array<Entity | undefined> | undefined;\n for (const refs of splitRefsIntoChunks(request.entityRefs)) {\n const entities = await getOneChunk(refs);\n if (!result) {\n result = entities;\n } else {\n result.push(...entities);\n }\n }\n\n return { items: result ?? [] };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryEntities}\n */\n async queryEntities(\n request: QueryEntitiesRequest = {},\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const isInitialRequest = isQueryEntitiesInitialRequest(request);\n\n // Route to POST endpoint if query predicate is provided (initial request)\n if (isInitialRequest && request.query) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n // Route to POST endpoint if cursor contains a query predicate (pagination)\n // TODO(freben): It's costly and non-opaque to have to introspect the cursor\n // like this. It should be refactored in the future to not need this.\n // Suggestion: make the GET and POST endpoints understand the same cursor\n // format, and pick which one to call ONLY based on whether the cursor size\n // risks hitting url length limits\n if (!isInitialRequest && cursorContainsQuery(request.cursor)) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n const params: Partial<GetEntitiesByQuery['query']> = {};\n\n if (isInitialRequest) {\n const {\n fields = [],\n filter,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n } = request;\n params.filter = this.getFilterValue(filter);\n\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (offset !== undefined) {\n params.offset = offset;\n }\n if (orderFields !== undefined) {\n params.orderField = (\n Array.isArray(orderFields) ? orderFields : [orderFields]\n ).map(({ field, order }) => `${field},${order}`);\n }\n if (fields.length) {\n params.fields = fields;\n }\n\n const normalizedFullTextFilterTerm = fullTextFilter?.term?.trim();\n if (normalizedFullTextFilterTerm) {\n params.fullTextFilterTerm = normalizedFullTextFilterTerm;\n }\n if (fullTextFilter?.fields?.length) {\n params.fullTextFilterFields = fullTextFilter.fields;\n }\n } else {\n const { fields = [], limit, cursor } = request;\n\n params.cursor = cursor;\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (fields.length) {\n params.fields = fields;\n }\n }\n\n return this.requestRequired(\n await this.apiClient.getEntitiesByQuery({ query: params }, options),\n );\n }\n\n /**\n * Query entities using predicate-based filters (POST endpoint).\n * @internal\n */\n private async queryEntitiesByPredicate(\n request: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const body: QueryEntitiesByPredicateRequest = {};\n\n if (isQueryEntitiesInitialRequest(request)) {\n const {\n filter,\n query,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n fields,\n } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (\n typeof query !== 'object' ||\n query === null ||\n Array.isArray(query)\n ) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n if (filterPredicate !== undefined) {\n body.query = filterPredicate as unknown as { [key: string]: any };\n }\n\n if (limit !== undefined) {\n body.limit = limit;\n }\n if (offset !== undefined) {\n body.offset = offset;\n }\n if (orderFields !== undefined) {\n body.orderBy = [orderFields].flat();\n }\n if (fullTextFilter) {\n body.fullTextFilter = fullTextFilter;\n }\n if (fields?.length) {\n body.fields = fields;\n }\n } else {\n body.cursor = request.cursor;\n if (request.limit !== undefined) {\n body.limit = request.limit;\n }\n if (request.fields?.length) {\n body.fields = request.fields;\n }\n }\n\n const res = await this.requestRequired(\n await this.apiClient.queryEntitiesByPredicate({ body }, options),\n );\n\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityByRef}\n */\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n {\n path: parseEntityRef(entityRef),\n },\n options,\n ),\n );\n }\n\n // NOTE(freben): When we deprecate getEntityByName from the interface, we may\n // still want to leave this implementation in place for quite some time\n // longer, to minimize the risk for breakages. Suggested date for removal:\n // August 2022\n /**\n * @deprecated Use getEntityByRef instead\n */\n async getEntityByName(\n compoundName: CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n const { kind, namespace = 'default', name } = compoundName;\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n { path: { kind, namespace, name } },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.refreshEntity}\n */\n async refreshEntity(entityRef: string, options?: CatalogRequestOptions) {\n const response = await this.apiClient.refreshEntity(\n { body: { entityRef } },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityFacets}\n */\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter = [], query, facets } = request;\n\n // Route to POST endpoint if query predicate is provided\n if (query) {\n return this.getEntityFacetsByPredicate(request, options);\n }\n\n return await this.requestOptional(\n await this.apiClient.getEntityFacets(\n {\n query: { facet: facets, filter: this.getFilterValue(filter) },\n },\n options,\n ),\n );\n }\n\n /**\n * Get entity facets using predicate-based filters (POST endpoint).\n * @internal\n */\n private async getEntityFacetsByPredicate(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter, query, facets } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n\n return await this.requestOptional(\n await this.apiClient.queryEntityFacetsByPredicate(\n {\n body: {\n facets,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.addLocation}\n */\n async addLocation(\n request: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse> {\n const { type = 'url', target, dryRun, onConflict } = request;\n\n const response = await this.apiClient.createLocation(\n {\n body: { type, target },\n query: {\n dryRun: dryRun ? 'true' : undefined,\n onConflict,\n },\n },\n options,\n );\n\n if (response.status !== 201) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { location, entities, exists } = await response.json();\n\n if (!location) {\n throw new Error(`Location wasn't added: ${target}`);\n }\n\n return {\n location,\n entities,\n exists,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByRef}\n */\n async getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n const all = await this.requestRequired(\n await this.apiClient.getLocations({}, options),\n );\n return all\n .map(r => r.data)\n .find(l => locationRef === stringifyLocationRef(l));\n }\n\n /**\n * {@inheritdoc CatalogApi.removeLocationById}\n */\n async removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.removeEntityByUid}\n */\n async removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteEntityByUid({ path: { uid } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.validateEntity}\n */\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse> {\n const response = await this.apiClient.validateEntity(\n { body: { entity, location: locationRef } },\n options,\n );\n\n if (response.ok) {\n return {\n valid: true,\n };\n }\n\n if (response.status !== 400) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { errors = [] } = (await response.json()) as any;\n\n return {\n valid: false,\n errors,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.analyzeLocation}\n */\n async analyzeLocation(\n request: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse> {\n const response = await this.apiClient.analyzeLocation(\n {\n body: request,\n },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json() as Promise<AnalyzeLocationResponse>;\n }\n\n /**\n * {@inheritdoc CatalogApi.streamEntities}\n */\n async *streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]> {\n let cursor: string | undefined = undefined;\n const limit = request?.pageSize ?? DEFAULT_STREAM_ENTITIES_LIMIT;\n do {\n const res = await this.queryEntities(\n cursor ? { ...request, cursor, limit } : { ...request, limit },\n options,\n );\n\n yield res.items;\n\n cursor = res.pageInfo.nextCursor;\n } while (cursor);\n }\n\n // #region Private methods\n\n private async requestIgnored(response: Response): Promise<void> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n private async requestRequired<T>(response: TypedResponse<T>): Promise<T> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n\n private async requestOptional(response: Response): Promise<any | undefined> {\n if (!response.ok) {\n if (response.status === 404) {\n return undefined;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n private getFilterValue(filter: EntityFilterQuery = []) {\n const filters: string[] = [];\n // filter param can occur multiple times, for example\n // /api/catalog/entities?filter=metadata.name=wayback-search,kind=component&filter=metadata.name=www-artist,kind=component'\n // the \"outer array\" defined by `filter` occurrences corresponds to \"anyOf\" filters\n // the \"inner array\" defined within a `filter` param corresponds to \"allOf\" filters\n for (const filterItem of [filter].flat()) {\n const filterParts: string[] = [];\n for (const [key, value] of Object.entries(filterItem)) {\n for (const v of [value].flat()) {\n if (v === CATALOG_FILTER_EXISTS) {\n filterParts.push(key);\n } else if (typeof v === 'string') {\n filterParts.push(`${key}=${v}`);\n }\n }\n }\n\n if (filterParts.length) {\n filters.push(filterParts.join(','));\n }\n }\n return filters;\n }\n\n // #endregion\n}\n"],"names":["DefaultApiClient","parseEntityRef","DEFAULT_STREAM_LOCATIONS_LIMIT","InputError","convertFilterToPredicate","ResponseError","splitRefsIntoChunks","isQueryEntitiesInitialRequest","cursorContainsQuery","stringifyLocationRef","errors","DEFAULT_STREAM_ENTITIES_LIMIT","CATALOG_FILTER_EXISTS"],"mappings":";;;;;;;;;AA6EO,MAAM,aAAA,CAAoC;AAAA,EAC9B,SAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,SAAA,GAAY,IAAIA,2BAAA,CAAiB,OAAO,CAAA;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAA,CACJ,OAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,MAAM,IAAA,CAAK,eAAA;AAAA,MAChB,MAAM,KAAK,SAAA,CAAU,uBAAA;AAAA,QACnB,EAAE,IAAA,EAAMC,2BAAA,CAAe,OAAA,CAAQ,SAAS,CAAA,EAAE;AAAA,QAC1C;AAAA;AACF,KACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YAAA,CACJ,OAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,eAAA;AAAA,MACrB,MAAM,IAAA,CAAK,SAAA,CAAU,aAAa,OAAA,IAAW,IAAI,OAAO;AAAA,KAC1D;AACA,IAAA,OAAO;AAAA,MACL,KAAA,EAAO,GAAA,CAAI,GAAA,CAAI,CAAA,IAAA,KAAQ,KAAK,IAAI;AAAA,KAClC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,cAAA,CACJ,OAAA,EACA,OAAA,EACiC;AACjC,IAAA,MAAM,GAAA,GAAM,MAA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,QACF;AAAA,MACF;AAEA,MAAA,IAAI,YAAY,MAAA,EAAQ;AACtB,QAAA,OAAA,CAAQ,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,CAAC,CAAA;AAAA,MACpC;AAAA,IACF;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAGF;;;;"}
|
|
@@ -383,11 +383,14 @@ class CatalogClient {
|
|
|
383
383
|
* {@inheritdoc CatalogApi.addLocation}
|
|
384
384
|
*/
|
|
385
385
|
async addLocation(request, options) {
|
|
386
|
-
const { type = "url", target, dryRun } = request;
|
|
386
|
+
const { type = "url", target, dryRun, onConflict } = request;
|
|
387
387
|
const response = await this.apiClient.createLocation(
|
|
388
388
|
{
|
|
389
389
|
body: { type, target },
|
|
390
|
-
query: {
|
|
390
|
+
query: {
|
|
391
|
+
dryRun: dryRun ? "true" : void 0,
|
|
392
|
+
onConflict
|
|
393
|
+
}
|
|
391
394
|
},
|
|
392
395
|
options
|
|
393
396
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogClient.esm.js","sources":["../src/CatalogClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CompoundEntityRef,\n Entity,\n parseEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { InputError, ResponseError } from '@backstage/errors';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CATALOG_FILTER_EXISTS,\n CatalogApi,\n CatalogRequestOptions,\n EntityFilterQuery,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n GetLocationsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n QueryLocationsInitialRequest,\n QueryLocationsRequest,\n QueryLocationsResponse,\n StreamEntitiesRequest,\n ValidateEntityResponse,\n} from './types/api';\nimport {\n convertFilterToPredicate,\n isQueryEntitiesInitialRequest,\n splitRefsIntoChunks,\n cursorContainsQuery,\n} from './utils';\nimport {\n DefaultApiClient,\n GetEntitiesByQuery,\n GetLocationsByQueryRequest,\n QueryEntitiesByPredicateRequest,\n TypedResponse,\n} from './schema/openapi';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport {\n DEFAULT_STREAM_ENTITIES_LIMIT,\n DEFAULT_STREAM_LOCATIONS_LIMIT,\n} from './constants';\n\n/**\n * A frontend and backend compatible client for communicating with the Backstage\n * software catalog.\n *\n * @public\n */\nexport class CatalogClient implements CatalogApi {\n private readonly apiClient: DefaultApiClient;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.apiClient = new DefaultApiClient(options);\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityAncestors}\n */\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return await this.requestRequired(\n await this.apiClient.getEntityAncestryByName(\n { path: parseEntityRef(request.entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocations}\n */\n async getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocations(request ?? {}, options),\n );\n return {\n items: res.map(item => item.data),\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryLocations}\n */\n async queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocationsByQuery(\n { body: (request ?? {}) as unknown as GetLocationsByQueryRequest },\n options,\n ),\n );\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.streamLocations}\n */\n async *streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]> {\n let response = await this.queryLocations(\n { limit: DEFAULT_STREAM_LOCATIONS_LIMIT, ...request },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n\n while (response.pageInfo.nextCursor) {\n response = await this.queryLocations(\n { cursor: response.pageInfo.nextCursor },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationById}\n */\n async getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByEntity}\n */\n async getLocationByEntity(\n entityRef: CompoundEntityRef | string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocationByEntity(\n { path: parseEntityRef(entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntities}\n */\n async getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse> {\n const {\n filter = [],\n fields = [],\n order,\n offset,\n limit,\n after,\n } = request ?? {};\n const encodedOrder = [];\n if (order) {\n for (const directive of [order].flat()) {\n if (directive) {\n encodedOrder.push(`${directive.order}:${directive.field}`);\n }\n }\n }\n\n const entities = await this.requestRequired(\n await this.apiClient.getEntities(\n {\n query: {\n fields,\n limit,\n filter: this.getFilterValue(filter),\n offset,\n after,\n order: order ? encodedOrder : undefined,\n },\n },\n options,\n ),\n );\n return { items: entities };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntitiesByRefs}\n */\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n const { filter, query } = request;\n\n // Only convert and merge if both filter and query are provided, or if\n // query alone is provided. When only filter is given, preserve the old\n // query-parameter behavior for backward compatibility.\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = { $all: [filterPredicate, converted] };\n }\n }\n\n const getOneChunk = async (refs: string[]) => {\n const response = await this.apiClient.getEntitiesByRefs(\n {\n body: {\n entityRefs: refs,\n fields: request.fields,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n query: filterPredicate\n ? {}\n : { filter: this.getFilterValue(request.filter) },\n },\n options,\n );\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const body = (await response.json()) as {\n items: Array<Entity | null>;\n };\n return body.items.map(i => i ?? undefined);\n };\n\n let result: Array<Entity | undefined> | undefined;\n for (const refs of splitRefsIntoChunks(request.entityRefs)) {\n const entities = await getOneChunk(refs);\n if (!result) {\n result = entities;\n } else {\n result.push(...entities);\n }\n }\n\n return { items: result ?? [] };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryEntities}\n */\n async queryEntities(\n request: QueryEntitiesRequest = {},\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const isInitialRequest = isQueryEntitiesInitialRequest(request);\n\n // Route to POST endpoint if query predicate is provided (initial request)\n if (isInitialRequest && request.query) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n // Route to POST endpoint if cursor contains a query predicate (pagination)\n // TODO(freben): It's costly and non-opaque to have to introspect the cursor\n // like this. It should be refactored in the future to not need this.\n // Suggestion: make the GET and POST endpoints understand the same cursor\n // format, and pick which one to call ONLY based on whether the cursor size\n // risks hitting url length limits\n if (!isInitialRequest && cursorContainsQuery(request.cursor)) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n const params: Partial<GetEntitiesByQuery['query']> = {};\n\n if (isInitialRequest) {\n const {\n fields = [],\n filter,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n } = request;\n params.filter = this.getFilterValue(filter);\n\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (offset !== undefined) {\n params.offset = offset;\n }\n if (orderFields !== undefined) {\n params.orderField = (\n Array.isArray(orderFields) ? orderFields : [orderFields]\n ).map(({ field, order }) => `${field},${order}`);\n }\n if (fields.length) {\n params.fields = fields;\n }\n\n const normalizedFullTextFilterTerm = fullTextFilter?.term?.trim();\n if (normalizedFullTextFilterTerm) {\n params.fullTextFilterTerm = normalizedFullTextFilterTerm;\n }\n if (fullTextFilter?.fields?.length) {\n params.fullTextFilterFields = fullTextFilter.fields;\n }\n } else {\n const { fields = [], limit, cursor } = request;\n\n params.cursor = cursor;\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (fields.length) {\n params.fields = fields;\n }\n }\n\n return this.requestRequired(\n await this.apiClient.getEntitiesByQuery({ query: params }, options),\n );\n }\n\n /**\n * Query entities using predicate-based filters (POST endpoint).\n * @internal\n */\n private async queryEntitiesByPredicate(\n request: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const body: QueryEntitiesByPredicateRequest = {};\n\n if (isQueryEntitiesInitialRequest(request)) {\n const {\n filter,\n query,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n fields,\n } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (\n typeof query !== 'object' ||\n query === null ||\n Array.isArray(query)\n ) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n if (filterPredicate !== undefined) {\n body.query = filterPredicate as unknown as { [key: string]: any };\n }\n\n if (limit !== undefined) {\n body.limit = limit;\n }\n if (offset !== undefined) {\n body.offset = offset;\n }\n if (orderFields !== undefined) {\n body.orderBy = [orderFields].flat();\n }\n if (fullTextFilter) {\n body.fullTextFilter = fullTextFilter;\n }\n if (fields?.length) {\n body.fields = fields;\n }\n } else {\n body.cursor = request.cursor;\n if (request.limit !== undefined) {\n body.limit = request.limit;\n }\n if (request.fields?.length) {\n body.fields = request.fields;\n }\n }\n\n const res = await this.requestRequired(\n await this.apiClient.queryEntitiesByPredicate({ body }, options),\n );\n\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityByRef}\n */\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n {\n path: parseEntityRef(entityRef),\n },\n options,\n ),\n );\n }\n\n // NOTE(freben): When we deprecate getEntityByName from the interface, we may\n // still want to leave this implementation in place for quite some time\n // longer, to minimize the risk for breakages. Suggested date for removal:\n // August 2022\n /**\n * @deprecated Use getEntityByRef instead\n */\n async getEntityByName(\n compoundName: CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n const { kind, namespace = 'default', name } = compoundName;\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n { path: { kind, namespace, name } },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.refreshEntity}\n */\n async refreshEntity(entityRef: string, options?: CatalogRequestOptions) {\n const response = await this.apiClient.refreshEntity(\n { body: { entityRef } },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityFacets}\n */\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter = [], query, facets } = request;\n\n // Route to POST endpoint if query predicate is provided\n if (query) {\n return this.getEntityFacetsByPredicate(request, options);\n }\n\n return await this.requestOptional(\n await this.apiClient.getEntityFacets(\n {\n query: { facet: facets, filter: this.getFilterValue(filter) },\n },\n options,\n ),\n );\n }\n\n /**\n * Get entity facets using predicate-based filters (POST endpoint).\n * @internal\n */\n private async getEntityFacetsByPredicate(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter, query, facets } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n\n return await this.requestOptional(\n await this.apiClient.queryEntityFacetsByPredicate(\n {\n body: {\n facets,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.addLocation}\n */\n async addLocation(\n request: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse> {\n const { type = 'url', target, dryRun } = request;\n\n const response = await this.apiClient.createLocation(\n {\n body: { type, target },\n query: { dryRun: dryRun ? 'true' : undefined },\n },\n options,\n );\n\n if (response.status !== 201) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { location, entities, exists } = await response.json();\n\n if (!location) {\n throw new Error(`Location wasn't added: ${target}`);\n }\n\n return {\n location,\n entities,\n exists,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByRef}\n */\n async getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n const all = await this.requestRequired(\n await this.apiClient.getLocations({}, options),\n );\n return all\n .map(r => r.data)\n .find(l => locationRef === stringifyLocationRef(l));\n }\n\n /**\n * {@inheritdoc CatalogApi.removeLocationById}\n */\n async removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.removeEntityByUid}\n */\n async removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteEntityByUid({ path: { uid } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.validateEntity}\n */\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse> {\n const response = await this.apiClient.validateEntity(\n { body: { entity, location: locationRef } },\n options,\n );\n\n if (response.ok) {\n return {\n valid: true,\n };\n }\n\n if (response.status !== 400) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { errors = [] } = (await response.json()) as any;\n\n return {\n valid: false,\n errors,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.analyzeLocation}\n */\n async analyzeLocation(\n request: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse> {\n const response = await this.apiClient.analyzeLocation(\n {\n body: request,\n },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json() as Promise<AnalyzeLocationResponse>;\n }\n\n /**\n * {@inheritdoc CatalogApi.streamEntities}\n */\n async *streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]> {\n let cursor: string | undefined = undefined;\n const limit = request?.pageSize ?? DEFAULT_STREAM_ENTITIES_LIMIT;\n do {\n const res = await this.queryEntities(\n cursor ? { ...request, cursor, limit } : { ...request, limit },\n options,\n );\n\n yield res.items;\n\n cursor = res.pageInfo.nextCursor;\n } while (cursor);\n }\n\n // #region Private methods\n\n private async requestIgnored(response: Response): Promise<void> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n private async requestRequired<T>(response: TypedResponse<T>): Promise<T> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n\n private async requestOptional(response: Response): Promise<any | undefined> {\n if (!response.ok) {\n if (response.status === 404) {\n return undefined;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n private getFilterValue(filter: EntityFilterQuery = []) {\n const filters: string[] = [];\n // filter param can occur multiple times, for example\n // /api/catalog/entities?filter=metadata.name=wayback-search,kind=component&filter=metadata.name=www-artist,kind=component'\n // the \"outer array\" defined by `filter` occurrences corresponds to \"anyOf\" filters\n // the \"inner array\" defined within a `filter` param corresponds to \"allOf\" filters\n for (const filterItem of [filter].flat()) {\n const filterParts: string[] = [];\n for (const [key, value] of Object.entries(filterItem)) {\n for (const v of [value].flat()) {\n if (v === CATALOG_FILTER_EXISTS) {\n filterParts.push(key);\n } else if (typeof v === 'string') {\n filterParts.push(`${key}=${v}`);\n }\n }\n }\n\n if (filterParts.length) {\n filters.push(filterParts.join(','));\n }\n }\n return filters;\n }\n\n // #endregion\n}\n"],"names":[],"mappings":";;;;;;;AA6EO,MAAM,aAAA,CAAoC;AAAA,EAC9B,SAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,gBAAA,CAAiB,OAAO,CAAA;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAA,CACJ,OAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,MAAM,IAAA,CAAK,eAAA;AAAA,MAChB,MAAM,KAAK,SAAA,CAAU,uBAAA;AAAA,QACnB,EAAE,IAAA,EAAM,cAAA,CAAe,OAAA,CAAQ,SAAS,CAAA,EAAE;AA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AAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,UAAU,CAAA,EAAG;AACrD,QAAA,KAAA,MAAW,CAAA,IAAK,CAAC,KAAK,CAAA,CAAE,MAAK,EAAG;AAC9B,UAAA,IAAI,MAAM,qBAAA,EAAuB;AAC/B,YAAA,WAAA,CAAY,KAAK,GAAG,CAAA;AAAA,UACtB,CAAA,MAAA,IAAW,OAAO,CAAA,KAAM,QAAA,EAAU;AAChC,YAAA,WAAA,CAAY,IAAA,CAAK,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,CAAC,CAAA,CAAE,CAAA;AAAA,UAChC;AAAA,QACF;AAAA,MACF;AAEA,MAAA,IAAI,YAAY,MAAA,EAAQ;AACtB,QAAA,OAAA,CAAQ,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,CAAC,CAAA;AAAA,MACpC;AAAA,IACF;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAGF;;;;"}
|
|
1
|
+
{"version":3,"file":"CatalogClient.esm.js","sources":["../src/CatalogClient.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CompoundEntityRef,\n Entity,\n parseEntityRef,\n stringifyLocationRef,\n} from '@backstage/catalog-model';\nimport { InputError, ResponseError } from '@backstage/errors';\nimport { FilterPredicate } from '@backstage/filter-predicates';\nimport {\n AddLocationRequest,\n AddLocationResponse,\n CATALOG_FILTER_EXISTS,\n CatalogApi,\n CatalogRequestOptions,\n EntityFilterQuery,\n GetEntitiesByRefsRequest,\n GetEntitiesByRefsResponse,\n GetEntitiesRequest,\n GetEntitiesResponse,\n GetEntityAncestorsRequest,\n GetEntityAncestorsResponse,\n GetEntityFacetsRequest,\n GetEntityFacetsResponse,\n GetLocationsResponse,\n Location,\n QueryEntitiesRequest,\n QueryEntitiesResponse,\n QueryLocationsInitialRequest,\n QueryLocationsRequest,\n QueryLocationsResponse,\n StreamEntitiesRequest,\n ValidateEntityResponse,\n} from './types/api';\nimport {\n convertFilterToPredicate,\n isQueryEntitiesInitialRequest,\n splitRefsIntoChunks,\n cursorContainsQuery,\n} from './utils';\nimport {\n DefaultApiClient,\n GetEntitiesByQuery,\n GetLocationsByQueryRequest,\n QueryEntitiesByPredicateRequest,\n TypedResponse,\n} from './schema/openapi';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport {\n DEFAULT_STREAM_ENTITIES_LIMIT,\n DEFAULT_STREAM_LOCATIONS_LIMIT,\n} from './constants';\n\n/**\n * A frontend and backend compatible client for communicating with the Backstage\n * software catalog.\n *\n * @public\n */\nexport class CatalogClient implements CatalogApi {\n private readonly apiClient: DefaultApiClient;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.apiClient = new DefaultApiClient(options);\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityAncestors}\n */\n async getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse> {\n return await this.requestRequired(\n await this.apiClient.getEntityAncestryByName(\n { path: parseEntityRef(request.entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocations}\n */\n async getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocations(request ?? {}, options),\n );\n return {\n items: res.map(item => item.data),\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryLocations}\n */\n async queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse> {\n const res = await this.requestRequired(\n await this.apiClient.getLocationsByQuery(\n { body: (request ?? {}) as unknown as GetLocationsByQueryRequest },\n options,\n ),\n );\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.streamLocations}\n */\n async *streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]> {\n let response = await this.queryLocations(\n { limit: DEFAULT_STREAM_LOCATIONS_LIMIT, ...request },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n\n while (response.pageInfo.nextCursor) {\n response = await this.queryLocations(\n { cursor: response.pageInfo.nextCursor },\n options,\n );\n if (response.items.length) {\n yield response.items;\n }\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationById}\n */\n async getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByEntity}\n */\n async getLocationByEntity(\n entityRef: CompoundEntityRef | string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n return await this.requestOptional(\n await this.apiClient.getLocationByEntity(\n { path: parseEntityRef(entityRef) },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntities}\n */\n async getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse> {\n const {\n filter = [],\n fields = [],\n order,\n offset,\n limit,\n after,\n } = request ?? {};\n const encodedOrder = [];\n if (order) {\n for (const directive of [order].flat()) {\n if (directive) {\n encodedOrder.push(`${directive.order}:${directive.field}`);\n }\n }\n }\n\n const entities = await this.requestRequired(\n await this.apiClient.getEntities(\n {\n query: {\n fields,\n limit,\n filter: this.getFilterValue(filter),\n offset,\n after,\n order: order ? encodedOrder : undefined,\n },\n },\n options,\n ),\n );\n return { items: entities };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntitiesByRefs}\n */\n async getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse> {\n const { filter, query } = request;\n\n // Only convert and merge if both filter and query are provided, or if\n // query alone is provided. When only filter is given, preserve the old\n // query-parameter behavior for backward compatibility.\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = { $all: [filterPredicate, converted] };\n }\n }\n\n const getOneChunk = async (refs: string[]) => {\n const response = await this.apiClient.getEntitiesByRefs(\n {\n body: {\n entityRefs: refs,\n fields: request.fields,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n query: filterPredicate\n ? {}\n : { filter: this.getFilterValue(request.filter) },\n },\n options,\n );\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const body = (await response.json()) as {\n items: Array<Entity | null>;\n };\n return body.items.map(i => i ?? undefined);\n };\n\n let result: Array<Entity | undefined> | undefined;\n for (const refs of splitRefsIntoChunks(request.entityRefs)) {\n const entities = await getOneChunk(refs);\n if (!result) {\n result = entities;\n } else {\n result.push(...entities);\n }\n }\n\n return { items: result ?? [] };\n }\n\n /**\n * {@inheritdoc CatalogApi.queryEntities}\n */\n async queryEntities(\n request: QueryEntitiesRequest = {},\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const isInitialRequest = isQueryEntitiesInitialRequest(request);\n\n // Route to POST endpoint if query predicate is provided (initial request)\n if (isInitialRequest && request.query) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n // Route to POST endpoint if cursor contains a query predicate (pagination)\n // TODO(freben): It's costly and non-opaque to have to introspect the cursor\n // like this. It should be refactored in the future to not need this.\n // Suggestion: make the GET and POST endpoints understand the same cursor\n // format, and pick which one to call ONLY based on whether the cursor size\n // risks hitting url length limits\n if (!isInitialRequest && cursorContainsQuery(request.cursor)) {\n return this.queryEntitiesByPredicate(request, options);\n }\n\n const params: Partial<GetEntitiesByQuery['query']> = {};\n\n if (isInitialRequest) {\n const {\n fields = [],\n filter,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n } = request;\n params.filter = this.getFilterValue(filter);\n\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (offset !== undefined) {\n params.offset = offset;\n }\n if (orderFields !== undefined) {\n params.orderField = (\n Array.isArray(orderFields) ? orderFields : [orderFields]\n ).map(({ field, order }) => `${field},${order}`);\n }\n if (fields.length) {\n params.fields = fields;\n }\n\n const normalizedFullTextFilterTerm = fullTextFilter?.term?.trim();\n if (normalizedFullTextFilterTerm) {\n params.fullTextFilterTerm = normalizedFullTextFilterTerm;\n }\n if (fullTextFilter?.fields?.length) {\n params.fullTextFilterFields = fullTextFilter.fields;\n }\n } else {\n const { fields = [], limit, cursor } = request;\n\n params.cursor = cursor;\n if (limit !== undefined) {\n params.limit = limit;\n }\n if (fields.length) {\n params.fields = fields;\n }\n }\n\n return this.requestRequired(\n await this.apiClient.getEntitiesByQuery({ query: params }, options),\n );\n }\n\n /**\n * Query entities using predicate-based filters (POST endpoint).\n * @internal\n */\n private async queryEntitiesByPredicate(\n request: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse> {\n const body: QueryEntitiesByPredicateRequest = {};\n\n if (isQueryEntitiesInitialRequest(request)) {\n const {\n filter,\n query,\n limit,\n offset,\n orderFields,\n fullTextFilter,\n fields,\n } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (\n typeof query !== 'object' ||\n query === null ||\n Array.isArray(query)\n ) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n if (filterPredicate !== undefined) {\n body.query = filterPredicate as unknown as { [key: string]: any };\n }\n\n if (limit !== undefined) {\n body.limit = limit;\n }\n if (offset !== undefined) {\n body.offset = offset;\n }\n if (orderFields !== undefined) {\n body.orderBy = [orderFields].flat();\n }\n if (fullTextFilter) {\n body.fullTextFilter = fullTextFilter;\n }\n if (fields?.length) {\n body.fields = fields;\n }\n } else {\n body.cursor = request.cursor;\n if (request.limit !== undefined) {\n body.limit = request.limit;\n }\n if (request.fields?.length) {\n body.fields = request.fields;\n }\n }\n\n const res = await this.requestRequired(\n await this.apiClient.queryEntitiesByPredicate({ body }, options),\n );\n\n return {\n items: res.items,\n totalItems: res.totalItems,\n pageInfo: res.pageInfo,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityByRef}\n */\n async getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n {\n path: parseEntityRef(entityRef),\n },\n options,\n ),\n );\n }\n\n // NOTE(freben): When we deprecate getEntityByName from the interface, we may\n // still want to leave this implementation in place for quite some time\n // longer, to minimize the risk for breakages. Suggested date for removal:\n // August 2022\n /**\n * @deprecated Use getEntityByRef instead\n */\n async getEntityByName(\n compoundName: CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined> {\n const { kind, namespace = 'default', name } = compoundName;\n return this.requestOptional(\n await this.apiClient.getEntityByName(\n { path: { kind, namespace, name } },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.refreshEntity}\n */\n async refreshEntity(entityRef: string, options?: CatalogRequestOptions) {\n const response = await this.apiClient.refreshEntity(\n { body: { entityRef } },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n /**\n * {@inheritdoc CatalogApi.getEntityFacets}\n */\n async getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter = [], query, facets } = request;\n\n // Route to POST endpoint if query predicate is provided\n if (query) {\n return this.getEntityFacetsByPredicate(request, options);\n }\n\n return await this.requestOptional(\n await this.apiClient.getEntityFacets(\n {\n query: { facet: facets, filter: this.getFilterValue(filter) },\n },\n options,\n ),\n );\n }\n\n /**\n * Get entity facets using predicate-based filters (POST endpoint).\n * @internal\n */\n private async getEntityFacetsByPredicate(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse> {\n const { filter, query, facets } = request;\n\n let filterPredicate: FilterPredicate | undefined;\n if (query !== undefined) {\n if (typeof query !== 'object' || query === null || Array.isArray(query)) {\n throw new InputError('Query must be an object');\n }\n filterPredicate = query;\n }\n if (filter !== undefined) {\n const converted = convertFilterToPredicate(filter);\n filterPredicate = filterPredicate\n ? { $all: [filterPredicate, converted] }\n : converted;\n }\n\n return await this.requestOptional(\n await this.apiClient.queryEntityFacetsByPredicate(\n {\n body: {\n facets,\n ...(filterPredicate && {\n query: filterPredicate as unknown as { [key: string]: any },\n }),\n },\n },\n options,\n ),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.addLocation}\n */\n async addLocation(\n request: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse> {\n const { type = 'url', target, dryRun, onConflict } = request;\n\n const response = await this.apiClient.createLocation(\n {\n body: { type, target },\n query: {\n dryRun: dryRun ? 'true' : undefined,\n onConflict,\n },\n },\n options,\n );\n\n if (response.status !== 201) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { location, entities, exists } = await response.json();\n\n if (!location) {\n throw new Error(`Location wasn't added: ${target}`);\n }\n\n return {\n location,\n entities,\n exists,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.getLocationByRef}\n */\n async getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined> {\n const all = await this.requestRequired(\n await this.apiClient.getLocations({}, options),\n );\n return all\n .map(r => r.data)\n .find(l => locationRef === stringifyLocationRef(l));\n }\n\n /**\n * {@inheritdoc CatalogApi.removeLocationById}\n */\n async removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteLocation({ path: { id } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.removeEntityByUid}\n */\n async removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void> {\n await this.requestIgnored(\n await this.apiClient.deleteEntityByUid({ path: { uid } }, options),\n );\n }\n\n /**\n * {@inheritdoc CatalogApi.validateEntity}\n */\n async validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse> {\n const response = await this.apiClient.validateEntity(\n { body: { entity, location: locationRef } },\n options,\n );\n\n if (response.ok) {\n return {\n valid: true,\n };\n }\n\n if (response.status !== 400) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { errors = [] } = (await response.json()) as any;\n\n return {\n valid: false,\n errors,\n };\n }\n\n /**\n * {@inheritdoc CatalogApi.analyzeLocation}\n */\n async analyzeLocation(\n request: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse> {\n const response = await this.apiClient.analyzeLocation(\n {\n body: request,\n },\n options,\n );\n\n if (response.status !== 200) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json() as Promise<AnalyzeLocationResponse>;\n }\n\n /**\n * {@inheritdoc CatalogApi.streamEntities}\n */\n async *streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]> {\n let cursor: string | undefined = undefined;\n const limit = request?.pageSize ?? DEFAULT_STREAM_ENTITIES_LIMIT;\n do {\n const res = await this.queryEntities(\n cursor ? { ...request, cursor, limit } : { ...request, limit },\n options,\n );\n\n yield res.items;\n\n cursor = res.pageInfo.nextCursor;\n } while (cursor);\n }\n\n // #region Private methods\n\n private async requestIgnored(response: Response): Promise<void> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n }\n\n private async requestRequired<T>(response: TypedResponse<T>): Promise<T> {\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n\n private async requestOptional(response: Response): Promise<any | undefined> {\n if (!response.ok) {\n if (response.status === 404) {\n return undefined;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n private getFilterValue(filter: EntityFilterQuery = []) {\n const filters: string[] = [];\n // filter param can occur multiple times, for example\n // /api/catalog/entities?filter=metadata.name=wayback-search,kind=component&filter=metadata.name=www-artist,kind=component'\n // the \"outer array\" defined by `filter` occurrences corresponds to \"anyOf\" filters\n // the \"inner array\" defined within a `filter` param corresponds to \"allOf\" filters\n for (const filterItem of [filter].flat()) {\n const filterParts: string[] = [];\n for (const [key, value] of Object.entries(filterItem)) {\n for (const v of [value].flat()) {\n if (v === CATALOG_FILTER_EXISTS) {\n filterParts.push(key);\n } else if (typeof v === 'string') {\n filterParts.push(`${key}=${v}`);\n }\n }\n }\n\n if (filterParts.length) {\n filters.push(filterParts.join(','));\n }\n }\n return filters;\n }\n\n // #endregion\n}\n"],"names":[],"mappings":";;;;;;;AA6EO,MAAM,aAAA,CAAoC;AAAA,EAC9B,SAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,gBAAA,CAAiB,OAAO,CAAA;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBAAA,CACJ,OAAA,EACA,OAAA,EACqC;AACrC,IAAA,OAAO,MAAM,IAAA,CAAK,eAAA;AAAA,MAChB,MAAM,KAAK,SAAA,CAAU,uBAAA;AAAA,QACnB,EAAE,IAAA,EAAM,cAAA,CAAe,OAAA,CAAQ,SAAS,CAAA,EAAE;AAAA,QAC1C;A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,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,UAAU,CAAA,EAAG;AACrD,QAAA,KAAA,MAAW,CAAA,IAAK,CAAC,KAAK,CAAA,CAAE,MAAK,EAAG;AAC9B,UAAA,IAAI,MAAM,qBAAA,EAAuB;AAC/B,YAAA,WAAA,CAAY,KAAK,GAAG,CAAA;AAAA,UACtB,CAAA,MAAA,IAAW,OAAO,CAAA,KAAM,QAAA,EAAU;AAChC,YAAA,WAAA,CAAY,IAAA,CAAK,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,CAAC,CAAA,CAAE,CAAA;AAAA,UAChC;AAAA,QACF;AAAA,MACF;AAEA,MAAA,IAAI,YAAY,MAAA,EAAQ;AACtB,QAAA,OAAA,CAAQ,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,CAAC,CAAA;AAAA,MACpC;AAAA,IACF;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AAAA;AAGF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -358,6 +358,12 @@ type AddLocationRequest = {
|
|
|
358
358
|
* contain the entities that match the given location.
|
|
359
359
|
*/
|
|
360
360
|
dryRun?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Behavior when the location already exists. If set to `'reject'` (the
|
|
363
|
+
* default), a conflict error is returned. If set to `'refresh'`, the
|
|
364
|
+
* existing location entity is marked for refresh and a 201 is returned.
|
|
365
|
+
*/
|
|
366
|
+
onConflict?: 'refresh' | 'reject';
|
|
361
367
|
};
|
|
362
368
|
/**
|
|
363
369
|
* The response type for {@link CatalogApi.addLocation}.
|
|
@@ -290,10 +290,11 @@ class DefaultApiClient {
|
|
|
290
290
|
* Create a location for a given target.
|
|
291
291
|
* @param createLocationRequest -
|
|
292
292
|
* @param dryRun -
|
|
293
|
+
* @param onConflict - Behavior when the location already exists. \'reject\' (default) returns a 409 error, \'refresh\' triggers a refresh of the existing location entity and returns 201.
|
|
293
294
|
*/
|
|
294
295
|
async createLocation(request, options) {
|
|
295
296
|
const baseUrl = await this.discoveryApi.getBaseUrl(pluginId.pluginId);
|
|
296
|
-
const uriTemplate = `/locations{?dryRun}`;
|
|
297
|
+
const uriTemplate = `/locations{?dryRun,onConflict}`;
|
|
297
298
|
const uri = parser__namespace.parse(uriTemplate).expand({
|
|
298
299
|
...request.query
|
|
299
300
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.client.cjs.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\n\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model';\nimport { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model';\nimport { Entity } from '../models/Entity.model';\nimport { EntityAncestryResponse } from '../models/EntityAncestryResponse.model';\nimport { EntityFacetsResponse } from '../models/EntityFacetsResponse.model';\nimport { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model';\nimport { QueryEntitiesByPredicateRequest } from '../models/QueryEntitiesByPredicateRequest.model';\nimport { QueryEntityFacetsByPredicateRequest } from '../models/QueryEntityFacetsByPredicateRequest.model';\nimport { RefreshEntityRequest } from '../models/RefreshEntityRequest.model';\nimport { ValidateEntityRequest } from '../models/ValidateEntityRequest.model';\nimport { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model';\nimport { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model';\nimport { CreateLocation201Response } from '../models/CreateLocation201Response.model';\nimport { CreateLocationRequest } from '../models/CreateLocationRequest.model';\nimport { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model';\nimport { GetLocationsByQueryRequest } from '../models/GetLocationsByQueryRequest.model';\nimport { Location } from '../models/Location.model';\nimport { LocationsQueryResponse } from '../models/LocationsQueryResponse.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type DeleteEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntities = {\n query: {\n fields?: Array<string>;\n limit?: number;\n filter?: Array<string>;\n offset?: number;\n after?: string;\n order?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByQuery = {\n query: {\n fields?: Array<string>;\n limit?: number;\n offset?: number;\n orderField?: Array<string>;\n cursor?: string;\n filter?: Array<string>;\n fullTextFilterTerm?: string;\n fullTextFilterFields?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByRefs = {\n body: GetEntitiesByRefsRequest;\n query: {\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntityAncestryByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityFacets = {\n query: {\n facet: Array<string>;\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type QueryEntitiesByPredicate = {\n body: QueryEntitiesByPredicateRequest;\n};\n/**\n * @public\n */\nexport type QueryEntityFacetsByPredicate = {\n body: QueryEntityFacetsByPredicateRequest;\n};\n/**\n * @public\n */\nexport type RefreshEntity = {\n body: RefreshEntityRequest;\n};\n/**\n * @public\n */\nexport type ValidateEntity = {\n body: ValidateEntityRequest;\n};\n/**\n * @public\n */\nexport type AnalyzeLocation = {\n body: AnalyzeLocationRequest;\n};\n/**\n * @public\n */\nexport type CreateLocation = {\n body: CreateLocationRequest;\n query: {\n dryRun?: string;\n };\n};\n/**\n * @public\n */\nexport type DeleteLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocationByEntity = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocations = {};\n/**\n * @public\n */\nexport type GetLocationsByQuery = {\n body: GetLocationsByQueryRequest;\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Delete a single entity by UID.\n * @param uid -\n */\n public async deleteEntityByUid(\n // @ts-ignore\n request: DeleteEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get all entities matching a given filter.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param offset - Number of records to skip in the query page.\n * @param after - Pointer to the previous page of results.\n * @param order -\n */\n public async getEntities(\n // @ts-ignore\n request: GetEntities,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<Entity>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities{?fields,limit,filter*,offset,after,order*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Search for entities by a given query.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param offset - Number of records to skip in the query page.\n * @param orderField - By default the entities are returned ordered by their internal uid. You can customize the `orderField` query parameters to affect that ordering. For example, to return entities by their name: `/entities/by-query?orderField=metadata.name,asc` Each parameter can be followed by `asc` for ascending lexicographical order or `desc` for descending (reverse) lexicographical order.\n * @param cursor - You may pass the `cursor` query parameters to perform cursor based pagination through the set of entities. The value of `cursor` will be returned in the response, under the `pageInfo` property: ```json \\"pageInfo\\": { \\"nextCursor\\": \\"a-cursor\\", \\"prevCursor\\": \\"another-cursor\\" } ``` If `nextCursor` exists, it can be used to retrieve the next batch of entities. Following the same approach, if `prevCursor` exists, it can be used to retrieve the previous batch of entities. - [`filter`](#filtering), for selecting only a subset of all entities - [`fields`](#field-selection), for selecting only parts of the full data structure of each entity - `limit` for limiting the number of entities returned (20 is the default) - [`orderField`](#ordering), for deciding the order of the entities - `fullTextFilter` **NOTE**: [`filter`, `orderField`, `fullTextFilter`] and `cursor` are mutually exclusive. This means that, it isn\\'t possible to change any of [`filter`, `orderField`, `fullTextFilter`] when passing `cursor` as query parameters, as changing any of these properties will affect pagination. If any of `filter`, `orderField`, `fullTextFilter` is specified together with `cursor`, only the latter is taken into consideration.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param fullTextFilterTerm - Text search term.\n * @param fullTextFilterFields - A comma separated list of fields to sort returned results by.\n */\n public async getEntitiesByQuery(\n // @ts-ignore\n request: GetEntitiesByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query{?fields,limit,offset,orderField*,cursor,filter*,fullTextFilterTerm,fullTextFilterFields}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a batch set of entities given an array of entityRefs.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param getEntitiesByRefsRequest -\n */\n public async getEntitiesByRefs(\n // @ts-ignore\n request: GetEntitiesByRefs,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesBatchResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-refs{?filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get an entity\\'s ancestry by entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityAncestryByName(\n // @ts-ignore\n request: GetEntityAncestryByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityAncestryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}/ancestry`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get an entity by an entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityByName(\n // @ts-ignore\n request: GetEntityByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a single entity by the UID.\n * @param uid -\n */\n public async getEntityByUid(\n // @ts-ignore\n request: GetEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all entity facets that match the given filters.\n * @param facet -\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n */\n public async getEntityFacets(\n // @ts-ignore\n request: GetEntityFacets,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets{?facet*,filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query entities using predicate-based filters.\n * @param queryEntitiesByPredicateRequest -\n */\n public async queryEntitiesByPredicate(\n // @ts-ignore\n request: QueryEntitiesByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get entity facets using predicate-based filters.\n * @param queryEntityFacetsByPredicateRequest -\n */\n public async queryEntityFacetsByPredicate(\n // @ts-ignore\n request: QueryEntityFacetsByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Refresh the entity related to entityRef.\n * @param refreshEntityRequest -\n */\n public async refreshEntity(\n // @ts-ignore\n request: RefreshEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/refresh`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate that a passed in entity has no errors in schema.\n * @param validateEntityRequest -\n */\n public async validateEntity(\n // @ts-ignore\n request: ValidateEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/validate-entity`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate a given location.\n * @param analyzeLocationRequest -\n */\n public async analyzeLocation(\n // @ts-ignore\n request: AnalyzeLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<AnalyzeLocationResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/analyze-location`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Create a location for a given target.\n * @param createLocationRequest -\n * @param dryRun -\n */\n public async createLocation(\n // @ts-ignore\n request: CreateLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<CreateLocation201Response>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations{?dryRun}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Delete a location by id.\n * @param id -\n */\n public async deleteLocation(\n // @ts-ignore\n request: DeleteLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get a location by id.\n * @param id -\n */\n public async getLocation(\n // @ts-ignore\n request: GetLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a location for entity.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getLocationByEntity(\n // @ts-ignore\n request: GetLocationByEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-entity/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all locations\n */\n public async getLocations(\n // @ts-ignore\n request: GetLocations,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<GetLocations200ResponseInner>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query for locations\n * @param getLocationsByQueryRequest -\n */\n public async getLocationsByQuery(\n // @ts-ignore\n request: GetLocationsByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<LocationsQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n}\n"],"names":["crossFetch","pluginId","parser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8NO,MAAM,gBAAA,CAAiB;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA,CAAQ,QAAA,IAAY,EAAE,OAAOA,2BAAA,EAAW;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,iBAAA,CAEX,OAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAWC,iBAAQ,CAAA;AAE3D,IAAA,MAAM,WAAA,GAAc,CAAA,sBAAA,CAAA;AAEpB,IAAA,MAAM,GAAA,GAAMC,iBAAA,CAAO,KAAA,CAAM,WAAW,EAAE,MAAA,CAAO;AAAA,MAC3C,GAAA,EAAK,QAAQ,IAAA,CAAK;AAAA,KACnB,CAAA;AAED,IAAA,OAAO,MAAM,KAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI;AAAA,MACnD,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAA,IAAS,EAAE,eAAe,CAAA,OAAA,EAAU,OAAA,EAAS,KAAK,CAAA,CAAA;AAAG,OACpE;AAAA,MACA,MAAA,EAAQ;AAAA,KACT,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,WAAA,CAEX,OAAA,EACA,OAAA,EACuC;AACvC,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAWD,iBAAQ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,eAAe,CAAA,OAAA,EAAU,OAAA,EAAS,KAAK,CAAA,CAAA;AAAG,OACpE;AAAA,MACA,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,IAAI;AAAA,KAClC,CAAA;AAAA,EACH;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Api.client.cjs.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\n\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model';\nimport { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model';\nimport { Entity } from '../models/Entity.model';\nimport { EntityAncestryResponse } from '../models/EntityAncestryResponse.model';\nimport { EntityFacetsResponse } from '../models/EntityFacetsResponse.model';\nimport { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model';\nimport { QueryEntitiesByPredicateRequest } from '../models/QueryEntitiesByPredicateRequest.model';\nimport { QueryEntityFacetsByPredicateRequest } from '../models/QueryEntityFacetsByPredicateRequest.model';\nimport { RefreshEntityRequest } from '../models/RefreshEntityRequest.model';\nimport { ValidateEntityRequest } from '../models/ValidateEntityRequest.model';\nimport { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model';\nimport { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model';\nimport { CreateLocation201Response } from '../models/CreateLocation201Response.model';\nimport { CreateLocationRequest } from '../models/CreateLocationRequest.model';\nimport { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model';\nimport { GetLocationsByQueryRequest } from '../models/GetLocationsByQueryRequest.model';\nimport { Location } from '../models/Location.model';\nimport { LocationsQueryResponse } from '../models/LocationsQueryResponse.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type DeleteEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntities = {\n query: {\n fields?: Array<string>;\n limit?: number;\n filter?: Array<string>;\n offset?: number;\n after?: string;\n order?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByQuery = {\n query: {\n fields?: Array<string>;\n limit?: number;\n offset?: number;\n orderField?: Array<string>;\n cursor?: string;\n filter?: Array<string>;\n fullTextFilterTerm?: string;\n fullTextFilterFields?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByRefs = {\n body: GetEntitiesByRefsRequest;\n query: {\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntityAncestryByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityFacets = {\n query: {\n facet: Array<string>;\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type QueryEntitiesByPredicate = {\n body: QueryEntitiesByPredicateRequest;\n};\n/**\n * @public\n */\nexport type QueryEntityFacetsByPredicate = {\n body: QueryEntityFacetsByPredicateRequest;\n};\n/**\n * @public\n */\nexport type RefreshEntity = {\n body: RefreshEntityRequest;\n};\n/**\n * @public\n */\nexport type ValidateEntity = {\n body: ValidateEntityRequest;\n};\n/**\n * @public\n */\nexport type AnalyzeLocation = {\n body: AnalyzeLocationRequest;\n};\n/**\n * @public\n */\nexport type CreateLocation = {\n body: CreateLocationRequest;\n query: {\n dryRun?: string;\n onConflict?: 'refresh' | 'reject';\n };\n};\n/**\n * @public\n */\nexport type DeleteLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocationByEntity = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocations = {};\n/**\n * @public\n */\nexport type GetLocationsByQuery = {\n body: GetLocationsByQueryRequest;\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Delete a single entity by UID.\n * @param uid -\n */\n public async deleteEntityByUid(\n // @ts-ignore\n request: DeleteEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get all entities matching a given filter.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param offset - Number of records to skip in the query page.\n * @param after - Pointer to the previous page of results.\n * @param order -\n */\n public async getEntities(\n // @ts-ignore\n request: GetEntities,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<Entity>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities{?fields,limit,filter*,offset,after,order*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Search for entities by a given query.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param offset - Number of records to skip in the query page.\n * @param orderField - By default the entities are returned ordered by their internal uid. You can customize the `orderField` query parameters to affect that ordering. For example, to return entities by their name: `/entities/by-query?orderField=metadata.name,asc` Each parameter can be followed by `asc` for ascending lexicographical order or `desc` for descending (reverse) lexicographical order.\n * @param cursor - You may pass the `cursor` query parameters to perform cursor based pagination through the set of entities. The value of `cursor` will be returned in the response, under the `pageInfo` property: ```json \\"pageInfo\\": { \\"nextCursor\\": \\"a-cursor\\", \\"prevCursor\\": \\"another-cursor\\" } ``` If `nextCursor` exists, it can be used to retrieve the next batch of entities. Following the same approach, if `prevCursor` exists, it can be used to retrieve the previous batch of entities. - [`filter`](#filtering), for selecting only a subset of all entities - [`fields`](#field-selection), for selecting only parts of the full data structure of each entity - `limit` for limiting the number of entities returned (20 is the default) - [`orderField`](#ordering), for deciding the order of the entities - `fullTextFilter` **NOTE**: [`filter`, `orderField`, `fullTextFilter`] and `cursor` are mutually exclusive. This means that, it isn\\'t possible to change any of [`filter`, `orderField`, `fullTextFilter`] when passing `cursor` as query parameters, as changing any of these properties will affect pagination. If any of `filter`, `orderField`, `fullTextFilter` is specified together with `cursor`, only the latter is taken into consideration.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param fullTextFilterTerm - Text search term.\n * @param fullTextFilterFields - A comma separated list of fields to sort returned results by.\n */\n public async getEntitiesByQuery(\n // @ts-ignore\n request: GetEntitiesByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query{?fields,limit,offset,orderField*,cursor,filter*,fullTextFilterTerm,fullTextFilterFields}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a batch set of entities given an array of entityRefs.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param getEntitiesByRefsRequest -\n */\n public async getEntitiesByRefs(\n // @ts-ignore\n request: GetEntitiesByRefs,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesBatchResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-refs{?filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get an entity\\'s ancestry by entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityAncestryByName(\n // @ts-ignore\n request: GetEntityAncestryByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityAncestryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}/ancestry`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get an entity by an entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityByName(\n // @ts-ignore\n request: GetEntityByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a single entity by the UID.\n * @param uid -\n */\n public async getEntityByUid(\n // @ts-ignore\n request: GetEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all entity facets that match the given filters.\n * @param facet -\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n */\n public async getEntityFacets(\n // @ts-ignore\n request: GetEntityFacets,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets{?facet*,filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query entities using predicate-based filters.\n * @param queryEntitiesByPredicateRequest -\n */\n public async queryEntitiesByPredicate(\n // @ts-ignore\n request: QueryEntitiesByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get entity facets using predicate-based filters.\n * @param queryEntityFacetsByPredicateRequest -\n */\n public async queryEntityFacetsByPredicate(\n // @ts-ignore\n request: QueryEntityFacetsByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Refresh the entity related to entityRef.\n * @param refreshEntityRequest -\n */\n public async refreshEntity(\n // @ts-ignore\n request: RefreshEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/refresh`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate that a passed in entity has no errors in schema.\n * @param validateEntityRequest -\n */\n public async validateEntity(\n // @ts-ignore\n request: ValidateEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/validate-entity`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate a given location.\n * @param analyzeLocationRequest -\n */\n public async analyzeLocation(\n // @ts-ignore\n request: AnalyzeLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<AnalyzeLocationResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/analyze-location`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Create a location for a given target.\n * @param createLocationRequest -\n * @param dryRun -\n * @param onConflict - Behavior when the location already exists. \\'reject\\' (default) returns a 409 error, \\'refresh\\' triggers a refresh of the existing location entity and returns 201.\n */\n public async createLocation(\n // @ts-ignore\n request: CreateLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<CreateLocation201Response>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations{?dryRun,onConflict}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Delete a location by id.\n * @param id -\n */\n public async deleteLocation(\n // @ts-ignore\n request: DeleteLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get a location by id.\n * @param id -\n */\n public async getLocation(\n // @ts-ignore\n request: GetLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a location for entity.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getLocationByEntity(\n // @ts-ignore\n request: GetLocationByEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-entity/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all locations\n */\n public async getLocations(\n // @ts-ignore\n request: GetLocations,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<GetLocations200ResponseInner>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query for locations\n * @param getLocationsByQueryRequest -\n */\n public async getLocationsByQuery(\n // @ts-ignore\n request: GetLocationsByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<LocationsQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n}\n"],"names":["crossFetch","pluginId","parser"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+NO,MAAM,gBAAA,CAAiB;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA,CAAQ,QAAA,IAAY,EAAE,OAAOA,2BAAA,EAAW;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,iBAAA,CAEX,OAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAWC,iBAAQ,CAAA;AAE3D,IAAA,MAAM,WAAA,GAAc,CAAA,sBAAA,CAAA;AAEpB,IAAA,MAAM,GAAA,GAAMC,iBAAA,CAAO,KAAA,CAAM,WAAW,EAAE,MAAA,CAAO;AAAA,MAC3C,GAAA,EAAK,QAAQ,IAAA,CAAK;AAAA,KACnB,CAAA;AAED,IAAA,OAAO,MAAM,KAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI;AAAA,MACnD,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAA,IAAS,EAAE,eAAe,CAAA,OAAA,EAAU,OAAA,EAAS,KAAK,CAAA,CAAA;AAAG,OACpE;AAAA,MACA,MAAA,EAAQ;AAAA,KACT,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,WAAA,CAEX,OAAA,EACA,OAAA,EACuC;AACvC,IAAA,MAAM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,cAAA,EAAgB,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAA,IAAS,EAAE,eAAe,CAAA,OAAA,EAAU,OAAA,EAAS,KAAK,CAAA,CAAA;AAAG,OACpE;AAAA,MACA,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,IAAI;AAAA,KAClC,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -265,10 +265,11 @@ class DefaultApiClient {
|
|
|
265
265
|
* Create a location for a given target.
|
|
266
266
|
* @param createLocationRequest -
|
|
267
267
|
* @param dryRun -
|
|
268
|
+
* @param onConflict - Behavior when the location already exists. \'reject\' (default) returns a 409 error, \'refresh\' triggers a refresh of the existing location entity and returns 201.
|
|
268
269
|
*/
|
|
269
270
|
async createLocation(request, options) {
|
|
270
271
|
const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);
|
|
271
|
-
const uriTemplate = `/locations{?dryRun}`;
|
|
272
|
+
const uriTemplate = `/locations{?dryRun,onConflict}`;
|
|
272
273
|
const uri = parser.parse(uriTemplate).expand({
|
|
273
274
|
...request.query
|
|
274
275
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.client.esm.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\n\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model';\nimport { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model';\nimport { Entity } from '../models/Entity.model';\nimport { EntityAncestryResponse } from '../models/EntityAncestryResponse.model';\nimport { EntityFacetsResponse } from '../models/EntityFacetsResponse.model';\nimport { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model';\nimport { QueryEntitiesByPredicateRequest } from '../models/QueryEntitiesByPredicateRequest.model';\nimport { QueryEntityFacetsByPredicateRequest } from '../models/QueryEntityFacetsByPredicateRequest.model';\nimport { RefreshEntityRequest } from '../models/RefreshEntityRequest.model';\nimport { ValidateEntityRequest } from '../models/ValidateEntityRequest.model';\nimport { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model';\nimport { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model';\nimport { CreateLocation201Response } from '../models/CreateLocation201Response.model';\nimport { CreateLocationRequest } from '../models/CreateLocationRequest.model';\nimport { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model';\nimport { GetLocationsByQueryRequest } from '../models/GetLocationsByQueryRequest.model';\nimport { Location } from '../models/Location.model';\nimport { LocationsQueryResponse } from '../models/LocationsQueryResponse.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type DeleteEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntities = {\n query: {\n fields?: Array<string>;\n limit?: number;\n filter?: Array<string>;\n offset?: number;\n after?: string;\n order?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByQuery = {\n query: {\n fields?: Array<string>;\n limit?: number;\n offset?: number;\n orderField?: Array<string>;\n cursor?: string;\n filter?: Array<string>;\n fullTextFilterTerm?: string;\n fullTextFilterFields?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByRefs = {\n body: GetEntitiesByRefsRequest;\n query: {\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntityAncestryByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityFacets = {\n query: {\n facet: Array<string>;\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type QueryEntitiesByPredicate = {\n body: QueryEntitiesByPredicateRequest;\n};\n/**\n * @public\n */\nexport type QueryEntityFacetsByPredicate = {\n body: QueryEntityFacetsByPredicateRequest;\n};\n/**\n * @public\n */\nexport type RefreshEntity = {\n body: RefreshEntityRequest;\n};\n/**\n * @public\n */\nexport type ValidateEntity = {\n body: ValidateEntityRequest;\n};\n/**\n * @public\n */\nexport type AnalyzeLocation = {\n body: AnalyzeLocationRequest;\n};\n/**\n * @public\n */\nexport type CreateLocation = {\n body: CreateLocationRequest;\n query: {\n dryRun?: string;\n };\n};\n/**\n * @public\n */\nexport type DeleteLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocationByEntity = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocations = {};\n/**\n * @public\n */\nexport type GetLocationsByQuery = {\n body: GetLocationsByQueryRequest;\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Delete a single entity by UID.\n * @param uid -\n */\n public async deleteEntityByUid(\n // @ts-ignore\n request: DeleteEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get all entities matching a given filter.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param offset - Number of records to skip in the query page.\n * @param after - Pointer to the previous page of results.\n * @param order -\n */\n public async getEntities(\n // @ts-ignore\n request: GetEntities,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<Entity>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities{?fields,limit,filter*,offset,after,order*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Search for entities by a given query.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param offset - Number of records to skip in the query page.\n * @param orderField - By default the entities are returned ordered by their internal uid. You can customize the `orderField` query parameters to affect that ordering. For example, to return entities by their name: `/entities/by-query?orderField=metadata.name,asc` Each parameter can be followed by `asc` for ascending lexicographical order or `desc` for descending (reverse) lexicographical order.\n * @param cursor - You may pass the `cursor` query parameters to perform cursor based pagination through the set of entities. The value of `cursor` will be returned in the response, under the `pageInfo` property: ```json \\"pageInfo\\": { \\"nextCursor\\": \\"a-cursor\\", \\"prevCursor\\": \\"another-cursor\\" } ``` If `nextCursor` exists, it can be used to retrieve the next batch of entities. Following the same approach, if `prevCursor` exists, it can be used to retrieve the previous batch of entities. - [`filter`](#filtering), for selecting only a subset of all entities - [`fields`](#field-selection), for selecting only parts of the full data structure of each entity - `limit` for limiting the number of entities returned (20 is the default) - [`orderField`](#ordering), for deciding the order of the entities - `fullTextFilter` **NOTE**: [`filter`, `orderField`, `fullTextFilter`] and `cursor` are mutually exclusive. This means that, it isn\\'t possible to change any of [`filter`, `orderField`, `fullTextFilter`] when passing `cursor` as query parameters, as changing any of these properties will affect pagination. If any of `filter`, `orderField`, `fullTextFilter` is specified together with `cursor`, only the latter is taken into consideration.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param fullTextFilterTerm - Text search term.\n * @param fullTextFilterFields - A comma separated list of fields to sort returned results by.\n */\n public async getEntitiesByQuery(\n // @ts-ignore\n request: GetEntitiesByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query{?fields,limit,offset,orderField*,cursor,filter*,fullTextFilterTerm,fullTextFilterFields}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a batch set of entities given an array of entityRefs.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param getEntitiesByRefsRequest -\n */\n public async getEntitiesByRefs(\n // @ts-ignore\n request: GetEntitiesByRefs,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesBatchResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-refs{?filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get an entity\\'s ancestry by entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityAncestryByName(\n // @ts-ignore\n request: GetEntityAncestryByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityAncestryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}/ancestry`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get an entity by an entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityByName(\n // @ts-ignore\n request: GetEntityByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a single entity by the UID.\n * @param uid -\n */\n public async getEntityByUid(\n // @ts-ignore\n request: GetEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all entity facets that match the given filters.\n * @param facet -\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n */\n public async getEntityFacets(\n // @ts-ignore\n request: GetEntityFacets,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets{?facet*,filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query entities using predicate-based filters.\n * @param queryEntitiesByPredicateRequest -\n */\n public async queryEntitiesByPredicate(\n // @ts-ignore\n request: QueryEntitiesByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get entity facets using predicate-based filters.\n * @param queryEntityFacetsByPredicateRequest -\n */\n public async queryEntityFacetsByPredicate(\n // @ts-ignore\n request: QueryEntityFacetsByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Refresh the entity related to entityRef.\n * @param refreshEntityRequest -\n */\n public async refreshEntity(\n // @ts-ignore\n request: RefreshEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/refresh`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate that a passed in entity has no errors in schema.\n * @param validateEntityRequest -\n */\n public async validateEntity(\n // @ts-ignore\n request: ValidateEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/validate-entity`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate a given location.\n * @param analyzeLocationRequest -\n */\n public async analyzeLocation(\n // @ts-ignore\n request: AnalyzeLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<AnalyzeLocationResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/analyze-location`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Create a location for a given target.\n * @param createLocationRequest -\n * @param dryRun -\n */\n public async createLocation(\n // @ts-ignore\n request: CreateLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<CreateLocation201Response>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations{?dryRun}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Delete a location by id.\n * @param id -\n */\n public async deleteLocation(\n // @ts-ignore\n request: DeleteLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get a location by id.\n * @param id -\n */\n public async getLocation(\n // @ts-ignore\n request: GetLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a location for entity.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getLocationByEntity(\n // @ts-ignore\n request: GetLocationByEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-entity/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all locations\n */\n public async getLocations(\n // @ts-ignore\n request: GetLocations,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<GetLocations200ResponseInner>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query for locations\n * @param getLocationsByQueryRequest -\n */\n public async getLocationsByQuery(\n // @ts-ignore\n request: GetLocationsByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<LocationsQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n}\n"],"names":[],"mappings":";;;;AA8NO,MAAM,gBAAA,CAAiB;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA,CAAQ,QAAA,IAAY,EAAE,OAAO,UAAA,EAAW;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,iBAAA,CAEX,OAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,QAAQ,CAAA;AAE3D,IAAA,MAAM,WAAA,GAAc,CAAA,sBAAA,CAAA;AAEpB,IAAA,MAAM,GAAA,GAAM,MAAA,CAAO,KAAA,CAAM,WAAW,EAAE,MAAA,CAAO;AAAA,MAC3C,GAAA,EAAK,QAAQ,IAAA,CAAK;AAAA,KACnB,CAAA;AAED,IAAA,OAAO,MAAM,KAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,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AAA,MAAM,WAAA,GAAc,CAAA,mBAAA,CAAA;AAEpB,IAAA,MAAM,MAAM,MAAA,CAAO,KAAA,CAAM,WAAW,CAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAE/C,IAAA,OAAO,MAAM,KAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI;AAAA,MACnD,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAA,IAAS,EAAE,eAAe,CAAA,OAAA,EAAU,OAAA,EAAS,KAAK,CAAA,CAAA;AAAG,OACpE;AAAA,MACA,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,IAAI;AAAA,KAClC,CAAA;AAAA,EACH;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Api.client.esm.js","sources":["../../../../../src/schema/openapi/generated/apis/Api.client.ts"],"sourcesContent":["/*\n * Copyright 2026 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\n\nimport { DiscoveryApi } from '../types/discovery';\nimport { FetchApi } from '../types/fetch';\nimport crossFetch from 'cross-fetch';\nimport { pluginId } from '../pluginId';\nimport * as parser from 'uri-template';\nimport { EntitiesBatchResponse } from '../models/EntitiesBatchResponse.model';\nimport { EntitiesQueryResponse } from '../models/EntitiesQueryResponse.model';\nimport { Entity } from '../models/Entity.model';\nimport { EntityAncestryResponse } from '../models/EntityAncestryResponse.model';\nimport { EntityFacetsResponse } from '../models/EntityFacetsResponse.model';\nimport { GetEntitiesByRefsRequest } from '../models/GetEntitiesByRefsRequest.model';\nimport { QueryEntitiesByPredicateRequest } from '../models/QueryEntitiesByPredicateRequest.model';\nimport { QueryEntityFacetsByPredicateRequest } from '../models/QueryEntityFacetsByPredicateRequest.model';\nimport { RefreshEntityRequest } from '../models/RefreshEntityRequest.model';\nimport { ValidateEntityRequest } from '../models/ValidateEntityRequest.model';\nimport { AnalyzeLocationRequest } from '../models/AnalyzeLocationRequest.model';\nimport { AnalyzeLocationResponse } from '../models/AnalyzeLocationResponse.model';\nimport { CreateLocation201Response } from '../models/CreateLocation201Response.model';\nimport { CreateLocationRequest } from '../models/CreateLocationRequest.model';\nimport { GetLocations200ResponseInner } from '../models/GetLocations200ResponseInner.model';\nimport { GetLocationsByQueryRequest } from '../models/GetLocationsByQueryRequest.model';\nimport { Location } from '../models/Location.model';\nimport { LocationsQueryResponse } from '../models/LocationsQueryResponse.model';\n\n/**\n * Wraps the Response type to convey a type on the json call.\n *\n * @public\n */\nexport type TypedResponse<T> = Omit<Response, 'json'> & {\n json: () => Promise<T>;\n};\n\n/**\n * Options you can pass into a request for additional information.\n *\n * @public\n */\nexport interface RequestOptions {\n token?: string;\n}\n/**\n * @public\n */\nexport type DeleteEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntities = {\n query: {\n fields?: Array<string>;\n limit?: number;\n filter?: Array<string>;\n offset?: number;\n after?: string;\n order?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByQuery = {\n query: {\n fields?: Array<string>;\n limit?: number;\n offset?: number;\n orderField?: Array<string>;\n cursor?: string;\n filter?: Array<string>;\n fullTextFilterTerm?: string;\n fullTextFilterFields?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntitiesByRefs = {\n body: GetEntitiesByRefsRequest;\n query: {\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type GetEntityAncestryByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByName = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityByUid = {\n path: {\n uid: string;\n };\n};\n/**\n * @public\n */\nexport type GetEntityFacets = {\n query: {\n facet: Array<string>;\n filter?: Array<string>;\n };\n};\n/**\n * @public\n */\nexport type QueryEntitiesByPredicate = {\n body: QueryEntitiesByPredicateRequest;\n};\n/**\n * @public\n */\nexport type QueryEntityFacetsByPredicate = {\n body: QueryEntityFacetsByPredicateRequest;\n};\n/**\n * @public\n */\nexport type RefreshEntity = {\n body: RefreshEntityRequest;\n};\n/**\n * @public\n */\nexport type ValidateEntity = {\n body: ValidateEntityRequest;\n};\n/**\n * @public\n */\nexport type AnalyzeLocation = {\n body: AnalyzeLocationRequest;\n};\n/**\n * @public\n */\nexport type CreateLocation = {\n body: CreateLocationRequest;\n query: {\n dryRun?: string;\n onConflict?: 'refresh' | 'reject';\n };\n};\n/**\n * @public\n */\nexport type DeleteLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocation = {\n path: {\n id: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocationByEntity = {\n path: {\n kind: string;\n namespace: string;\n name: string;\n };\n};\n/**\n * @public\n */\nexport type GetLocations = {};\n/**\n * @public\n */\nexport type GetLocationsByQuery = {\n body: GetLocationsByQueryRequest;\n};\n\n/**\n * @public\n */\nexport class DefaultApiClient {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n constructor(options: {\n discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };\n fetchApi?: { fetch: typeof fetch };\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi || { fetch: crossFetch };\n }\n\n /**\n * Delete a single entity by UID.\n * @param uid -\n */\n public async deleteEntityByUid(\n // @ts-ignore\n request: DeleteEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get all entities matching a given filter.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param offset - Number of records to skip in the query page.\n * @param after - Pointer to the previous page of results.\n * @param order -\n */\n public async getEntities(\n // @ts-ignore\n request: GetEntities,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<Entity>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities{?fields,limit,filter*,offset,after,order*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Search for entities by a given query.\n * @param fields - By default the full entities are returned, but you can pass in a `fields` query parameter which selects what parts of the entity data to retain. This makes the response smaller and faster to transfer, and may allow the catalog to perform more efficient queries. The query parameter value is a comma separated list of simplified JSON paths like above. Each path corresponds to the key of either a value, or of a subtree root that you want to keep in the output. The rest is pruned away. For example, specifying `?fields=metadata.name,metadata.annotations,spec` retains only the `name` and `annotations` fields of the `metadata` of each entity (it\\'ll be an object with at most two keys), keeps the entire `spec` unchanged, and cuts out all other roots such as `relations`. Some more real world usable examples: - Return only enough data to form the full ref of each entity: `/entities/by-query?fields=kind,metadata.namespace,metadata.name`\n * @param limit - Number of records to return in the response.\n * @param offset - Number of records to skip in the query page.\n * @param orderField - By default the entities are returned ordered by their internal uid. You can customize the `orderField` query parameters to affect that ordering. For example, to return entities by their name: `/entities/by-query?orderField=metadata.name,asc` Each parameter can be followed by `asc` for ascending lexicographical order or `desc` for descending (reverse) lexicographical order.\n * @param cursor - You may pass the `cursor` query parameters to perform cursor based pagination through the set of entities. The value of `cursor` will be returned in the response, under the `pageInfo` property: ```json \\"pageInfo\\": { \\"nextCursor\\": \\"a-cursor\\", \\"prevCursor\\": \\"another-cursor\\" } ``` If `nextCursor` exists, it can be used to retrieve the next batch of entities. Following the same approach, if `prevCursor` exists, it can be used to retrieve the previous batch of entities. - [`filter`](#filtering), for selecting only a subset of all entities - [`fields`](#field-selection), for selecting only parts of the full data structure of each entity - `limit` for limiting the number of entities returned (20 is the default) - [`orderField`](#ordering), for deciding the order of the entities - `fullTextFilter` **NOTE**: [`filter`, `orderField`, `fullTextFilter`] and `cursor` are mutually exclusive. This means that, it isn\\'t possible to change any of [`filter`, `orderField`, `fullTextFilter`] when passing `cursor` as query parameters, as changing any of these properties will affect pagination. If any of `filter`, `orderField`, `fullTextFilter` is specified together with `cursor`, only the latter is taken into consideration.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param fullTextFilterTerm - Text search term.\n * @param fullTextFilterFields - A comma separated list of fields to sort returned results by.\n */\n public async getEntitiesByQuery(\n // @ts-ignore\n request: GetEntitiesByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query{?fields,limit,offset,orderField*,cursor,filter*,fullTextFilterTerm,fullTextFilterFields}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a batch set of entities given an array of entityRefs.\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n * @param getEntitiesByRefsRequest -\n */\n public async getEntitiesByRefs(\n // @ts-ignore\n request: GetEntitiesByRefs,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesBatchResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-refs{?filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get an entity\\'s ancestry by entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityAncestryByName(\n // @ts-ignore\n request: GetEntityAncestryByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityAncestryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}/ancestry`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get an entity by an entity ref.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getEntityByName(\n // @ts-ignore\n request: GetEntityByName,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-name/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a single entity by the UID.\n * @param uid -\n */\n public async getEntityByUid(\n // @ts-ignore\n request: GetEntityByUid,\n options?: RequestOptions,\n ): Promise<TypedResponse<Entity>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-uid/{uid}`;\n\n const uri = parser.parse(uriTemplate).expand({\n uid: request.path.uid,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all entity facets that match the given filters.\n * @param facet -\n * @param filter - You can pass in one or more filter sets that get matched against each entity. Each filter set is a number of conditions that all have to match for the condition to be true (conditions effectively have an AND between them). At least one filter set has to be true for the entity to be part of the result set (filter sets effectively have an OR between them). Example: ```text /entities/by-query?filter=kind=user,metadata.namespace=default&filter=kind=group,spec.type Return entities that match Filter set 1: Condition 1: kind = user AND Condition 2: metadata.namespace = default OR Filter set 2: Condition 1: kind = group AND Condition 2: spec.type exists ``` Each condition is either on the form `<key>`, or on the form `<key>=<value>`. The first form asserts on the existence of a certain key (with any value), and the second asserts that the key exists and has a certain value. All checks are always case _insensitive_. In all cases, the key is a simplified JSON path in a given piece of entity data. Each part of the path is a key of an object, and the traversal also descends through arrays. There are two special forms: - Array items that are simple value types (such as strings) match on a key-value pair where the key is the item as a string, and the value is the string `true` - Relations can be matched on a `relations.<type>=<targetRef>` form Let\\'s look at a simplified example to illustrate the concept: ```json { \\"a\\": { \\"b\\": [\\"c\\", { \\"d\\": 1 }], \\"e\\": 7 } } ``` This would match any one of the following conditions: - `a` - `a.b` - `a.b.c` - `a.b.c=true` - `a.b.d` - `a.b.d=1` - `a.e` - `a.e=7` Some more real world usable examples: - Return all orphaned entities: `/entities/by-query?filter=metadata.annotations.backstage.io/orphan=true` - Return all users and groups: `/entities/by-query?filter=kind=user&filter=kind=group` - Return all service components: `/entities/by-query?filter=kind=component,spec.type=service` - Return all entities with the `java` tag: `/entities/by-query?filter=metadata.tags.java` - Return all users who are members of the `ops` group (note that the full [reference](references.md) of the group is used): `/entities/by-query?filter=kind=user,relations.memberof=group:default/ops`\n */\n public async getEntityFacets(\n // @ts-ignore\n request: GetEntityFacets,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets{?facet*,filter*}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query entities using predicate-based filters.\n * @param queryEntitiesByPredicateRequest -\n */\n public async queryEntitiesByPredicate(\n // @ts-ignore\n request: QueryEntitiesByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntitiesQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entities/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Get entity facets using predicate-based filters.\n * @param queryEntityFacetsByPredicateRequest -\n */\n public async queryEntityFacetsByPredicate(\n // @ts-ignore\n request: QueryEntityFacetsByPredicate,\n options?: RequestOptions,\n ): Promise<TypedResponse<EntityFacetsResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/entity-facets`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Refresh the entity related to entityRef.\n * @param refreshEntityRequest -\n */\n public async refreshEntity(\n // @ts-ignore\n request: RefreshEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/refresh`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate that a passed in entity has no errors in schema.\n * @param validateEntityRequest -\n */\n public async validateEntity(\n // @ts-ignore\n request: ValidateEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/validate-entity`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Validate a given location.\n * @param analyzeLocationRequest -\n */\n public async analyzeLocation(\n // @ts-ignore\n request: AnalyzeLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<AnalyzeLocationResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/analyze-location`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Create a location for a given target.\n * @param createLocationRequest -\n * @param dryRun -\n * @param onConflict - Behavior when the location already exists. \\'reject\\' (default) returns a 409 error, \\'refresh\\' triggers a refresh of the existing location entity and returns 201.\n */\n public async createLocation(\n // @ts-ignore\n request: CreateLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<CreateLocation201Response>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations{?dryRun,onConflict}`;\n\n const uri = parser.parse(uriTemplate).expand({\n ...request.query,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n\n /**\n * Delete a location by id.\n * @param id -\n */\n public async deleteLocation(\n // @ts-ignore\n request: DeleteLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<void>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'DELETE',\n });\n }\n\n /**\n * Get a location by id.\n * @param id -\n */\n public async getLocation(\n // @ts-ignore\n request: GetLocation,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/{id}`;\n\n const uri = parser.parse(uriTemplate).expand({\n id: request.path.id,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get a location for entity.\n * @param kind -\n * @param namespace -\n * @param name -\n */\n public async getLocationByEntity(\n // @ts-ignore\n request: GetLocationByEntity,\n options?: RequestOptions,\n ): Promise<TypedResponse<Location>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-entity/{kind}/{namespace}/{name}`;\n\n const uri = parser.parse(uriTemplate).expand({\n kind: request.path.kind,\n namespace: request.path.namespace,\n name: request.path.name,\n });\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Get all locations\n */\n public async getLocations(\n // @ts-ignore\n request: GetLocations,\n options?: RequestOptions,\n ): Promise<TypedResponse<Array<GetLocations200ResponseInner>>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'GET',\n });\n }\n\n /**\n * Query for locations\n * @param getLocationsByQueryRequest -\n */\n public async getLocationsByQuery(\n // @ts-ignore\n request: GetLocationsByQuery,\n options?: RequestOptions,\n ): Promise<TypedResponse<LocationsQueryResponse>> {\n const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);\n\n const uriTemplate = `/locations/by-query`;\n\n const uri = parser.parse(uriTemplate).expand({});\n\n return await this.fetchApi.fetch(`${baseUrl}${uri}`, {\n headers: {\n 'Content-Type': 'application/json',\n ...(options?.token && { Authorization: `Bearer ${options?.token}` }),\n },\n method: 'POST',\n body: JSON.stringify(request.body),\n });\n }\n}\n"],"names":[],"mappings":";;;;AA+NO,MAAM,gBAAA,CAAiB;AAAA,EACX,YAAA;AAAA,EACA,QAAA;AAAA,EAEjB,YAAY,OAAA,EAGT;AACD,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA,CAAQ,QAAA,IAAY,EAAE,OAAO,UAAA,EAAW;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAa,iBAAA,CAEX,OAAA,EACA,OAAA,EAC8B;AAC9B,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,QAAQ,CAAA;AAE3D,IAAA,MAAM,WAAA,GAAc,CAAA,sBAAA,CAAA;AAEpB,IAAA,MAAM,GAAA,GAAM,MAAA,CAAO,KAAA,CAAM,WAAW,EAAE,MAAA,CAAO;AAAA,MAC3C,GAAA,EAAK,QAAQ,IAAA,CAAK;AAAA,KACnB,CAAA;AAED,IAAA,OAAO,MAAM,KAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI;AAAA,MACnD,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,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KAAA,CAAM,WAAW,CAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAE/C,IAAA,OAAO,MAAM,KAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI;AAAA,MACnD,OAAA,EAAS;AAAA,QACP,cAAA,EAAgB,kBAAA;AAAA,QAChB,GAAI,SAAS,KAAA,IAAS,EAAE,eAAe,CAAA,OAAA,EAAU,OAAA,EAAS,KAAK,CAAA,CAAA;AAAG,OACpE;AAAA,MACA,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,IAAI;AAAA,KAClC,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs.js","sources":["../../src/types/api.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport type { SerializedError } from '@backstage/errors';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport type { FilterPredicate } from '@backstage/filter-predicates';\n\n/**\n * This symbol can be used in place of a value when passed to filters in e.g.\n * {@link CatalogApi.getEntities}, to signify that you want to filter on the\n * presence of that key no matter what its value is.\n *\n * @public\n */\nexport const CATALOG_FILTER_EXISTS = Symbol.for(\n // Random UUID to ensure no collisions\n 'CATALOG_FILTER_EXISTS_0e15b590c0b343a2bae3e787e84c2111',\n);\n\n/**\n * A key-value based filter expression for entities.\n *\n * @remarks\n *\n * Each key of a record is a dot-separated path into the entity structure, e.g.\n * `metadata.name`.\n *\n * The values are literal values to match against. As a value you can also pass\n * in the symbol `CATALOG_FILTER_EXISTS` (exported from this package), which\n * means that you assert on the existence of that key, no matter what its value\n * is.\n *\n * All matching of keys and values is case insensitive.\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * @public\n */\nexport type EntityFilterQuery =\n | Record<string, string | symbol | (string | symbol)[]>[]\n | Record<string, string | symbol | (string | symbol)[]>;\n\n/**\n * A set of dot-separated paths into an entity's keys, showing what parts of an\n * entity to include in a response, and excluding all others.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations']`, then response\n * objects will be shaped like\n *\n * ```\n * {\n * \"kind\": \"Component\",\n * \"metadata\": {\n * \"annotations\": {\n * \"foo\": \"bar\"\n * }\n * }\n * }\n * ```\n * @public\n */\nexport type EntityFieldsQuery = string[];\n\n/**\n * Dot-separated field based ordering directives, controlling the sort order of\n * the output entities.\n *\n * @remarks\n *\n * Each field is a dot-separated path into an entity's keys. The order is either\n * ascending (`asc`, lexicographical order) or descending (`desc`, reverse\n * lexicographical order). The ordering is case insensitive.\n *\n * If more than one order directive is given, later directives have lower\n * precedence (they are applied only when directives of higher precedence have\n * equal values).\n *\n * Example:\n *\n * ```\n * [\n * { field: 'kind', order: 'asc' },\n * { field: 'metadata.name', order: 'desc' },\n * ]\n * ```\n *\n * This will order the output first by kind ascending, and then within each kind\n * (if there's more than one of a given kind) by their name descending.\n *\n * When given a field that does NOT exist on all entities in the result set,\n * those entities that do not have the field will always be sorted last in that\n * particular order step, no matter what the desired order was.\n *\n * @public\n */\nexport type EntityOrderQuery =\n | {\n field: string;\n order: 'asc' | 'desc';\n }\n | Array<{\n field: string;\n order: 'asc' | 'desc';\n }>;\n\n/**\n * The request type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesRequest {\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery;\n /**\n *If given, order the result set by those directives.\n */\n order?: EntityOrderQuery;\n /**\n * If given, skips over the first N items in the result set.\n */\n offset?: number;\n /**\n * If given, returns at most N items from the result set.\n */\n limit?: number;\n /**\n * If given, skips over all items before that cursor as returned by a previous\n * request.\n */\n after?: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesResponse {\n items: Entity[];\n}\n\n/**\n * The request type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsRequest {\n /**\n * The list of entity refs to fetch.\n *\n * @remarks\n *\n * The returned list of entities will be in the same order as the refs, and\n * undefined will be returned in those positions that were not found.\n */\n entityRefs: string[];\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery | undefined;\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsResponse {\n /**\n * The returned list of entities.\n *\n * @remarks\n *\n * The list will be in the same order as the refs given in the request, and\n * undefined will be returned in those positions that were not found.\n */\n items: Array<Entity | undefined>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsRequest {\n entityRef: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsResponse {\n rootEntityRef: string;\n items: Array<{\n entity: Entity;\n parentEntityRefs: string[];\n }>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsRequest {\n /**\n * If given, return only entities that match the given patterns.\n *\n * @remarks\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various\n * keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * Each key is a dot separated path in each object.\n *\n * As a value you can also pass in the symbol `CATALOG_FILTER_EXISTS`\n * (exported from this package), which means that you assert on the existence\n * of that key, no matter what its value is.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n /**\n * Dot separated paths for the facets to extract from each entity.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations.backstage.io/orphan']`, then the\n * response will be shaped like\n *\n * ```\n * {\n * \"facets\": {\n * \"kind\": [\n * { \"key\": \"Component\", \"count\": 22 },\n * { \"key\": \"API\", \"count\": 13 }\n * ],\n * \"metadata.annotations.backstage.io/orphan\": [\n * { \"key\": \"true\", \"count\": 2 }\n * ]\n * }\n * }\n * ```\n */\n facets: string[];\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsResponse {\n /**\n * The computed facets, one entry per facet in the request.\n */\n facets: Record<string, Array<{ value: string; count: number }>>;\n}\n\n/**\n * Options you can pass into a catalog request for additional information.\n *\n * @public\n */\nexport interface CatalogRequestOptions {\n token?: string;\n}\n\n/**\n * Entity location for a specific entity.\n *\n * @public\n */\nexport type Location = {\n id: string;\n type: string;\n target: string;\n};\n\n/**\n * The response type for {@link CatalogApi.getLocations}\n *\n * @public\n */\nexport interface GetLocationsResponse {\n items: Location[];\n}\n\n/**\n * The request type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationRequest = {\n type?: string;\n target: string;\n /**\n * If set to true, the location will not be added, but the response will\n * contain the entities that match the given location.\n */\n dryRun?: boolean;\n};\n\n/**\n * The response type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationResponse = {\n location: Location;\n /**\n * The entities matching this location. Will only be filled in dryRun mode\n */\n entities: Entity[];\n /**\n * True, if the location exists. Will only be filled in dryRun mode\n */\n exists?: boolean;\n};\n\n/**\n * The response type for {@link CatalogApi.validateEntity}\n *\n * @public\n */\nexport type ValidateEntityResponse =\n | { valid: true }\n | { valid: false; errors: SerializedError[] };\n\n/**\n * The request type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesRequest =\n | QueryEntitiesInitialRequest\n | QueryEntitiesCursorRequest;\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in an initial pagination request,\n * when requesting the first batch of entities.\n *\n * The properties filter, query, sortField and sortFieldOrder, are going\n * to be immutable for the entire lifecycle of the following requests.\n *\n * @remarks\n *\n * Either `filter` or `query` can be provided, or even both:\n * - `filter`: Uses the traditional key-value filter syntax (GET endpoint)\n * - `query`: Uses the predicate-based filter syntax with logical operators (POST endpoint)\n *\n * @public\n */\nexport type QueryEntitiesInitialRequest = {\n fields?: string[];\n limit?: number;\n offset?: number;\n /**\n * Traditional key-value based filter.\n */\n filter?: EntityFilterQuery;\n /**\n * Predicate-based filter with operators for logical expressions (`$all`,\n * `$any`, and `$not`) and matching (`$exists`, `$in`, `$hasPrefix`, and\n * (partially) `$contains`).\n *\n * @example\n * ```typescript\n * {\n * query: {\n * $all: [\n * { kind: 'component' },\n * { 'spec.type': { $in: ['service', 'website'] } }\n * ]\n * }\n * }\n * ```\n */\n query?: FilterPredicate;\n orderFields?: EntityOrderQuery;\n fullTextFilter?: {\n term: string;\n fields?: string[];\n };\n};\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in a pagination request, following\n * the initial request.\n *\n * @public\n */\nexport type QueryEntitiesCursorRequest = {\n fields?: string[];\n limit?: number;\n cursor: string;\n};\n\n/**\n * The response type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesResponse = {\n /* The list of entities for the current request */\n items: Entity[];\n /* The number of entities among all the requests */\n totalItems: number;\n pageInfo: {\n /* The cursor for the next batch of entities */\n nextCursor?: string;\n /* The cursor for the previous batch of entities */\n prevCursor?: string;\n };\n};\n\n/**\n * Stream entities request for {@link CatalogApi.streamEntities}.\n *\n * @public\n */\nexport type StreamEntitiesRequest = Omit<\n QueryEntitiesInitialRequest,\n 'limit' | 'offset'\n> & {\n /**\n * The number of entities to fetch in each page. Defaults to 500.\n */\n pageSize?: number;\n};\n\n/**\n * The request type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport type QueryLocationsRequest =\n | QueryLocationsInitialRequest\n | QueryLocationsCursorRequest;\n\n/**\n * The request type for initial requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsInitialRequest {\n limit?: number;\n query?: FilterPredicate;\n}\n\n/**\n * The request type for cursor requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsCursorRequest {\n cursor: string;\n}\n\n/**\n * The response type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsResponse {\n items: Location[];\n totalItems: number;\n pageInfo: {\n nextCursor?: string;\n };\n}\n\n/**\n * A client for interacting with the Backstage software catalog through its API.\n *\n * @public\n */\nexport interface CatalogApi {\n /**\n * Lists catalog entities.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n /**\n * Gets a batch of entities, by their entity refs.\n *\n * @remarks\n *\n * The output list of entities is of the same size and in the same order as\n * the requested list of entity refs. Entries that are not found are returned\n * as undefined.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n /**\n * Gets paginated entities from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryEntities({\n * filter: [{ kind: 'group' }],\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * fullTextFilter: {\n * term: 'A',\n * },\n * orderFields: { field: 'metadata.name', order: 'asc' },\n * });\n * ```\n *\n * this will match all entities of type group having a name starting\n * with 'A', ordered by name ascending.\n *\n * The response will contain a maximum of 20 entities. In case\n * more than 20 entities exist, the response will contain a nextCursor\n * property that can be used to fetch the next batch of entities.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryEntities({\n * cursor: response.nextCursor,\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 entities,\n * together with a `prevCursor` property, useful to fetch the previous batch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryEntities(\n request?: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n /**\n * Gets entity ancestor information, i.e. the hierarchy of parent entities\n * whose processing resulted in a given entity appearing in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n /**\n * Gets a single entity from the catalog by its ref (kind, namespace, name)\n * triplet.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n * @returns The matching entity, or undefined if there was no entity with that ref\n */\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined>;\n\n /**\n * Removes a single entity from the catalog by entity UID.\n *\n * @param uid - An entity UID\n * @param options - Additional options\n */\n removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Refreshes (marks for reprocessing) an entity in the catalog.\n *\n * @param entityRef - An entity ref on string form (e.g.\n * 'component/default:my-component')\n * @param options - Additional options\n */\n refreshEntity(\n entityRef: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a summary of field facets of entities in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n // Locations\n\n /**\n * List locations\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse>;\n\n /**\n * Gets paginated locations from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryLocations({\n * limit: 20,\n * query: {\n * type: 'url',\n * target: { $hasPrefix: 'https://github.com/backstage/backstage' },\n * },\n * });\n * ```\n *\n * This will match all locations of type `url` having a target starting\n * with `https://github.com/backstage/backstage`.\n *\n * The response will contain a maximum of 20 locations. In case\n * more than 20 locations exist, the response will contain a `nextCursor`\n * property that can be used to fetch the next batch of locations.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryLocations({ cursor: response.pageInfo.nextCursor });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 locations,\n * again together with a `nextCursor` property if there is more data to fetch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse>;\n\n /**\n * Asynchronously streams locations from the catalog. Uses `queryLocations`\n * to fetch locations in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]>;\n\n /**\n * Gets a registered location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Gets a registered location by its ref.\n *\n * @param locationRef - A location ref, e.g. \"url:https://github.com/...\"\n * @param options - Additional options\n */\n getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Registers a new location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n addLocation(\n location: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse>;\n\n /**\n * Removes a registered Location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a location associated with an entity.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n */\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Validate entity and its location.\n *\n * @param entity - Entity to validate\n * @param locationRef - Location ref in format `url:http://example.com/file`\n * @param options - Additional options\n */\n validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse>;\n\n /**\n * Validate a given location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n analyzeLocation(\n location: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse>;\n\n /**\n * Asynchronously streams entities from the catalog. Uses `queryEntities`\n * to fetch entities in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]>;\n}\n"],"names":[],"mappings":";;AA+BO,MAAM,wCAAwB,MAAA,CAAO,GAAA;AAAA;AAAA,EAE1C;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"api.cjs.js","sources":["../../src/types/api.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport type { SerializedError } from '@backstage/errors';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport type { FilterPredicate } from '@backstage/filter-predicates';\n\n/**\n * This symbol can be used in place of a value when passed to filters in e.g.\n * {@link CatalogApi.getEntities}, to signify that you want to filter on the\n * presence of that key no matter what its value is.\n *\n * @public\n */\nexport const CATALOG_FILTER_EXISTS = Symbol.for(\n // Random UUID to ensure no collisions\n 'CATALOG_FILTER_EXISTS_0e15b590c0b343a2bae3e787e84c2111',\n);\n\n/**\n * A key-value based filter expression for entities.\n *\n * @remarks\n *\n * Each key of a record is a dot-separated path into the entity structure, e.g.\n * `metadata.name`.\n *\n * The values are literal values to match against. As a value you can also pass\n * in the symbol `CATALOG_FILTER_EXISTS` (exported from this package), which\n * means that you assert on the existence of that key, no matter what its value\n * is.\n *\n * All matching of keys and values is case insensitive.\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * @public\n */\nexport type EntityFilterQuery =\n | Record<string, string | symbol | (string | symbol)[]>[]\n | Record<string, string | symbol | (string | symbol)[]>;\n\n/**\n * A set of dot-separated paths into an entity's keys, showing what parts of an\n * entity to include in a response, and excluding all others.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations']`, then response\n * objects will be shaped like\n *\n * ```\n * {\n * \"kind\": \"Component\",\n * \"metadata\": {\n * \"annotations\": {\n * \"foo\": \"bar\"\n * }\n * }\n * }\n * ```\n * @public\n */\nexport type EntityFieldsQuery = string[];\n\n/**\n * Dot-separated field based ordering directives, controlling the sort order of\n * the output entities.\n *\n * @remarks\n *\n * Each field is a dot-separated path into an entity's keys. The order is either\n * ascending (`asc`, lexicographical order) or descending (`desc`, reverse\n * lexicographical order). The ordering is case insensitive.\n *\n * If more than one order directive is given, later directives have lower\n * precedence (they are applied only when directives of higher precedence have\n * equal values).\n *\n * Example:\n *\n * ```\n * [\n * { field: 'kind', order: 'asc' },\n * { field: 'metadata.name', order: 'desc' },\n * ]\n * ```\n *\n * This will order the output first by kind ascending, and then within each kind\n * (if there's more than one of a given kind) by their name descending.\n *\n * When given a field that does NOT exist on all entities in the result set,\n * those entities that do not have the field will always be sorted last in that\n * particular order step, no matter what the desired order was.\n *\n * @public\n */\nexport type EntityOrderQuery =\n | {\n field: string;\n order: 'asc' | 'desc';\n }\n | Array<{\n field: string;\n order: 'asc' | 'desc';\n }>;\n\n/**\n * The request type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesRequest {\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery;\n /**\n *If given, order the result set by those directives.\n */\n order?: EntityOrderQuery;\n /**\n * If given, skips over the first N items in the result set.\n */\n offset?: number;\n /**\n * If given, returns at most N items from the result set.\n */\n limit?: number;\n /**\n * If given, skips over all items before that cursor as returned by a previous\n * request.\n */\n after?: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesResponse {\n items: Entity[];\n}\n\n/**\n * The request type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsRequest {\n /**\n * The list of entity refs to fetch.\n *\n * @remarks\n *\n * The returned list of entities will be in the same order as the refs, and\n * undefined will be returned in those positions that were not found.\n */\n entityRefs: string[];\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery | undefined;\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsResponse {\n /**\n * The returned list of entities.\n *\n * @remarks\n *\n * The list will be in the same order as the refs given in the request, and\n * undefined will be returned in those positions that were not found.\n */\n items: Array<Entity | undefined>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsRequest {\n entityRef: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsResponse {\n rootEntityRef: string;\n items: Array<{\n entity: Entity;\n parentEntityRefs: string[];\n }>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsRequest {\n /**\n * If given, return only entities that match the given patterns.\n *\n * @remarks\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various\n * keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * Each key is a dot separated path in each object.\n *\n * As a value you can also pass in the symbol `CATALOG_FILTER_EXISTS`\n * (exported from this package), which means that you assert on the existence\n * of that key, no matter what its value is.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n /**\n * Dot separated paths for the facets to extract from each entity.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations.backstage.io/orphan']`, then the\n * response will be shaped like\n *\n * ```\n * {\n * \"facets\": {\n * \"kind\": [\n * { \"key\": \"Component\", \"count\": 22 },\n * { \"key\": \"API\", \"count\": 13 }\n * ],\n * \"metadata.annotations.backstage.io/orphan\": [\n * { \"key\": \"true\", \"count\": 2 }\n * ]\n * }\n * }\n * ```\n */\n facets: string[];\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsResponse {\n /**\n * The computed facets, one entry per facet in the request.\n */\n facets: Record<string, Array<{ value: string; count: number }>>;\n}\n\n/**\n * Options you can pass into a catalog request for additional information.\n *\n * @public\n */\nexport interface CatalogRequestOptions {\n token?: string;\n}\n\n/**\n * Entity location for a specific entity.\n *\n * @public\n */\nexport type Location = {\n id: string;\n type: string;\n target: string;\n};\n\n/**\n * The response type for {@link CatalogApi.getLocations}\n *\n * @public\n */\nexport interface GetLocationsResponse {\n items: Location[];\n}\n\n/**\n * The request type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationRequest = {\n type?: string;\n target: string;\n /**\n * If set to true, the location will not be added, but the response will\n * contain the entities that match the given location.\n */\n dryRun?: boolean;\n /**\n * Behavior when the location already exists. If set to `'reject'` (the\n * default), a conflict error is returned. If set to `'refresh'`, the\n * existing location entity is marked for refresh and a 201 is returned.\n */\n onConflict?: 'refresh' | 'reject';\n};\n\n/**\n * The response type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationResponse = {\n location: Location;\n /**\n * The entities matching this location. Will only be filled in dryRun mode\n */\n entities: Entity[];\n /**\n * True, if the location exists. Will only be filled in dryRun mode\n */\n exists?: boolean;\n};\n\n/**\n * The response type for {@link CatalogApi.validateEntity}\n *\n * @public\n */\nexport type ValidateEntityResponse =\n | { valid: true }\n | { valid: false; errors: SerializedError[] };\n\n/**\n * The request type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesRequest =\n | QueryEntitiesInitialRequest\n | QueryEntitiesCursorRequest;\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in an initial pagination request,\n * when requesting the first batch of entities.\n *\n * The properties filter, query, sortField and sortFieldOrder, are going\n * to be immutable for the entire lifecycle of the following requests.\n *\n * @remarks\n *\n * Either `filter` or `query` can be provided, or even both:\n * - `filter`: Uses the traditional key-value filter syntax (GET endpoint)\n * - `query`: Uses the predicate-based filter syntax with logical operators (POST endpoint)\n *\n * @public\n */\nexport type QueryEntitiesInitialRequest = {\n fields?: string[];\n limit?: number;\n offset?: number;\n /**\n * Traditional key-value based filter.\n */\n filter?: EntityFilterQuery;\n /**\n * Predicate-based filter with operators for logical expressions (`$all`,\n * `$any`, and `$not`) and matching (`$exists`, `$in`, `$hasPrefix`, and\n * (partially) `$contains`).\n *\n * @example\n * ```typescript\n * {\n * query: {\n * $all: [\n * { kind: 'component' },\n * { 'spec.type': { $in: ['service', 'website'] } }\n * ]\n * }\n * }\n * ```\n */\n query?: FilterPredicate;\n orderFields?: EntityOrderQuery;\n fullTextFilter?: {\n term: string;\n fields?: string[];\n };\n};\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in a pagination request, following\n * the initial request.\n *\n * @public\n */\nexport type QueryEntitiesCursorRequest = {\n fields?: string[];\n limit?: number;\n cursor: string;\n};\n\n/**\n * The response type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesResponse = {\n /* The list of entities for the current request */\n items: Entity[];\n /* The number of entities among all the requests */\n totalItems: number;\n pageInfo: {\n /* The cursor for the next batch of entities */\n nextCursor?: string;\n /* The cursor for the previous batch of entities */\n prevCursor?: string;\n };\n};\n\n/**\n * Stream entities request for {@link CatalogApi.streamEntities}.\n *\n * @public\n */\nexport type StreamEntitiesRequest = Omit<\n QueryEntitiesInitialRequest,\n 'limit' | 'offset'\n> & {\n /**\n * The number of entities to fetch in each page. Defaults to 500.\n */\n pageSize?: number;\n};\n\n/**\n * The request type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport type QueryLocationsRequest =\n | QueryLocationsInitialRequest\n | QueryLocationsCursorRequest;\n\n/**\n * The request type for initial requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsInitialRequest {\n limit?: number;\n query?: FilterPredicate;\n}\n\n/**\n * The request type for cursor requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsCursorRequest {\n cursor: string;\n}\n\n/**\n * The response type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsResponse {\n items: Location[];\n totalItems: number;\n pageInfo: {\n nextCursor?: string;\n };\n}\n\n/**\n * A client for interacting with the Backstage software catalog through its API.\n *\n * @public\n */\nexport interface CatalogApi {\n /**\n * Lists catalog entities.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n /**\n * Gets a batch of entities, by their entity refs.\n *\n * @remarks\n *\n * The output list of entities is of the same size and in the same order as\n * the requested list of entity refs. Entries that are not found are returned\n * as undefined.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n /**\n * Gets paginated entities from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryEntities({\n * filter: [{ kind: 'group' }],\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * fullTextFilter: {\n * term: 'A',\n * },\n * orderFields: { field: 'metadata.name', order: 'asc' },\n * });\n * ```\n *\n * this will match all entities of type group having a name starting\n * with 'A', ordered by name ascending.\n *\n * The response will contain a maximum of 20 entities. In case\n * more than 20 entities exist, the response will contain a nextCursor\n * property that can be used to fetch the next batch of entities.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryEntities({\n * cursor: response.nextCursor,\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 entities,\n * together with a `prevCursor` property, useful to fetch the previous batch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryEntities(\n request?: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n /**\n * Gets entity ancestor information, i.e. the hierarchy of parent entities\n * whose processing resulted in a given entity appearing in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n /**\n * Gets a single entity from the catalog by its ref (kind, namespace, name)\n * triplet.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n * @returns The matching entity, or undefined if there was no entity with that ref\n */\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined>;\n\n /**\n * Removes a single entity from the catalog by entity UID.\n *\n * @param uid - An entity UID\n * @param options - Additional options\n */\n removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Refreshes (marks for reprocessing) an entity in the catalog.\n *\n * @param entityRef - An entity ref on string form (e.g.\n * 'component/default:my-component')\n * @param options - Additional options\n */\n refreshEntity(\n entityRef: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a summary of field facets of entities in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n // Locations\n\n /**\n * List locations\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse>;\n\n /**\n * Gets paginated locations from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryLocations({\n * limit: 20,\n * query: {\n * type: 'url',\n * target: { $hasPrefix: 'https://github.com/backstage/backstage' },\n * },\n * });\n * ```\n *\n * This will match all locations of type `url` having a target starting\n * with `https://github.com/backstage/backstage`.\n *\n * The response will contain a maximum of 20 locations. In case\n * more than 20 locations exist, the response will contain a `nextCursor`\n * property that can be used to fetch the next batch of locations.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryLocations({ cursor: response.pageInfo.nextCursor });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 locations,\n * again together with a `nextCursor` property if there is more data to fetch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse>;\n\n /**\n * Asynchronously streams locations from the catalog. Uses `queryLocations`\n * to fetch locations in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]>;\n\n /**\n * Gets a registered location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Gets a registered location by its ref.\n *\n * @param locationRef - A location ref, e.g. \"url:https://github.com/...\"\n * @param options - Additional options\n */\n getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Registers a new location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n addLocation(\n location: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse>;\n\n /**\n * Removes a registered Location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a location associated with an entity.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n */\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Validate entity and its location.\n *\n * @param entity - Entity to validate\n * @param locationRef - Location ref in format `url:http://example.com/file`\n * @param options - Additional options\n */\n validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse>;\n\n /**\n * Validate a given location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n analyzeLocation(\n location: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse>;\n\n /**\n * Asynchronously streams entities from the catalog. Uses `queryEntities`\n * to fetch entities in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]>;\n}\n"],"names":[],"mappings":";;AA+BO,MAAM,wCAAwB,MAAA,CAAO,GAAA;AAAA;AAAA,EAE1C;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.esm.js","sources":["../../src/types/api.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport type { SerializedError } from '@backstage/errors';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport type { FilterPredicate } from '@backstage/filter-predicates';\n\n/**\n * This symbol can be used in place of a value when passed to filters in e.g.\n * {@link CatalogApi.getEntities}, to signify that you want to filter on the\n * presence of that key no matter what its value is.\n *\n * @public\n */\nexport const CATALOG_FILTER_EXISTS = Symbol.for(\n // Random UUID to ensure no collisions\n 'CATALOG_FILTER_EXISTS_0e15b590c0b343a2bae3e787e84c2111',\n);\n\n/**\n * A key-value based filter expression for entities.\n *\n * @remarks\n *\n * Each key of a record is a dot-separated path into the entity structure, e.g.\n * `metadata.name`.\n *\n * The values are literal values to match against. As a value you can also pass\n * in the symbol `CATALOG_FILTER_EXISTS` (exported from this package), which\n * means that you assert on the existence of that key, no matter what its value\n * is.\n *\n * All matching of keys and values is case insensitive.\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * @public\n */\nexport type EntityFilterQuery =\n | Record<string, string | symbol | (string | symbol)[]>[]\n | Record<string, string | symbol | (string | symbol)[]>;\n\n/**\n * A set of dot-separated paths into an entity's keys, showing what parts of an\n * entity to include in a response, and excluding all others.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations']`, then response\n * objects will be shaped like\n *\n * ```\n * {\n * \"kind\": \"Component\",\n * \"metadata\": {\n * \"annotations\": {\n * \"foo\": \"bar\"\n * }\n * }\n * }\n * ```\n * @public\n */\nexport type EntityFieldsQuery = string[];\n\n/**\n * Dot-separated field based ordering directives, controlling the sort order of\n * the output entities.\n *\n * @remarks\n *\n * Each field is a dot-separated path into an entity's keys. The order is either\n * ascending (`asc`, lexicographical order) or descending (`desc`, reverse\n * lexicographical order). The ordering is case insensitive.\n *\n * If more than one order directive is given, later directives have lower\n * precedence (they are applied only when directives of higher precedence have\n * equal values).\n *\n * Example:\n *\n * ```\n * [\n * { field: 'kind', order: 'asc' },\n * { field: 'metadata.name', order: 'desc' },\n * ]\n * ```\n *\n * This will order the output first by kind ascending, and then within each kind\n * (if there's more than one of a given kind) by their name descending.\n *\n * When given a field that does NOT exist on all entities in the result set,\n * those entities that do not have the field will always be sorted last in that\n * particular order step, no matter what the desired order was.\n *\n * @public\n */\nexport type EntityOrderQuery =\n | {\n field: string;\n order: 'asc' | 'desc';\n }\n | Array<{\n field: string;\n order: 'asc' | 'desc';\n }>;\n\n/**\n * The request type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesRequest {\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery;\n /**\n *If given, order the result set by those directives.\n */\n order?: EntityOrderQuery;\n /**\n * If given, skips over the first N items in the result set.\n */\n offset?: number;\n /**\n * If given, returns at most N items from the result set.\n */\n limit?: number;\n /**\n * If given, skips over all items before that cursor as returned by a previous\n * request.\n */\n after?: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesResponse {\n items: Entity[];\n}\n\n/**\n * The request type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsRequest {\n /**\n * The list of entity refs to fetch.\n *\n * @remarks\n *\n * The returned list of entities will be in the same order as the refs, and\n * undefined will be returned in those positions that were not found.\n */\n entityRefs: string[];\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery | undefined;\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsResponse {\n /**\n * The returned list of entities.\n *\n * @remarks\n *\n * The list will be in the same order as the refs given in the request, and\n * undefined will be returned in those positions that were not found.\n */\n items: Array<Entity | undefined>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsRequest {\n entityRef: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsResponse {\n rootEntityRef: string;\n items: Array<{\n entity: Entity;\n parentEntityRefs: string[];\n }>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsRequest {\n /**\n * If given, return only entities that match the given patterns.\n *\n * @remarks\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various\n * keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * Each key is a dot separated path in each object.\n *\n * As a value you can also pass in the symbol `CATALOG_FILTER_EXISTS`\n * (exported from this package), which means that you assert on the existence\n * of that key, no matter what its value is.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n /**\n * Dot separated paths for the facets to extract from each entity.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations.backstage.io/orphan']`, then the\n * response will be shaped like\n *\n * ```\n * {\n * \"facets\": {\n * \"kind\": [\n * { \"key\": \"Component\", \"count\": 22 },\n * { \"key\": \"API\", \"count\": 13 }\n * ],\n * \"metadata.annotations.backstage.io/orphan\": [\n * { \"key\": \"true\", \"count\": 2 }\n * ]\n * }\n * }\n * ```\n */\n facets: string[];\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsResponse {\n /**\n * The computed facets, one entry per facet in the request.\n */\n facets: Record<string, Array<{ value: string; count: number }>>;\n}\n\n/**\n * Options you can pass into a catalog request for additional information.\n *\n * @public\n */\nexport interface CatalogRequestOptions {\n token?: string;\n}\n\n/**\n * Entity location for a specific entity.\n *\n * @public\n */\nexport type Location = {\n id: string;\n type: string;\n target: string;\n};\n\n/**\n * The response type for {@link CatalogApi.getLocations}\n *\n * @public\n */\nexport interface GetLocationsResponse {\n items: Location[];\n}\n\n/**\n * The request type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationRequest = {\n type?: string;\n target: string;\n /**\n * If set to true, the location will not be added, but the response will\n * contain the entities that match the given location.\n */\n dryRun?: boolean;\n};\n\n/**\n * The response type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationResponse = {\n location: Location;\n /**\n * The entities matching this location. Will only be filled in dryRun mode\n */\n entities: Entity[];\n /**\n * True, if the location exists. Will only be filled in dryRun mode\n */\n exists?: boolean;\n};\n\n/**\n * The response type for {@link CatalogApi.validateEntity}\n *\n * @public\n */\nexport type ValidateEntityResponse =\n | { valid: true }\n | { valid: false; errors: SerializedError[] };\n\n/**\n * The request type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesRequest =\n | QueryEntitiesInitialRequest\n | QueryEntitiesCursorRequest;\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in an initial pagination request,\n * when requesting the first batch of entities.\n *\n * The properties filter, query, sortField and sortFieldOrder, are going\n * to be immutable for the entire lifecycle of the following requests.\n *\n * @remarks\n *\n * Either `filter` or `query` can be provided, or even both:\n * - `filter`: Uses the traditional key-value filter syntax (GET endpoint)\n * - `query`: Uses the predicate-based filter syntax with logical operators (POST endpoint)\n *\n * @public\n */\nexport type QueryEntitiesInitialRequest = {\n fields?: string[];\n limit?: number;\n offset?: number;\n /**\n * Traditional key-value based filter.\n */\n filter?: EntityFilterQuery;\n /**\n * Predicate-based filter with operators for logical expressions (`$all`,\n * `$any`, and `$not`) and matching (`$exists`, `$in`, `$hasPrefix`, and\n * (partially) `$contains`).\n *\n * @example\n * ```typescript\n * {\n * query: {\n * $all: [\n * { kind: 'component' },\n * { 'spec.type': { $in: ['service', 'website'] } }\n * ]\n * }\n * }\n * ```\n */\n query?: FilterPredicate;\n orderFields?: EntityOrderQuery;\n fullTextFilter?: {\n term: string;\n fields?: string[];\n };\n};\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in a pagination request, following\n * the initial request.\n *\n * @public\n */\nexport type QueryEntitiesCursorRequest = {\n fields?: string[];\n limit?: number;\n cursor: string;\n};\n\n/**\n * The response type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesResponse = {\n /* The list of entities for the current request */\n items: Entity[];\n /* The number of entities among all the requests */\n totalItems: number;\n pageInfo: {\n /* The cursor for the next batch of entities */\n nextCursor?: string;\n /* The cursor for the previous batch of entities */\n prevCursor?: string;\n };\n};\n\n/**\n * Stream entities request for {@link CatalogApi.streamEntities}.\n *\n * @public\n */\nexport type StreamEntitiesRequest = Omit<\n QueryEntitiesInitialRequest,\n 'limit' | 'offset'\n> & {\n /**\n * The number of entities to fetch in each page. Defaults to 500.\n */\n pageSize?: number;\n};\n\n/**\n * The request type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport type QueryLocationsRequest =\n | QueryLocationsInitialRequest\n | QueryLocationsCursorRequest;\n\n/**\n * The request type for initial requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsInitialRequest {\n limit?: number;\n query?: FilterPredicate;\n}\n\n/**\n * The request type for cursor requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsCursorRequest {\n cursor: string;\n}\n\n/**\n * The response type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsResponse {\n items: Location[];\n totalItems: number;\n pageInfo: {\n nextCursor?: string;\n };\n}\n\n/**\n * A client for interacting with the Backstage software catalog through its API.\n *\n * @public\n */\nexport interface CatalogApi {\n /**\n * Lists catalog entities.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n /**\n * Gets a batch of entities, by their entity refs.\n *\n * @remarks\n *\n * The output list of entities is of the same size and in the same order as\n * the requested list of entity refs. Entries that are not found are returned\n * as undefined.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n /**\n * Gets paginated entities from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryEntities({\n * filter: [{ kind: 'group' }],\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * fullTextFilter: {\n * term: 'A',\n * },\n * orderFields: { field: 'metadata.name', order: 'asc' },\n * });\n * ```\n *\n * this will match all entities of type group having a name starting\n * with 'A', ordered by name ascending.\n *\n * The response will contain a maximum of 20 entities. In case\n * more than 20 entities exist, the response will contain a nextCursor\n * property that can be used to fetch the next batch of entities.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryEntities({\n * cursor: response.nextCursor,\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 entities,\n * together with a `prevCursor` property, useful to fetch the previous batch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryEntities(\n request?: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n /**\n * Gets entity ancestor information, i.e. the hierarchy of parent entities\n * whose processing resulted in a given entity appearing in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n /**\n * Gets a single entity from the catalog by its ref (kind, namespace, name)\n * triplet.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n * @returns The matching entity, or undefined if there was no entity with that ref\n */\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined>;\n\n /**\n * Removes a single entity from the catalog by entity UID.\n *\n * @param uid - An entity UID\n * @param options - Additional options\n */\n removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Refreshes (marks for reprocessing) an entity in the catalog.\n *\n * @param entityRef - An entity ref on string form (e.g.\n * 'component/default:my-component')\n * @param options - Additional options\n */\n refreshEntity(\n entityRef: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a summary of field facets of entities in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n // Locations\n\n /**\n * List locations\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse>;\n\n /**\n * Gets paginated locations from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryLocations({\n * limit: 20,\n * query: {\n * type: 'url',\n * target: { $hasPrefix: 'https://github.com/backstage/backstage' },\n * },\n * });\n * ```\n *\n * This will match all locations of type `url` having a target starting\n * with `https://github.com/backstage/backstage`.\n *\n * The response will contain a maximum of 20 locations. In case\n * more than 20 locations exist, the response will contain a `nextCursor`\n * property that can be used to fetch the next batch of locations.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryLocations({ cursor: response.pageInfo.nextCursor });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 locations,\n * again together with a `nextCursor` property if there is more data to fetch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse>;\n\n /**\n * Asynchronously streams locations from the catalog. Uses `queryLocations`\n * to fetch locations in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]>;\n\n /**\n * Gets a registered location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Gets a registered location by its ref.\n *\n * @param locationRef - A location ref, e.g. \"url:https://github.com/...\"\n * @param options - Additional options\n */\n getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Registers a new location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n addLocation(\n location: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse>;\n\n /**\n * Removes a registered Location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a location associated with an entity.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n */\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Validate entity and its location.\n *\n * @param entity - Entity to validate\n * @param locationRef - Location ref in format `url:http://example.com/file`\n * @param options - Additional options\n */\n validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse>;\n\n /**\n * Validate a given location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n analyzeLocation(\n location: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse>;\n\n /**\n * Asynchronously streams entities from the catalog. Uses `queryEntities`\n * to fetch entities in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]>;\n}\n"],"names":[],"mappings":"AA+BO,MAAM,wCAAwB,MAAA,CAAO,GAAA;AAAA;AAAA,EAE1C;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"api.esm.js","sources":["../../src/types/api.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { CompoundEntityRef, Entity } from '@backstage/catalog-model';\nimport type { SerializedError } from '@backstage/errors';\nimport type {\n AnalyzeLocationRequest,\n AnalyzeLocationResponse,\n} from '@backstage/plugin-catalog-common';\nimport type { FilterPredicate } from '@backstage/filter-predicates';\n\n/**\n * This symbol can be used in place of a value when passed to filters in e.g.\n * {@link CatalogApi.getEntities}, to signify that you want to filter on the\n * presence of that key no matter what its value is.\n *\n * @public\n */\nexport const CATALOG_FILTER_EXISTS = Symbol.for(\n // Random UUID to ensure no collisions\n 'CATALOG_FILTER_EXISTS_0e15b590c0b343a2bae3e787e84c2111',\n);\n\n/**\n * A key-value based filter expression for entities.\n *\n * @remarks\n *\n * Each key of a record is a dot-separated path into the entity structure, e.g.\n * `metadata.name`.\n *\n * The values are literal values to match against. As a value you can also pass\n * in the symbol `CATALOG_FILTER_EXISTS` (exported from this package), which\n * means that you assert on the existence of that key, no matter what its value\n * is.\n *\n * All matching of keys and values is case insensitive.\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * @public\n */\nexport type EntityFilterQuery =\n | Record<string, string | symbol | (string | symbol)[]>[]\n | Record<string, string | symbol | (string | symbol)[]>;\n\n/**\n * A set of dot-separated paths into an entity's keys, showing what parts of an\n * entity to include in a response, and excluding all others.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations']`, then response\n * objects will be shaped like\n *\n * ```\n * {\n * \"kind\": \"Component\",\n * \"metadata\": {\n * \"annotations\": {\n * \"foo\": \"bar\"\n * }\n * }\n * }\n * ```\n * @public\n */\nexport type EntityFieldsQuery = string[];\n\n/**\n * Dot-separated field based ordering directives, controlling the sort order of\n * the output entities.\n *\n * @remarks\n *\n * Each field is a dot-separated path into an entity's keys. The order is either\n * ascending (`asc`, lexicographical order) or descending (`desc`, reverse\n * lexicographical order). The ordering is case insensitive.\n *\n * If more than one order directive is given, later directives have lower\n * precedence (they are applied only when directives of higher precedence have\n * equal values).\n *\n * Example:\n *\n * ```\n * [\n * { field: 'kind', order: 'asc' },\n * { field: 'metadata.name', order: 'desc' },\n * ]\n * ```\n *\n * This will order the output first by kind ascending, and then within each kind\n * (if there's more than one of a given kind) by their name descending.\n *\n * When given a field that does NOT exist on all entities in the result set,\n * those entities that do not have the field will always be sorted last in that\n * particular order step, no matter what the desired order was.\n *\n * @public\n */\nexport type EntityOrderQuery =\n | {\n field: string;\n order: 'asc' | 'desc';\n }\n | Array<{\n field: string;\n order: 'asc' | 'desc';\n }>;\n\n/**\n * The request type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesRequest {\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery;\n /**\n *If given, order the result set by those directives.\n */\n order?: EntityOrderQuery;\n /**\n * If given, skips over the first N items in the result set.\n */\n offset?: number;\n /**\n * If given, returns at most N items from the result set.\n */\n limit?: number;\n /**\n * If given, skips over all items before that cursor as returned by a previous\n * request.\n */\n after?: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntities}.\n *\n * @public\n */\nexport interface GetEntitiesResponse {\n items: Entity[];\n}\n\n/**\n * The request type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsRequest {\n /**\n * The list of entity refs to fetch.\n *\n * @remarks\n *\n * The returned list of entities will be in the same order as the refs, and\n * undefined will be returned in those positions that were not found.\n */\n entityRefs: string[];\n /**\n * If given, return only the parts of each entity that match the field\n * declarations.\n */\n fields?: EntityFieldsQuery | undefined;\n /**\n * If given, return only entities that match the given filter.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntitiesByRefs}.\n *\n * @public\n */\nexport interface GetEntitiesByRefsResponse {\n /**\n * The returned list of entities.\n *\n * @remarks\n *\n * The list will be in the same order as the refs given in the request, and\n * undefined will be returned in those positions that were not found.\n */\n items: Array<Entity | undefined>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsRequest {\n entityRef: string;\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityAncestors}.\n *\n * @public\n */\nexport interface GetEntityAncestorsResponse {\n rootEntityRef: string;\n items: Array<{\n entity: Entity;\n parentEntityRefs: string[];\n }>;\n}\n\n/**\n * The request type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsRequest {\n /**\n * If given, return only entities that match the given patterns.\n *\n * @remarks\n *\n * If multiple filter sets are given as an array, then there is effectively an\n * OR between each filter set.\n *\n * Within one filter set, there is effectively an AND between the various\n * keys.\n *\n * Within one key, if there are more than one value, then there is effectively\n * an OR between them.\n *\n * Example: For an input of\n *\n * ```\n * [\n * { kind: ['API', 'Component'] },\n * { 'metadata.name': 'a', 'metadata.namespace': 'b' }\n * ]\n * ```\n *\n * This effectively means\n *\n * ```\n * (kind = EITHER 'API' OR 'Component')\n * OR\n * (metadata.name = 'a' AND metadata.namespace = 'b' )\n * ```\n *\n * Each key is a dot separated path in each object.\n *\n * As a value you can also pass in the symbol `CATALOG_FILTER_EXISTS`\n * (exported from this package), which means that you assert on the existence\n * of that key, no matter what its value is.\n */\n filter?: EntityFilterQuery;\n /**\n * If given, return only entities that match the given predicate query.\n *\n * @remarks\n *\n * Supports operators like `$all`, `$any`, `$not`, `$exists`, `$in`,\n * `$contains`, and `$hasPrefix`. When both `filter` and `query` are\n * provided, they are combined with `$all`.\n */\n query?: FilterPredicate;\n /**\n * Dot separated paths for the facets to extract from each entity.\n *\n * @remarks\n *\n * Example: For an input of `['kind', 'metadata.annotations.backstage.io/orphan']`, then the\n * response will be shaped like\n *\n * ```\n * {\n * \"facets\": {\n * \"kind\": [\n * { \"key\": \"Component\", \"count\": 22 },\n * { \"key\": \"API\", \"count\": 13 }\n * ],\n * \"metadata.annotations.backstage.io/orphan\": [\n * { \"key\": \"true\", \"count\": 2 }\n * ]\n * }\n * }\n * ```\n */\n facets: string[];\n}\n\n/**\n * The response type for {@link CatalogApi.getEntityFacets}.\n *\n * @public\n */\nexport interface GetEntityFacetsResponse {\n /**\n * The computed facets, one entry per facet in the request.\n */\n facets: Record<string, Array<{ value: string; count: number }>>;\n}\n\n/**\n * Options you can pass into a catalog request for additional information.\n *\n * @public\n */\nexport interface CatalogRequestOptions {\n token?: string;\n}\n\n/**\n * Entity location for a specific entity.\n *\n * @public\n */\nexport type Location = {\n id: string;\n type: string;\n target: string;\n};\n\n/**\n * The response type for {@link CatalogApi.getLocations}\n *\n * @public\n */\nexport interface GetLocationsResponse {\n items: Location[];\n}\n\n/**\n * The request type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationRequest = {\n type?: string;\n target: string;\n /**\n * If set to true, the location will not be added, but the response will\n * contain the entities that match the given location.\n */\n dryRun?: boolean;\n /**\n * Behavior when the location already exists. If set to `'reject'` (the\n * default), a conflict error is returned. If set to `'refresh'`, the\n * existing location entity is marked for refresh and a 201 is returned.\n */\n onConflict?: 'refresh' | 'reject';\n};\n\n/**\n * The response type for {@link CatalogApi.addLocation}.\n *\n * @public\n */\nexport type AddLocationResponse = {\n location: Location;\n /**\n * The entities matching this location. Will only be filled in dryRun mode\n */\n entities: Entity[];\n /**\n * True, if the location exists. Will only be filled in dryRun mode\n */\n exists?: boolean;\n};\n\n/**\n * The response type for {@link CatalogApi.validateEntity}\n *\n * @public\n */\nexport type ValidateEntityResponse =\n | { valid: true }\n | { valid: false; errors: SerializedError[] };\n\n/**\n * The request type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesRequest =\n | QueryEntitiesInitialRequest\n | QueryEntitiesCursorRequest;\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in an initial pagination request,\n * when requesting the first batch of entities.\n *\n * The properties filter, query, sortField and sortFieldOrder, are going\n * to be immutable for the entire lifecycle of the following requests.\n *\n * @remarks\n *\n * Either `filter` or `query` can be provided, or even both:\n * - `filter`: Uses the traditional key-value filter syntax (GET endpoint)\n * - `query`: Uses the predicate-based filter syntax with logical operators (POST endpoint)\n *\n * @public\n */\nexport type QueryEntitiesInitialRequest = {\n fields?: string[];\n limit?: number;\n offset?: number;\n /**\n * Traditional key-value based filter.\n */\n filter?: EntityFilterQuery;\n /**\n * Predicate-based filter with operators for logical expressions (`$all`,\n * `$any`, and `$not`) and matching (`$exists`, `$in`, `$hasPrefix`, and\n * (partially) `$contains`).\n *\n * @example\n * ```typescript\n * {\n * query: {\n * $all: [\n * { kind: 'component' },\n * { 'spec.type': { $in: ['service', 'website'] } }\n * ]\n * }\n * }\n * ```\n */\n query?: FilterPredicate;\n orderFields?: EntityOrderQuery;\n fullTextFilter?: {\n term: string;\n fields?: string[];\n };\n};\n\n/**\n * A request type for {@link CatalogApi.queryEntities}.\n * The method takes this type in a pagination request, following\n * the initial request.\n *\n * @public\n */\nexport type QueryEntitiesCursorRequest = {\n fields?: string[];\n limit?: number;\n cursor: string;\n};\n\n/**\n * The response type for {@link CatalogApi.queryEntities}.\n *\n * @public\n */\nexport type QueryEntitiesResponse = {\n /* The list of entities for the current request */\n items: Entity[];\n /* The number of entities among all the requests */\n totalItems: number;\n pageInfo: {\n /* The cursor for the next batch of entities */\n nextCursor?: string;\n /* The cursor for the previous batch of entities */\n prevCursor?: string;\n };\n};\n\n/**\n * Stream entities request for {@link CatalogApi.streamEntities}.\n *\n * @public\n */\nexport type StreamEntitiesRequest = Omit<\n QueryEntitiesInitialRequest,\n 'limit' | 'offset'\n> & {\n /**\n * The number of entities to fetch in each page. Defaults to 500.\n */\n pageSize?: number;\n};\n\n/**\n * The request type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport type QueryLocationsRequest =\n | QueryLocationsInitialRequest\n | QueryLocationsCursorRequest;\n\n/**\n * The request type for initial requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsInitialRequest {\n limit?: number;\n query?: FilterPredicate;\n}\n\n/**\n * The request type for cursor requests to {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsCursorRequest {\n cursor: string;\n}\n\n/**\n * The response type for {@link CatalogApi.queryLocations}.\n *\n * @public\n */\nexport interface QueryLocationsResponse {\n items: Location[];\n totalItems: number;\n pageInfo: {\n nextCursor?: string;\n };\n}\n\n/**\n * A client for interacting with the Backstage software catalog through its API.\n *\n * @public\n */\nexport interface CatalogApi {\n /**\n * Lists catalog entities.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntities(\n request?: GetEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesResponse>;\n\n /**\n * Gets a batch of entities, by their entity refs.\n *\n * @remarks\n *\n * The output list of entities is of the same size and in the same order as\n * the requested list of entity refs. Entries that are not found are returned\n * as undefined.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntitiesByRefs(\n request: GetEntitiesByRefsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntitiesByRefsResponse>;\n\n /**\n * Gets paginated entities from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryEntities({\n * filter: [{ kind: 'group' }],\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * fullTextFilter: {\n * term: 'A',\n * },\n * orderFields: { field: 'metadata.name', order: 'asc' },\n * });\n * ```\n *\n * this will match all entities of type group having a name starting\n * with 'A', ordered by name ascending.\n *\n * The response will contain a maximum of 20 entities. In case\n * more than 20 entities exist, the response will contain a nextCursor\n * property that can be used to fetch the next batch of entities.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryEntities({\n * cursor: response.nextCursor,\n * limit: 20,\n * fields: ['metadata', 'kind'],\n * });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 entities,\n * together with a `prevCursor` property, useful to fetch the previous batch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryEntities(\n request?: QueryEntitiesRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryEntitiesResponse>;\n\n /**\n * Gets entity ancestor information, i.e. the hierarchy of parent entities\n * whose processing resulted in a given entity appearing in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityAncestors(\n request: GetEntityAncestorsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityAncestorsResponse>;\n\n /**\n * Gets a single entity from the catalog by its ref (kind, namespace, name)\n * triplet.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n * @returns The matching entity, or undefined if there was no entity with that ref\n */\n getEntityByRef(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Entity | undefined>;\n\n /**\n * Removes a single entity from the catalog by entity UID.\n *\n * @param uid - An entity UID\n * @param options - Additional options\n */\n removeEntityByUid(\n uid: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Refreshes (marks for reprocessing) an entity in the catalog.\n *\n * @param entityRef - An entity ref on string form (e.g.\n * 'component/default:my-component')\n * @param options - Additional options\n */\n refreshEntity(\n entityRef: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a summary of field facets of entities in the catalog.\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getEntityFacets(\n request: GetEntityFacetsRequest,\n options?: CatalogRequestOptions,\n ): Promise<GetEntityFacetsResponse>;\n\n // Locations\n\n /**\n * List locations\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n getLocations(\n request?: {},\n options?: CatalogRequestOptions,\n ): Promise<GetLocationsResponse>;\n\n /**\n * Gets paginated locations from the catalog.\n *\n * @remarks\n *\n * @example\n *\n * ```\n * const response = await catalogClient.queryLocations({\n * limit: 20,\n * query: {\n * type: 'url',\n * target: { $hasPrefix: 'https://github.com/backstage/backstage' },\n * },\n * });\n * ```\n *\n * This will match all locations of type `url` having a target starting\n * with `https://github.com/backstage/backstage`.\n *\n * The response will contain a maximum of 20 locations. In case\n * more than 20 locations exist, the response will contain a `nextCursor`\n * property that can be used to fetch the next batch of locations.\n *\n * ```\n * const secondBatchResponse = await catalogClient\n * .queryLocations({ cursor: response.pageInfo.nextCursor });\n * ```\n *\n * `secondBatchResponse` will contain the next batch of (maximum) 20 locations,\n * again together with a `nextCursor` property if there is more data to fetch.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n queryLocations(\n request?: QueryLocationsRequest,\n options?: CatalogRequestOptions,\n ): Promise<QueryLocationsResponse>;\n\n /**\n * Asynchronously streams locations from the catalog. Uses `queryLocations`\n * to fetch locations in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamLocations(\n request?: QueryLocationsInitialRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Location[]>;\n\n /**\n * Gets a registered location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n getLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Gets a registered location by its ref.\n *\n * @param locationRef - A location ref, e.g. \"url:https://github.com/...\"\n * @param options - Additional options\n */\n getLocationByRef(\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Registers a new location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n addLocation(\n location: AddLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AddLocationResponse>;\n\n /**\n * Removes a registered Location by its ID.\n *\n * @param id - A location ID\n * @param options - Additional options\n */\n removeLocationById(\n id: string,\n options?: CatalogRequestOptions,\n ): Promise<void>;\n\n /**\n * Gets a location associated with an entity.\n *\n * @param entityRef - A complete entity ref, either on string or compound form\n * @param options - Additional options\n */\n getLocationByEntity(\n entityRef: string | CompoundEntityRef,\n options?: CatalogRequestOptions,\n ): Promise<Location | undefined>;\n\n /**\n * Validate entity and its location.\n *\n * @param entity - Entity to validate\n * @param locationRef - Location ref in format `url:http://example.com/file`\n * @param options - Additional options\n */\n validateEntity(\n entity: Entity,\n locationRef: string,\n options?: CatalogRequestOptions,\n ): Promise<ValidateEntityResponse>;\n\n /**\n * Validate a given location.\n *\n * @param location - Request parameters\n * @param options - Additional options\n */\n analyzeLocation(\n location: AnalyzeLocationRequest,\n options?: CatalogRequestOptions,\n ): Promise<AnalyzeLocationResponse>;\n\n /**\n * Asynchronously streams entities from the catalog. Uses `queryEntities`\n * to fetch entities in batches, and yields them one page at a time.\n *\n * @public\n *\n * @param request - Request parameters\n * @param options - Additional options\n */\n streamEntities(\n request?: StreamEntitiesRequest,\n options?: CatalogRequestOptions,\n ): AsyncIterable<Entity[]>;\n}\n"],"names":[],"mappings":"AA+BO,MAAM,wCAAwB,MAAA,CAAO,GAAA;AAAA;AAAA,EAE1C;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/catalog-client",
|
|
3
|
-
"version": "1.14.0-next.
|
|
3
|
+
"version": "1.14.0-next.2",
|
|
4
4
|
"description": "An isomorphic client for the catalog backend",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "common-library"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"uri-template": "^2.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@backstage/cli": "0.36.0-next.
|
|
69
|
+
"@backstage/cli": "0.36.0-next.2",
|
|
70
70
|
"@backstage/plugin-catalog-common": "1.1.8",
|
|
71
71
|
"@types/lodash": "^4.14.151",
|
|
72
72
|
"msw": "^1.0.0"
|