/** @packageDocumentation * @module Merging */ import { Schema, SchemaContext, SchemaKey } from "@itwin/ecschema-metadata"; import { SchemaContextEditor } from "../Editing/Editor"; import { AnySchemaDifference, type SchemaDifferenceResult } from "../Differencing/SchemaDifference"; import { SchemaEdits } from "./Edits/SchemaEdits"; import { NameMapping } from "./Edits/NameMapping"; /** * Defines the context of a Schema merging run. * @internal */ export interface SchemaMergeContext { readonly targetSchema: Schema; readonly targetSchemaKey: SchemaKey; readonly sourceSchemaKey: SchemaKey; readonly editor: SchemaContextEditor; readonly nameMapping: NameMapping; } /** * Represents a single merge operation that was executed. * @internal */ export interface SchemaMergeOperation { readonly change: AnySchemaDifference; readonly durationMs: number; } /** * Represents a merge operation that failed with an error. * @internal */ export interface SchemaMergeFailure extends SchemaMergeOperation { readonly error: string; } /** * Report of a schema merge operation containing success/failure details. * @internal */ export interface SchemaMergeReport { /** Source schema identifier */ readonly sourceSchemaKey: SchemaKey; /** Target schema identifier */ readonly targetSchemaKey: SchemaKey; /** Array of successfully merged differences */ readonly successfulOperations: SchemaMergeOperation[]; /** Array of failed merge operations with their errors */ readonly failedOperations: SchemaMergeFailure[]; /** Summary statistics of the merge operation */ readonly mergeStatistics: { readonly total: number; readonly succeeded: number; readonly failed: number; }; /** Performance metrics of the merge operation */ readonly performanceMetrics: { readonly totalDurationMs: number; readonly schemaDifferenceDurationMs: number; readonly mergeDurationMs: number; readonly averageMergeOpDurationMs: number; }; /** Returns true if all operations succeeded */ readonly success: boolean; } /** * @internal */ export declare class SchemaMergeReporter implements SchemaMergeReport { private readonly _succeeded; private readonly _failed; private readonly _sourceSchemaKey; private readonly _targetSchemaKey; private readonly _totalDifferences; private _totalDurationMs; private _schemaDifferenceDurationMs; private _mergeDurationMs; private _averageMergeOpDurationMs; constructor(sourceSchemaKey: SchemaKey, targetSchemaKey: SchemaKey, totalDifferences: number); get sourceSchemaKey(): SchemaKey; get targetSchemaKey(): SchemaKey; get successfulOperations(): SchemaMergeOperation[]; get failedOperations(): SchemaMergeFailure[]; get mergeStatistics(): { total: number; succeeded: number; failed: number; }; get performanceMetrics(): { totalDurationMs: number; schemaDifferenceDurationMs: number; mergeDurationMs: number; averageMergeOpDurationMs: number; }; get success(): boolean; /** * Sets the performance metrics for the merge operation. * @internal */ setPerformanceMetrics(metrics: { totalDurationMs: number; schemaDifferenceDurationMs: number; mergeDurationMs: number; averageMergeOpDurationMs: number; }): void; /** * Records a successful merge operation. * @internal */ recordSuccess(change: AnySchemaDifference, durationMs: number): void; /** * Records a failed merge operation. * @internal */ recordFailure(change: AnySchemaDifference, durationMs: number, error: Error): void; /** * Returns the merge report. * @internal */ getMergeReport(): SchemaMergeReport; } /** * Class to merge two schemas together. * @see [[merge]] or [[mergeSchemas]] to merge two schemas together. * @beta */ export declare class SchemaMerger { private readonly _editingContext; private _mergeReporter; private _differenceStartTime; /** * Constructs a new instance of the SchemaMerger object. * @param editingContext The schema contexts that holds the schema to be edited. */ constructor(editingContext: SchemaContext); /** * Copy the SchemaItems of the source schemas to the target schema. * @param targetSchema The schema the SchemaItems gets merged to. * @param sourceSchema The schema the SchemaItems gets copied from. * @param edits An optional instance of schema edits that shall be applied before the schemas get merged. * @returns The merged target schema. * @alpha */ mergeSchemas(targetSchema: Schema, sourceSchema: Schema, edits?: SchemaEdits): Promise; /** * Merges the schema differences into the target schema context. * @param differenceResult The differences that shall be applied to the target schema. * @param edits An optional instance of schema edits that shall be applied before the schemas get merged. * @alpha */ merge(differenceResult: SchemaDifferenceResult, edits?: SchemaEdits): Promise; /** * Gets the merge report for the last merge operation. * @alpha */ getMergeReport(): SchemaMergeReport | undefined; } //# sourceMappingURL=SchemaMerger.d.ts.map