@types/amqp-connection-manager
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -16,38 +16,38 @@ // Type definitions for amqp-connection-manager 2.0 | ||
export interface AmqpConnectionManagerOptions { | ||
/** | ||
* Interval to send heartbeats to broker. Defaults to 5 seconds. | ||
*/ | ||
heartbeatIntervalInSeconds?: number; | ||
/** | ||
* Interval to send heartbeats to broker. Defaults to 5 seconds. | ||
*/ | ||
heartbeatIntervalInSeconds?: number; | ||
/** | ||
* The time to wait before trying to reconnect. If not specified, defaults to heartbeatIntervalInSeconds | ||
*/ | ||
reconnectTimeInSeconds?: number; | ||
/** | ||
* The time to wait before trying to reconnect. If not specified, defaults to heartbeatIntervalInSeconds | ||
*/ | ||
reconnectTimeInSeconds?: number; | ||
/** | ||
* is a function which returns one or more servers to connect to. This should return either a single URL or an array of URLs. | ||
* This is handy when you're using a service discovery mechanism such as Consul or etcd. Instead of taking a callback, this can also | ||
* return a Promise. Note that if this is supplied, then urls is ignored. | ||
*/ | ||
findServers?: ((callback: (urls: string | string[]) => void) => void) | (() => Promise<string | string[]>); | ||
/** | ||
* is a function which returns one or more servers to connect to. This should return either a single URL or an array of URLs. | ||
* This is handy when you're using a service discovery mechanism such as Consul or etcd. Instead of taking a callback, this can also | ||
* return a Promise. Note that if this is supplied, then urls is ignored. | ||
*/ | ||
findServers?: ((callback: (urls: string | string[]) => void) => void) | (() => Promise<string | string[]>); | ||
/** | ||
* TLS options | ||
* | ||
* These are passed through directly to amqplib (http://www.squaremobius.net/amqp.node/channel_api.html#connect), | ||
* which in turn passes them through to tls.connect (https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) | ||
*/ | ||
connectionOptions?: ConnectionOptions & { | ||
noDelay?: boolean; | ||
timeout?: number; | ||
keepAlive?: boolean; | ||
keepAliveDelay?: number; | ||
clientProperties?: any; | ||
credentials?: { | ||
mechanism: string; | ||
username: string; | ||
password: string; | ||
response: () => Buffer; | ||
}; | ||
}; | ||
/** | ||
* TLS options | ||
* | ||
* These are passed through directly to amqplib (http://www.squaremobius.net/amqp.node/channel_api.html#connect), | ||
* which in turn passes them through to tls.connect (https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) | ||
*/ | ||
connectionOptions?: ConnectionOptions & { | ||
noDelay?: boolean; | ||
timeout?: number; | ||
keepAlive?: boolean; | ||
keepAliveDelay?: number; | ||
clientProperties?: any; | ||
credentials?: { | ||
mechanism: string; | ||
username: string; | ||
password: string; | ||
response: () => Buffer; | ||
}; | ||
}; | ||
} | ||
@@ -66,92 +66,92 @@ | ||
export interface CreateChannelOpts { | ||
/** | ||
* Name for this channel. Used for debugging. | ||
*/ | ||
name?: string; | ||
/** | ||
* A function to call whenever we reconnect to the broker (and therefore create a new underlying channel.) | ||
* This function should either accept a callback, or return a Promise. See addSetup below | ||
*/ | ||
setup?: SetupFunc; | ||
/** | ||
* if true, then ChannelWrapper assumes all messages passed to publish() and sendToQueue() are plain JSON objects. | ||
* These will be encoded automatically before being sent. | ||
*/ | ||
json?: boolean; | ||
/** | ||
* Name for this channel. Used for debugging. | ||
*/ | ||
name?: string; | ||
/** | ||
* A function to call whenever we reconnect to the broker (and therefore create a new underlying channel.) | ||
* This function should either accept a callback, or return a Promise. See addSetup below | ||
*/ | ||
setup?: SetupFunc; | ||
/** | ||
* if true, then ChannelWrapper assumes all messages passed to publish() and sendToQueue() are plain JSON objects. | ||
* These will be encoded automatically before being sent. | ||
*/ | ||
json?: boolean; | ||
} | ||
export interface AmqpConnectionManager extends EventEmitter { | ||
addListener(event: string, listener: (...args: any[]) => void): this; | ||
addListener(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
addListener(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
addListener(event: string, listener: (...args: any[]) => void): this; | ||
addListener(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
addListener(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
on(event: string, listener: (...args: any[]) => void): this; | ||
on(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
on(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
on(event: string, listener: (...args: any[]) => void): this; | ||
on(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
on(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
once(event: string, listener: (...args: any[]) => void): this; | ||
once(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
once(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
once(event: string, listener: (...args: any[]) => void): this; | ||
once(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
once(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
prependListener(event: string, listener: (...args: any[]) => void): this; | ||
prependListener(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
prependListener(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
prependListener(event: string, listener: (...args: any[]) => void): this; | ||
prependListener(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
prependListener(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
prependOnceListener(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: "connect", listener: (arg: { connection: Connection, url: string }) => void): this; | ||
prependOnceListener(event: "disconnect", listener: (arg: {err: Error}) => void): this; | ||
/** | ||
* Create a new ChannelWrapper. This is a proxy for the actual channel (which may or may not exist at any moment, depending on whether or not we are currently connected.) | ||
* @param opts | ||
*/ | ||
createChannel(opts?: CreateChannelOpts): ChannelWrapper; | ||
/** | ||
* Create a new ChannelWrapper. This is a proxy for the actual channel (which may or may not exist at any moment, depending on whether or not we are currently connected.) | ||
* @param opts | ||
*/ | ||
createChannel(opts?: CreateChannelOpts): ChannelWrapper; | ||
/** | ||
* Returns true if the AmqpConnectionManager is connected to a broker, false otherwise. | ||
*/ | ||
isConnected(): boolean; | ||
/** | ||
* Returns true if the AmqpConnectionManager is connected to a broker, false otherwise. | ||
*/ | ||
isConnected(): boolean; | ||
/** | ||
* Close this AmqpConnectionManager and free all associated resources. | ||
*/ | ||
close(): Promise<void>; | ||
/** | ||
* Close this AmqpConnectionManager and free all associated resources. | ||
*/ | ||
close(): Promise<void>; | ||
} | ||
export interface ChannelWrapper extends EventEmitter { | ||
addListener(event: string, listener: (...args: any[]) => void): this; | ||
addListener(event: "connect", listener: () => void): this; | ||
addListener(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
addListener(event: "close", listener: () => void): this; | ||
addListener(event: string, listener: (...args: any[]) => void): this; | ||
addListener(event: "connect", listener: () => void): this; | ||
addListener(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
addListener(event: "close", listener: () => void): this; | ||
on(event: string, listener: (...args: any[]) => void): this; | ||
on(event: "connect", listener: () => void): this; | ||
on(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
on(event: "close", listener: () => void): this; | ||
on(event: string, listener: (...args: any[]) => void): this; | ||
on(event: "connect", listener: () => void): this; | ||
on(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
on(event: "close", listener: () => void): this; | ||
once(event: string, listener: (...args: any[]) => void): this; | ||
once(event: "connect", listener: () => void): this; | ||
once(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
once(event: "close", listener: () => void): this; | ||
once(event: string, listener: (...args: any[]) => void): this; | ||
once(event: "connect", listener: () => void): this; | ||
once(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
once(event: "close", listener: () => void): this; | ||
prependListener(event: string, listener: (...args: any[]) => void): this; | ||
prependListener(event: "connect", listener: () => void): this; | ||
prependListener(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
prependListener(event: "close", listener: () => void): this; | ||
prependListener(event: string, listener: (...args: any[]) => void): this; | ||
prependListener(event: "connect", listener: () => void): this; | ||
prependListener(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
prependListener(event: "close", listener: () => void): this; | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: "connect", listener: () => void): this; | ||
prependOnceListener(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
prependOnceListener(event: "close", listener: () => void): this; | ||
prependOnceListener(event: string, listener: (...args: any[]) => void): this; | ||
prependOnceListener(event: "connect", listener: () => void): this; | ||
prependOnceListener(event: "error", listener: (err: Error, info: { name: string }) => void): this; | ||
prependOnceListener(event: "close", listener: () => void): this; | ||
/** | ||
* Adds a new 'setup handler'. setup(channel, [cb]) is a function to call when a new underlying channel is created - | ||
* handy for asserting exchanges and queues exists, and whatnot. The channel object here is a ConfirmChannel from amqplib. | ||
* The setup function should return a Promise (or optionally take a callback) - no messages will be sent until this Promise resolves. | ||
* If there is a connection, setup() will be run immediately, and the addSetup Promise/callback won't resolve until setup is complete. | ||
* Note that in this case, if the setup throws an error, no 'error' event will be emitted, since you can just handle the error here | ||
* (although the setup will still be added for future reconnects, even if it throws an error.) | ||
* Setup functions should, ideally, not throw errors, but if they do then the ChannelWrapper will emit an 'error' event. | ||
* @param func | ||
*/ | ||
/** | ||
* Adds a new 'setup handler'. setup(channel, [cb]) is a function to call when a new underlying channel is created - | ||
* handy for asserting exchanges and queues exists, and whatnot. The channel object here is a ConfirmChannel from amqplib. | ||
* The setup function should return a Promise (or optionally take a callback) - no messages will be sent until this Promise resolves. | ||
* If there is a connection, setup() will be run immediately, and the addSetup Promise/callback won't resolve until setup is complete. | ||
* Note that in this case, if the setup throws an error, no 'error' event will be emitted, since you can just handle the error here | ||
* (although the setup will still be added for future reconnects, even if it throws an error.) | ||
* Setup functions should, ideally, not throw errors, but if they do then the ChannelWrapper will emit an 'error' event. | ||
* @param func | ||
*/ | ||
addSetup(func: SetupFunc): Promise<void>; | ||
@@ -168,50 +168,50 @@ | ||
/** | ||
* @see amqplib | ||
* @param exchange | ||
* @param routingKey | ||
* @param content | ||
* @param options | ||
* @param callback | ||
*/ | ||
/** | ||
* @see amqplib | ||
* @param exchange | ||
* @param routingKey | ||
* @param content | ||
* @param options | ||
* @param callback | ||
*/ | ||
publish(exchange: string, routingKey: string, content: Buffer | object, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise<void>; | ||
/** | ||
* @see amqplib | ||
* @param queue | ||
* @param content | ||
* @param options | ||
* @param callback | ||
*/ | ||
/** | ||
* @see amqplib | ||
* @param queue | ||
* @param content | ||
* @param options | ||
* @param callback | ||
*/ | ||
sendToQueue(queue: string, content: Buffer | object, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): Promise<void>; | ||
/** | ||
* @see amqplib | ||
* @param message | ||
* @param allUpTo | ||
*/ | ||
/** | ||
* @see amqplib | ||
* @param message | ||
* @param allUpTo | ||
*/ | ||
ack(message: Message, allUpTo?: boolean): void; | ||
/** | ||
* @see amqplib | ||
* @param message | ||
* @param allUpTo | ||
* @param requeue | ||
*/ | ||
/** | ||
* @see amqplib | ||
* @param message | ||
* @param allUpTo | ||
* @param requeue | ||
*/ | ||
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; | ||
/** | ||
* Returns a count of messages currently waiting to be sent to the underlying channel. | ||
*/ | ||
queueLength(): number; | ||
/** | ||
* Returns a count of messages currently waiting to be sent to the underlying channel. | ||
*/ | ||
queueLength(): number; | ||
/** | ||
* Close a channel, clean up resources associated with it. | ||
*/ | ||
close(): Promise<void>; | ||
/** | ||
* Close a channel, clean up resources associated with it. | ||
*/ | ||
close(): Promise<void>; | ||
/** | ||
* Returns a Promise which resolves when this channel next connects. | ||
*/ | ||
waitForConnect(): Promise<void>; | ||
/** | ||
* Returns a Promise which resolves when this channel next connects. | ||
*/ | ||
waitForConnect(): Promise<void>; | ||
} |
{ | ||
"name": "@types/amqp-connection-manager", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "TypeScript definitions for amqp-connection-manager", | ||
@@ -29,4 +29,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "9a1599290cce22bacac9f77a66533c4bc977728d4d890d85a150613896b0b421", | ||
"typesPublisherContentHash": "501b74cb55808aed18b9f2ab92b55deb425aa2386f6d0e7e8d385433f955ea1f", | ||
"typeScriptVersion": "3.2" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 31 Mar 2020 01:23:35 GMT | ||
* Last updated: Fri, 15 May 2020 04:08:44 GMT | ||
* Dependencies: [@types/amqplib](https://npmjs.com/package/@types/amqplib) | ||
@@ -14,0 +14,0 @@ * Global values: none |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11825