UNPKG

@itwin/presentation-shared

Version:

The package contains types and utilities used across different iTwin.js Presentation packages.

107 lines 2.78 kB
import { Id64String } from "@itwin/core-bentley"; import { PrimitiveValueType } from "./Metadata.js"; /** * A data structure uniquely identifying an ECInstance in an iModel. * @public */ export interface InstanceKey { /** Full class name in format `SchemaName.ClassName` */ className: string; /** ECInstance ID */ id: Id64String; } /** @public */ export declare namespace InstanceKey { /** * Checks whether the two given instance keys are equal. * @public */ function equals(lhs: InstanceKey, rhs: InstanceKey): boolean; /** * Compares two given instance keys. * @returns *- `0` if they are equal *- `negative value` if lhs key is less than rhs key *- `positive value` if lhs key is more than rhs key */ function compare(lhs: InstanceKey, rhs: InstanceKey): number; } /** * A data structure for a 2d point. * @public */ export interface Point2d { x: number; y: number; } /** * A data structure for a 3d point. * @public */ export interface Point3d { x: number; y: number; z: number; } /** * A union for all supported primitive value types. * @public */ export type PrimitiveValue = Id64String | string | number | boolean | Date | Point2d | Point3d; /** @public */ export declare namespace PrimitiveValue { /** * Checks whether the given value is a `Point2d`. * @note Since `Point3d` is a superset of `Point2d`, this function will return `true` for `Point3d` as well. * @public */ function isPoint2d(value: PrimitiveValue): value is Point2d; /** * Checks whether the given value is a `Point3d`. * @public */ function isPoint3d(value: PrimitiveValue): value is Point3d; } /** * A type for a primitive value, its type and, optionally, its extended type. * @note Use `TypedPrimitiveValue.create` to create an instance of this type. * @public */ export type TypedPrimitiveValue = ({ value: number; type: "Integer" | "Long"; } | { value: number; type: "Double"; koqName?: string; } | { value: boolean; type: "Boolean"; } | { value: Id64String; type: "Id"; } | { value: string; type: "String"; } | { value: number | string | Date; type: "DateTime"; } | { value: Point2d; type: "Point2d"; } | { value: Point3d; type: "Point3d"; }) & { extendedType?: string; }; /** @public */ export declare namespace TypedPrimitiveValue { /** * A function for a creating a `TypedPrimitiveValue` object. * @throws Error if primitive type and value are incompatible. * @public */ function create(value: PrimitiveValue, type: PrimitiveValueType, koqName?: string, extendedType?: string): TypedPrimitiveValue; } //# sourceMappingURL=Values.d.ts.map