Revert "Refactor"

This reverts commit 54f4eba561.

Signed-off-by: sblausten <sam@roadie.io>
This commit is contained in:
sblausten
2022-07-06 17:13:42 +02:00
parent 54f4eba561
commit 4f17e4eb55
15 changed files with 92 additions and 226 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ import express from 'express';
import { FactChecker } from '@backstage/plugin-tech-insights-node';
import { FactCheckerFactory } from '@backstage/plugin-tech-insights-node';
import { FactLifecycle } from '@backstage/plugin-tech-insights-node';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
import { FactRetriever } from '@backstage/plugin-tech-insights-node';
import { FactRetrieverRegistration } from '@backstage/plugin-tech-insights-node';
import { FactSchema } from '@backstage/plugin-tech-insights-node';
import { Logger } from 'winston';
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import {
FactRetriever,
FactRetrieverRegistration,
FactSchemaDefinition,
TechInsightFact,
@@ -29,15 +30,12 @@ import {
import { ConfigReader } from '@backstage/config';
import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
import { TaskScheduler } from '@backstage/backend-tasks';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
jest.useFakeTimers();
const testFactRetriever: FactRetriever = {
id: 'test_factretriever',
version: '0.0.1',
title: 'Test 1',
description: 'testing',
entityFilter: [{ kind: 'component' }],
schema: {
testnumberfact: {
@@ -15,6 +15,7 @@
*/
import {
FactLifecycle,
FactRetriever,
FactRetrieverContext,
FactRetrieverRegistration,
TechInsightFact,
@@ -24,7 +25,6 @@ import { FactRetrieverRegistry } from './FactRetrieverRegistry';
import { Logger } from 'winston';
import { PluginTaskScheduler } from '@backstage/backend-tasks';
import { Duration } from 'luxon';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
function randomDailyCron() {
const rand = (min: number, max: number) =>
@@ -15,11 +15,11 @@
*/
import {
FactRetriever,
FactRetrieverRegistration,
FactSchema,
} from '@backstage/plugin-tech-insights-node';
import { ConflictError, NotFoundError } from '@backstage/errors';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
/**
* @public
@@ -15,15 +15,15 @@
*/
import {
FactLifecycle,
FactRetriever,
FactRetrieverRegistration,
} from '@backstage/plugin-tech-insights-node';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
/**
* @public
*
* @param cadence - cron expression to indicate when the fact retriever should be triggered
* @param factRetriever - Implementation of fact retriever definition
* @param factRetriever - Implementation of fact retriever consisting of at least id, version, schema and handler
* @param lifecycle - Optional lifecycle definition indicating the cleanup logic of facts when this retriever is run
*
*/
@@ -14,11 +14,13 @@
* limitations under the License.
*/
import { FactRetrieverContext } from '@backstage/plugin-tech-insights-node';
import {
FactRetriever,
FactRetrieverContext,
} from '@backstage/plugin-tech-insights-node';
import { CatalogClient } from '@backstage/catalog-client';
import { Entity } from '@backstage/catalog-model';
import isEmpty from 'lodash/isEmpty';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
/**
* Generates facts which indicate the completeness of entity metadata.
@@ -14,10 +14,12 @@
* limitations under the License.
*/
import { FactRetrieverContext } from '@backstage/plugin-tech-insights-node';
import {
FactRetriever,
FactRetrieverContext,
} from '@backstage/plugin-tech-insights-node';
import { CatalogClient } from '@backstage/catalog-client';
import { Entity } from '@backstage/catalog-model';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
/**
* Generates facts which indicate the quality of data in the spec.owner field.
@@ -14,11 +14,13 @@
* limitations under the License.
*/
import { FactRetrieverContext } from '@backstage/plugin-tech-insights-node';
import {
FactRetriever,
FactRetrieverContext,
} from '@backstage/plugin-tech-insights-node';
import { CatalogClient } from '@backstage/catalog-client';
import { Entity } from '@backstage/catalog-model';
import { entityHasAnnotation, generateAnnotationFactName } from './utils';
import { FactRetriever } from '@backstage/plugin-tech-insights-common';
const techdocsAnnotation = 'backstage.io/techdocs-ref';
const techdocsAnnotationFactName =