@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
73 lines (72 loc) • 4.37 kB
TypeScript
import { Nullable, NullableResultPromise } from "../base-types";
import { IEntityDefinition } from "../contracts/base";
import { ViewMode } from "../contracts/base/view-mode";
/**
* Caches definition in memory.
*/
export declare class EntityDefinitionCache {
private readonly _allCacheKey;
private readonly _promiseKeyPrefix;
private readonly _map;
constructor();
/**
* Load the specified definition into the cache.
* @param definition - The entity definition
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definition
*/
load(definition: IEntityDefinition, includeConditionalMembers?: boolean, loadPermissions?: boolean): void;
/**
* Load the specified definition into the cache asynchronously.
* @param key - The definition name or definition id
* @param promise - A promise resolving to the definition
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definition
*/
loadAsync(key: string | number, promise: NullableResultPromise<IEntityDefinition>, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise<void>;
/**
* Retrieve the definition with specified name or id from the cache.
* @param key - The definition name or definition id
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definition
* @returns The cached definition or null
*/
get(key: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean): Nullable<IEntityDefinition>;
/**
* Retrieve the definition with specified name or id from the cache asynchronously.
* @param key - The definition name or definition id
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definition
* @returns A promise resolving to the cached definition or null
*/
getAsync(key: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean): Nullable<NullableResultPromise<IEntityDefinition>>;
/**
* Loads all definitions into the cache.
* @param definitions - An array of entity definitions
* @param loadAllIndividually - Flag indicating whether to load the definitions individually or not
* @param loadAsGroup - Key to be used to store the array of definitions, or false to not load the array
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definitions
*/
loadAll(definitions: Array<IEntityDefinition>, loadAllIndividually?: boolean, loadAsGroup?: false | string, includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string, excludeLightDefinitions?: boolean): void;
/**
* Retrieves an array of definitions that was cached with the specified group key.
*
* @remarks
* Can not be used to retrieve a single cached definition. Use {@link EntityDefinitionCache.get} instead.
*
* @param group - The key with which the group of definitions was stored
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definitions
*/
getAll(group?: string, includeConditionalMembers?: boolean, loadPermissions?: boolean, viewMode?: ViewMode, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string, excludeLightDefinitions?: boolean): Nullable<Array<IEntityDefinition>>;
/**
* Invalidates/removes the definition with specified name or id from the cache.
* @param key - The definition name or definition id
* @param includeConditionalMembers - Include conditional members
* @param loadPermissions - Load permissions for the definition
*/
invalidate(key?: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean): void;
private validateKey;
private getCacheKey;
}