Deprecate and re-export

Signed-off-by: solimant <solimant@users.noreply.github.com>
This commit is contained in:
solimant
2024-12-27 07:22:58 +00:00
parent e2fa65af59
commit d2da49c568
103 changed files with 1619 additions and 3018 deletions
+85 -192
View File
@@ -13,47 +13,54 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common';
import { JsonObject, JsonValue, Observable } from '@backstage/types';
import { JSONSchema7 } from 'json-schema';
import { TemplateParameterSchema } from '../types';
import {
type ScaffolderApi as _ScaffolderApi,
type ScaffolderDryRunOptions as _ScaffolderDryRunOptions,
type ScaffolderDryRunResponse as _ScaffolderDryRunResponse,
type ScaffolderGetIntegrationsListOptions as _ScaffolderGetIntegrationsListOptions,
type ScaffolderGetIntegrationsListResponse as _ScaffolderGetIntegrationsListResponse,
type ScaffolderScaffoldOptions as _ScaffolderScaffoldOptions,
type ScaffolderScaffoldResponse as _ScaffolderScaffoldResponse,
type ScaffolderStreamLogsOptions as _ScaffolderStreamLogsOptions,
type ScaffolderUsageExample as _ScaffolderUsageExample,
type Action as _Action,
type ListActionsResponse as _ListActionsResponse,
type ListTemplatingExtensionsResponse as _ListTemplatingExtensionsResponse,
type LogEvent as _LogEvent,
type ScaffolderOutputLink as _ScaffolderOutputLink,
type ScaffolderOutputText as _ScaffolderOutputText,
type ScaffolderTask as _ScaffolderTask,
type ScaffolderTaskOutput as _ScaffolderTaskOutput,
type ScaffolderTaskStatus as _ScaffolderTaskStatus,
type TemplateFilter as _TemplateFilter,
type TemplateGlobalFunction as _TemplateGlobalFunction,
type TemplateGlobalValue as _TemplateGlobalValue,
} from '@backstage/plugin-scaffolder-common';
/**
* The status of each task in a Scaffolder Job
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskStatus} instead as this has now been moved.
*/
export type ScaffolderTaskStatus =
| 'cancelled'
| 'completed'
| 'failed'
| 'open'
| 'processing'
| 'skipped';
export type ScaffolderTaskStatus = _ScaffolderTaskStatus;
/**
* The shape of each task returned from the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTask} instead as this has now been moved.
*/
export type ScaffolderTask = {
id: string;
spec: TaskSpec;
status: 'failed' | 'completed' | 'processing' | 'open' | 'cancelled';
lastHeartbeatAt: string;
createdAt: string;
};
export type ScaffolderTask = _ScaffolderTask;
/**
* A single scaffolder usage example
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderUsageExample} instead as this has now been moved.
*/
export type ScaffolderUsageExample = {
description?: string;
example: string;
notes?: string;
};
export type ScaffolderUsageExample = _ScaffolderUsageExample;
/**
* A single action example
@@ -67,249 +74,135 @@ export type ActionExample = ScaffolderUsageExample;
* The response shape for a single action in the `listActions` call to the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#Action} instead as this has now been moved.
*/
export type Action = {
id: string;
description?: string;
schema?: {
input?: JSONSchema7;
output?: JSONSchema7;
};
examples?: ActionExample[];
};
export type Action = _Action;
/**
* The response shape for the `listActions` call to the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListActionsResponse} instead as this has now been moved.
*/
export type ListActionsResponse = Array<Action>;
export type ListActionsResponse = _ListActionsResponse;
/**
* The response shape for a single filter in the `listTemplatingExtensions` call to the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateFilter} instead as this has now been moved.
*/
export type TemplateFilter = {
description?: string;
schema?: {
input?: JSONSchema7;
arguments?: JSONSchema7[];
output?: JSONSchema7;
};
examples?: ScaffolderUsageExample[];
};
export type TemplateFilter = _TemplateFilter;
/**
* The response shape for a single global function in the `listTemplatingExtensions` call to the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateGlobalFunction} instead as this has now been moved.
*/
export type TemplateGlobalFunction = {
description?: string;
schema?: {
arguments?: JSONSchema7[];
output?: JSONSchema7;
};
examples?: ScaffolderUsageExample[];
};
export type TemplateGlobalFunction = _TemplateGlobalFunction;
/**
* The response shape for a single global value in the `listTemplatingExtensions` call to the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateGlobalValue} instead as this has now been moved.
*/
export type TemplateGlobalValue = {
description?: string;
value: JsonValue;
};
export type TemplateGlobalValue = _TemplateGlobalValue;
/**
* The response shape for the `listTemplatingExtensions` call to the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ListTemplatingExtensionsResponse} instead as this has now been moved.
*/
export type ListTemplatingExtensionsResponse = {
filters: Record<string, TemplateFilter>;
globals: {
functions: Record<string, TemplateGlobalFunction>;
values: Record<string, TemplateGlobalValue>;
};
};
export type ListTemplatingExtensionsResponse =
_ListTemplatingExtensionsResponse;
/** @public */
export type ScaffolderOutputLink = {
title?: string;
icon?: string;
url?: string;
entityRef?: string;
};
/**
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputLink} instead as this has now been moved.
*/
export type ScaffolderOutputLink = _ScaffolderOutputLink;
/** @public */
export type ScaffolderOutputText = {
title?: string;
icon?: string;
content?: string;
default?: boolean;
};
/**
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderOutputText} instead as this has now been moved.
*/
export type ScaffolderOutputText = _ScaffolderOutputText;
/** @public */
export type ScaffolderTaskOutput = {
links?: ScaffolderOutputLink[];
text?: ScaffolderOutputText[];
} & {
[key: string]: unknown;
};
/**
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderTaskOutput} instead as this has now been moved.
*/
export type ScaffolderTaskOutput = _ScaffolderTaskOutput;
/**
* The shape of a `LogEvent` message from the `scaffolder-backend`
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#LogEvent} instead as this has now been moved.
*/
export type LogEvent = {
type: 'log' | 'completion' | 'cancelled' | 'recovered';
body: {
message: string;
stepId?: string;
status?: ScaffolderTaskStatus;
};
createdAt: string;
id: string;
taskId: string;
};
export type LogEvent = _LogEvent;
/**
* The input options to the `scaffold` method of the `ScaffolderClient`.
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldOptions} instead as this has now been moved.
*/
export interface ScaffolderScaffoldOptions {
templateRef: string;
values: Record<string, JsonValue>;
secrets?: Record<string, string>;
}
export type ScaffolderScaffoldOptions = _ScaffolderScaffoldOptions;
/**
* The response shape of the `scaffold` method of the `ScaffolderClient`.
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderScaffoldResponse} instead as this has now been moved.
*/
export interface ScaffolderScaffoldResponse {
taskId: string;
}
export type ScaffolderScaffoldResponse = _ScaffolderScaffoldResponse;
/**
* The arguments for `getIntegrationsList`.
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListOptions} instead as this has now been moved.
*/
export interface ScaffolderGetIntegrationsListOptions {
allowedHosts: string[];
}
export type ScaffolderGetIntegrationsListOptions =
_ScaffolderGetIntegrationsListOptions;
/**
* The response shape for `getIntegrationsList`.
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderGetIntegrationsListResponse} instead as this has now been moved.
*/
export interface ScaffolderGetIntegrationsListResponse {
integrations: { type: string; title: string; host: string }[];
}
export type ScaffolderGetIntegrationsListResponse =
_ScaffolderGetIntegrationsListResponse;
/**
* The input options to the `streamLogs` method of the `ScaffolderClient`.
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderStreamLogsOptions} instead as this has now been moved.
*/
export interface ScaffolderStreamLogsOptions {
isTaskRecoverable?: boolean;
taskId: string;
after?: number;
}
export type ScaffolderStreamLogsOptions = _ScaffolderStreamLogsOptions;
/** @public */
export interface ScaffolderDryRunOptions {
template: JsonValue;
values: JsonObject;
secrets?: Record<string, string>;
directoryContents: { path: string; base64Content: string }[];
}
/**
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunOptions} instead as this has now been moved.
*/
export type ScaffolderDryRunOptions = _ScaffolderDryRunOptions;
/**
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderDryRunResponse} instead as this has now been moved.
*/
export type ScaffolderDryRunResponse = _ScaffolderDryRunResponse;
/** @public */
export interface ScaffolderDryRunResponse {
directoryContents: Array<{
path: string;
base64Content: string;
executable: boolean;
}>;
log: Array<Pick<LogEvent, 'body'>>;
steps: TaskStep[];
output: ScaffolderTaskOutput;
}
/**
* An API to interact with the scaffolder backend.
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#ScaffolderApi} instead as this has now been moved.
*/
export interface ScaffolderApi {
getTemplateParameterSchema(
templateRef: string,
): Promise<TemplateParameterSchema>;
/**
* Executes the scaffolding of a component, given a template and its
* parameter values.
*
* @param options - The {@link ScaffolderScaffoldOptions} the scaffolding.
*/
scaffold(
options: ScaffolderScaffoldOptions,
): Promise<ScaffolderScaffoldResponse>;
getTask(taskId: string): Promise<ScaffolderTask>;
/**
* Sends a signal to a task broker to cancel the running task by taskId.
*
* @param taskId - the id of the task
*/
cancelTask(taskId: string): Promise<void>;
/**
* Starts the task again from the point where it failed.
*
* @param taskId - the id of the task
*/
retry?(taskId: string): Promise<void>;
listTasks?(options: {
filterByOwnership: 'owned' | 'all';
limit?: number;
offset?: number;
}): Promise<{ tasks: ScaffolderTask[]; totalTasks?: number }>;
getIntegrationsList(
options: ScaffolderGetIntegrationsListOptions,
): Promise<ScaffolderGetIntegrationsListResponse>;
/**
* Returns a list of all installed actions.
*/
listActions(): Promise<ListActionsResponse>;
/**
* Returns a structure describing the available templating extensions.
*/
listTemplatingExtensions?(): Promise<ListTemplatingExtensionsResponse>;
streamLogs(options: ScaffolderStreamLogsOptions): Observable<LogEvent>;
dryRun?(options: ScaffolderDryRunOptions): Promise<ScaffolderDryRunResponse>;
autocomplete?(options: {
token: string;
provider: string;
resource: string;
context?: Record<string, string>;
}): Promise<{ results: { title?: string; id: string }[] }>;
}
export type ScaffolderApi = _ScaffolderApi;
+3 -14
View File
@@ -14,24 +14,13 @@
* limitations under the License.
*/
import { JsonObject } from '@backstage/types';
import { TemplatePresentationV1beta3 } from '@backstage/plugin-scaffolder-common';
import { TemplateParameterSchema as _TemplateParameterSchema } from '@backstage/plugin-scaffolder-common';
/**
* The shape of each entry of parameters which gets rendered
* as a separate step in the wizard input
*
* @public
* @deprecated use import from {@link @backstage/plugin-scaffolder-common#TemplateParameterSchema} instead as this has now been moved.
*/
export type TemplateParameterSchema = {
title: string;
description?: string;
presentation?: TemplatePresentationV1beta3;
steps: Array<{
title: string;
description?: string;
schema: JsonObject;
}>;
EXPERIMENTAL_formDecorators?: { id: string; input?: JsonObject }[];
};
export type TemplateParameterSchema = _TemplateParameterSchema;