@types/jackrabbit
TypeScript icon, indicating that this package has built-in type declarations

4.3.7 • Public • Published

Installation

npm install --save @types/jackrabbit

Summary

This package contains type definitions for jackrabbit (https://github.com/hunterloftis/jackrabbit).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jackrabbit.

index.d.ts

import { Connection, Message, Options } from "amqplib";

declare namespace jackrabbit {
    function jackrabbit(url: string): JackRabbit;

    interface JackRabbit extends NodeJS.EventEmitter {
        default(): Exchange;
        direct(name?: string): Exchange;
        fanout(name?: string): Exchange;
        topic(name?: string): Exchange;
        close(callback: (e: Error) => any): void;
        getInternals: () => {
            amqp: any;
            connection: Connection;
        };
    }

    enum exchangeType {
        direct = "direct",
        fanout = "fanout",
        topic = "topic",
    }

    interface Exchange extends NodeJS.EventEmitter {
        name: string;
        type: exchangeType;
        options: Options.AssertExchange;
        queue(options: QueueOptions): Queue;
        connect(con: Connection): Exchange;
        publish(message: any, options?: PublishOptions): Exchange;
    }

    type PublishOptions = Options.Publish & {
        key: string;
        reply?: AckCallback | undefined;
    };

    type QueueOptions = Options.AssertQueue & {
        name?: string | undefined;
        key?: string | undefined;
        keys?: readonly string[] | undefined;
        prefetch?: number | undefined;
    };

    type AckCallback = (data?: any) => void;

    interface Queue extends NodeJS.EventEmitter {
        name: string;
        options: QueueOptions;
        connect(con: Connection): void;
        consume: (
            callback: (data: any, ack: AckCallback, nack: () => void, msg: Message) => void,
            options?: Options.Consume,
        ) => void;
        cancel(done: any): void;
        purge(done: any): void;
    }
}

export default jackrabbit.jackrabbit;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: @types/amqplib

Credits

These definitions were written by Elvis Adomnica.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/jackrabbit

Weekly Downloads

16

Version

4.3.7

License

MIT

Unpacked Size

6.07 kB

Total Files

5

Last publish

Collaborators

  • types