import type { MsgHdrs, NatsConnection, Payload, QueuedIterator } from "@nats-io/nats-core/internal"; import { StorageType } from "@nats-io/jetstream/internal"; import type { ConsumerConfig, JetStreamClient, JetStreamClientImpl, JetStreamManager, JsMsg, Lister, Placement, PurgeOpts, PurgeResponse, Republish, StoredMsg, StreamInfo } from "@nats-io/jetstream/internal"; import type { KV, KvCodecs, KvDeleteOptions, KvEntry, KvKeyCodec, KvOptions, KvPutOptions, KvStatus, KvWatchEntry, KvWatchOptions } from "./types"; import { KvWatchInclude } from "./types"; export declare function Base64KeyCodec(): KvKeyCodec; export declare function NoopKvCodecs(): KvCodecs; export declare function defaultBucketOpts(): Partial; export declare const kvOperationHdr = "KV-Operation"; export declare function validateKey(k: string): void; export declare function validateSearchKey(k: string): void; export declare function hasWildcards(k: string): boolean; export declare function validateBucket(name: string): void; /** * The entry point to creating new KV instances. */ export declare class Kvm { #private; js: JetStreamClientImpl; /** * Creates an instance of the Kv that allows you to create and access KV stores. * Note that if the argument is a NatsConnection, default JetStream Options are * used. If you want to set some options, please provide a JetStreamClient instead. * @param nc */ constructor(nc: JetStreamClient | NatsConnection); /** * Creates and opens the specified KV. If the KV already exists, it opens the existing KV. * @param name * @param opts */ create(name: string, opts?: Partial): Promise; /** * Open to the specified KV. If the KV doesn't exist, this API will fail on accessing * the KV. * @param name * @param opts */ open(name: string, opts?: Partial): Promise; /** * Lists all available KVs */ list(): Lister; } export declare class Bucket implements KV { js: JetStreamClient; jsm: JetStreamManager; stream: string; bucket: string; direct: boolean; codec: KvCodecs; prefix: string; editPrefix: string; useJsPrefix: boolean; _prefixLen: number; constructor(bucket: string, js: JetStreamClient, jsm: JetStreamManager); static create(js: JetStreamClient, name: string, opts?: Partial): Promise; static bind(js: JetStreamClient, name: string, opts?: Partial): Promise; init(opts?: Partial): Promise; initializePrefixes(info: StreamInfo): void; bucketName(): string; subjectForBucket(): string; subjectForKey(k: string, edit?: boolean): string; fullKeyName(k: string): string; get prefixLen(): number; encodeKey(key: string): string; decodeKey(ekey: string): string; validateKey: typeof validateKey; validateSearchKey: typeof validateSearchKey; hasWildcards: typeof hasWildcards; close(): Promise; dataLen(data: Uint8Array, h?: MsgHdrs): number; smToEntry(sm: StoredMsg): KvEntry; jmToWatchEntry(jm: JsMsg, isUpdate: boolean): KvWatchEntry; create(k: string, data: Payload, markerTTL?: string): Promise; update(k: string, data: Payload, version: number, timeout?: number): Promise; _put(k: string, data: Payload, opts?: Partial, markerTTL?: string): Promise; put(k: string, data: Payload, opts?: Partial): Promise; get(k: string, opts?: { revision: number; }): Promise; purge(k: string, opts?: Partial): Promise; delete(k: string, opts?: Partial): Promise; purgeDeletes(olderMillis?: number): Promise; _deleteOrPurge(k: string, op: "DEL" | "PURGE", opts?: Partial): Promise; _doDeleteOrPurge(k: string, op: "DEL" | "PURGE", opts?: Partial): Promise; _buildCC(k: string | string[], content: KvWatchInclude, opts?: Partial): Partial; remove(k: string): Promise; history(opts?: { key?: string | string[]; headers_only?: boolean; }): Promise>; canSetWatcherName(): boolean; watch(opts?: KvWatchOptions): Promise>; keys(k?: string | string[]): Promise>; purgeBucket(opts?: PurgeOpts): Promise; destroy(): Promise; status(): Promise; } export declare class KvStatusImpl implements KvStatus { si: StreamInfo; cluster: string; constructor(si: StreamInfo, cluster?: string); get bucket(): string; get values(): number; get history(): number; get ttl(): number; get markerTTL(): number; get bucket_location(): string; get backingStore(): StorageType; get storage(): StorageType; get replicas(): number; get description(): string; get maxBucketSize(): number; get maxValueSize(): number; get max_bytes(): number; get placement(): Placement; get placementCluster(): string; get republish(): Republish; get streamInfo(): StreamInfo; get size(): number; get metadata(): Record; get compression(): boolean; }