import { StorageKeyType } from './storage-key'; /** * Sentinel object returned by middleware to signal that the value has not changed. * BaseStorage checks for this by reference equality to skip subscriber notifications. */ export declare const VALUE_NOT_CHANGED: unique symbol; export type StorageActionType = 'get' | 'set' | 'delete' | 'clear' | 'init' | 'keys' | 'update' | 'reset'; export type StorageAction = { type: StorageActionType; key?: StorageKeyType; value?: any; metadata?: Record; source?: string; timestamp?: number; }; export type MiddlewareAPI = { dispatch: (action: StorageAction) => Promise; getState: () => Promise>; storage: { doGet: (key: StorageKeyType) => Promise; doSet: (key: StorageKeyType, value: any) => Promise; doUpdate: (updates: Array<{ key: StorageKeyType; value: any; }>) => Promise; doDelete: (key: StorageKeyType) => Promise; doClear: () => Promise; doKeys: () => Promise; notifySubscribers: (key: StorageKeyType, value: any) => void; }; }; export type NextFunction = (action: StorageAction) => Promise; export type SetupEventsFunction = (api: MiddlewareAPI) => void; export type Middleware = { name: string; setup?: SetupEventsFunction; cleanup?: () => Promise | void; reducer: (api: MiddlewareAPI) => (next: NextFunction) => (action: StorageAction) => Promise; }; export type AsyncMiddlewareAPI = MiddlewareAPI; export type AsyncNextFunction = NextFunction; export type AsyncMiddleware = Middleware; export type SyncMiddlewareAPI = { dispatch: (action: StorageAction) => any; getState: () => Record; storage: { doGet: (key: StorageKeyType) => any; doSet: (key: StorageKeyType, value: any) => void; doUpdate: (updates: Array<{ key: StorageKeyType; value: any; }>) => void; doRemove: (key: StorageKeyType) => boolean; doClear: () => void; doKeys: () => string[]; notifySubscribers: (key: StorageKeyType, value: any) => void; }; }; export type SyncNextFunction = (action: StorageAction) => any; export type SyncSetupEventsFunction = (api: SyncMiddlewareAPI) => void; export type SyncMiddleware = { name: string; setup?: SyncSetupEventsFunction; cleanup?: () => void; reducer: (api: SyncMiddlewareAPI) => (next: SyncNextFunction) => (action: StorageAction) => any; }; export declare class AsyncMiddlewareModule { private middlewares; private api; private initialized; private dispatchFn; constructor(storage: any); private baseOperation; private initializeMiddlewares; use(middleware: Middleware): void; dispatch(action: StorageAction): Promise; } /** @deprecated Use AsyncMiddlewareModule */ export declare class MiddlewareModule extends AsyncMiddlewareModule { } export declare class SyncMiddlewareModule { private middlewares; private api; private initialized; private dispatchFn; constructor(storage: any); private baseOperation; private initializeMiddlewares; use(middleware: SyncMiddleware): void; dispatch(action: StorageAction): any; }