refactor: stop using backend-tasks in packages and plugins

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2024-08-16 13:59:40 +02:00
parent 41b02f5c3c
commit fc24d9ebf0
146 changed files with 605 additions and 508 deletions
@@ -14,7 +14,10 @@
* limitations under the License.
*/
import { TaskInvocationDefinition, TaskRunner } from '@backstage/backend-tasks';
import {
SchedulerServiceTaskRunner,
SchedulerServiceTaskInvocationDefinition,
} from '@backstage/backend-plugin-api';
import {
DocumentCollatorFactory,
DocumentDecoratorFactory,
@@ -54,12 +57,14 @@ class DifferentlyTypedDocumentDecoratorFactory extends TestDocumentDecoratorFact
describe('IndexBuilder', () => {
let testSearchEngine: SearchEngine;
let testIndexBuilder: IndexBuilder;
let testScheduledTaskRunner: TaskRunner;
let testScheduledTaskRunner: SchedulerServiceTaskRunner;
beforeEach(() => {
const logger = mockServices.logger.mock();
testScheduledTaskRunner = {
run: async (task: TaskInvocationDefinition & { fn: () => void }) => {
run: async (
task: SchedulerServiceTaskInvocationDefinition & { fn: () => void },
) => {
task.fn();
},
};
+9 -6
View File
@@ -14,12 +14,15 @@
* limitations under the License.
*/
import { TaskFunction, TaskRunner } from '@backstage/backend-tasks';
import { LoggerService } from '@backstage/backend-plugin-api';
import {
LoggerService,
SchedulerServiceTaskRunner,
SchedulerServiceTaskFunction,
} from '@backstage/backend-plugin-api';
type TaskEnvelope = {
task: TaskFunction;
scheduledRunner: TaskRunner;
task: SchedulerServiceTaskFunction;
scheduledRunner: SchedulerServiceTaskRunner;
};
/**
@@ -28,8 +31,8 @@ type TaskEnvelope = {
*/
export type ScheduleTaskParameters = {
id: string;
task: TaskFunction;
scheduledRunner: TaskRunner;
task: SchedulerServiceTaskFunction;
scheduledRunner: SchedulerServiceTaskRunner;
};
/**
+3 -3
View File
@@ -17,8 +17,8 @@
import {
BackstageCredentials,
LoggerService,
SchedulerServiceTaskRunner,
} from '@backstage/backend-plugin-api';
import { TaskRunner } from '@backstage/backend-tasks';
import {
DocumentCollatorFactory,
DocumentDecoratorFactory,
@@ -43,9 +43,9 @@ export type IndexBuilderOptions = {
export interface RegisterCollatorParameters {
/**
* The schedule for which the provided collator will be called, commonly the result of
* {@link @backstage/backend-tasks#PluginTaskScheduler.createScheduledTaskRunner}
* {@link @backstage/backend-plugin-api#SchedulerService.createScheduledTaskRunner}
*/
schedule: TaskRunner;
schedule: SchedulerServiceTaskRunner;
/**
* The class responsible for returning the document collator of the given type.
*/