You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

amqp-connection-manager

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.4.1 to 3.4.2

27

dist/cjs/AmqpConnectionManager.js

@@ -31,3 +31,3 @@ "use strict";

*
* @param {(string|Object)[]} urls - An array of brokers to connect to.
* @param urls - An array of brokers to connect to.
* Takes url strings or objects {url: string, connectionOptions?: object}

@@ -38,11 +38,11 @@ * If present, a broker's [connectionOptions] will be used instead

* needs to create a new connection.
* @param {Object} [options={}] -
* @param {number} [options.heartbeatIntervalInSeconds=5] - The interval,
* @param [options={}] -
* @param [options.heartbeatIntervalInSeconds=5] - The interval,
* in seconds, to send heartbeats.
* @param {number} [options.reconnectTimeInSeconds] - The time to wait
* @param [options.reconnectTimeInSeconds] - The time to wait
* before trying to reconnect. If not specified, defaults to
* `heartbeatIntervalInSeconds`.
* @param {Object} [options.connectionOptions] - Passed to the amqplib
* @param [options.connectionOptions] - Passed to the amqplib
* connect method.
* @param {function} [options.findServers] - A `fn(callback)` or a `fn()`
* @param [options.findServers] - A `fn(callback)` or a `fn()`
* which returns a Promise. This should resolve to one or more servers

@@ -79,17 +79,2 @@ * to connect to, either a single URL or an array of URLs. This is handy

}
addListener(event, listener) {
return super.addListener(event, listener);
}
on(event, listener) {
return super.on(event, listener);
}
once(event, listener) {
return super.once(event, listener);
}
prependListener(event, listener) {
return super.prependListener(event, listener);
}
prependOnceListener(event, listener) {
return super.prependOnceListener(event, listener);
}
// `options` here are any options that can be passed to ChannelWrapper.

