import type { CallbackFn, ConnectionClosedListener, Delay, QueuedIterator, Status, Subscription } from "@nats-io/nats-core/internal"; import { IdleHeartbeatMonitor, QueuedIteratorImpl } from "@nats-io/nats-core/internal"; import type { ConsumerAPIImpl } from "./jsmconsumer_api"; import type { JsMsg } from "./jsmsg"; import type { ConsumerConfig, ConsumerInfo, OverflowMinPendingAndMinAck, PrioritizedOptions, PullOptions } from "./jsapi_types"; import type { ConsumeOptions, Consumer, ConsumerAPI, ConsumerCallbackFn, ConsumerMessages, ConsumerNotification, Expires, FetchOptions, IdleHeartbeat, MaxBytes, MaxMessages, NextOptions, OrderedConsumerOptions, PullConsumerOptions, ThresholdBytes, ThresholdMessages } from "./types"; import { JetStreamStatus } from "./jserrors"; export declare const PullConsumerType: { readonly Unset: ""; readonly Consume: "consume"; readonly Fetch: "fetch"; }; export type PullConsumerType = typeof PullConsumerType[keyof typeof PullConsumerType]; export type OrderedConsumerState = { namePrefix: string; cursor: { stream_seq: number; deliver_seq: number; }; type: PullConsumerType; startSeq: number; maxInitialReset: number; opts: Partial; createFails: number; needsReset?: boolean; }; export type PullConsumerInternalOptions = { refilling: boolean; ordered?: OrderedConsumerOptions; }; type ClientPinId = { id: string; }; type InternalPullOptions = MaxMessages & MaxBytes & Expires & IdleHeartbeat & ThresholdMessages & OverflowMinPendingAndMinAck & PrioritizedOptions & ThresholdBytes & ClientPinId; export declare function isOverflowOptions(opts: unknown): opts is OverflowMinPendingAndMinAck; export declare function isPrioritizedOptions(opts: unknown): opts is PrioritizedOptions; export declare class PullConsumerMessagesImpl extends QueuedIteratorImpl implements ConsumerMessages { consumer: PullConsumerImpl; opts: InternalPullOptions; sub: Subscription; monitor: IdleHeartbeatMonitor | null; pending: { msgs: number; bytes: number; requests: number; }; isConsume: boolean; callback: ConsumerCallbackFn | null; listeners: QueuedIterator[]; statusIterator?: QueuedIteratorImpl; abortOnMissingResource?: boolean; bind: boolean; inboxPrefix: string; inbox: string; cancelables: Delay[]; inReset: boolean; closeListener: ConnectionClosedListener; isPinned: boolean; isPriority: boolean; natsPinId: string; constructor(c: PullConsumerImpl, opts: ConsumeOptions | FetchOptions, refilling?: boolean); start(): void; /** * Handle the notification of 409 error and whether * it should reject the operation by returning an Error or null * @param status */ handle409(status: JetStreamStatus): Error | null; reset(): void; _push(r: JsMsg | CallbackFn): void; notify(n: ConsumerNotification): void; resetPending(): Promise; resetPendingNoInfo(): Promise; resetPendingWithInfo(): Promise; pull(opts: Partial): void; pullOptions(): Partial; close(): Promise; closed(): Promise; clearTimers(): void; stop(err?: Error): void; parseOptions(opts: PullConsumerOptions, refilling?: boolean): InternalPullOptions; status(): AsyncIterable; } export declare class PullConsumerImpl implements Consumer { api: ConsumerAPIImpl; _info: ConsumerInfo; stream: string; name: string; opts: Partial; type: PullConsumerType; messages?: PullConsumerMessagesImpl; ordered: boolean; serial: number; orderedConsumerState?: OrderedConsumerState; constructor(api: ConsumerAPI, info: ConsumerInfo, opts?: Partial | null); debug(): void; isPullConsumer(): boolean; isPushConsumer(): boolean; consume(opts?: ConsumeOptions): Promise; fetch(opts?: FetchOptions): Promise; next(opts?: NextOptions): Promise; delete(): Promise; getConsumerOpts(): ConsumerConfig; _reset(): Promise; info(cached?: boolean): Promise; } export declare function validateOverflowPullOptions(opts: unknown): void; export declare function validatePrioritizedPullOptions(opts: unknown): void; export {};