UNPKG

@sitecore/sc-contenthub-webclient-sdk

Version:

Sitecore Content Hub WebClient SDK.

88 lines (87 loc) 3.9 kB
import type { MapCultureTo } from "../../base-types"; import DataType from "./data-type"; import { IMemberCondition } from "./member-condition"; import { MemberDefinitionType } from "./member-definition-type"; import { IPropertyDefinition } from "./property-definition"; import { BooleanPropertyDefinition, DateTimeOffsetPropertyDefinition, DateTimePropertyDefinition, DecimalPropertyDefinition, IntegerPropertyDefinition, JsonPropertyDefinition, LongPropertyDefinition, StringPropertyDefinition } from "./property-definitions"; import { IRelationDefinition } from "./relation-definition"; /** * Base interface for all member definitions. */ export interface IMemberDefinition { /** * Data type of the member. */ readonly type: DataType; /** * Type of the member definition. */ readonly definitionType: MemberDefinitionType; /** * Language agnostic case insensitive name of the member. * Must be unique per member and {@link IEntityDefinition}, except for self-referencing relations. */ name: string; /** * Indicates whether this member can be updated from external sources (e.g. REST API, SDK...). */ allowUpdates: boolean; /** * Indicates whether this member definition has any member conditions. */ readonly isConditional: boolean; /** * The conditions that are evaluated to decide if this member should be exposed in the external API/UI. * These conditions have no impact on data validity. */ conditions: Array<IMemberCondition>; /** * Indicates if the member definition is owned by the system and cannot be modified or deleted by the regular users. */ isSystemOwned: boolean; /** * Indicates if the read-write access to this member is restricted. */ isSecured: boolean; /** * Collection of the culture specific member labels. */ labels: MapCultureTo<string>; /** * Collection of the culture specific help text. */ helpText: MapCultureTo<string>; /** * Indicates whether this member definition can trigger conditional members. */ canTriggerConditionalMembers: boolean; /** * Indicates whether this member definition can write. */ canWrite: boolean; } export declare abstract class MemberDefinition implements IMemberDefinition { readonly type: DataType; name: string; allowUpdates: boolean; isSystemOwned: boolean; isSecured: boolean; labels: MapCultureTo<string>; helpText: MapCultureTo<string>; conditions: Array<IMemberCondition>; canTriggerConditionalMembers: boolean; canWrite: boolean; get isConditional(): boolean; abstract get definitionType(): MemberDefinitionType; constructor(name: string, type: DataType); static isPropertyDefinition(definition: IMemberDefinition): definition is IPropertyDefinition; static isStringPropertyDefinition(definition: IMemberDefinition): definition is StringPropertyDefinition; static isIntegerPropertyDefinition(definition: IMemberDefinition): definition is IntegerPropertyDefinition; static isLongPropertyDefinition(definition: IMemberDefinition): definition is LongPropertyDefinition; static isDecimalPropertyDefinition(definition: IMemberDefinition): definition is DecimalPropertyDefinition; static isBooleanPropertyDefinition(definition: IMemberDefinition): definition is BooleanPropertyDefinition; static isDateTimePropertyDefinition(definition: IMemberDefinition): definition is DateTimePropertyDefinition; static isDateTimeOffsetPropertyDefinition(definition: IMemberDefinition): definition is DateTimeOffsetPropertyDefinition; static isJsonPropertyDefinition(definition: IMemberDefinition): definition is JsonPropertyDefinition; static isRelationDefinition(definition: IMemberDefinition): definition is IRelationDefinition; }