@@ -96,0 +81,0 @@ createChannel(options = {}) {

@@ -37,9 +37,9 @@ "use strict";

*
* @param {AmqpConnectionManager} connectionManager - connection manager which
* @param connectionManager - connection manager which
* created this channel.
* @param {Object} [options] -
* @param {string} [options.name] - A name for this channel. Handy for debugging.
* @param {function} [options.setup] - A default setup function to call. See
* @param [options] -
* @param [options.name] - A name for this channel. Handy for debugging.
* @param [options.setup] - A default setup function to call. See
* `addSetup` for details.
* @param {boolean} [options.json] - if true, then ChannelWrapper assumes all
* @param [options.json] - if true, then ChannelWrapper assumes all
* messages passed to `publish()` and `sendToQueue()` are plain JSON objects.

@@ -119,5 +119,5 @@ * These will be encoded automatically before being sent.

*
* @param {function} setup - setup function.
* @param {function} [done] - callback.
* @returns {void | Promise} - Resolves when complete.
* @param setup - setup function.
* @param [done] - callback.
* @returns - Resolves when complete.
*/

@@ -156,4 +156,4 @@ addSetup(setup, done) {

*
* @param {function} [done] - Optional callback.
* @returns {void | Promise} - Resolves when connected.
* @param [done] - Optional callback.
* @returns - Resolves when connected.
*/

@@ -160,0 +160,0 @@ waitForConnect(done) {

@@ -53,37 +53,2 @@ /// <reference types="node" />

reconnectTimeInSeconds: number;
on(event: string, listener: (...args: any[]) => void): this;
on(event: 'connect', listener: ConnectListener): this;
on(event: 'blocked', listener: (arg: {
reason: string;
}) => void): this;
on(event: 'unblocked', listener: () => void): this;
on(event: 'disconnect', listener: (arg: {
err: Error;
}) => void): this;
removeListener(event: string, listener: (...args: any[]) => void): this;
createChannel(options?: CreateChannelOpts): ChannelWrapper;
close(): Promise<void>;
isConnected(): boolean;
get connection(): Connection | undefined;
}
export default class AmqpConnectionManager extends EventEmitter implements IAmqpConnectionManager {
private _channels;
private _currentUrl;
private _closed;
private _cancelRetriesHandler?;
private _connectPromise?;
private _currentConnection?;
private _findServers;
private _urls?;
/**
* Keep track of whether a disconnect event has been sent or not. The problem
* is that if we've never connected, and we encounter an error, we want to
* generate a "disconnect" event, even though we're not disconnected, otherwise
* the caller will never know there was an error. So we can't just rely on
* this._currentConnection.
*/
private _disconnectSent;
connectionOptions: AmpqConnectionOptions | undefined;
heartbeatIntervalInSeconds: number;
reconnectTimeInSeconds: number;
addListener(event: string, listener: (...args: any[]) => void): this;

@@ -134,6 +99,35 @@ addListener(event: 'connect', listener: ConnectListener): this;

}) => void): this;
removeListener(event: string, listener: (...args: any[]) => void): this;
createChannel(options?: CreateChannelOpts): ChannelWrapper;
close(): Promise<void>;
isConnected(): boolean;
/** The current connection. */
get connection(): Connection | undefined;
/** Returns the number of registered channels. */
get channelCount(): number;
}
export default class AmqpConnectionManager extends EventEmitter implements IAmqpConnectionManager {
private _channels;
private _currentUrl;
private _closed;
private _cancelRetriesHandler?;
private _connectPromise?;
private _currentConnection?;
private _findServers;
private _urls?;
/**
* Keep track of whether a disconnect event has been sent or not. The problem
* is that if we've never connected, and we encounter an error, we want to
* generate a "disconnect" event, even though we're not disconnected, otherwise
* the caller will never know there was an error. So we can't just rely on
* this._currentConnection.
*/
private _disconnectSent;
connectionOptions: AmpqConnectionOptions | undefined;
heartbeatIntervalInSeconds: number;
reconnectTimeInSeconds: number;
/**
* Create a new AmqplibConnectionManager.
*
* @param {(string|Object)[]} urls - An array of brokers to connect to.
* @param urls - An array of brokers to connect to.
* Takes url strings or objects {url: string, connectionOptions?: object}

@@ -144,11 +138,11 @@ * If present, a broker's [connectionOptions] will be used instead

* needs to create a new connection.
* @param {Object} [options={}] -
* @param {number} [options.heartbeatIntervalInSeconds=5] - The interval,
* @param [options={}] -
* @param [options.heartbeatIntervalInSeconds=5] - The interval,
* in seconds, to send heartbeats.
* @param {number} [options.reconnectTimeInSeconds] - The time to wait
* @param [options.reconnectTimeInSeconds] - The time to wait
* before trying to reconnect. If not specified, defaults to
* `heartbeatIntervalInSeconds`.
* @param {Object} [options.connectionOptions] - Passed to the amqplib
* @param [options.connectionOptions] - Passed to the amqplib
* connect method.
* @param {function} [options.findServers] - A `fn(callback)` or a `fn()`
* @param [options.findServers] - A `fn(callback)` or a `fn()`
* which returns a Promise. This should resolve to one or more servers

@@ -155,0 +149,0 @@ * to connect to, either a single URL or an array of URLs. This is handy

@@ -26,3 +26,3 @@ import amqp from 'amqplib';

*
* @param {(string|Object)[]} urls - An array of brokers to connect to.
* @param urls - An array of brokers to connect to.
* Takes url strings or objects {url: string, connectionOptions?: object}

@@ -33,11 +33,11 @@ * If present, a broker's [connectionOptions] will be used instead

* needs to create a new connection.
* @param {Object} [options={}] -
* @param {number} [options.heartbeatIntervalInSeconds=5] - The interval,
* @param [options={}] -
* @param [options.heartbeatIntervalInSeconds=5] - The interval,
* in seconds, to send heartbeats.
* @param {number} [options.reconnectTimeInSeconds] - The time to wait
* @param [options.reconnectTimeInSeconds] - The time to wait
* before trying to reconnect. If not specified, defaults to
* `heartbeatIntervalInSeconds`.
* @param {Object} [options.connectionOptions] - Passed to the amqplib
* @param [options.connectionOptions] - Passed to the amqplib
* connect method.
* @param {function} [options.findServers] - A `fn(callback)` or a `fn()`
* @param [options.findServers] - A `fn(callback)` or a `fn()`
* which returns a Promise. This should resolve to one or more servers

@@ -74,17 +74,2 @@ * to connect to, either a single URL or an array of URLs. This is handy

}
addListener(event, listener) {
return super.addListener(event, listener);
}
on(event, listener) {
return super.on(event, listener);
}
once(event, listener) {
return super.once(event, listener);
}
prependListener(event, listener) {
return super.prependListener(event, listener);
}
prependOnceListener(event, listener) {
return super.prependOnceListener(event, listener);
}
// `options` here are any options that can be passed to ChannelWrapper.

@@ -91,0 +76,0 @@ createChannel(options = {}) {

@@ -112,5 +112,5 @@ /// <reference types="node" />

*
* @param {function} setup - setup function.
* @param {function} [done] - callback.
* @returns {void | Promise} - Resolves when complete.
* @param setup - setup function.
* @param [done] - callback.
* @returns - Resolves when complete.
*/

@@ -134,4 +134,4 @@ addSetup(setup: SetupFunc, done?: pb.Callback<void>): Promise<void>;

*
* @param {function} [done] - Optional callback.
* @returns {void | Promise} - Resolves when connected.
* @param [done] - Optional callback.
* @returns - Resolves when connected.
*/

@@ -144,9 +144,9 @@ waitForConnect(done?: pb.Callback<void>): Promise<void>;

*
* @param {AmqpConnectionManager} connectionManager - connection manager which
* @param connectionManager - connection manager which
* created this channel.
* @param {Object} [options] -
* @param {string} [options.name] - A name for this channel. Handy for debugging.
* @param {function} [options.setup] - A default setup function to call. See
* @param [options] -
* @param [options.name] - A name for this channel. Handy for debugging.
* @param [options.setup] - A default setup function to call. See
* `addSetup` for details.
* @param {boolean} [options.json] - if true, then ChannelWrapper assumes all
* @param [options.json] - if true, then ChannelWrapper assumes all
* messages passed to `publish()` and `sendToQueue()` are plain JSON objects.

@@ -153,0 +153,0 @@ * These will be encoded automatically before being sent.

@@ -32,9 +32,9 @@ import { EventEmitter } from 'events';

*
* @param {AmqpConnectionManager} connectionManager - connection manager which
* @param connectionManager - connection manager which
* created this channel.
* @param {Object} [options] -
* @param {string} [options.name] - A name for this channel. Handy for debugging.
* @param {function} [options.setup] - A default setup function to call. See
* @param [options] -
* @param [options.name] - A name for this channel. Handy for debugging.
* @param [options.setup] - A default setup function to call. See
* `addSetup` for details.
* @param {boolean} [options.json] - if true, then ChannelWrapper assumes all
* @param [options.json] - if true, then ChannelWrapper assumes all
* messages passed to `publish()` and `sendToQueue()` are plain JSON objects.

@@ -114,5 +114,5 @@ * These will be encoded automatically before being sent.

*
* @param {function} setup - setup function.
* @param {function} [done] - callback.
* @returns {void | Promise} - Resolves when complete.
* @param setup - setup function.
* @param [done] - callback.
* @returns - Resolves when complete.
*/

@@ -151,4 +151,4 @@ addSetup(setup, done) {

*
* @param {function} [done] - Optional callback.
* @returns {void | Promise} - Resolves when connected.
* @param [done] - Optional callback.
* @returns - Resolves when connected.
*/

@@ -155,0 +155,0 @@ waitForConnect(done) {

@@ -1,5 +0,5 @@

import AmqpConnectionManager, { AmqpConnectionManagerOptions } from './AmqpConnectionManager.js';
export type { AmqpConnectionManagerOptions, default as AmqpConnectionManager, } from './AmqpConnectionManager.js';
import { AmqpConnectionManagerOptions, IAmqpConnectionManager } from './AmqpConnectionManager.js';
export type { AmqpConnectionManagerOptions, IAmqpConnectionManager as AmqpConnectionManager, } from './AmqpConnectionManager.js';
export type { SetupFunc, CreateChannelOpts, default as ChannelWrapper } from './ChannelWrapper.js';
export declare function connect(urls: string[], options: AmqpConnectionManagerOptions): AmqpConnectionManager;
export declare function connect(urls: string[], options: AmqpConnectionManagerOptions): IAmqpConnectionManager;
declare const amqp: {

@@ -6,0 +6,0 @@ connect: typeof connect;

{
"name": "amqp-connection-manager",
"version": "3.4.1",
"version": "3.4.2",
"description": "Auto-reconnect and round robin support for amqplib.",

@@ -36,4 +36,2 @@ "module": "./dist/esm/index.js",

"@types/node": "^16.7.1",
"@types/sinon": "^10.0.2",
"@types/sinon-chai": "^3.2.5",
"@types/whatwg-url": "^8.2.1",

@@ -64,4 +62,2 @@ "@typescript-eslint/eslint-plugin": "^4.29.3",

"semantic-release": "^17.1.1",
"sinon": "^11.1.2",
"sinon-chai": "^3.7.0",
"ts-jest": "^27.0.5"

@@ -68,0 +64,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc