import { SpecDatabase } from '@aws-cdk/service-spec-types'; import { Result } from '@cdklabs/tskb'; import { LoadResult } from './loaders'; import { JsonLensPatcher } from './patching'; import { ProblemReport, ReportAudience } from './report'; export interface DatabaseBuilderOptions { /** * Fail if we detect schema validations with the data source * @default true */ readonly validate?: boolean; /** * Print additional debug information * @default false */ readonly debug?: boolean; } export type SourceImporter = (db: SpecDatabase, report: ProblemReport) => Promise; export declare class DatabaseBuilder { protected readonly db: SpecDatabase; private readonly options; /** * The default grouping for any non-specific import problems */ readonly defaultProblemGrouping: ReportAudience; /** * Stack of importers */ private readonly sourceImporters; constructor(db: SpecDatabase | undefined, options: DatabaseBuilderOptions); /** * Add a SourceImporter to the database builder */ addSourceImporter(sourceImporter: SourceImporter): this; /** * Apply all source importers */ build(): Promise<{ db: SpecDatabase; report: ProblemReport; }>; /** * Import the (legacy) resource spec */ importCloudFormationResourceSpec(specDirectory: string): this; /** * Import the (legacy) resource spec for SAM, from GoFormation */ importSamResourceSpec(specDirectory: string): this; /** * Import the (modern) registry spec from CloudFormation */ importCloudFormationRegistryResources(schemaDirectory: string, patcher?: JsonLensPatcher): this; /** * Import the (modern) JSON schema spec from SAM */ importSamJsonSchema(filePath: string, patcher?: JsonLensPatcher): this; /** * Import the CloudFormation Documentation */ importCloudFormationDocs(filePath: string): this; /** * Import stateful resource information */ importStatefulResources(filePath: string): this; /** * Import canned metrics from the CloudWatch Console Service Directory */ importCannedMetrics(directoryPath: string): this; /** * Import the GetAtt allowlist */ importGetAttAllowList(specFilePath: string): this; /** * Import patches to primary identifiers */ importCfnPrimaryIdentifierOverrides(specFilePath: string): this; importArnTemplates(filePath: string, overridesFilePath: string): this; importOobRelationships(filePath: string, patcher?: JsonLensPatcher): this; importLogSources(filepath: string): this; importEventBridgeSchema(schemaDirectory: string): this; /** * Look at a load result and report problems */ protected loadResult(result: Result>, report: ProblemReport): A; }