@itwin/core-common
Version:
iTwin.js components common to frontend and backend
204 lines • 7.71 kB
TypeScript
/** @packageDocumentation
* @module Entities
*/
import { Id64String } from "@itwin/core-bentley";
/** The persistent format of an [Entity]($backend), also used as the "wire format" when transmitting information about entities
* between the backend and frontend.
* EntityProps and all of its sub-types like [[ElementProps]] are "plain old Javascript objects" - that is, objects containing
* no methods and no properties of `class` type.
* @public @preview
* @extensions
*/
export interface EntityProps {
/** A non-existent property used to discriminate between [[EntityProps]] and [Entity]($backend).
* @see [Entity.isInstanceOfEntity]($backend).
*/
readonly isInstanceOfEntity?: never;
/** The full name of the [ECClass]($docs/bis/guide/references/glossary/#ecclass) for this entity, in the form "Schema:ClassName" */
classFullName: string;
/** The Id of the entity. Must be present for SELECT, UPDATE, or DELETE, ignored for INSERT. */
id?: Id64String;
/** Optional [json properties]($docs/bis/guide/fundamentals/element-fundamentals.md#jsonproperties) of this Entity. */
jsonProperties?: {
[key: string]: any;
};
}
/** Specifies the source and target elements of a [[Relationship]] instance.
* @public @preview
* @extensions
*/
export interface SourceAndTarget {
sourceId: Id64String;
targetId: Id64String;
}
/** Properties that are common to all types of link table ECRelationships
* @public @preview
* @extensions
*/
export interface RelationshipProps extends EntityProps, SourceAndTarget {
}
/** Parameters for performing a query on [Entity]($backend) classes.
* @public @preview
* @extensions
*/
export interface EntityQueryParams {
/** The sql className, in the form "Schema.ClassName", of the class to search. */
from?: string;
/** Set to true to limit results to *not* include sub-classes of "from" class */
only?: boolean;
/** Optional "WHERE" clause to filter entities. Note: do *not* include the "WHERE" keyword. */
where?: string;
/** Optional "ORDERBY" clause to sort results. Note: do *not* include the "ORDERBY" keyword. */
orderBy?: string;
/** Optional "LIMIT" clause to limit the number of rows returned. */
limit?: number;
/** Optional "OFFSET" clause. Only valid if Limit is also present. */
offset?: number;
/** Bindings for parameterized values.
* @see [[ECSqlStatement.bindValues]]
*/
bindings?: any[] | object;
}
/** The primitive types of an Entity property.
* @beta
*/
export declare enum PrimitiveTypeCode {
Uninitialized = 0,
Binary = 257,
Boolean = 513,
DateTime = 769,
Double = 1025,
Integer = 1281,
Long = 1537,
Point2d = 1793,// eslint-disable-line @typescript-eslint/no-shadow
Point3d = 2049,// eslint-disable-line @typescript-eslint/no-shadow
String = 2305,
IGeometry = 2561
}
/** A callback function to process properties of an Entity
* @beta
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `PropertyHandler` from `@itwin/ecschema-metadata` instead.
*
* @example
* ```typescript
* // Current usage:
* const callback: PropertyCallback = (name: string, propMetaData: PropertyMetaData) => {
* console.log(`Property name: ${name}, Property type: ${propMetaData.primitiveType}`);
* };
*
* // Replacement:
* const callback: PropertyHandler = (propName: string, property: Property) => {
* console.log(`Property name: ${propName}, Property type: ${property.propertyType}`);
* };
* ```
*/
export type PropertyCallback = (name: string, meta: PropertyMetaData) => void;
/** A custom attribute instance
* @beta
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `CustomAttribute` interface from `@itwin/ecschema-metadata` instead.
*/
export interface CustomAttribute {
/** The class of the CustomAttribute */
ecclass: string;
/** An object whose properties correspond by name to the properties of this custom attribute instance. */
properties: {
[propName: string]: any;
};
}
/**
* @beta
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `@itwin/ecschema-metadata` instead.
*/
export interface PropertyMetaDataProps {
primitiveType?: number;
structName?: string;
extendedType?: string;
description?: string;
displayLabel?: string;
minimumValue?: any;
maximumValue?: any;
minimumLength?: number;
maximumLength?: number;
readOnly?: boolean;
kindOfQuantity?: string;
isCustomHandled?: boolean;
isCustomHandledOrphan?: boolean;
minOccurs?: number;
maxOccurs?: number;
direction?: string;
relationshipClass?: string;
customAttributes?: CustomAttribute[];
}
/** Metadata for a property.
* @beta
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use the `Property` class from @itwin/ecschema-metadata` instead.
*/
export declare class PropertyMetaData implements PropertyMetaDataProps {
primitiveType?: PrimitiveTypeCode;
structName?: string;
extendedType?: string;
description?: string;
displayLabel?: string;
minimumValue?: any;
maximumValue?: any;
minimumLength?: number;
maximumLength?: number;
readOnly?: boolean;
kindOfQuantity?: string;
isCustomHandled?: boolean;
isCustomHandledOrphan?: boolean;
minOccurs?: number;
maxOccurs?: number;
direction?: string;
relationshipClass?: string;
customAttributes?: CustomAttribute[];
constructor(jsonObj: PropertyMetaDataProps);
/** Create a typed value, or array of values, from a factory and an input object */
private createValueOrArray;
/** construct a single property from an input object according to this metadata */
createProperty(jsonObj: any): any;
/** Return `true` if this property is a NavigationProperty. */
get isNavigation(): boolean;
}
/**
* @beta
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `@itwin/ecschema-metadata` instead.
*/
export interface EntityMetaDataProps {
classId: Id64String;
ecclass: string;
description?: string;
modifier?: string;
displayLabel?: string;
/** The base classes from which this class derives. If more than one, the first is the super class and the others are [mixins]($docs/bis/ec/ec-mixin-class). */
baseClasses: string[];
/** The Custom Attributes for this class */
customAttributes?: CustomAttribute[];
/** An object whose properties correspond by name to the properties of this class. */
properties: {
[propName: string]: PropertyMetaData;
};
}
/** Metadata for an Entity.
* @beta
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `EntityClass` class from `@itwin/ecschema-metadata` instead.
*/
export declare class EntityMetaData implements EntityMetaDataProps {
/** The Id of the class in the [[IModelDb]] from which the metadata was obtained. */
readonly classId: Id64String;
/** The Entity name */
readonly ecclass: string;
readonly description?: string;
readonly modifier?: string;
readonly displayLabel?: string;
/** The base class that this class is derives from. If more than one, the first is the actual base class and the others are mixins. */
readonly baseClasses: string[];
/** The Custom Attributes for this class */
readonly customAttributes?: CustomAttribute[];
/** An object whose properties correspond by name to the properties of this class. */
readonly properties: {
[propName: string]: PropertyMetaData;
};
constructor(jsonObj: EntityMetaDataProps);
}
//# sourceMappingURL=EntityProps.d.ts.map