separates concerns of type usage within todo-backend

Signed-off-by: Oleg S <97077423+RobotSail@users.noreply.github.com>
This commit is contained in:
Oleg S
2023-02-16 12:39:47 -05:00
parent 581b1f8a3a
commit fd28151c95
4 changed files with 19 additions and 13 deletions
+2 -4
View File
@@ -8,7 +8,7 @@ import { CatalogApi } from '@backstage/catalog-client';
import { CompoundEntityRef } from '@backstage/catalog-model';
import { Config } from '@backstage/config';
import express from 'express';
import { HttpRouterService } from '@backstage/backend-plugin-api';
import type { HttpRouterService } from '@backstage/backend-plugin-api';
import { Logger } from 'winston';
import { ScmIntegrations } from '@backstage/integration';
import { UrlReader } from '@backstage/backend-common';
@@ -150,9 +150,7 @@ export interface TodoService {
// @alpha (undocumented)
export const todosPlugin: () => BackendFeature;
// Warning: (ae-missing-release-tag) "TodosPluginDependencies" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @alpha (undocumented)
export type TodosPluginDependencies = {
todoReader: TodoService;
http: HttpRouterService;
+6 -2
View File
@@ -16,8 +16,12 @@
export { createRouter } from './router';
export type { RouterOptions } from './router';
export type { TodoService, ListTodosRequest, ListTodosResponse } from './types';
export type {
TodoService,
ListTodosRequest,
ListTodosResponse,
TodosPluginDependencies,
} from './types';
export { TodoReaderService } from './TodoReaderService';
export type { TodoReaderServiceOptions } from './TodoReaderService';
export { todosPlugin } from './plugin';
export type { TodosPluginDependencies } from './plugin';
+2 -7
View File
@@ -17,7 +17,6 @@
import {
createBackendPlugin,
coreServices,
HttpRouterService,
} from '@backstage/backend-plugin-api';
import { CompoundEntityRef, parseEntityRef } from '@backstage/catalog-model';
import { InputError } from '@backstage/errors';
@@ -29,12 +28,8 @@ import {
parseOrderByParam,
} from '../lib/utils';
import { todoReaderServiceRef } from './TodoReaderService';
import { TodoService, TODO_FIELDS } from './types';
export type TodosPluginDependencies = {
todoReader: TodoService;
http: HttpRouterService;
};
import { TODO_FIELDS } from './types';
import type { TodosPluginDependencies } from './types';
const todosPluginInit = async (params: TodosPluginDependencies) => {
const { http, todoReader } = params;
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import type { HttpRouterService } from '@backstage/backend-plugin-api';
import { CompoundEntityRef } from '@backstage/catalog-model';
import { TodoItem } from '../lib';
@@ -56,3 +57,11 @@ export const TODO_FIELDS = [
'viewUrl',
'repoFilePath',
] as const;
/**
* @alpha
*/
export type TodosPluginDependencies = {
todoReader: TodoService;
http: HttpRouterService;
};