import { flushPromises } from './utils'; import { LooseTimeStrategyKind } from './time-strategy'; import { Option, State, StateChangePayload, StoreHooks, StoreOptions } from './types'; import type * as commands from "./commands"; /** * Base class for the store implementations. * * @internal */ export declare abstract class BaseStore { abstract readonly id: string; protected abstract readonly options: StoreOptions; /** Whether the synchronization is enabled. */ protected enabled: boolean; /** Queue of state changes to be processed. */ protected changeQueue: StateChangePayload[]; /** Flushes pending promises. */ protected readonly flush: typeof flushPromises; /** Starts the store synchronization. */ start(): Promise; /** Stops the store synchronization. */ stop(): Promise; /** Loads the store state from the backend. */ protected abstract load(): Promise; protected abstract unload(): Promise; /** Watches itself for state changes, notifying the backend when necessary. */ protected abstract watch(): () => void; /** Stops watching for changes in the store state. */ protected unwatch: Option<() => void>; /** Listens for state changes coming from the backend. */ protected listen(): Promise<() => void>; /** Stops listening for state changes coming from the backend. */ protected unlisten: Option<() => void>; private listenOptions; private unlistenOptions; protected processChangeQueue(): Promise; protected abstract patchSelf(state: S): void; protected abstract patchBackend(state: S): void; protected patchBackendHelper(fn: ReturnType, state: S): void; protected abstract setOptions(): Promise; protected setOptionsHelper(fn: ReturnType): Promise; private patchOptions; protected applyKeyFilters(state: Partial): Partial; protected tryAutoStart(): Promise; protected updateDenylist(f: { allowSave: ReturnType; allowSync: ReturnType; denySave: ReturnType; denySync: ReturnType; }): Promise; /** * {@link StoreOptions.syncStrategy} */ protected get syncStrategy(): LooseTimeStrategyKind; /** * {@link StoreOptions.saveStrategy} */ protected get syncInterval(): Option; /** * {@link StoreHooks.error} */ protected get onError(): Option["error"]>; }