import { BaseApiClientImpl } from "./jsbaseclient_api"; import type { ConsumerNotification, DirectMsg, DirectStreamAPI, JetStreamOptions, StoredMsg } from "./types"; import type { Msg, MsgHdrs, NatsConnection, QueuedIterator, ReviverFn } from "@nats-io/nats-core/internal"; import { QueuedIteratorImpl } from "@nats-io/nats-core/internal"; import type { DirectBatch, DirectBatchOptions, DirectBatchStartSeq, DirectBatchStartTime, DirectLastFor, DirectMaxBytes, DirectMsgRequest } from "./jsapi_types"; export declare class DirectStreamAPIImpl extends BaseApiClientImpl implements DirectStreamAPI { constructor(nc: NatsConnection, opts?: JetStreamOptions); getMessage(stream: string, query: DirectMsgRequest): Promise; getBatch(stream: string, opts: DirectBatchOptions): Promise>; getLastMessagesFor(stream: string, opts: DirectLastFor): Promise>; get(stream: string, opts: DirectBatchOptions | DirectLastFor): Promise>; } export declare class DirectMsgImpl implements DirectMsg { data: Uint8Array; header: MsgHdrs; constructor(m: Msg); get subject(): string; get seq(): number; get time(): Date; get timestamp(): string; get stream(): string; get lastSequence(): number; get pending(): number; json(reviver?: ReviverFn): T; string(): string; } /** * Options for directly starting a direct consumer. The options can either specify * a sequence start or a time start. * @property {DirectBatchStartSeq} DirectBatchStartSeq - Specifies a sequence start for the consumer. * @property {DirectBatchStartTime} DirectBatchStartTime - Specifies a time start for the consumer. */ export type DirectStartOptions = DirectBatchStartSeq | DirectBatchStartTime; /** * Represents the limits for the operation. For fetch requests it represents the maximum to be retrieved. * For consume operations it represents the buffering for the consumer. * * This type is used to define constraints or configurations for batching processes that * operate under specific limits, either in terms of quantity (DirectBatch) or size in bytes (DirectMaxBytes). */ export type DirectBatchLimits = DirectBatch | DirectMaxBytes; export declare class DirectConsumer { stream: string; api: DirectStreamAPIImpl; cursor: { last: number; pending?: number; }; listeners: QueuedIteratorImpl[]; start: DirectStartOptions; constructor(stream: string, api: DirectStreamAPIImpl, start: DirectStartOptions); getOptions(opts?: DirectBatchLimits): DirectBatchOptions; status(): AsyncIterable; notify(n: ConsumerNotification): void; debug(): void; consume(opts: DirectBatchLimits): Promise>; fetch(opts?: DirectBatchLimits): Promise>; next(): Promise; }