@itwin/core-backend
Version:
iTwin.js backend components
50 lines • 2.47 kB
TypeScript
/** @packageDocumentation
* @module Schema
*/
import { ConcreteEntityTypes, ElementAspectProps, ElementProps, EntityReference, ModelProps } from "@itwin/core-common";
import { Id64String } from "@itwin/core-bentley";
import type { Entity } from "./Entity";
import { Model } from "./Model";
import { Element } from "./Element";
import { ElementAspect } from "./ElementAspect";
import { Relationship, RelationshipProps } from "./Relationship";
/** Concrete classes that can be created, with the notable exception of CodeSpecs since it is does not derive from Entity
* other entity classes. In the future if there is a need
* to manage them this way, it can be added
* @alpha
*/
export type ConcreteEntity = Element | Model | ElementAspect | Relationship;
/** Props for a [[ConcreteEntity]]
* @alpha
*/
export type ConcreteEntityProps = ElementProps | ModelProps | ElementAspectProps | RelationshipProps;
/**
* Utilities for the [EntityReference]($common) type which is a kind of strings
* @alpha
*/
export declare namespace EntityReferences {
function isModel(id: EntityReference): boolean;
function isElement(id: EntityReference): boolean;
function isElementAspect(id: EntityReference): boolean;
function isRelationship(id: EntityReference): boolean;
function toId64(id: EntityReference): string;
/** split a concrete entity id into its type and raw id */
function split(id: EntityReference): [ConcreteEntityTypes, Id64String];
/** used by the transformer to figure out where to check for the existence in a db of a concrete element id
* @internal
*/
function isValid(id: EntityReference): boolean;
/** create the invalid id for a concrete entity type
* @internal
*/
function makeInvalid(type: ConcreteEntityTypes): EntityReference;
/** create an EntityReference given an entity */
function from(entity: ConcreteEntity): EntityReference;
/** create an EntityReference given an id and a JavaScript class */
function fromClass(id: Id64String, entityClass: typeof Entity): EntityReference;
/** Create an EntityReference quickly from an exact reference type and id */
function fromEntityType(id: Id64String, type: ConcreteEntityTypes): EntityReference;
/** @internal the argument entityClass be concrete (i.e. not the Entity abstract base class) */
function typeFromClass(entityClass: typeof Entity): ConcreteEntityTypes;
}
//# sourceMappingURL=EntityReferences.d.ts.map