/// <reference types="node" />
import { IDeSer } from './deser';
import { ITransportFailure, ITransport, ITransportEnvelope, MessageHandler, ITransportSession } from './transport';
import { Subscription } from 'nats';
export declare const NATS_ERROR_NOT_CONNECTED = "NOT_CONNECTED";
export declare const NATS_ERROR_SEND_FAILED = "SEND_FAILED";
export declare const NATS_ERROR_SEND_NO_ACK = "NO_ACK";
export interface INatsMessage {
    envelope: ITransportEnvelope;
    contents?: Buffer;
    failure?: Buffer;
    cids?: string[];
    parentUid?: string;
}
export declare class NatsTransport implements ITransport {
    private deser;
    private seedUrls?;
    private ackTimeout;
    constructor(deser: IDeSer, seedUrls?: string[], ackTimeout?: number);
    connect(appId: string, onMessage: MessageHandler): Promise<ITransportSession>;
}
export declare class NatsTransportSession implements ITransportSession {
    private deser;
    private connection?;
    private subscription?;
    private appId?;
    private messageHandler?;
    private seedUrls?;
    private ackTimeout;
    constructor(deser: IDeSer, seedUrls: string[] | undefined, ackTimeout: number);
    connect(appId: string, onMessage: MessageHandler): Promise<void>;
    send(envelope: ITransportEnvelope, contents: unknown, failure?: ITransportFailure): Promise<void>;
    finalize(): Promise<void>;
    protected listen(sub: Subscription, onMessage: MessageHandler): Promise<void>;
    protected sendFailureMessage(originalEnv: ITransportEnvelope, code: string, msg: string): void;
}
