/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import { EventParameters } from "@workglow/util"; import { JSONValue } from "../tabular/ITabularStorage"; export declare const DefaultKeyValueSchema: { readonly type: "object"; readonly properties: { readonly key: { readonly type: "string"; }; readonly value: {}; }; readonly additionalProperties: false; }; export declare const DefaultKeyValueKey: readonly ["key"]; export type KvEventListeners = { put: (key: Key, value: Value) => void; get: (key: Key, value: Value | undefined) => void; getBulk: (keys: readonly Key[], results: readonly Combined[]) => void; getAll: (results: Combined[] | undefined) => void; delete: (key: unknown) => void; deleteall: () => void; }; export type KvEventName = keyof KvEventListeners; export type KvEventListener = KvEventListeners[Event]; export type KvEventParameters = EventParameters, Event>; /** * Interface defining the contract for kv storage repositories. * Provides a flexible interface for storing and retrieving data with typed * primary keys and values, and supports compound keys and partial key lookup. * * @typeParam Key - Type for the primary key * @typeParam Value - Type for the value struct re * @typeParam Combined - Combined type of Key & Value */ export interface IKvStorage { put(key: Key, value: Value): Promise; putBulk(items: Array<{ key: Key; value: Value; }>): Promise; get(key: Key): Promise; /** * Fetches multiple values by their keys in a single bulk operation. * * Returns only the records that were found, as `Combined` (key + value) * pairs. Result ordering is unspecified. Missing keys produce no entry. * Empty input returns `[]` without issuing a backend call. */ getBulk(keys: readonly Key[]): Promise; delete(key: Key): Promise; getAll(): Promise; deleteAll(): Promise; size(): Promise; getObjectAsIdString(object: JSONValue): Promise; on(name: Event, fn: KvEventListener): void; off(name: Event, fn: KvEventListener): void; emit(name: Event, ...args: KvEventParameters): void; once(name: Event, fn: KvEventListener): void; waitOn(name: Event): Promise>; } //# sourceMappingURL=IKvStorage.d.ts.map