import { Collection, CollectionKey, DefaultItem, ItemKey } from './collection'; import type { Group, GroupKey } from './group'; import { CreatePersistentConfigInterface, Persistent, PersistentKey, StorageKey } from '../storages'; export declare class CollectionPersistent extends Persistent { collection: () => Collection; static defaultGroupSideEffectKey: string; static storageItemKeyPattern: string; static storageGroupKeyPattern: string; /** * Internal Class for managing the permanent persistence of a Collection. * * @internal * @param collection - Collection to be persisted. * @param config - Configuration object */ constructor(collection: Collection, config?: CreatePersistentConfigInterface); /** * Loads the persisted value into the Collection * or persists the Collection value in the corresponding Storage. * This behaviour depends on whether the Collection has been persisted before. * * @internal */ initialLoading(): Promise; /** * Loads Collection Instances (like Items or Groups) from the corresponding Storage * and sets up side effects that dynamically update * the Storage value when the Collection (Instances) changes. * * @internal * @param storageItemKey - Prefix Storage key of the to load Collection Instances. * | default = Persistent.key | * @return Whether the loading of the persisted Collection Instances and setting up of the corresponding side effects was successful. */ loadPersistedValue(storageItemKey?: PersistentKey): Promise; /** * Persists Collection Instances (like Items or Groups) in the corresponding Storage * and sets up side effects that dynamically update * the Storage value when the Collection (Instances) changes. * * @internal * @param storageItemKey - Prefix Storage key of the to persist Collection Instances. * | default = Persistent.key | * @return Whether the persisting of the Collection Instances and the setting up of the corresponding side effects was successful. */ persistValue(storageItemKey?: PersistentKey): Promise; /** * Sets up side effects to keep the Storage value in sync * with the Collection (Instances) value. * * @internal * @param storageItemKey - Prefix Storage key of the to remove Collection Instances. * | default = Persistent.key | */ setupSideEffects(storageItemKey?: PersistentKey): void; /** * Removes the Collection from the corresponding Storage. * -> Collection is no longer persisted * * @internal * @param storageItemKey - Prefix Storage key of the persisted Collection Instances. * | default = Persistent.key | * @return Whether the removal of the Collection Instances was successful. */ removePersistedValue(storageItemKey?: PersistentKey): Promise; /** * Formats the specified key so that it can be used as a valid Storage key * and returns the formatted variant of it. * * If no formatable key (`undefined`/`null`) was provided, * an attempt is made to use the Collection identifier key as Storage key. * * @internal * @param key - Storage key to be formatted. */ formatKey(key: StorageKey | undefined | null): StorageKey | undefined; /** * Adds and removes Items from the Storage based on the Group value. * * @internal * @param group - Group whose Items are to be dynamically added or removed from the Storage. * @param storageItemKey - Prefix Storage key of the persisted Collection Instances. * | default = Persistent.key | */ rebuildStorageSideEffect(group: Group, storageItemKey?: PersistentKey): void; /** * Builds valid Item Storage key based on the 'Collection Item Persist Pattern'. * * @internal * @param itemKey - Key identifier of Item * @param collectionKey - Key identifier of Collection */ static getItemStorageKey(itemKey: ItemKey | undefined | null, collectionKey: CollectionKey | undefined | null): string; /** * Builds valid Item Storage key based on the 'Collection Group Persist Pattern'. * * @internal * @param groupKey - Key identifier of Group * @param collectionKey - Key identifier of Collection */ static getGroupStorageKey(groupKey: GroupKey | undefined | null, collectionKey: CollectionKey | undefined | null): string; }