deprecate everything in backend-tasks

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-04-25 11:54:18 +02:00
parent abc983847f
commit 736bc3c243
7 changed files with 25 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-tasks': patch
---
Marked all exports as deprecated and pointed at `@backstage/backend-plugin-api/scheduler` and `@backstage/backend-defaults/scheduler`
+9 -9
View File
@@ -14,7 +14,7 @@ import { PluginDatabaseManager } from '@backstage/backend-common';
// @public @deprecated
export type HumanDuration = HumanDuration_2;
// @public
// @public @deprecated
export interface PluginTaskScheduler {
createScheduledTaskRunner(schedule: TaskScheduleDefinition): TaskRunner;
getScheduledTasks(): Promise<TaskDescriptor[]>;
@@ -24,12 +24,12 @@ export interface PluginTaskScheduler {
triggerTask(id: string): Promise<void>;
}
// @public
// @public @deprecated
export function readTaskScheduleDefinitionFromConfig(
config: Config,
): TaskScheduleDefinition;
// @public
// @public @deprecated
export type TaskDescriptor = {
id: string;
scope: 'global' | 'local';
@@ -38,24 +38,24 @@ export type TaskDescriptor = {
} & JsonObject;
};
// @public
// @public @deprecated
export type TaskFunction =
| ((abortSignal: AbortSignal) => void | Promise<void>)
| (() => void | Promise<void>);
// @public
// @public @deprecated
export interface TaskInvocationDefinition {
fn: TaskFunction;
id: string;
signal?: AbortSignal;
}
// @public
// @public @deprecated
export interface TaskRunner {
run(task: TaskInvocationDefinition): Promise<void>;
}
// @public
// @public @deprecated
export interface TaskScheduleDefinition {
frequency:
| {
@@ -68,7 +68,7 @@ export interface TaskScheduleDefinition {
timeout: Duration | HumanDuration_2;
}
// @public
// @public @deprecated
export interface TaskScheduleDefinitionConfig {
frequency:
| {
@@ -81,7 +81,7 @@ export interface TaskScheduleDefinitionConfig {
timeout: string | HumanDuration_2;
}
// @public
// @public @deprecated
export class TaskScheduler {
constructor(
databaseManager: LegacyRootDatabaseService,
+2
View File
@@ -23,3 +23,5 @@ import { HumanDuration as TypesHumanDuration } from '@backstage/types';
* @deprecated Import from `@backstage/types` instead
*/
export type HumanDuration = TypesHumanDuration;
export * from './tasks';
-1
View File
@@ -20,5 +20,4 @@
* @packageDocumentation
*/
export * from './tasks';
export * from './deprecated';
@@ -33,6 +33,7 @@ import { LoggerService } from '@backstage/backend-plugin-api';
* Deals with the scheduling of distributed tasks.
*
* @public
* @deprecated Please migrate to the new backend system, and depend on `coreServices.scheduler` from `@backstage/backend-plugin-api` instead. The new default implementation of this service lives in `@backstage/backend-defaults/scheduler`.
*/
export class TaskScheduler {
static fromConfig(
@@ -51,6 +51,7 @@ function readCronOrDuration(
*
* @param config - config for a TaskScheduleDefinition.
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export function readTaskScheduleDefinitionFromConfig(
config: Config,
@@ -26,6 +26,7 @@ import { z } from 'zod';
* processing should abort and return as quickly as possible.
*
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export type TaskFunction =
| ((abortSignal: AbortSignal) => void | Promise<void>)
@@ -35,6 +36,7 @@ export type TaskFunction =
* A semi-opaque type to describe an actively scheduled task.
*
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export type TaskDescriptor = {
/**
@@ -57,6 +59,7 @@ export type TaskDescriptor = {
* Options that control the scheduling of a task.
*
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export interface TaskScheduleDefinition {
/**
@@ -154,6 +157,7 @@ export interface TaskScheduleDefinition {
* that control the scheduling of a task.
*
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export interface TaskScheduleDefinitionConfig {
/**
@@ -250,6 +254,7 @@ export interface TaskScheduleDefinitionConfig {
* Options that apply to the invocation of a given task.
*
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export interface TaskInvocationDefinition {
/**
@@ -273,6 +278,7 @@ export interface TaskInvocationDefinition {
* A previously prepared task schedule, ready to be invoked.
*
* @public
* @deprecated Please import from `@backstage/backend-plugin-api/scheduler` instead
*/
export interface TaskRunner {
/**
@@ -287,6 +293,7 @@ export interface TaskRunner {
* Deals with the scheduling of distributed tasks, for a given plugin.
*
* @public
* @deprecated Please use `SchedulerService` from `@backstage/backend-plugin-api/scheduler` instead
*/
export interface PluginTaskScheduler {
/**