catalog: Move database, processing and stitching out of next
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ import {
|
||||
DbRefreshStateRow,
|
||||
DbRelationsRow,
|
||||
} from './tables';
|
||||
import { createRandomRefreshInterval } from '../refresh';
|
||||
import { createRandomRefreshInterval } from '../next/refresh';
|
||||
import { timestampToDateTime } from './conversion';
|
||||
import { generateStableHash } from './util';
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import {
|
||||
UpdateEntityCacheOptions,
|
||||
} from './types';
|
||||
import { DeferredEntity } from '../processing/types';
|
||||
import { RefreshIntervalFunction } from '../refresh';
|
||||
import { RefreshIntervalFunction } from '../next/refresh';
|
||||
import { rethrowError, timestampToDateTime } from './conversion';
|
||||
import { initDatabaseMetrics } from './metrics';
|
||||
import {
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Knex } from 'knex';
|
||||
import { createGaugeMetric } from '../metrics';
|
||||
import { createGaugeMetric } from '../next/metrics';
|
||||
import { DbRefreshStateRow, DbRelationsRow, DbLocationsRow } from './tables';
|
||||
|
||||
export function initDatabaseMetrics(knex: Knex) {
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { Config } from '@backstage/config';
|
||||
import path from 'path';
|
||||
import { getEntityLocationRef } from './processing/util';
|
||||
import { getEntityLocationRef } from '../processing/util';
|
||||
import { EntityProvider, EntityProviderConnection } from './types';
|
||||
import { locationSpecToLocationEntity } from './util';
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ import { getVoidLogger } from '@backstage/backend-common';
|
||||
import { Hash } from 'crypto';
|
||||
import { DateTime } from 'luxon';
|
||||
import waitForExpect from 'wait-for-expect';
|
||||
import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase';
|
||||
import { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';
|
||||
import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine';
|
||||
import { CatalogProcessingOrchestrator } from './processing/types';
|
||||
import { Stitcher } from './stitching/Stitcher';
|
||||
import { CatalogProcessingOrchestrator } from '../processing/types';
|
||||
import { Stitcher } from '../stitching/Stitcher';
|
||||
|
||||
describe('DefaultCatalogProcessingEngine', () => {
|
||||
const db = {
|
||||
|
||||
@@ -23,13 +23,13 @@ import { serializeError } from '@backstage/errors';
|
||||
import { Hash } from 'crypto';
|
||||
import stableStringify from 'fast-json-stable-stringify';
|
||||
import { Logger } from 'winston';
|
||||
import { ProcessingDatabase, RefreshStateItem } from './database/types';
|
||||
import { ProcessingDatabase, RefreshStateItem } from '../database/types';
|
||||
import { createCounterMetric, createSummaryMetric } from './metrics';
|
||||
import {
|
||||
CatalogProcessingOrchestrator,
|
||||
EntityProcessingResult,
|
||||
} from './processing/types';
|
||||
import { Stitcher } from './stitching/Stitcher';
|
||||
} from '../processing/types';
|
||||
import { Stitcher } from '../stitching/Stitcher';
|
||||
import { startTaskPipeline } from './TaskPipeline';
|
||||
import {
|
||||
CatalogProcessingEngine,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { DefaultLocationService } from './DefaultLocationService';
|
||||
import { CatalogProcessingOrchestrator } from './processing/types';
|
||||
import { CatalogProcessingOrchestrator } from '../processing/types';
|
||||
import { LocationStore } from './types';
|
||||
|
||||
describe('DefaultLocationServiceTest', () => {
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import {
|
||||
CatalogProcessingOrchestrator,
|
||||
DeferredEntity,
|
||||
} from './processing/types';
|
||||
} from '../processing/types';
|
||||
import { LocationService, LocationStore } from './types';
|
||||
import { locationSpecToMetadataName } from './util';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { applyDatabaseMigrations } from './database/migrations';
|
||||
import { applyDatabaseMigrations } from '../database/migrations';
|
||||
import { DefaultLocationStore } from './DefaultLocationStore';
|
||||
|
||||
describe('DefaultLocationStore', () => {
|
||||
|
||||
@@ -18,8 +18,8 @@ import { Location, LocationSpec } from '@backstage/catalog-model';
|
||||
import { ConflictError, NotFoundError } from '@backstage/errors';
|
||||
import { Knex } from 'knex';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { DbLocationsRow } from './database/tables';
|
||||
import { getEntityLocationRef } from './processing/util';
|
||||
import { DbLocationsRow } from '../database/tables';
|
||||
import { getEntityLocationRef } from '../processing/util';
|
||||
import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
|
||||
@@ -19,16 +19,16 @@ import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
|
||||
import { createHash } from 'crypto';
|
||||
import { Knex } from 'knex';
|
||||
import { Logger } from 'winston';
|
||||
import { applyDatabaseMigrations } from './database/migrations';
|
||||
import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase';
|
||||
import { applyDatabaseMigrations } from '../database/migrations';
|
||||
import { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';
|
||||
import {
|
||||
DbRefreshStateReferencesRow,
|
||||
DbRefreshStateRow,
|
||||
} from './database/tables';
|
||||
import { ProcessingDatabase } from './database/types';
|
||||
} from '../database/tables';
|
||||
import { ProcessingDatabase } from '../database/types';
|
||||
import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine';
|
||||
import { EntityProcessingRequest } from './processing/types';
|
||||
import { Stitcher } from './stitching/Stitcher';
|
||||
import { EntityProcessingRequest } from '../processing/types';
|
||||
import { Stitcher } from '../stitching/Stitcher';
|
||||
import { Entity, stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { DefaultRefreshService } from './DefaultRefreshService';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase';
|
||||
import { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';
|
||||
import { RefreshOptions, RefreshService } from './types';
|
||||
|
||||
export class DefaultRefreshService implements RefreshService {
|
||||
|
||||
@@ -65,14 +65,14 @@ import {
|
||||
LocationService,
|
||||
} from '../next/types';
|
||||
import { ConfigLocationEntityProvider } from './ConfigLocationEntityProvider';
|
||||
import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase';
|
||||
import { applyDatabaseMigrations } from './database/migrations';
|
||||
import { DefaultProcessingDatabase } from '../database/DefaultProcessingDatabase';
|
||||
import { applyDatabaseMigrations } from '../database/migrations';
|
||||
import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine';
|
||||
import { DefaultLocationService } from './DefaultLocationService';
|
||||
import { DefaultLocationStore } from './DefaultLocationStore';
|
||||
import { NextEntitiesCatalog } from './NextEntitiesCatalog';
|
||||
import { DefaultCatalogProcessingOrchestrator } from './processing/DefaultCatalogProcessingOrchestrator';
|
||||
import { Stitcher } from './stitching/Stitcher';
|
||||
import { DefaultCatalogProcessingOrchestrator } from '../processing/DefaultCatalogProcessingOrchestrator';
|
||||
import { Stitcher } from '../stitching/Stitcher';
|
||||
import {
|
||||
createRandomRefreshInterval,
|
||||
RefreshIntervalFunction,
|
||||
|
||||
@@ -18,12 +18,12 @@ import { TestDatabaseId, TestDatabases } from '@backstage/backend-test-utils';
|
||||
import { Entity, stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { Knex } from 'knex';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { applyDatabaseMigrations } from './database/migrations';
|
||||
import { applyDatabaseMigrations } from '../database/migrations';
|
||||
import {
|
||||
DbFinalEntitiesRow,
|
||||
DbRefreshStateReferencesRow,
|
||||
DbRefreshStateRow,
|
||||
} from './database/tables';
|
||||
} from '../database/tables';
|
||||
import { NextEntitiesCatalog } from './NextEntitiesCatalog';
|
||||
|
||||
describe('NextEntitiesCatalog', () => {
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
DbRefreshStateRow,
|
||||
DbSearchRow,
|
||||
DbPageInfo,
|
||||
} from './database/tables';
|
||||
} from '../database/tables';
|
||||
|
||||
function parsePagination(input?: EntityPagination): {
|
||||
limit?: number;
|
||||
|
||||
@@ -18,10 +18,10 @@ export type { CatalogEnvironment } from './NextCatalogBuilder';
|
||||
export { NextCatalogBuilder } from './NextCatalogBuilder';
|
||||
export { createNextRouter } from './NextRouter';
|
||||
export type { NextRouterOptions } from './NextRouter';
|
||||
export * from './processing';
|
||||
export * from '../processing';
|
||||
export { createRandomRefreshInterval } from './refresh';
|
||||
export type { RefreshIntervalFunction } from './refresh';
|
||||
export * from './stitching';
|
||||
export * from '../stitching';
|
||||
export type {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Entity, Location, LocationSpec } from '@backstage/catalog-model';
|
||||
import { DeferredEntity } from './processing/types';
|
||||
import { DeferredEntity } from '../processing/types';
|
||||
|
||||
export interface LocationService {
|
||||
createLocation(
|
||||
|
||||
+3
-3
@@ -30,10 +30,10 @@ import {
|
||||
CatalogProcessorEmit,
|
||||
CatalogProcessorParser,
|
||||
results,
|
||||
} from '../../ingestion';
|
||||
import { CatalogRulesEnforcer } from '../../ingestion/CatalogRules';
|
||||
} from '../ingestion';
|
||||
import { CatalogRulesEnforcer } from '../ingestion/CatalogRules';
|
||||
import { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator';
|
||||
import { defaultEntityDataParser } from '../../ingestion/processors/util/parse';
|
||||
import { defaultEntityDataParser } from '../ingestion/processors/util/parse';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
|
||||
class FooBarProcessor implements CatalogProcessor {
|
||||
+3
-3
@@ -31,8 +31,8 @@ import { Logger } from 'winston';
|
||||
import {
|
||||
CatalogProcessor,
|
||||
CatalogProcessorParser,
|
||||
} from '../../ingestion/processors';
|
||||
import * as results from '../../ingestion/processors/results';
|
||||
} from '../ingestion/processors';
|
||||
import * as results from '../ingestion/processors/results';
|
||||
import {
|
||||
CatalogProcessingOrchestrator,
|
||||
EntityProcessingRequest,
|
||||
@@ -48,7 +48,7 @@ import {
|
||||
validateEntityEnvelope,
|
||||
isObject,
|
||||
} from './util';
|
||||
import { CatalogRulesEnforcer } from '../../ingestion/CatalogRules';
|
||||
import { CatalogRulesEnforcer } from '../ingestion/CatalogRules';
|
||||
import { ProcessorCacheManager } from './ProcessorCacheManager';
|
||||
|
||||
type Context = {
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CatalogProcessor } from '../../ingestion/processors';
|
||||
import { CatalogProcessor } from '../ingestion/processors';
|
||||
import { ProcessorCacheManager } from './ProcessorCacheManager';
|
||||
|
||||
class MyProcessor implements CatalogProcessor {
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
|
||||
import { JsonObject, JsonValue } from '@backstage/config';
|
||||
import { CatalogProcessor } from '../../ingestion/processors';
|
||||
import { CatalogProcessorCache } from '../../ingestion/processors/types';
|
||||
import { CatalogProcessor } from '../ingestion/processors';
|
||||
import { CatalogProcessorCache } from '../ingestion/processors/types';
|
||||
import { isObject } from './util';
|
||||
|
||||
class SingleProcessorSubCache implements CatalogProcessorCache {
|
||||
+2
-2
@@ -22,8 +22,8 @@ import {
|
||||
stringifyLocationReference,
|
||||
} from '@backstage/catalog-model';
|
||||
import { Logger } from 'winston';
|
||||
import { CatalogProcessorResult } from '../../ingestion';
|
||||
import { locationSpecToLocationEntity } from '../util';
|
||||
import { CatalogProcessorResult } from '../ingestion';
|
||||
import { locationSpecToLocationEntity } from '../next/util';
|
||||
import { DeferredEntity } from './types';
|
||||
import {
|
||||
getEntityLocationRef,
|
||||
Reference in New Issue
Block a user