@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
44 lines • 1.72 kB
TypeScript
import { SchemaContext } from "../Context";
import { SchemaInfo } from "../Interfaces";
import { Schema } from "../Metadata/Schema";
/**
* A schema and it's reference that make up part of a schema cycle
* @internal
*/
export interface ReferenceCycle {
schema: SchemaInfo;
refSchema: SchemaInfo;
}
/**
* Utility class for detecting cyclic references in a Schema graph.
* @internal
*/
export declare class SchemaGraph {
private _schemas;
private constructor();
private find;
/**
* Detected cyclic references in a schema and throw an exception if a cycle is found.
*/
throwIfCycles(): void;
/**
* Detected cyclic references in a schema.
* @returns An array describing the cycle if there is a cycle or undefined if no cycles found.
*/
detectCycles(): ReferenceCycle[] | undefined;
private detectCycleUtil;
/**
* Generates a SchemaGraph for the input schema using the context to find info on referenced schemas. Use the generateGraphSync if you have the fully loaded Schema.
* @param schema The SchemaInfo to build the graph from
* @param context The SchemaContext used to locate info on the referenced schemas
* @returns A SchemaGraph that can be used to detect schema cycles
*/
static generateGraph(schema: SchemaInfo, context: SchemaContext): Promise<SchemaGraph>;
/**
* Generates a SchemaGraph for the input schema. Use the generateGraph if you just have schema info.
* @param schema The Schema to build the graph from.
* @returns A SchemaGraph that can be used to detect schema cycles
*/
static generateGraphSync(schema: Schema): SchemaGraph;
}
//# sourceMappingURL=SchemaGraph.d.ts.map