chore: remove deprecated types and making breaking changes

Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
benjdlambert
2025-09-23 15:49:58 +02:00
parent 56d856b8ab
commit 6ea23c9c6d
10 changed files with 24 additions and 455 deletions
-373
View File
@@ -3,45 +3,21 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { AuditorService } from '@backstage/backend-plugin-api';
import { AuthService } from '@backstage/backend-plugin-api';
import { BackendFeature } from '@backstage/backend-plugin-api';
import { BackstageCredentials } from '@backstage/backend-plugin-api';
import { CatalogService } from '@backstage/plugin-catalog-node';
import { Config } from '@backstage/config';
import { DatabaseService } from '@backstage/backend-plugin-api';
import { Duration } from 'luxon';
import { EventsService } from '@backstage/plugin-events-node';
import { HumanDuration } from '@backstage/types';
import { JsonObject } from '@backstage/types';
import { Knex } from 'knex';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PermissionCriteria } from '@backstage/plugin-permission-common';
import { PermissionEvaluator } from '@backstage/plugin-permission-common';
import { PermissionRule } from '@backstage/plugin-permission-node';
import { PermissionRuleParams } from '@backstage/plugin-permission-common';
import { RESOURCE_TYPE_SCAFFOLDER_ACTION } from '@backstage/plugin-scaffolder-common/alpha';
import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common/alpha';
import { ScmIntegrations } from '@backstage/integration';
import { SerializedTask } from '@backstage/plugin-scaffolder-node';
import { SerializedTaskEvent } from '@backstage/plugin-scaffolder-node';
import { TaskBroker } from '@backstage/plugin-scaffolder-node';
import { TaskCompletionState } from '@backstage/plugin-scaffolder-node';
import { TaskContext } from '@backstage/plugin-scaffolder-node';
import { TaskFilters } from '@backstage/plugin-scaffolder-node';
import { TaskRecovery } from '@backstage/plugin-scaffolder-common';
import { TaskSecrets } from '@backstage/plugin-scaffolder-node';
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
import { TaskStatus } from '@backstage/plugin-scaffolder-node';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
import { TemplateEntityStepV1beta3 } from '@backstage/plugin-scaffolder-common';
import { TemplateFilter } from '@backstage/plugin-scaffolder-node';
import { TemplateGlobal } from '@backstage/plugin-scaffolder-node';
import { TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
import { UpdateTaskCheckpointOptions } from '@backstage/plugin-scaffolder-node/alpha';
import { UrlReaderService } from '@backstage/backend-plugin-api';
import { WorkspaceProvider } from '@backstage/plugin-scaffolder-node/alpha';
// @public (undocumented)
export type ActionPermissionRuleInput<
@@ -267,359 +243,10 @@ export function createWaitAction(options?: {
'v2'
>;
// @public @deprecated
export type CreateWorkerOptions = {
taskBroker: TaskBroker;
actionRegistry: TemplateActionRegistry;
integrations: ScmIntegrations;
workingDirectory: string;
logger: LoggerService;
auditor?: AuditorService;
config?: Config;
additionalTemplateFilters?: Record<string, TemplateFilter>;
concurrentTasksLimit?: number;
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
permissions?: PermissionEvaluator;
gracefulShutdown?: boolean;
};
// @public
export interface CurrentClaimedTask {
createdBy?: string;
secrets?: TaskSecrets;
spec: TaskSpec;
state?: JsonObject;
taskId: string;
workspace?: Promise<Buffer>;
}
// @public @deprecated
export class DatabaseTaskStore implements TaskStore {
// (undocumented)
cancelTask(
options: TaskStoreEmitOptions<
{
message: string;
} & JsonObject
>,
): Promise<void>;
// (undocumented)
claimTask(): Promise<SerializedTask | undefined>;
// (undocumented)
cleanWorkspace({ taskId }: { taskId: string }): Promise<void>;
// (undocumented)
completeTask(options: {
taskId: string;
status: TaskStatus;
eventBody: JsonObject;
}): Promise<void>;
// (undocumented)
static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
// (undocumented)
createTask(
options: TaskStoreCreateTaskOptions,
): Promise<TaskStoreCreateTaskResult>;
// (undocumented)
emitLogEvent(
options: TaskStoreEmitOptions<
{
message: string;
} & JsonObject
>,
): Promise<void>;
// (undocumented)
getTask(taskId: string): Promise<SerializedTask>;
// (undocumented)
getTaskState({ taskId }: { taskId: string }): Promise<
| {
state: JsonObject;
}
| undefined
>;
// (undocumented)
heartbeatTask(taskId: string): Promise<void>;
// (undocumented)
list(options: {
createdBy?: string;
status?: TaskStatus;
filters?: {
createdBy?: string | string[];
status?: TaskStatus | TaskStatus[];
};
pagination?: {
limit?: number;
offset?: number;
};
order?: {
order: 'asc' | 'desc';
field: string;
}[];
permissionFilters?: PermissionCriteria<TaskFilters>;
}): Promise<{
tasks: SerializedTask[];
totalTasks?: number;
}>;
// (undocumented)
listEvents(options: TaskStoreListEventsOptions): Promise<{
events: SerializedTaskEvent[];
}>;
// (undocumented)
listStaleTasks(options: { timeoutS: number }): Promise<{
tasks: {
taskId: string;
recovery?: TaskRecovery;
}[];
}>;
// (undocumented)
recoverTasks(options: TaskStoreRecoverTaskOptions): Promise<{
ids: string[];
}>;
// (undocumented)
rehydrateWorkspace(options: {
taskId: string;
targetPath: string;
}): Promise<void>;
// (undocumented)
retryTask?(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
// (undocumented)
saveTaskState(options: { taskId: string; state?: JsonObject }): Promise<void>;
// (undocumented)
serializeWorkspace(options: { path: string; taskId: string }): Promise<void>;
// (undocumented)
shutdownTask(options: TaskStoreShutDownTaskOptions): Promise<void>;
}
// @public @deprecated
export type DatabaseTaskStoreOptions = {
database: DatabaseService | Knex;
events?: EventsService;
};
// @public
const scaffolderPlugin: BackendFeature;
export default scaffolderPlugin;
// @public @deprecated
export class TaskManager implements TaskContext {
// (undocumented)
get cancelSignal(): AbortSignal;
// (undocumented)
cleanWorkspace?(): Promise<void>;
// (undocumented)
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
// (undocumented)
static create(
task: CurrentClaimedTask,
storage: TaskStore,
abortSignal: AbortSignal,
logger: LoggerService,
auth?: AuthService,
config?: Config,
additionalWorkspaceProviders?: Record<string, WorkspaceProvider>,
): TaskManager;
// (undocumented)
get createdBy(): string | undefined;
// (undocumented)
get done(): boolean;
// (undocumented)
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
// (undocumented)
getInitiatorCredentials(): Promise<BackstageCredentials>;
// (undocumented)
getTaskState?(): Promise<
| {
state?: JsonObject;
}
| undefined
>;
// (undocumented)
getWorkspaceName(): Promise<string>;
// (undocumented)
rehydrateWorkspace?(options: {
taskId: string;
targetPath: string;
}): Promise<void>;
// (undocumented)
get secrets(): TaskSecrets | undefined;
// (undocumented)
serializeWorkspace?(options: { path: string }): Promise<void>;
// (undocumented)
get spec(): TaskSpecV1beta3;
// (undocumented)
get taskId(): string;
// (undocumented)
updateCheckpoint?(options: UpdateTaskCheckpointOptions): Promise<void>;
}
// @public @deprecated
export interface TaskStore {
// (undocumented)
cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
// (undocumented)
claimTask(): Promise<SerializedTask | undefined>;
// (undocumented)
cleanWorkspace?({ taskId }: { taskId: string }): Promise<void>;
// (undocumented)
completeTask(options: {
taskId: string;
status: TaskStatus;
eventBody: JsonObject;
}): Promise<void>;
// (undocumented)
createTask(
options: TaskStoreCreateTaskOptions,
): Promise<TaskStoreCreateTaskResult>;
// (undocumented)
emitLogEvent(options: TaskStoreEmitOptions): Promise<void>;
// (undocumented)
getTask(taskId: string): Promise<SerializedTask>;
// (undocumented)
getTaskState?({ taskId }: { taskId: string }): Promise<
| {
state: JsonObject;
}
| undefined
>;
// (undocumented)
heartbeatTask(taskId: string): Promise<void>;
// (undocumented)
list?(options: {
filters?: {
createdBy?: string | string[];
status?: TaskStatus | TaskStatus[];
};
pagination?: {
limit?: number;
offset?: number;
};
permissionFilters?: PermissionCriteria<TaskFilters>;
order?: {
order: 'asc' | 'desc';
field: string;
}[];
}): Promise<{
tasks: SerializedTask[];
totalTasks?: number;
}>;
// @deprecated (undocumented)
list?(options: {
createdBy?: string;
status?: TaskStatus;
filters?: {
createdBy?: string | string[];
status?: TaskStatus | TaskStatus[];
};
pagination?: {
limit?: number;
offset?: number;
};
order?: {
order: 'asc' | 'desc';
field: string;
}[];
}): Promise<{
tasks: SerializedTask[];
totalTasks?: number;
}>;
// (undocumented)
listEvents(options: TaskStoreListEventsOptions): Promise<{
events: SerializedTaskEvent[];
}>;
// (undocumented)
listStaleTasks(options: { timeoutS: number }): Promise<{
tasks: {
taskId: string;
}[];
}>;
// (undocumented)
recoverTasks?(options: TaskStoreRecoverTaskOptions): Promise<{
ids: string[];
}>;
// (undocumented)
rehydrateWorkspace?(options: {
taskId: string;
targetPath: string;
}): Promise<void>;
// (undocumented)
retryTask?(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
// (undocumented)
saveTaskState?(options: {
taskId: string;
state?: JsonObject;
}): Promise<void>;
// (undocumented)
serializeWorkspace?({
path,
taskId,
}: {
path: string;
taskId: string;
}): Promise<void>;
// (undocumented)
shutdownTask?(options: TaskStoreShutDownTaskOptions): Promise<void>;
}
// @public @deprecated
export type TaskStoreCreateTaskOptions = {
spec: TaskSpec;
createdBy?: string;
secrets?: TaskSecrets;
};
// @public @deprecated
export type TaskStoreCreateTaskResult = {
taskId: string;
};
// @public @deprecated
export type TaskStoreEmitOptions<TBody = JsonObject> = {
taskId: string;
body: TBody;
};
// @public @deprecated
export type TaskStoreListEventsOptions = {
isTaskRecoverable?: boolean;
taskId: string;
after?: number | undefined;
};
// @public @deprecated
export type TaskStoreRecoverTaskOptions = {
timeout: HumanDuration;
};
// @public @deprecated
export type TaskStoreShutDownTaskOptions = {
taskId: string;
};
// @public @deprecated
export class TaskWorker {
// (undocumented)
static create(options: CreateWorkerOptions): Promise<TaskWorker>;
// (undocumented)
protected onReadyToClaimTask(): Promise<void>;
// (undocumented)
recoverTasks(): Promise<void>;
// (undocumented)
runOneTask(task: TaskContext): Promise<void>;
// (undocumented)
start(): void;
// (undocumented)
stop(): Promise<void>;
}
// @public @deprecated
export class TemplateActionRegistry {
// (undocumented)
get(actionId: string): TemplateAction<any, any, any>;
// (undocumented)
list(): TemplateAction<any, any, any>[];
// (undocumented)
register(action: TemplateAction<any, any, any>): void;
}
// @public (undocumented)
export type TemplatePermissionRuleInput<
TParams extends PermissionRuleParams = PermissionRuleParams,
+3 -1
View File
@@ -21,7 +21,9 @@
*/
export { scaffolderPlugin as default } from './ScaffolderPlugin';
export * from './scaffolder';
export * from './scaffolder/actions/builtin';
export {
type TemplatePermissionRuleInput,
type ActionPermissionRuleInput,
@@ -16,10 +16,9 @@
import { ConflictError, NotFoundError } from '@backstage/errors';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
/**
* Registry of all registered template actions.
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export class TemplateActionRegistry {
private readonly actions = new Map<string, TemplateAction>();
@@ -85,8 +85,6 @@ export type RawDbTaskEventRow = {
/**
* DatabaseTaskStore
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
* @public
*/
export type DatabaseTaskStoreOptions = {
database: DatabaseService | Knex;
@@ -118,8 +116,6 @@ const parseSqlDateToIsoString = <T>(input: T): T | string => {
/**
* DatabaseTaskStore
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
* @public
*/
export class DatabaseTaskStore implements TaskStore {
private readonly db: Knex;
@@ -723,7 +719,7 @@ export class DatabaseTaskStore implements TaskStore {
});
}
async retryTask?(options: {
async retryTask(options: {
secrets?: TaskSecrets;
taskId: string;
}): Promise<void> {
@@ -33,7 +33,7 @@ import {
SecureTemplater,
SecureTemplateRenderer,
} from '../../lib/templating/SecureTemplater';
import { TemplateActionRegistry } from '../actions';
import { TemplateActionRegistry } from '../actions/TemplateActionRegistry';
import { generateExampleOutput, isTruthy } from './helper';
import { TaskTrackType, WorkflowResponse, WorkflowRunner } from './types';
@@ -50,8 +50,6 @@ type TaskState = {
};
/**
* TaskManager
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
* @public
*/
export class TaskManager implements TaskContext {
private isDone = false;
@@ -488,7 +486,7 @@ export class StorageTaskBroker implements TaskBroker {
});
}
async retry?(options: {
async retry(options: {
secrets?: TaskSecrets;
taskId: string;
}): Promise<void> {
@@ -25,7 +25,7 @@ import {
TemplateGlobal,
} from '@backstage/plugin-scaffolder-node';
import PQueue from 'p-queue';
import { TemplateActionRegistry } from '../actions';
import { TemplateActionRegistry } from '../actions/TemplateActionRegistry';
import { NunjucksWorkflowRunner } from './NunjucksWorkflowRunner';
import { WorkflowRunner } from './types';
import { setTimeout } from 'timers/promises';
@@ -36,8 +36,6 @@ const DEFAULT_TASK_PARAMETER_MAX_LENGTH = 256;
/**
* TaskWorkerOptions
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
* @public
*/
export type TaskWorkerOptions = {
taskBroker: TaskBroker;
@@ -54,8 +52,6 @@ export type TaskWorkerOptions = {
/**
* CreateWorkerOptions
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
* @public
*/
export type CreateWorkerOptions = {
taskBroker: TaskBroker;
@@ -86,8 +82,6 @@ export type CreateWorkerOptions = {
/**
* TaskWorker
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
* @public
*/
export class TaskWorker {
private taskQueue: PQueue;
@@ -30,8 +30,6 @@ import { PermissionCriteria } from '@backstage/plugin-permission-common';
/**
* TaskStoreEmitOptions
*
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export type TaskStoreEmitOptions<TBody = JsonObject> = {
taskId: string;
@@ -41,8 +39,6 @@ export type TaskStoreEmitOptions<TBody = JsonObject> = {
/**
* TaskStoreListEventsOptions
*
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export type TaskStoreListEventsOptions = {
isTaskRecoverable?: boolean;
@@ -53,8 +49,6 @@ export type TaskStoreListEventsOptions = {
/**
* TaskStoreShutDownTaskOptions
*
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export type TaskStoreShutDownTaskOptions = {
taskId: string;
@@ -62,8 +56,6 @@ export type TaskStoreShutDownTaskOptions = {
/**
* The options passed to {@link TaskStore.createTask}
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export type TaskStoreCreateTaskOptions = {
spec: TaskSpec;
@@ -73,8 +65,6 @@ export type TaskStoreCreateTaskOptions = {
/**
* The options passed to {@link TaskStore.recoverTasks}
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export type TaskStoreRecoverTaskOptions = {
timeout: HumanDuration;
@@ -82,8 +72,6 @@ export type TaskStoreRecoverTaskOptions = {
/**
* The response from {@link TaskStore.createTask}
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export type TaskStoreCreateTaskResult = {
taskId: string;
@@ -92,19 +80,17 @@ export type TaskStoreCreateTaskResult = {
/**
* TaskStore
*
* @public
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
*/
export interface TaskStore {
cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
cancelTask(options: TaskStoreEmitOptions): Promise<void>;
createTask(
options: TaskStoreCreateTaskOptions,
): Promise<TaskStoreCreateTaskResult>;
retryTask?(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
retryTask(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
recoverTasks?(
recoverTasks(
options: TaskStoreRecoverTaskOptions,
): Promise<{ ids: string[] }>;
@@ -137,51 +123,31 @@ export interface TaskStore {
order?: { order: 'asc' | 'desc'; field: string }[];
}): Promise<{ tasks: SerializedTask[]; totalTasks?: number }>;
/**
* @deprecated Make sure to pass `createdBy` and `status` in the `filters` parameter instead
*/
list?(options: {
createdBy?: string;
status?: TaskStatus;
filters?: {
createdBy?: string | string[];
status?: TaskStatus | TaskStatus[];
};
pagination?: {
limit?: number;
offset?: number;
};
order?: { order: 'asc' | 'desc'; field: string }[];
}): Promise<{ tasks: SerializedTask[]; totalTasks?: number }>;
emitLogEvent(options: TaskStoreEmitOptions): Promise<void>;
getTaskState?({ taskId }: { taskId: string }): Promise<
getTaskState({ taskId }: { taskId: string }): Promise<
| {
state: JsonObject;
}
| undefined
>;
saveTaskState?(options: {
taskId: string;
state?: JsonObject;
}): Promise<void>;
saveTaskState(options: { taskId: string; state?: JsonObject }): Promise<void>;
listEvents(
options: TaskStoreListEventsOptions,
): Promise<{ events: SerializedTaskEvent[] }>;
shutdownTask?(options: TaskStoreShutDownTaskOptions): Promise<void>;
shutdownTask(options: TaskStoreShutDownTaskOptions): Promise<void>;
rehydrateWorkspace?(options: {
taskId: string;
targetPath: string;
}): Promise<void>;
cleanWorkspace?({ taskId }: { taskId: string }): Promise<void>;
cleanWorkspace({ taskId }: { taskId: string }): Promise<void>;
serializeWorkspace?({
serializeWorkspace({
path,
taskId,
}: {
+4 -9
View File
@@ -356,7 +356,7 @@ export type SerializedTaskEvent = {
// @public
export interface TaskBroker {
// (undocumented)
cancel?(taskId: string): Promise<void>;
cancel(taskId: string): Promise<void>;
// (undocumented)
claim(): Promise<TaskContext>;
// (undocumented)
@@ -370,7 +370,7 @@ export interface TaskBroker {
// (undocumented)
get(taskId: string): Promise<SerializedTask>;
// (undocumented)
list?(options?: {
list(options?: {
filters?: {
createdBy?: string | string[];
status?: TaskStatus | TaskStatus[];
@@ -388,15 +388,10 @@ export interface TaskBroker {
tasks: SerializedTask[];
totalTasks?: number;
}>;
// @deprecated (undocumented)
list?(options: { createdBy?: string; status?: TaskStatus }): Promise<{
tasks: SerializedTask[];
totalTasks?: number;
}>;
// (undocumented)
recoverTasks?(): Promise<void>;
recoverTasks(): Promise<void>;
// (undocumented)
retry?(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
retry(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
// (undocumented)
vacuumTasks(options: { timeoutS: number }): Promise<void>;
}
+4 -12
View File
@@ -177,13 +177,13 @@ export interface TaskContext {
* @public
*/
export interface TaskBroker {
cancel?(taskId: string): Promise<void>;
cancel(taskId: string): Promise<void>;
retry?(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
retry(options: { secrets?: TaskSecrets; taskId: string }): Promise<void>;
claim(): Promise<TaskContext>;
recoverTasks?(): Promise<void>;
recoverTasks(): Promise<void>;
dispatch(
options: TaskBrokerDispatchOptions,
@@ -198,7 +198,7 @@ export interface TaskBroker {
get(taskId: string): Promise<SerializedTask>;
list?(options?: {
list(options?: {
filters?: {
createdBy?: string | string[];
status?: TaskStatus | TaskStatus[];
@@ -210,12 +210,4 @@ export interface TaskBroker {
order?: { order: 'asc' | 'desc'; field: string }[];
permissionFilters?: PermissionCriteria<TaskFilters>;
}): Promise<{ tasks: SerializedTask[]; totalTasks?: number }>;
/**
* @deprecated Make sure to pass `createdBy` and `status` in the `filters` parameter instead
*/
list?(options: {
createdBy?: string;
status?: TaskStatus;
}): Promise<{ tasks: SerializedTask[]; totalTasks?: number }>;
}