import { Subject, Observable } from 'rxjs'; import * as i0 from '@angular/core'; import { InjectionToken, NgZone, Provider } from '@angular/core'; declare enum StorageStrategies { Local = "local_strategy", Session = "session_strategy", InMemory = "in_memory_strategy" } interface WebStorage { readonly length: number; clear(): void; getItem(key: string): string | null; key(index: number): string | null; removeItem(key: string): void; setItem(key: string, value: string): void; [name: string]: any; } declare class CompatHelper { static isStorageAvailable(storage: WebStorage): boolean; } interface StorageStrategy { readonly keyChanges: Subject; readonly isAvailable: boolean; readonly name: string; get(key: string): Observable; set(key: string, value: T): Observable; del(key: string): Observable; clear(): Observable; } interface StorageService { retrieve(key: string): any; store(key: string, value: any): any; clear(key?: string): any; getStrategyName(): string; observe(key: string): Observable; } declare class SyncStorage implements StorageService { protected strategy: StorageStrategy; constructor(strategy: StorageStrategy); retrieve(key: string): any; store(key: string, value: any): any; clear(key?: string): void; getStrategyName(): string; observe(key: string): Observable; } declare class AsyncStorage implements StorageService { protected strategy: StorageStrategy; constructor(strategy: StorageStrategy); retrieve(key: string): Observable; store(key: string, value: any): Observable; clear(key?: string): Observable; getStrategyName(): string; observe(key: string): Observable; } interface StrategyCache { [key: string]: any; } declare class StrategyCacheService { protected caches: { [name: string]: StrategyCache; }; get(strategyName: string, key: string): any; set(strategyName: string, key: string, value: any): void; del(strategyName: string, key: string): void; clear(strategyName: string): void; protected getCacheStore(strategyName: string): StrategyCache; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const LOCAL_STORAGE: InjectionToken; declare const SESSION_STORAGE: InjectionToken; declare const STORAGE_STRATEGIES: InjectionToken>; declare abstract class BaseSyncStorageStrategy implements StorageStrategy { protected storage: WebStorage; protected cache: StrategyCacheService; readonly keyChanges: Subject; abstract readonly name: string; constructor(storage: WebStorage, cache: StrategyCacheService); protected _isAvailable: boolean; get isAvailable(): boolean; get(key: string): Observable; set(key: string, value: any): Observable; del(key: string): Observable; clear(): Observable; } declare class LocalStorageStrategy extends BaseSyncStorageStrategy { protected storage: WebStorage; protected cache: StrategyCacheService; protected platformId: any; protected zone: NgZone; static readonly strategyName: string; readonly name: string; constructor(storage: WebStorage, cache: StrategyCacheService, platformId: any, zone: NgZone); protected listenExternalChanges(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class SessionStorageStrategy extends BaseSyncStorageStrategy { protected storage: WebStorage; protected cache: StrategyCacheService; protected platformId: any; protected zone: NgZone; static readonly strategyName: string; readonly name: string; constructor(storage: WebStorage, cache: StrategyCacheService, platformId: any, zone: NgZone); protected listenExternalChanges(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class InMemoryStorageStrategy implements StorageStrategy { protected cache: StrategyCacheService; static readonly strategyName: string; readonly keyChanges: Subject; isAvailable: boolean; readonly name: string; constructor(cache: StrategyCacheService); get(key: string): Observable; set(key: string, value: any): Observable; del(key: string): Observable; clear(): Observable; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const StorageStrategyStubName: string; declare class StorageStrategyStub implements StorageStrategy { readonly keyChanges: Subject; store: any; _available: boolean; readonly name: string; constructor(name?: string); get isAvailable(): boolean; get(key: string): Observable; set(key: string, value: any): Observable; del(key: string): Observable; clear(): Observable; } declare class StorageStub implements WebStorage { [name: string]: any; store: { [prop: string]: any; }; get length(): number; clear(): void; getItem(key: string): string | null; key(index: number): string | null; removeItem(key: string): void; setItem(key: string, value: string): void; } declare const InvalidStrategyError = "invalid_strategy"; declare class StrategyIndex { protected strategies: StorageStrategy[]; static index: { [name: string]: StorageStrategy; }; readonly registration$: Subject; constructor(strategies: StorageStrategy[]); static get(name: string): StorageStrategy; static set(name: string, strategy: any): void; static clear(name?: string): void; static isStrategyRegistered(name: string): boolean; static hasRegistredStrategies(): boolean; getStrategy(name: string): StorageStrategy; indexStrategies(): void; indexStrategy(name: string, overrideIfExists?: boolean): StorageStrategy; register(name: string, strategy: StorageStrategy, overrideIfExists?: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class LocalStorageService extends SyncStorage { } declare class SessionStorageService extends SyncStorage { } declare function LocalStorage(key?: string, defaultValue?: any): (prototype: any, propName: any) => void; declare function SessionStorage(key?: string, defaultValue?: any): (prototype: any, propName: any) => void; interface NgxWebstorageConfiguration { prefix?: string; separator?: string; caseSensitive?: boolean; } declare const LIB_CONFIG: InjectionToken; declare enum InternalNgxWebstorageFeatureKind { Config = 1, LocalStorage = 2, SessionStorage = 3 } type NgxWebstorageFeatureKind = string | InternalNgxWebstorageFeatureKind; type NgxWebstorageFeature = { kind: FeatureKind; providers: Provider[]; }; /** * Provide ngx-webstorage basic features. * * - You can customise the configuration with the `withConfiguration` feature. * - You can enable the `LocalStorage` features with the `withLocalStorage` feature. * - You can enable the `SessionStorage` features with the `withSessionStorage` feature. * * @default config { prefix: 'ngx-webstorage', separator: '|', caseSensitive: false } */ declare function provideNgxWebstorage(...features: NgxWebstorageFeature[]): i0.EnvironmentProviders; declare function makeNgxWebstorageFeature(kind: FeatureKind, providers: Provider[]): NgxWebstorageFeature; declare function withNgxWebstorageConfig(config: NgxWebstorageConfiguration): NgxWebstorageFeature; /** Provides everything necessary to use the `LocalStorage` features. */ declare function withLocalStorage(): NgxWebstorageFeature; declare function withSessionStorage(): NgxWebstorageFeature; export { AsyncStorage, CompatHelper, InMemoryStorageStrategy, InternalNgxWebstorageFeatureKind, InvalidStrategyError, LIB_CONFIG, LOCAL_STORAGE, LocalStorage, LocalStorageService, LocalStorageStrategy, SESSION_STORAGE, STORAGE_STRATEGIES, SessionStorage, SessionStorageService, SessionStorageStrategy, StorageStrategies, StorageStrategyStub, StorageStrategyStubName, StorageStub, StrategyCacheService, StrategyIndex, SyncStorage, makeNgxWebstorageFeature, provideNgxWebstorage, withLocalStorage, withNgxWebstorageConfig, withSessionStorage }; export type { NgxWebstorageFeature, NgxWebstorageFeatureKind, StorageStrategy, StrategyCache };