Fix API report

Signed-off-by: solimant <solimant@users.noreply.github.com>
This commit is contained in:
solimant
2024-12-30 22:28:21 +00:00
parent bd7ae8559d
commit 68eca7b9a0
9 changed files with 483 additions and 351 deletions
@@ -45,9 +45,6 @@ import {
TaskStatus,
TypedResponse,
} from '../client/src/schema/openapi';
import { DiscoveryApi } from '../client/src/schema/openapi/generated/types/discovery';
import { FetchApi } from '../client/src/schema/openapi/generated/types/fetch';
import { IdentityApi } from './types/IdentityApi';
/**
* An API to interact with the scaffolder backend.
@@ -56,16 +53,30 @@ import { IdentityApi } from './types/IdentityApi';
*/
export class ScaffolderClient implements ScaffolderApi {
private readonly apiClient: DefaultApiClient;
private readonly discoveryApi: DiscoveryApi;
private readonly discoveryApi: {
getBaseUrl(pluginId: string): Promise<string>;
};
private readonly scmIntegrationsApi: ScmIntegrationRegistry;
private readonly fetchApi: FetchApi;
private readonly identityApi?: IdentityApi;
private readonly fetchApi: { fetch: typeof fetch };
private readonly identityApi?: {
getBackstageIdentity(): Promise<{
type: 'user';
userEntityRef: string;
ownershipEntityRefs: string[];
}>;
};
private readonly useLongPollingLogs: boolean;
constructor(options: {
discoveryApi: DiscoveryApi;
fetchApi: FetchApi;
identityApi?: IdentityApi;
discoveryApi: { getBaseUrl(pluginId: string): Promise<string> };
fetchApi: { fetch: typeof fetch };
identityApi?: {
getBackstageIdentity(): Promise<{
type: 'user';
userEntityRef: string;
ownershipEntityRefs: string[];
}>;
};
scmIntegrationsApi: ScmIntegrationRegistry;
useLongPollingLogs?: boolean;
}) {
+1 -1
View File
@@ -25,7 +25,7 @@ import type {
TaskStatus as ScaffolderTaskStatus,
} from '../client/src/schema/openapi';
export type { ScaffolderTaskStatus };
export type { ScaffolderTaskStatus, TaskEventType };
/**
* Options you can pass into a Scaffolder request for additional information.
@@ -1,47 +0,0 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This is a copy of the BackstageUserIdentity, to avoid importing core-plugin-api.
*/
type BackstageUserIdentity = {
/**
* The type of identity that this structure represents. In the frontend app
* this will currently always be 'user'.
*/
type: 'user';
/**
* The entityRef of the user in the catalog.
* For example User:default/sandra
*/
userEntityRef: string;
/**
* The user and group entities that the user claims ownership through
*/
ownershipEntityRefs: string[];
};
/**
* This is a partial copy of the IdentityApi, to avoid importing core-plugin-api.
*/
export type IdentityApi = {
/**
* User identity information within Backstage.
*/
getBackstageIdentity(): Promise<BackstageUserIdentity>;
};