stop exposing legacy and replace with next
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import { CatalogEntitiesRequest } from '@backstage/catalog-client';
|
||||
import { Config } from '@backstage/config';
|
||||
import { DocumentCollator } from '@backstage/search-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityName } from '@backstage/catalog-model';
|
||||
import { EntityPolicy } from '@backstage/catalog-model';
|
||||
import { EntityRelationSpec } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
@@ -21,7 +20,6 @@ import { GitHubIntegrationConfig } from '@backstage/integration';
|
||||
import { IndexableDocument } from '@backstage/search-common';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { Knex } from 'knex';
|
||||
import { Location as Location_2 } from '@backstage/catalog-model';
|
||||
import { LocationSpec } from '@backstage/catalog-model';
|
||||
import { Logger as Logger_2 } from 'winston';
|
||||
@@ -38,14 +36,6 @@ import { TokenManager } from '@backstage/backend-common';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
import { Validators } from '@backstage/catalog-model';
|
||||
|
||||
// Warning: (ae-missing-release-tag) "AddLocationResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type AddLocationResult = {
|
||||
location: Location_2;
|
||||
entities: Entity[];
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "AnalyzeLocationEntityField" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -246,30 +236,39 @@ export class BuiltinKindsEntityProcessor implements CatalogProcessor {
|
||||
validateEntityKind(entity: Entity): Promise<boolean>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "CatalogBuilder" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export class CatalogBuilder {
|
||||
// @deprecated
|
||||
constructor(env: CatalogEnvironment);
|
||||
addEntityPolicy(...policies: EntityPolicy[]): CatalogBuilder;
|
||||
addEntityProvider(...providers: EntityProvider[]): CatalogBuilder;
|
||||
addPermissionRules(
|
||||
...permissionRules: PermissionRule<
|
||||
Entity,
|
||||
EntitiesSearchFilter,
|
||||
unknown[]
|
||||
>[]
|
||||
): void;
|
||||
addProcessor(...processors: CatalogProcessor[]): CatalogBuilder;
|
||||
build(): Promise<{
|
||||
entitiesCatalog: EntitiesCatalog;
|
||||
locationsCatalog: LocationsCatalog;
|
||||
higherOrderOperation: HigherOrderOperation;
|
||||
locationAnalyzer: LocationAnalyzer;
|
||||
processingEngine: CatalogProcessingEngine;
|
||||
locationService: LocationService;
|
||||
router: Router;
|
||||
}>;
|
||||
// (undocumented)
|
||||
static create(env: CatalogEnvironment): Promise<NextCatalogBuilder>;
|
||||
static create(env: CatalogEnvironment): CatalogBuilder;
|
||||
getDefaultProcessors(): CatalogProcessor[];
|
||||
replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder;
|
||||
replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder;
|
||||
setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder;
|
||||
setFieldFormatValidators(validators: Partial<Validators>): CatalogBuilder;
|
||||
setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder;
|
||||
setPlaceholderResolver(
|
||||
key: string,
|
||||
resolver: PlaceholderResolver,
|
||||
): CatalogBuilder;
|
||||
setRefreshInterval(refreshInterval: RefreshIntervalFunction): CatalogBuilder;
|
||||
setRefreshIntervalSeconds(seconds: number): CatalogBuilder;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "CatalogEntityDocument" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
@@ -451,89 +450,11 @@ export class CodeOwnersProcessor implements CatalogProcessor {
|
||||
preProcessEntity(entity: Entity, location: LocationSpec): Promise<Entity>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "CommonDatabase" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated
|
||||
export class CommonDatabase implements Database {
|
||||
constructor(database: Knex, logger: Logger_2);
|
||||
// (undocumented)
|
||||
addEntities(
|
||||
txOpaque: Transaction,
|
||||
request: DbEntityRequest[],
|
||||
): Promise<DbEntityResponse[]>;
|
||||
// (undocumented)
|
||||
addLocation(
|
||||
txOpaque: Transaction,
|
||||
location: Location_2,
|
||||
): Promise<DbLocationsRow>;
|
||||
// (undocumented)
|
||||
addLocationUpdateLogEvent(
|
||||
locationId: string,
|
||||
status: DatabaseLocationUpdateLogStatus,
|
||||
entityName?: string | string[],
|
||||
message?: string,
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
entities(
|
||||
txOpaque: Transaction,
|
||||
request?: DbEntitiesRequest,
|
||||
): Promise<DbEntitiesResponse>;
|
||||
// (undocumented)
|
||||
entityByName(
|
||||
txOpaque: Transaction,
|
||||
name: EntityName,
|
||||
): Promise<DbEntityResponse | undefined>;
|
||||
// (undocumented)
|
||||
entityByUid(
|
||||
txOpaque: Transaction,
|
||||
uid: string,
|
||||
): Promise<DbEntityResponse | undefined>;
|
||||
// (undocumented)
|
||||
location(id: string): Promise<DbLocationsRowWithStatus>;
|
||||
// (undocumented)
|
||||
locationHistory(id: string): Promise<DatabaseLocationUpdateLogEvent[]>;
|
||||
// (undocumented)
|
||||
locations(): Promise<DbLocationsRowWithStatus[]>;
|
||||
// (undocumented)
|
||||
removeEntityByUid(txOpaque: Transaction, uid: string): Promise<void>;
|
||||
// (undocumented)
|
||||
removeLocation(txOpaque: Transaction, id: string): Promise<void>;
|
||||
// (undocumented)
|
||||
setRelations(
|
||||
txOpaque: Transaction,
|
||||
originatingEntityId: string,
|
||||
relations: EntityRelationSpec[],
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>;
|
||||
// (undocumented)
|
||||
updateEntity(
|
||||
txOpaque: Transaction,
|
||||
request: DbEntityRequest,
|
||||
matchingEtag?: string,
|
||||
matchingGeneration?: number,
|
||||
): Promise<DbEntityResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const createCatalogPermissionRule: <TParams extends unknown[]>(
|
||||
rule: PermissionRule<Entity, EntitiesSearchFilter, TParams>,
|
||||
) => PermissionRule<Entity, EntitiesSearchFilter, TParams>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "CreateDatabaseOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type CreateDatabaseOptions = {
|
||||
logger: Logger_2;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "createNextRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export function createNextRouter(
|
||||
options: NextRouterOptions,
|
||||
): Promise<express.Router>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "createRandomRefreshInterval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
@@ -544,208 +465,8 @@ export function createRandomRefreshInterval(options: {
|
||||
|
||||
// Warning: (ae-missing-release-tag) "createRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "Database" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated
|
||||
export type Database = {
|
||||
transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>;
|
||||
addEntities(
|
||||
tx: Transaction,
|
||||
request: DbEntityRequest[],
|
||||
): Promise<DbEntityResponse[]>;
|
||||
updateEntity(
|
||||
tx: Transaction,
|
||||
request: DbEntityRequest,
|
||||
matchingEtag?: string,
|
||||
matchingGeneration?: number,
|
||||
): Promise<DbEntityResponse>;
|
||||
entities(
|
||||
tx: Transaction,
|
||||
request?: DbEntitiesRequest,
|
||||
): Promise<DbEntitiesResponse>;
|
||||
entityByName(
|
||||
tx: Transaction,
|
||||
name: EntityName,
|
||||
): Promise<DbEntityResponse | undefined>;
|
||||
entityByUid(
|
||||
tx: Transaction,
|
||||
uid: string,
|
||||
): Promise<DbEntityResponse | undefined>;
|
||||
removeEntityByUid(tx: Transaction, uid: string): Promise<void>;
|
||||
setRelations(
|
||||
tx: Transaction,
|
||||
entityUid: string,
|
||||
relations: EntityRelationSpec[],
|
||||
): Promise<void>;
|
||||
addLocation(tx: Transaction, location: Location_2): Promise<DbLocationsRow>;
|
||||
removeLocation(tx: Transaction, id: string): Promise<void>;
|
||||
location(id: string): Promise<DbLocationsRowWithStatus>;
|
||||
locations(): Promise<DbLocationsRowWithStatus[]>;
|
||||
locationHistory(id: string): Promise<DatabaseLocationUpdateLogEvent[]>;
|
||||
addLocationUpdateLogEvent(
|
||||
locationId: string,
|
||||
status: DatabaseLocationUpdateLogStatus,
|
||||
entityName?: string | string[],
|
||||
message?: string,
|
||||
): Promise<void>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DatabaseEntitiesCatalog" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export class DatabaseEntitiesCatalog implements EntitiesCatalog {
|
||||
constructor(database: Database, logger: Logger_2);
|
||||
// (undocumented)
|
||||
batchAddOrUpdateEntities(
|
||||
requests: EntityUpsertRequest[],
|
||||
options?: {
|
||||
locationId?: string;
|
||||
dryRun?: boolean;
|
||||
outputEntities?: boolean;
|
||||
},
|
||||
): Promise<EntityUpsertResponse[]>;
|
||||
// (undocumented)
|
||||
entities(request?: EntitiesRequest): Promise<EntitiesResponse>;
|
||||
// (undocumented)
|
||||
entityAncestry(): Promise<never>;
|
||||
// (undocumented)
|
||||
removeEntityByUid(uid: string): Promise<void>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DatabaseLocationsCatalog" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export class DatabaseLocationsCatalog implements LocationsCatalog {
|
||||
constructor(database: Database);
|
||||
// (undocumented)
|
||||
addLocation(location: Location_2): Promise<Location_2>;
|
||||
// (undocumented)
|
||||
location(id: string): Promise<LocationResponse>;
|
||||
// (undocumented)
|
||||
locationHistory(id: string): Promise<DatabaseLocationUpdateLogEvent[]>;
|
||||
// (undocumented)
|
||||
locations(): Promise<LocationResponse[]>;
|
||||
// (undocumented)
|
||||
logUpdateFailure(
|
||||
locationId: string,
|
||||
error?: Error,
|
||||
entityName?: string,
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
logUpdateSuccess(
|
||||
locationId: string,
|
||||
entityName?: string | string[],
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
removeLocation(id: string): Promise<void>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DatabaseLocationUpdateLogEvent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DatabaseLocationUpdateLogEvent = {
|
||||
id: string;
|
||||
status: DatabaseLocationUpdateLogStatus;
|
||||
location_id: string;
|
||||
entity_name: string;
|
||||
created_at?: string;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DatabaseLocationUpdateLogStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export enum DatabaseLocationUpdateLogStatus {
|
||||
// (undocumented)
|
||||
FAIL = 'fail',
|
||||
// (undocumented)
|
||||
SUCCESS = 'success',
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DatabaseManager" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export class DatabaseManager {
|
||||
// (undocumented)
|
||||
static createDatabase(
|
||||
knex: Knex,
|
||||
options?: Partial<CreateDatabaseOptions>,
|
||||
): Promise<Database>;
|
||||
// (undocumented)
|
||||
static createInMemoryDatabase(): Promise<Database>;
|
||||
// (undocumented)
|
||||
static createInMemoryDatabaseConnection(): Promise<Knex>;
|
||||
// (undocumented)
|
||||
static createTestDatabase(): Promise<Database>;
|
||||
// (undocumented)
|
||||
static createTestDatabaseConnection(): Promise<Knex>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbEntitiesRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbEntitiesRequest = {
|
||||
filter?: EntityFilter;
|
||||
pagination?: EntityPagination;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbEntitiesResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbEntitiesResponse = {
|
||||
entities: DbEntityResponse[];
|
||||
pageInfo: DbPageInfo;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbEntityRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbEntityRequest = {
|
||||
locationId?: string;
|
||||
entity: Entity;
|
||||
relations: EntityRelationSpec[];
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbEntityResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbEntityResponse = {
|
||||
locationId?: string;
|
||||
entity: Entity;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbLocationsRow" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbLocationsRow = {
|
||||
id: string;
|
||||
type: string;
|
||||
target: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbLocationsRowWithStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbLocationsRowWithStatus = DbLocationsRow & {
|
||||
status: string | null;
|
||||
timestamp: string | null;
|
||||
message: string | null;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DbPageInfo" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type DbPageInfo =
|
||||
| {
|
||||
hasNextPage: false;
|
||||
}
|
||||
| {
|
||||
hasNextPage: true;
|
||||
endCursor: string;
|
||||
};
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "DefaultCatalogCollator" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
@@ -1132,38 +853,6 @@ export class GitLabDiscoveryProcessor implements CatalogProcessor {
|
||||
updateLastActivity(): Promise<string | undefined>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "HigherOrderOperation" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type HigherOrderOperation = {
|
||||
addLocation(
|
||||
spec: LocationSpec,
|
||||
options?: {
|
||||
dryRun?: boolean;
|
||||
},
|
||||
): Promise<AddLocationResult>;
|
||||
refreshAllLocations(): Promise<void>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "HigherOrderOperations" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated
|
||||
export class HigherOrderOperations implements HigherOrderOperation {
|
||||
constructor(
|
||||
entitiesCatalog: EntitiesCatalog,
|
||||
locationsCatalog: LocationsCatalog,
|
||||
locationReader: LocationReader,
|
||||
logger: Logger_2,
|
||||
);
|
||||
addLocation(
|
||||
spec: LocationSpec,
|
||||
options?: {
|
||||
dryRun?: boolean;
|
||||
},
|
||||
): Promise<AddLocationResult>;
|
||||
refreshAllLocations(): Promise<void>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "inputError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -1209,51 +898,6 @@ export type LocationEntityProcessorOptions = {
|
||||
integrations: ScmIntegrationRegistry;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationReader" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type LocationReader = {
|
||||
read(location: LocationSpec): Promise<ReadLocationResult>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationReaders" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated
|
||||
export class LocationReaders implements LocationReader {
|
||||
// Warning: (ae-forgotten-export) The symbol "Options" needs to be exported by the entry point index.d.ts
|
||||
constructor(options: Options_3);
|
||||
// (undocumented)
|
||||
read(location: LocationSpec): Promise<ReadLocationResult>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type LocationResponse = {
|
||||
data: Location_2;
|
||||
currentStatus: LocationUpdateStatus;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationsCatalog" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type LocationsCatalog = {
|
||||
addLocation(location: Location_2): Promise<Location_2>;
|
||||
removeLocation(id: string): Promise<void>;
|
||||
locations(): Promise<LocationResponse[]>;
|
||||
location(id: string): Promise<LocationResponse>;
|
||||
locationHistory(id: string): Promise<LocationUpdateLogEvent[]>;
|
||||
logUpdateSuccess(
|
||||
locationId: string,
|
||||
entityName?: string | string[],
|
||||
): Promise<void>;
|
||||
logUpdateFailure(
|
||||
locationId: string,
|
||||
error?: Error,
|
||||
entityName?: string,
|
||||
): Promise<void>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationService" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -1289,86 +933,6 @@ export interface LocationStore {
|
||||
listLocations(): Promise<Location_2[]>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationUpdateLogEvent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type LocationUpdateLogEvent = {
|
||||
id: string;
|
||||
status: 'fail' | 'success';
|
||||
location_id: string;
|
||||
entity_name: string;
|
||||
created_at?: string;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LocationUpdateStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type LocationUpdateStatus = {
|
||||
timestamp: string | null;
|
||||
status: string | null;
|
||||
message: string | null;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "NextCatalogBuilder" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export class NextCatalogBuilder {
|
||||
constructor(env: CatalogEnvironment);
|
||||
addEntityPolicy(...policies: EntityPolicy[]): NextCatalogBuilder;
|
||||
addEntityProvider(...providers: EntityProvider[]): NextCatalogBuilder;
|
||||
addPermissionRules(
|
||||
...permissionRules: PermissionRule<
|
||||
Entity,
|
||||
EntitiesSearchFilter,
|
||||
unknown[]
|
||||
>[]
|
||||
): void;
|
||||
addProcessor(...processors: CatalogProcessor[]): NextCatalogBuilder;
|
||||
build(): Promise<{
|
||||
entitiesCatalog: EntitiesCatalog;
|
||||
locationsCatalog: LocationsCatalog;
|
||||
locationAnalyzer: LocationAnalyzer;
|
||||
processingEngine: CatalogProcessingEngine;
|
||||
locationService: LocationService;
|
||||
router: Router;
|
||||
}>;
|
||||
getDefaultProcessors(): CatalogProcessor[];
|
||||
replaceEntityPolicies(policies: EntityPolicy[]): NextCatalogBuilder;
|
||||
replaceProcessors(processors: CatalogProcessor[]): NextCatalogBuilder;
|
||||
setEntityDataParser(parser: CatalogProcessorParser): NextCatalogBuilder;
|
||||
setFieldFormatValidators(validators: Partial<Validators>): NextCatalogBuilder;
|
||||
setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): NextCatalogBuilder;
|
||||
setPlaceholderResolver(
|
||||
key: string,
|
||||
resolver: PlaceholderResolver,
|
||||
): NextCatalogBuilder;
|
||||
setRefreshInterval(
|
||||
refreshInterval: RefreshIntervalFunction,
|
||||
): NextCatalogBuilder;
|
||||
setRefreshIntervalSeconds(seconds: number): NextCatalogBuilder;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "NextRouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export interface NextRouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
// (undocumented)
|
||||
entitiesCatalog?: EntitiesCatalog;
|
||||
// (undocumented)
|
||||
locationAnalyzer?: LocationAnalyzer;
|
||||
// (undocumented)
|
||||
locationService: LocationService;
|
||||
// (undocumented)
|
||||
logger: Logger_2;
|
||||
// (undocumented)
|
||||
permissionIntegrationRouter?: express.Router;
|
||||
// (undocumented)
|
||||
refreshService?: RefreshService;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "notFoundError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -1472,31 +1036,6 @@ export type PlaceholderResolverResolveUrl = (
|
||||
base: string,
|
||||
) => string;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ReadLocationEntity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type ReadLocationEntity = {
|
||||
location: LocationSpec;
|
||||
entity: Entity;
|
||||
relations: EntityRelationSpec[];
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ReadLocationError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type ReadLocationError = {
|
||||
location: LocationSpec;
|
||||
error: Error;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ReadLocationResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
export type ReadLocationResult = {
|
||||
entities: ReadLocationEntity[];
|
||||
errors: ReadLocationError[];
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "RecursivePartial" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
@@ -1543,23 +1082,21 @@ export { results };
|
||||
|
||||
// Warning: (ae-missing-release-tag) "RouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated (undocumented)
|
||||
// @public (undocumented)
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
// (undocumented)
|
||||
entitiesCatalog?: EntitiesCatalog;
|
||||
// (undocumented)
|
||||
higherOrderOperation?: HigherOrderOperation;
|
||||
// (undocumented)
|
||||
locationAnalyzer?: LocationAnalyzer;
|
||||
// (undocumented)
|
||||
locationsCatalog?: LocationsCatalog;
|
||||
// (undocumented)
|
||||
locationService?: LocationService;
|
||||
locationService: LocationService;
|
||||
// (undocumented)
|
||||
logger: Logger_2;
|
||||
// (undocumented)
|
||||
permissionIntegrationRouter?: express.Router;
|
||||
// (undocumented)
|
||||
refreshService?: RefreshService;
|
||||
}
|
||||
|
||||
@@ -1583,13 +1120,6 @@ export class StaticLocationProcessor implements StaticLocationProcessor {
|
||||
): Promise<boolean>;
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "Transaction" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public @deprecated
|
||||
export type Transaction = {
|
||||
rollback(): Promise<unknown>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "UrlReaderProcessor" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
export * from './catalog';
|
||||
export * from './ingestion';
|
||||
export * from './legacy';
|
||||
export * from './search';
|
||||
export * from './util';
|
||||
export * from './processing';
|
||||
|
||||
@@ -68,7 +68,7 @@ import {
|
||||
} from '../../ingestion/processors/PlaceholderProcessor';
|
||||
import { defaultEntityDataParser } from '../../ingestion/processors/util/parse';
|
||||
import { LocationAnalyzer } from '../../ingestion/types';
|
||||
import { CatalogEnvironment, NextCatalogBuilder } from '../../service';
|
||||
import { CatalogEnvironment } from '../../service';
|
||||
|
||||
/**
|
||||
* A builder that helps wire up all of the component parts of the catalog.
|
||||
@@ -103,8 +103,8 @@ export class CatalogBuilder {
|
||||
private processorsReplace: boolean;
|
||||
private parser: CatalogProcessorParser | undefined;
|
||||
|
||||
static async create(env: CatalogEnvironment): Promise<NextCatalogBuilder> {
|
||||
return new NextCatalogBuilder(env);
|
||||
static async create(env: CatalogEnvironment): Promise<CatalogBuilder> {
|
||||
return new CatalogBuilder(env);
|
||||
}
|
||||
|
||||
/** @deprecated Please use CatalogBuilder.create() instead */
|
||||
|
||||
+28
-34
@@ -37,11 +37,6 @@ import { createHash } from 'crypto';
|
||||
import { Router } from 'express';
|
||||
import lodash, { keyBy } from 'lodash';
|
||||
import { EntitiesCatalog, EntitiesSearchFilter } from '../catalog';
|
||||
import {
|
||||
DatabaseLocationsCatalog,
|
||||
LocationsCatalog,
|
||||
CommonDatabase,
|
||||
} from '../legacy';
|
||||
|
||||
import {
|
||||
AnnotateLocationEntityProcessor,
|
||||
@@ -82,7 +77,7 @@ import {
|
||||
createRandomRefreshInterval,
|
||||
RefreshIntervalFunction,
|
||||
} from '../processing/refresh';
|
||||
import { createNextRouter } from './NextRouter';
|
||||
import { createRouter } from './createRouter';
|
||||
import { DefaultRefreshService } from './DefaultRefreshService';
|
||||
import { AuthorizedRefreshService } from './AuthorizedRefreshService';
|
||||
import { DefaultCatalogRulesEnforcer } from '../ingestion/CatalogRules';
|
||||
@@ -127,8 +122,10 @@ export type CatalogEnvironment = {
|
||||
* - Processors can be added or replaced. These implement the functionality of
|
||||
* reading, parsing, validating, and processing the entity data before it is
|
||||
* persisted in the catalog.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class NextCatalogBuilder {
|
||||
export class CatalogBuilder {
|
||||
private readonly env: CatalogEnvironment;
|
||||
private entityPolicies: EntityPolicy[];
|
||||
private entityPoliciesReplace: boolean;
|
||||
@@ -150,6 +147,13 @@ export class NextCatalogBuilder {
|
||||
unknown[]
|
||||
>[];
|
||||
|
||||
/**
|
||||
* Creates a catalog builder.
|
||||
*/
|
||||
static create(env: CatalogEnvironment): CatalogBuilder {
|
||||
return new CatalogBuilder(env);
|
||||
}
|
||||
|
||||
constructor(env: CatalogEnvironment) {
|
||||
this.env = env;
|
||||
this.entityPolicies = [];
|
||||
@@ -170,11 +174,11 @@ export class NextCatalogBuilder {
|
||||
*
|
||||
* If what you want to do is to replace the rules for what format is allowed
|
||||
* in various core entity fields (such as metadata.name), you may want to use
|
||||
* {@link NextCatalogBuilder#setFieldFormatValidators} instead.
|
||||
* {@link CatalogBuilder#setFieldFormatValidators} instead.
|
||||
*
|
||||
* @param policies - One or more policies
|
||||
*/
|
||||
addEntityPolicy(...policies: EntityPolicy[]): NextCatalogBuilder {
|
||||
addEntityPolicy(...policies: EntityPolicy[]): CatalogBuilder {
|
||||
this.entityPolicies.push(...policies);
|
||||
return this;
|
||||
}
|
||||
@@ -185,7 +189,7 @@ export class NextCatalogBuilder {
|
||||
* The default refresh duration is 100-150 seconds.
|
||||
* setting this too low will potentially deplete request quotas to upstream services.
|
||||
*/
|
||||
setRefreshIntervalSeconds(seconds: number): NextCatalogBuilder {
|
||||
setRefreshIntervalSeconds(seconds: number): CatalogBuilder {
|
||||
this.refreshInterval = createRandomRefreshInterval({
|
||||
minSeconds: seconds,
|
||||
maxSeconds: seconds * 1.5,
|
||||
@@ -197,9 +201,7 @@ export class NextCatalogBuilder {
|
||||
* Overwrites the default refresh interval function used to spread
|
||||
* entity updates in the catalog.
|
||||
*/
|
||||
setRefreshInterval(
|
||||
refreshInterval: RefreshIntervalFunction,
|
||||
): NextCatalogBuilder {
|
||||
setRefreshInterval(refreshInterval: RefreshIntervalFunction): CatalogBuilder {
|
||||
this.refreshInterval = refreshInterval;
|
||||
return this;
|
||||
}
|
||||
@@ -207,7 +209,7 @@ export class NextCatalogBuilder {
|
||||
/**
|
||||
* Overwrites the default location analyzer.
|
||||
*/
|
||||
setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): NextCatalogBuilder {
|
||||
setLocationAnalyzer(locationAnalyzer: LocationAnalyzer): CatalogBuilder {
|
||||
this.locationAnalyzer = locationAnalyzer;
|
||||
return this;
|
||||
}
|
||||
@@ -219,13 +221,13 @@ export class NextCatalogBuilder {
|
||||
*
|
||||
* If what you want to do is to replace the rules for what format is allowed
|
||||
* in various core entity fields (such as metadata.name), you may want to use
|
||||
* {@link NextCatalogBuilder#setFieldFormatValidators} instead.
|
||||
* {@link CatalogBuilder#setFieldFormatValidators} instead.
|
||||
*
|
||||
* This function replaces the default set of policies; use with care.
|
||||
*
|
||||
* @param policies - One or more policies
|
||||
*/
|
||||
replaceEntityPolicies(policies: EntityPolicy[]): NextCatalogBuilder {
|
||||
replaceEntityPolicies(policies: EntityPolicy[]): CatalogBuilder {
|
||||
this.entityPolicies = [...policies];
|
||||
this.entityPoliciesReplace = true;
|
||||
return this;
|
||||
@@ -241,7 +243,7 @@ export class NextCatalogBuilder {
|
||||
setPlaceholderResolver(
|
||||
key: string,
|
||||
resolver: PlaceholderResolver,
|
||||
): NextCatalogBuilder {
|
||||
): CatalogBuilder {
|
||||
this.placeholderResolvers[key] = resolver;
|
||||
return this;
|
||||
}
|
||||
@@ -252,13 +254,11 @@ export class NextCatalogBuilder {
|
||||
* not sufficient.
|
||||
*
|
||||
* This function has no effect if used together with
|
||||
* {@link NextCatalogBuilder#replaceEntityPolicies}.
|
||||
* {@link CatalogBuilder#replaceEntityPolicies}.
|
||||
*
|
||||
* @param validators - The (subset of) validators to set
|
||||
*/
|
||||
setFieldFormatValidators(
|
||||
validators: Partial<Validators>,
|
||||
): NextCatalogBuilder {
|
||||
setFieldFormatValidators(validators: Partial<Validators>): CatalogBuilder {
|
||||
lodash.merge(this.fieldFormatValidators, validators);
|
||||
return this;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ export class NextCatalogBuilder {
|
||||
*
|
||||
* @param providers - One or more entity providers
|
||||
*/
|
||||
addEntityProvider(...providers: EntityProvider[]): NextCatalogBuilder {
|
||||
addEntityProvider(...providers: EntityProvider[]): CatalogBuilder {
|
||||
this.entityProviders.push(...providers);
|
||||
return this;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ export class NextCatalogBuilder {
|
||||
*
|
||||
* @param processors - One or more processors
|
||||
*/
|
||||
addProcessor(...processors: CatalogProcessor[]): NextCatalogBuilder {
|
||||
addProcessor(...processors: CatalogProcessor[]): CatalogBuilder {
|
||||
this.processors.push(...processors);
|
||||
return this;
|
||||
}
|
||||
@@ -293,11 +293,11 @@ export class NextCatalogBuilder {
|
||||
* parsing, and processing entities before they are persisted in the catalog.
|
||||
*
|
||||
* This function replaces the default set of processors, consider using with
|
||||
* {@link NextCatalogBuilder#getDefaultProcessors}; use with care.
|
||||
* {@link CatalogBuilder#getDefaultProcessors}; use with care.
|
||||
*
|
||||
* @param processors - One or more processors
|
||||
*/
|
||||
replaceProcessors(processors: CatalogProcessor[]): NextCatalogBuilder {
|
||||
replaceProcessors(processors: CatalogProcessor[]): CatalogBuilder {
|
||||
this.processors = [...processors];
|
||||
this.processorsReplace = true;
|
||||
return this;
|
||||
@@ -308,7 +308,7 @@ export class NextCatalogBuilder {
|
||||
* parsing, and processing entities before they are persisted in the catalog. Changing
|
||||
* the order of processing can give more control to custom processors.
|
||||
*
|
||||
* Consider using with {@link NextCatalogBuilder#replaceProcessors}
|
||||
* Consider using with {@link CatalogBuilder#replaceProcessors}
|
||||
*
|
||||
*/
|
||||
getDefaultProcessors(): CatalogProcessor[] {
|
||||
@@ -345,7 +345,7 @@ export class NextCatalogBuilder {
|
||||
*
|
||||
* @param parser - The custom parser
|
||||
*/
|
||||
setEntityDataParser(parser: CatalogProcessorParser): NextCatalogBuilder {
|
||||
setEntityDataParser(parser: CatalogProcessorParser): CatalogBuilder {
|
||||
this.parser = parser;
|
||||
return this;
|
||||
}
|
||||
@@ -372,8 +372,6 @@ export class NextCatalogBuilder {
|
||||
*/
|
||||
async build(): Promise<{
|
||||
entitiesCatalog: EntitiesCatalog;
|
||||
/** @deprecated This will be removed */
|
||||
locationsCatalog: LocationsCatalog;
|
||||
locationAnalyzer: LocationAnalyzer;
|
||||
processingEngine: CatalogProcessingEngine;
|
||||
locationService: LocationService;
|
||||
@@ -391,8 +389,6 @@ export class NextCatalogBuilder {
|
||||
await applyDatabaseMigrations(dbClient);
|
||||
}
|
||||
|
||||
const db = new CommonDatabase(dbClient, logger);
|
||||
|
||||
const processingDatabase = new DefaultProcessingDatabase({
|
||||
database: dbClient,
|
||||
logger,
|
||||
@@ -457,7 +453,6 @@ export class NextCatalogBuilder {
|
||||
() => createHash('sha1'),
|
||||
);
|
||||
|
||||
const locationsCatalog = new DatabaseLocationsCatalog(db);
|
||||
const locationAnalyzer =
|
||||
this.locationAnalyzer ?? new RepoLocationAnalyzer(logger, integrations);
|
||||
const locationService = new DefaultLocationService(
|
||||
@@ -468,7 +463,7 @@ export class NextCatalogBuilder {
|
||||
new DefaultRefreshService({ database: processingDatabase }),
|
||||
permissions,
|
||||
);
|
||||
const router = await createNextRouter({
|
||||
const router = await createRouter({
|
||||
entitiesCatalog,
|
||||
locationAnalyzer,
|
||||
locationService,
|
||||
@@ -482,7 +477,6 @@ export class NextCatalogBuilder {
|
||||
|
||||
return {
|
||||
entitiesCatalog,
|
||||
locationsCatalog,
|
||||
locationAnalyzer,
|
||||
processingEngine,
|
||||
locationService,
|
||||
+6
-6
@@ -23,12 +23,12 @@ import request from 'supertest';
|
||||
import { EntitiesCatalog } from '../catalog';
|
||||
import { LocationService, RefreshService } from './types';
|
||||
import { basicEntityFilter } from './request';
|
||||
import { createNextRouter } from './NextRouter';
|
||||
import { createRouter } from './createRouter';
|
||||
import { AuthorizeResult } from '@backstage/plugin-permission-common';
|
||||
import { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';
|
||||
import { RESOURCE_TYPE_CATALOG_ENTITY } from '@backstage/plugin-catalog-common';
|
||||
|
||||
describe('createNextRouter readonly disabled', () => {
|
||||
describe('createRouter readonly disabled', () => {
|
||||
let entitiesCatalog: jest.Mocked<EntitiesCatalog>;
|
||||
let locationService: jest.Mocked<LocationService>;
|
||||
let app: express.Express;
|
||||
@@ -48,7 +48,7 @@ describe('createNextRouter readonly disabled', () => {
|
||||
deleteLocation: jest.fn(),
|
||||
};
|
||||
refreshService = { refresh: jest.fn() };
|
||||
const router = await createNextRouter({
|
||||
const router = await createRouter({
|
||||
entitiesCatalog,
|
||||
locationService,
|
||||
logger: getVoidLogger(),
|
||||
@@ -323,7 +323,7 @@ describe('createNextRouter readonly disabled', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('createNextRouter readonly enabled', () => {
|
||||
describe('createRouter readonly enabled', () => {
|
||||
let entitiesCatalog: jest.Mocked<EntitiesCatalog>;
|
||||
let app: express.Express;
|
||||
let locationService: jest.Mocked<LocationService>;
|
||||
@@ -341,7 +341,7 @@ describe('createNextRouter readonly enabled', () => {
|
||||
listLocations: jest.fn(),
|
||||
deleteLocation: jest.fn(),
|
||||
};
|
||||
const router = await createNextRouter({
|
||||
const router = await createRouter({
|
||||
entitiesCatalog,
|
||||
locationService,
|
||||
logger: getVoidLogger(),
|
||||
@@ -476,7 +476,7 @@ describe('NextRouter permissioning', () => {
|
||||
deleteLocation: jest.fn(),
|
||||
};
|
||||
refreshService = { refresh: jest.fn() };
|
||||
const router = await createNextRouter({
|
||||
const router = await createRouter({
|
||||
entitiesCatalog,
|
||||
locationService,
|
||||
logger: getVoidLogger(),
|
||||
+5
-5
@@ -33,11 +33,11 @@ import {
|
||||
parseEntityFilterParams,
|
||||
parseEntityPaginationParams,
|
||||
parseEntityTransformParams,
|
||||
} from '../service/request';
|
||||
import { disallowReadonlyMode, validateRequestBody } from '../service/util';
|
||||
} from './request';
|
||||
import { disallowReadonlyMode, validateRequestBody } from './util';
|
||||
import { RefreshOptions, LocationService, RefreshService } from './types';
|
||||
|
||||
export interface NextRouterOptions {
|
||||
export interface RouterOptions {
|
||||
entitiesCatalog?: EntitiesCatalog;
|
||||
locationAnalyzer?: LocationAnalyzer;
|
||||
locationService: LocationService;
|
||||
@@ -47,8 +47,8 @@ export interface NextRouterOptions {
|
||||
permissionIntegrationRouter?: express.Router;
|
||||
}
|
||||
|
||||
export async function createNextRouter(
|
||||
options: NextRouterOptions,
|
||||
export async function createRouter(
|
||||
options: RouterOptions,
|
||||
): Promise<express.Router> {
|
||||
const {
|
||||
entitiesCatalog,
|
||||
@@ -20,7 +20,7 @@ export type {
|
||||
RefreshOptions,
|
||||
LocationStore,
|
||||
} from './types';
|
||||
export { createNextRouter } from './NextRouter';
|
||||
export type { NextRouterOptions } from './NextRouter';
|
||||
export type { CatalogEnvironment } from './NextCatalogBuilder';
|
||||
export { NextCatalogBuilder } from './NextCatalogBuilder';
|
||||
export { createRouter } from './createRouter';
|
||||
export type { RouterOptions } from './createRouter';
|
||||
export type { CatalogEnvironment } from './CatalogBuilder';
|
||||
export { CatalogBuilder } from './CatalogBuilder';
|
||||
|
||||
@@ -16,18 +16,19 @@
|
||||
|
||||
import {
|
||||
createServiceBuilder,
|
||||
DatabaseManager,
|
||||
loadBackendConfig,
|
||||
ServerTokenManager,
|
||||
SingleHostDiscovery,
|
||||
UrlReaders,
|
||||
useHotMemoize,
|
||||
} from '@backstage/backend-common';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
|
||||
import { Server } from 'http';
|
||||
import { Logger } from 'winston';
|
||||
import { DatabaseManager } from '../legacy/database';
|
||||
import { CatalogBuilder } from '../legacy/service/CatalogBuilder';
|
||||
import { createRouter } from '../legacy/service';
|
||||
import { ServerPermissionClient } from '@backstage/plugin-permission-node';
|
||||
import { applyDatabaseMigrations } from '../database/migrations';
|
||||
import { CatalogBuilder } from './CatalogBuilder';
|
||||
|
||||
export interface ServerOptions {
|
||||
port: number;
|
||||
@@ -42,38 +43,38 @@ export async function startStandaloneServer(
|
||||
const logger = options.logger.child({ service: 'catalog-backend' });
|
||||
const config = await loadBackendConfig({ logger, argv: process.argv });
|
||||
const reader = UrlReaders.default({ logger, config });
|
||||
const db = useHotMemoize(module, () =>
|
||||
DatabaseManager.createInMemoryDatabaseConnection(),
|
||||
);
|
||||
const database = useHotMemoize(module, () => {
|
||||
const manager = DatabaseManager.fromConfig(
|
||||
new ConfigReader({
|
||||
backend: { database: { client: 'sqlite3', connection: ':memory:' } },
|
||||
}),
|
||||
);
|
||||
return manager.forPlugin('catalog');
|
||||
});
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
const tokenManager = ServerTokenManager.fromConfig(config, { logger });
|
||||
const tokenManager = ServerTokenManager.fromConfig(config, {
|
||||
logger,
|
||||
});
|
||||
const permissions = ServerPermissionClient.fromConfig(config, {
|
||||
discovery,
|
||||
tokenManager,
|
||||
});
|
||||
|
||||
logger.debug('Creating application...');
|
||||
await applyDatabaseMigrations(await database.getClient());
|
||||
const builder = new CatalogBuilder({
|
||||
logger,
|
||||
database: { getClient: () => db },
|
||||
database,
|
||||
config,
|
||||
reader,
|
||||
permissions,
|
||||
});
|
||||
const { entitiesCatalog, locationsCatalog, higherOrderOperation } =
|
||||
await builder.build();
|
||||
const catalog = await builder.build();
|
||||
|
||||
logger.debug('Starting application server...');
|
||||
const router = await createRouter({
|
||||
entitiesCatalog,
|
||||
locationsCatalog,
|
||||
higherOrderOperation,
|
||||
logger,
|
||||
config,
|
||||
});
|
||||
let service = createServiceBuilder(module)
|
||||
.setPort(options.port)
|
||||
.addRouter('/catalog', router);
|
||||
.addRouter('/catalog', catalog.router);
|
||||
if (options.enableCors) {
|
||||
service = service.enableCors({ origin: 'http://localhost:3000' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user