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
+5 -5
View File
@@ -16,9 +16,9 @@ import { LoggerService } from '@backstage/backend-plugin-api';
import { default as lunr_2 } from 'lunr';
import { Permission } from '@backstage/plugin-permission-common';
import { Readable } from 'stream';
import { SchedulerServiceTaskFunction } from '@backstage/backend-plugin-api';
import { SchedulerServiceTaskRunner } from '@backstage/backend-plugin-api';
import { SearchQuery } from '@backstage/plugin-search-common';
import { TaskFunction } from '@backstage/backend-tasks';
import { TaskRunner } from '@backstage/backend-tasks';
import { Transform } from 'stream';
import { UrlReaderService } from '@backstage/backend-plugin-api';
import { Writable } from 'stream';
@@ -158,7 +158,7 @@ export type QueryTranslator = (query: SearchQuery) => unknown;
// @public
export interface RegisterCollatorParameters {
factory: DocumentCollatorFactory;
schedule: TaskRunner;
schedule: SchedulerServiceTaskRunner;
}
// @public
@@ -177,8 +177,8 @@ export class Scheduler {
// @public
export type ScheduleTaskParameters = {
id: string;
task: TaskFunction;
scheduledRunner: TaskRunner;
task: SchedulerServiceTaskFunction;
scheduledRunner: SchedulerServiceTaskRunner;
};
// @public
-1
View File
@@ -55,7 +55,6 @@
"dependencies": {
"@backstage/backend-defaults": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/backend-tasks": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-permission-common": "workspace:^",
@@ -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.
*/