@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
124 lines (123 loc) • 4.79 kB
TypeScript
import type { MapCultureTo, Nullable } from "../../base-types";
import { IMemberGroup } from "./member-group";
import { IPropertyDefinition } from "./property-definition";
import { IRelationDefinition } from "./relation-definition";
import { RelationRole } from "./relation-role";
import IResource from "./resource";
/**
* Represents a data schema / domain model for an entity.
*/
export interface IEntityDefinition extends IResource {
/**
* Gets the id of this definition.
* This is an automatically assigned unique and strictly positive number identifying the entity definition.
* Value is 0, null or undefined when the definition has not been persisted.
*/
readonly id?: number;
/**
* Gets a value indicating whether the entity definition is new.
*/
readonly isNew: boolean;
/**
* Gets the unique and language agnostic name of the entity definition.
* It should be handled as case sensitive.
*/
name: string;
/**
* Gets the language agnostic display format for entities of this definition.
*/
displayTemplate: string;
/**
* Gets a value indicating whether entities of this entity definition are taxonomy items.
* They can then be used as a search facet.
*/
isTaxonomyItemDefinition: boolean;
/**
* Gets a value indicating whether entities of this entity definition can be part of the so called paths, which are technically UI breadcrumbs.
* Example use cases are taxonomy entity definitions or M Project block entity definitions.
*/
isPathEnabledDefinition: boolean;
/**
* Gets a value indicating whether the items of this definition can be sorted manually (UI related).
*/
isManualSortingAllowed: boolean;
/**
* Gets a value indicating whether the entity definition is owned by the system and cannot be modified or deleted by the regular users.
*/
isSystemOwned: boolean;
/**
* Gets a value indicating whether the entity definition is a light entity definition, meaning that it is not persisted in the elastic search index.
*/
isLight: boolean;
/**
* Gets the collection of {@link IMemberGroup}s.
*/
memberGroups: Array<IMemberGroup>;
/**
* Gets a collection of the culture specific definition labels.
*/
labels: MapCultureTo<string>;
/**
* The permissions the current user has for this entity definition.
*/
permissions?: Array<string>;
/**
* Usage type of definition. Can be 'Normal', 'Light', 'External'
*/
usageType: string;
/**
* Get the definition of the specified property.
* @param name - The name of the property
* @returns The property definition or null.
*/
getPropertyDefinition(name: string): Nullable<IPropertyDefinition>;
/**
* Generic version to get the definition of the specified property.
* @param name - The name of the property
* @returns The property definition or null.
*/
getPropertyDefinition<T extends IPropertyDefinition>(name: string): Nullable<T>;
/**
* Gets all property definitions.
* @returns A list of all property definitions.
*/
getPropertyDefinitions(): Array<IPropertyDefinition>;
/**
* Get the definition of the specified relation.
* @param name - Name of the relation
* @param role - Relation role
* @returns The relation definition or null.
* @throws An {@link InvalidOperationError} when no role is given and the relation is a self-relation.
*/
getRelationDefinition(name: string, role?: RelationRole): Nullable<IRelationDefinition>;
/**
* Get all relation definitions.
* @returns A list of all relations definitions.
*/
getRelationDefinitions(): Array<IRelationDefinition>;
}
export declare class EntityDefinition implements IEntityDefinition {
readonly id?: number;
get isNew(): boolean;
name: string;
readonly createdBy?: number;
readonly createdOn?: Date;
readonly modifiedBy?: number;
readonly modifiedOn?: Date;
displayTemplate: string;
isTaxonomyItemDefinition: boolean;
isPathEnabledDefinition: boolean;
isManualSortingAllowed: boolean;
isSystemOwned: boolean;
isLight: boolean;
memberGroups: Array<IMemberGroup>;
labels: MapCultureTo<string>;
permissions?: Array<string>;
usageType: string;
constructor(init?: Partial<EntityDefinition>);
getPropertyDefinition<T extends IPropertyDefinition>(name: string): Nullable<T>;
getPropertyDefinitions(): Array<IPropertyDefinition>;
getRelationDefinition(name: string, role?: RelationRole): Nullable<IRelationDefinition>;
getRelationDefinitions(): Array<IRelationDefinition>;
private getMemberDefinitions;
}