mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #33415 from jacobgardner/feature/amqp-connection
amqplib: Add serverProperties to Connection object
This commit is contained in:
@@ -14,6 +14,14 @@ amqp.connect('amqp://localhost')
|
||||
|
||||
amqp.connect('amqp://localhost')
|
||||
.then(connection => {
|
||||
connection.serverProperties.copyright; // $ExpectType string | undefined
|
||||
connection.serverProperties.platform; // $ExpectType string
|
||||
connection.serverProperties.information; // $ExpectType string
|
||||
connection.serverProperties.host; // $ExpectType string
|
||||
connection.serverProperties.product; // $ExpectType string
|
||||
connection.serverProperties.version; // $ExpectType string
|
||||
connection.serverProperties.customField; // $ExpectType string | undefined
|
||||
|
||||
return connection.createChannel()
|
||||
.tap(channel => channel.checkQueue('myQueue'))
|
||||
.then(channel => {
|
||||
@@ -37,6 +45,14 @@ import amqpcb = require('amqplib/callback_api');
|
||||
|
||||
amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
if (!err) {
|
||||
connection.serverProperties.copyright; // $ExpectType string | undefined
|
||||
connection.serverProperties.platform; // $ExpectType string
|
||||
connection.serverProperties.information; // $ExpectType string
|
||||
connection.serverProperties.host; // $ExpectType string
|
||||
connection.serverProperties.product; // $ExpectType string
|
||||
connection.serverProperties.version; // $ExpectType string
|
||||
connection.serverProperties.customField; // $ExpectType string | undefined
|
||||
|
||||
connection.createChannel((err, channel) => {
|
||||
if (!err) {
|
||||
channel.assertQueue('myQueue', {}, (err, ok) => {
|
||||
|
||||
Vendored
+2
-1
@@ -1,11 +1,12 @@
|
||||
import events = require('events');
|
||||
import { Replies, Options, Message } from './properties';
|
||||
import { Replies, Options, Message, ServerProperties } from './properties';
|
||||
export * from './properties';
|
||||
|
||||
export interface Connection extends events.EventEmitter {
|
||||
close(callback?: (err: any) => void): void;
|
||||
createChannel(callback: (err: any, channel: Channel) => void): void;
|
||||
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
|
||||
serverProperties: ServerProperties;
|
||||
}
|
||||
|
||||
export interface Channel extends events.EventEmitter {
|
||||
|
||||
Vendored
+2
-1
@@ -8,13 +8,14 @@
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
import * as events from 'events';
|
||||
import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties';
|
||||
import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties';
|
||||
export * from './properties';
|
||||
|
||||
export interface Connection extends events.EventEmitter {
|
||||
close(): Promise<void>;
|
||||
createChannel(): Promise<Channel>;
|
||||
createConfirmChannel(): Promise<ConfirmChannel>;
|
||||
serverProperties: ServerProperties;
|
||||
}
|
||||
|
||||
export interface Channel extends events.EventEmitter {
|
||||
|
||||
Vendored
+10
@@ -210,3 +210,13 @@ export interface XDeath {
|
||||
"original-expiration"?: any;
|
||||
"routing-keys": string[];
|
||||
}
|
||||
|
||||
export interface ServerProperties {
|
||||
host: string;
|
||||
product: string;
|
||||
version: string;
|
||||
platform: string;
|
||||
copyright?: string;
|
||||
information: string;
|
||||
[key: string]: string | undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user