@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
211 lines • 10.9 kB
TypeScript
import { SchemaContext } from "../Context";
import { ConstantProps, CustomAttributeClassProps, EntityClassProps, EnumerationProps, InvertedUnitProps, KindOfQuantityProps, MixinProps, PhenomenonProps, PropertyCategoryProps, RelationshipClassProps, SchemaItemFormatProps, SchemaItemUnitProps, SchemaProps, StructClassProps, UnitSystemProps } from "../Deserialization/JsonProps";
import { SchemaInfo } from "../Interfaces";
import { SchemaKey } from "../SchemaKey";
import { IncrementalSchemaLocater, SchemaLocaterOptions } from "./IncrementalSchemaLocater";
import { PerformanceLogger } from "./PerformanceLogger";
interface QueryParameters {
[parameterName: string]: string | number;
}
/**
* Query options used by the ECSqlSchemaLocater.
* @internal
*/
export interface ECSqlQueryOptions {
parameters?: QueryParameters;
limit?: number;
}
/**
* Defines the [[ECSqlSchemaLocater]] options which determine how each
* schema is to be loaded. All options are optional.
* @internal
*/
export interface ECSqlSchemaLocaterOptions extends SchemaLocaterOptions {
/** Query for Schemas using multiple queries. Defaults to false. */
readonly useMultipleQueries?: boolean;
/** Collects query execution performance data. Defaults to false. */
readonly performanceLogger?: PerformanceLogger;
}
/**
* An abstract [[IncrementalSchemaLocater]] implementation for loading
* EC [Schema] instances from an iModelDb using ECSql queries.
* @internal
*/
export declare abstract class ECSqlSchemaLocater extends IncrementalSchemaLocater {
/**
* Gets the [[ECSqlSchemaLocaterOptions]] used by this locater.
*/
protected get options(): ECSqlSchemaLocaterOptions;
/**
* Initializes a new ECSqlSchemaLocater instance.
* @param options The options used by this Schema locater.
*/
constructor(options?: ECSqlSchemaLocaterOptions);
/**
* Executes the given ECSql query and returns the resulting rows.
* @param query The ECSql query to execute.
* @param options Optional arguments to control the query result.
* @returns A promise that resolves to the resulting rows.
*/
protected abstract executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>>;
/**
* Gets the [[SchemaProps]] for the given schema key.
* @param schemaKey The schema key of the schema to be resolved.
*/
protected abstract getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined>;
/**
* Gets the [[SchemaProps]] for the given schema key. This is the full schema json with all elements that are defined
* in the schema. The schema locater calls this after the stub has been loaded to fully load the schema in the background.
* @param schemaKey The [[SchemaKey]] of the schema to be resolved.
* @param context The [[SchemaContext]] to use for resolving references.
* @internal
*/
getSchemaJson(schemaKey: SchemaKey, context: SchemaContext): Promise<SchemaProps | undefined>;
/**
* Gets the [[SchemaProps]] without schemaItems.
*/
/**
* Gets the [[SchemaProps]] without schemaItems for the given schema name.
* @param schemaName The name of the Schema.
* @param context The [[SchemaContext]] to use for resolving references.
* @returns
* @internal
*/
getSchemaNoItems(schemaName: string, context: SchemaContext): Promise<SchemaProps | undefined>;
/**
* Checks if the [[SchemaContext]] has the right Meta Schema version to support the incremental schema loading.
* @param context The schema context to lookup the meta schema.
* @returns true if the context has a supported meta schema version, false otherwise.
*/
protected supportPartialSchemaLoading(context: SchemaContext): Promise<boolean>;
/**
* Gets all the Schema's Entity classes as [[EntityClassProps]] JSON objects.
* @param schemaName The name of the Schema.
* @param context The [[SchemaContext]] to which the schema belongs.
* @returns A promise that resolves to a EntityClassProps array. Maybe empty of no entities are found.
* @internal
*/
getEntities(schema: string, context: SchemaContext, queryOverride?: string): Promise<EntityClassProps[]>;
/**
* Gets all the Schema's Mixin classes as [[MixinProps]] JSON objects.
* @param schemaName The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a MixinProps array. Maybe empty of no entities are found.
* @internal
*/
getMixins(schema: string, context: SchemaContext, queryOverride?: string): Promise<MixinProps[]>;
/**
* Gets all the Schema's Relationship classes as [[RelationshipClassProps]] JSON objects.
* @param schemaName The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a RelationshipClassProps array. Maybe empty if no items are found.
* @internal
*/
getRelationships(schema: string, context: SchemaContext, queryOverride?: string): Promise<RelationshipClassProps[]>;
/**
* Gets all the Schema's CustomAttributeClass items as [[CustomAttributeClassProps]] JSON objects.
* @param schemaName The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a CustomAttributeClassProps array. Maybe empty if not items are found.
* @internal
*/
getCustomAttributeClasses(schema: string, context: SchemaContext, queryOverride?: string): Promise<CustomAttributeClassProps[]>;
/**
* Gets all the Schema's StructClass items as [[StructClassProps]] JSON objects.
* @param schemaName The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a StructClassProps array. Maybe empty if not items are found.
* @internal
*/
getStructs(schema: string, context: SchemaContext, queryOverride?: string): Promise<StructClassProps[]>;
/**
* Gets all the Schema's KindOfQuantity items as [[KindOfQuantityProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a KindOfQuantityProps array. Maybe empty if not items are found.
* @internal
*/
getKindOfQuantities(schema: string, context: SchemaContext): Promise<KindOfQuantityProps[]>;
/**
* Gets all the Schema's PropertyCategory items as [[PropertyCategoryProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a PropertyCategoryProps array. Maybe empty if not items are found.
* @internal
*/
getPropertyCategories(schema: string, context: SchemaContext): Promise<PropertyCategoryProps[]>;
/**
* Gets all the Schema's Enumeration items as [[EnumerationProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a EnumerationProps array. Maybe empty if not items are found.
* @internal
*/
getEnumerations(schema: string, context: SchemaContext): Promise<EnumerationProps[]>;
/**
* Gets all the Schema's Unit items as [[SchemaItemUnitProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a SchemaItemUnitProps array. Maybe empty if not items are found.
* @internal
*/
getUnits(schema: string, context: SchemaContext): Promise<SchemaItemUnitProps[]>;
/**
* Gets all the Schema's InvertedUnit items as [[InvertedUnitProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a InvertedUnitProps array. Maybe empty if not items are found.
* @internal
*/
getInvertedUnits(schema: string, context: SchemaContext): Promise<InvertedUnitProps[]>;
/**
* Gets all the Schema's Constant items as [[ConstantProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a ConstantProps array. Maybe empty if not items are found.
* @internal
*/
getConstants(schema: string, context: SchemaContext): Promise<ConstantProps[]>;
/**
* Gets all the Schema's UnitSystem items as [[UnitSystemProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a UnitSystemProps array. Maybe empty if not items are found.
* @internal
*/
getUnitSystems(schema: string, context: SchemaContext): Promise<UnitSystemProps[]>;
/**
* Gets all the Schema's Phenomenon items as [[PhenomenonProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a PhenomenonProps array. Maybe empty if not items are found.
* @internal
*/
getPhenomenon(schema: string, context: SchemaContext): Promise<PhenomenonProps[]>;
/**
* Gets all the Schema's Format items as [[SchemaItemFormatProps]] JSON objects.
* @param schema The name of the Schema.
* @param context The SchemaContext to which the schema belongs.
* @returns A promise that resolves to a SchemaItemFormatProps array. Maybe empty if not items are found.
* @internal
*/
getFormats(schema: string, context: SchemaContext): Promise<SchemaItemFormatProps[]>;
/**
* Gets [[SchemaInfo]] objects for all schemas including their direct schema references.
* @internal
*/
loadSchemaInfos(): Promise<ReadonlyArray<SchemaInfo>>;
/**
* Gets the [[SchemaProps]] to create the basic schema skeleton. Depending on which options are set, the schema items or class hierarchy
* can be included in the initial fetch.
* @param schemaKey The [[SchemaKey]] of the schema to be resolved.
* @returns A promise that resolves to the schema partials, which is an array of [[SchemaProps]].
* @internal
*/
getSchemaPartials(schemaKey: SchemaKey, context: SchemaContext): Promise<ReadonlyArray<SchemaProps> | undefined>;
private querySchemaItem;
private getFullSchema;
private getFullSchemaMultipleQueries;
}
export {};
//# sourceMappingURL=ECSqlSchemaLocater.d.ts.map