@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
81 lines (80 loc) • 4.23 kB
TypeScript
import type { MapStringTo, Nullable, NullableResultPromise } from "../../base-types";
import type { IContentHubClient } from "../../clients/content-hub-client";
import CultureInfo from "../../culture-info";
import Link from "../../link";
import { MemberLoadOption } from "../querying/member-load-option";
import { IPropertyLoadOption } from "../querying/property-load-option";
import { IRelationLoadOption } from "../querying/relation-load-option";
import { PropertyDataType, PropertyValue } from "./data-type";
import { IEntity } from "./entity";
import { EntityConstructionArgs } from "./entity-construction-args";
import { IEntityDefinition } from "./entity-definition";
import { IMember } from "./member";
import { IProperty } from "./property";
import { PropertyManager } from "./property-manager";
import { IRelatedPath } from "./related-path";
import { IRelation, RelationType } from "./relation";
import { RelationManager } from "./relation-manager";
import { RelationRole } from "./relation-role";
import { IRendition } from "./rendition";
export declare abstract class EntityBase implements IEntity {
protected readonly _client: IContentHubClient;
protected readonly _members: MapStringTo<IMember>;
protected readonly _propertyManager: PropertyManager;
protected readonly _relationManager: RelationManager;
id?: number;
identifier: Nullable<string>;
hasPublicLink?: boolean;
annotationCount?: number;
masterFileModifiedOn?: Date;
gatewayLinks?: Record<string, Link>;
publicLink?: string;
publicCollectionLink?: string;
definitionName: string;
readonly lockedBy: Nullable<number>;
readonly lockedOn: Nullable<Date>;
isRootTaxonomyItem: boolean;
isPathRoot: boolean;
inheritsSecurity: boolean;
isSystemOwned: boolean;
version: number;
cultures: Array<CultureInfo>;
isCurrentUserDefault?: boolean;
isEnabled?: boolean;
modules?: Array<string>;
combinedPublishStatus?: string;
combinedPublishStatusDetails?: string;
protected _properties: Array<IProperty>;
get properties(): ReadonlyArray<IProperty>;
protected _relations: Array<IRelation>;
get relations(): ReadonlyArray<IRelation>;
readonly createdOn?: Date;
readonly createdBy?: number;
readonly modifiedOn?: Date;
readonly modifiedBy?: number;
isTracking: boolean;
get canDoLazyLoading(): boolean;
get isDirty(): boolean;
get isNew(): boolean;
abstract get renditions(): Array<IRendition>;
abstract get relatedPaths(): Array<IRelatedPath>;
constructor(client: IContentHubClient, args: EntityConstructionArgs);
private isProperty;
getProperty<T extends IProperty = IProperty>(name: string): Nullable<T>;
getPropertyAsync<T extends IProperty = IProperty>(name: string, loadOption?: MemberLoadOption): NullableResultPromise<T>;
getPropertyValue<T extends PropertyDataType | unknown = unknown, B extends boolean = false>(name: string, culture?: CultureInfo): PropertyValue<T, B>;
getPropertyValueAsync<T extends PropertyDataType | unknown = unknown, B extends boolean = false>(name: string, loadOption?: MemberLoadOption, culture?: CultureInfo): NullableResultPromise<PropertyValue<T, B>>;
setPropertyValue<T extends PropertyDataType, B extends boolean = false>(name: string, value: PropertyValue<T, B>, culture?: CultureInfo): void;
getRelation(name: string, role?: RelationRole, _returnNull?: boolean): Nullable<RelationType>;
getRelationAsync(name: string, role?: RelationRole, loadOption?: MemberLoadOption): NullableResultPromise<RelationType>;
loadPropertiesAsync(propertyLoadOption: IPropertyLoadOption): Promise<boolean>;
loadRelationsAsync(relationLoadOption: IRelationLoadOption): Promise<boolean>;
loadMembersAsync(propertyLoadOption: IPropertyLoadOption, relationLoadOption: IRelationLoadOption): Promise<boolean>;
getEntityDefinitionAsync(): Promise<IEntityDefinition>;
abstract getRendition(name: string): Nullable<IRendition>;
abstract getRelatedPath(name: string): Nullable<IRelatedPath>;
abstract getPermissionsAsync(): Promise<Array<string>>;
startTracking(): void;
markClean(): void;
private getDirtyTrackingMembers;
}