From 9702f41938c2761c0212f1db8c4917b7b1a36bfc Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Sat, 16 Mar 2024 00:21:04 -0400 Subject: [PATCH] update import location Signed-off-by: aramissennyeydd Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd --- packages/catalog-client/package.json | 3 ++- packages/catalog-client/src/alpha.ts | 16 ++++++++++++++++ .../src/generated/apis/DefaultApi.client.ts | 9 ++++++--- packages/catalog-client/src/index.ts | 4 +--- .../package/schema/openapi/generate/server.ts | 4 ++-- .../typescript-backstage-server/api.mustache | 2 +- .../src/generated/apis/DefaultApi.server.ts | 6 ++++-- 7 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 packages/catalog-client/src/alpha.ts diff --git a/packages/catalog-client/package.json b/packages/catalog-client/package.json index 1e6501f470..2fd7f8915e 100644 --- a/packages/catalog-client/package.json +++ b/packages/catalog-client/package.json @@ -37,7 +37,8 @@ } }, "files": [ - "dist" + "dist", + "alpha" ], "scripts": { "build": "backstage-cli package build", diff --git a/packages/catalog-client/src/alpha.ts b/packages/catalog-client/src/alpha.ts new file mode 100644 index 0000000000..730b2f3c45 --- /dev/null +++ b/packages/catalog-client/src/alpha.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './generated'; diff --git a/packages/catalog-client/src/generated/apis/DefaultApi.client.ts b/packages/catalog-client/src/generated/apis/DefaultApi.client.ts index 1f1c54d6f8..598d9c706f 100644 --- a/packages/catalog-client/src/generated/apis/DefaultApi.client.ts +++ b/packages/catalog-client/src/generated/apis/DefaultApi.client.ts @@ -276,13 +276,14 @@ export class DefaultApiClient { /** * Get a batch set of entities given an array of entityRefs. + * @param filter Filter for just the entities defined by this filter. * @param getEntitiesByRefsRequest */ public async getEntitiesByRefs( // @ts-ignore request: { body: GetEntitiesByRefsRequest; - query?: { + query: { filter?: Array; }; }, @@ -290,9 +291,11 @@ export class DefaultApiClient { ): Promise> { const baseUrl = await this.discoveryApi.getBaseUrl(pluginId); - const uriTemplate = `/entities/by-refs/{?filter*}`; + const uriTemplate = `/entities/by-refs{?filter*}`; - const uri = parser.parse(uriTemplate).expand({ ...request.query }); + const uri = parser.parse(uriTemplate).expand({ + ...request.query, + }); return await this.fetchApi.fetch(`${baseUrl}${uri}`, { headers: { diff --git a/packages/catalog-client/src/index.ts b/packages/catalog-client/src/index.ts index 63748fa121..2e81942c2f 100644 --- a/packages/catalog-client/src/index.ts +++ b/packages/catalog-client/src/index.ts @@ -21,6 +21,4 @@ */ export { CatalogClient } from './CatalogClient'; -// export * from './types'; - -export * from './generated/models'; +export * from './types'; diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts index 05f7d48c2d..b929128de5 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts @@ -79,8 +79,8 @@ async function generate(abortSignal?: AbortController) { ); const additionalProperties = []; - if (clientPackage) { - additionalProperties.push(`clientPackageName=${clientPackage}`); + if (clientImport) { + additionalProperties.push(`clientImport=${clientImport}`); } await exec( diff --git a/packages/repo-tools/templates/typescript-backstage-server/api.mustache b/packages/repo-tools/templates/typescript-backstage-server/api.mustache index 6281e032ca..4289f00800 100644 --- a/packages/repo-tools/templates/typescript-backstage-server/api.mustache +++ b/packages/repo-tools/templates/typescript-backstage-server/api.mustache @@ -3,7 +3,7 @@ import type { {{#imports}} {{classname}}, {{/imports}} -} from '{{clientPackageName}}'; +} from '{{clientImport}}'; {{#operations}} diff --git a/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts b/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts index 6592d281e5..4de2d4e4ce 100644 --- a/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts +++ b/plugins/catalog-backend/src/generated/apis/DefaultApi.server.ts @@ -32,7 +32,7 @@ import type { Location, RefreshEntityRequest, ValidateEntityRequest, -} from '@backstage/catalog-client'; +} from '@backstage/catalog-client/alpha'; /** * no description @@ -100,7 +100,9 @@ export type EndpointMap = { '#post|/entities/by-refs': { path: {}; - query: {}; + query: { + filter?: Array; + }; body: GetEntitiesByRefsRequest; response: EntitiesBatchResponse; };