import { Result } from "@webiny/feature/api"; import { KeyNotFoundError, KeyValueStorageError } from "./errors.js"; export interface IKeyValueRecord { key: string; value: any; } export interface IGlobalKeyValueStoreOptions { scope?: string; expiresAt?: Date; } export interface IGlobalKeyValueStore { get(key: string, options?: IGlobalKeyValueStoreOptions): Promise>; set(key: string, value: any, options?: IGlobalKeyValueStoreOptions): Promise>; delete(key: string, options?: IGlobalKeyValueStoreOptions): Promise>; } /** Global (non-tenant-scoped) key-value store. */ export declare const GlobalKeyValueStore: import("@webiny/di").Abstraction; export declare namespace GlobalKeyValueStore { type Interface = IGlobalKeyValueStore; type KeyValueRecord = IKeyValueRecord; type Error = KeyValueStoreRepository.Error; } export interface IKeyValueStore { get(key: string): Promise>; set(key: string, value: any): Promise>; delete(key: string): Promise>; } /** Tenant-scoped key-value store. */ export declare const KeyValueStore: import("@webiny/di").Abstraction; export declare namespace KeyValueStore { type Interface = IKeyValueStore; type KeyValueRecord = IKeyValueRecord; type Error = KeyValueStoreRepository.Error; } export interface IKeyValueStoreRepositoryErrors { base: KeyNotFoundError | KeyValueStorageError; } type RepositoryError = IKeyValueStoreRepositoryErrors[keyof IKeyValueStoreRepositoryErrors]; export interface IKeyValueStoreSetOptions { expiresAt?: Date; } export interface IKeyValueStoreRepository { get(key: string, scope: string): Promise>; set(key: string, value: any, scope: string, options?: IKeyValueStoreSetOptions): Promise>; delete(key: string, scope: string): Promise>; } /** Persist and retrieve key-value pairs. */ export declare const KeyValueStoreRepository: import("@webiny/di").Abstraction; export declare namespace KeyValueStoreRepository { type Interface = IKeyValueStoreRepository; type Error = RepositoryError; } export interface IKeyValueStorageOperations { get(key: string, scope: string): Promise<{ key: string; value: any; } | null>; set(key: string, value: any, scope: string, options?: IKeyValueStoreSetOptions): Promise; delete(key: string, scope: string): Promise; } /** Storage operations for key-value persistence. */ export declare const KeyValueStorageOperations: import("@webiny/di").Abstraction; export declare namespace KeyValueStorageOperations { type Interface = IKeyValueStorageOperations; } export {};