Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rhea

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rhea - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

19

lib/connection.js

@@ -242,3 +242,3 @@ /*

this.heartbeat_in = undefined;
this.abort_idle = false;
this.abort_idle = undefined;
this.socket_ready = false;

@@ -278,3 +278,4 @@ this.scheduled_reconnect = undefined;

if (this.abort_idle) {
this.abort_idle = false;
clearTimeout(this.abort_idle);
this.abort_idle = undefined;
this.local.close.error = undefined;

@@ -307,3 +308,6 @@ this.state = new EndpointState();

this.is_server = false;
this.abort_idle = false;
if (this.abort_idle) {
clearTimeout(this.abort_idle);
this.abort_idle = undefined;
}
this._reset_remote_state();

@@ -347,2 +351,3 @@ this._connect(this.options.connection_details(this.conn_established_counter));

if (socket === this.socket) {
this.abort_idle = undefined;
log.io('[%s] aborting socket', this.options.id);

@@ -582,7 +587,6 @@ this.socket.end();

if (!this.is_closed()) {
this.abort_idle = true;
this.closed_with_non_fatal_error = true;
this.local.close.error = {condition:'amqp:resource-limit-exceeded', description:'max idle time exceeded'};
this.close();
setTimeout(this.abort_socket.bind(this, this.socket), 1000);
this.abort_idle = setTimeout(this.abort_socket.bind(this, this.socket), 1000);
}

@@ -610,2 +614,6 @@ };

}
if (this.abort_idle) {
clearTimeout(this.abort_idle);
this.abort_idle = undefined;
}
var was_closed_with_non_fatal_error = this.closed_with_non_fatal_error;

@@ -765,2 +773,3 @@ if (this.closed_with_non_fatal_error) {

this._write_frame(0, this.local.close);
this.local.close.error = undefined;
};

@@ -767,0 +776,0 @@

@@ -61,3 +61,3 @@ /*

if (options.transport === undefined || options.transport === 'tcp') {
server = net.createServer();
server = net.createServer(options);
server.on('connection', function (socket) {

@@ -64,0 +64,0 @@ new Connection(options, container).accept(socket);

@@ -21,3 +21,3 @@ /*

function ProtocolError(message) {
Error.call(this);
Error.captureStackTrace(this, ProtocolError);
this.message = message;

@@ -29,11 +29,10 @@ this.name = 'ProtocolError';

function TypeError(message) {
ProtocolError.call(this, message);
Error.captureStackTrace(this, TypeError);
this.message = message;
this.name = 'TypeError';
}
util.inherits(TypeError, ProtocolError);
function ConnectionError(message, condition, connection) {
Error.call(this, message);
Error.captureStackTrace(this, ConnectionError);
this.message = message;

@@ -45,3 +44,2 @@ this.name = 'ConnectionError';

}
util.inherits(ConnectionError, Error);

@@ -48,0 +46,0 @@

@@ -53,2 +53,6 @@ /*

Typed.prototype.toRheaTyped = function() {
return this;
};
function TypeDesc(name, typecode, props, empty_value) {

@@ -421,2 +425,7 @@ this.name = name;

};
types.wrap_set_as_list = function(l) {
if (l.size === 0) return types.List0();
var items = Array.from(l, types.wrap);
return types.List32(items);
};
types.wrap_map = function(m, key_wrapper) {

@@ -430,2 +439,10 @@ var items = [];

};
types.wrap_map_as_map = function(m) {
var items = [];
for (var [k, v] of m) {
items.push(types.wrap(k));
items.push(types.wrap(v));
}
return types.Map32(items);
};
types.wrap_symbolic_map = function(m) {

@@ -444,3 +461,5 @@ return types.wrap_map(m, types.wrap_symbol);

var t = typeof o;
if (t === 'string') {
if (t === 'object' && o !== null && typeof o.toRheaTyped === 'function') {
return o.toRheaTyped();
} else if (t === 'string') {
return types.wrap_string(o);

@@ -469,4 +488,2 @@ } else if (t === 'boolean') {

return types.wrap_timestamp(o.getTime());
} else if (o instanceof Typed) {
return o;
} else if (o instanceof Buffer || o instanceof Uint8Array) {

@@ -478,2 +495,6 @@ return types.wrap_binary(o);

return types.wrap_list(o);
} else if (o instanceof Map) {
return types.wrap_map_as_map(o);
} else if (o instanceof Set) {
return types.wrap_set_as_list(o);
} else {

@@ -480,0 +501,0 @@ return types.wrap_map(o);

{
"name": "rhea",
"version": "2.0.6",
"version": "2.0.7",
"description": "reactive AMQP 1.0 library",

@@ -17,19 +17,18 @@ "homepage": "http://github.com/amqp/rhea",

"dependencies": {
"debug": "0.8.0 - 3.5.0"
"debug": "^4.3.3"
},
"devDependencies": {
"@types/debug": "^0.0.30",
"@types/mocha": "^5.2.0",
"@types/node": "^8.0.37",
"@types/debug": "^4.1.7",
"@types/mocha": "^9.0.0",
"@types/node": "10 -",
"browserify": "",
"eslint": "^4.19.1",
"eslint": "^7.32.0",
"minimist": "",
"mocha": "^8.2.1",
"mocha": "^9.1.4",
"nyc": "^15.1.0",
"require-self": "^0.2.1",
"ts-node": "^7.0.0",
"typescript": "^3.0.1",
"ts-node": "^10.4.0",
"typescript": "^4.5.5",
"uglify-js": "",
"ws": "^6.0.0",
"wtfnode": "^0.8.4"
"ws": "^6.0.0"
},

@@ -48,2 +47,4 @@ "scripts": {

"amqp",
"amqp10",
"amqp 1.0",
"messaging"

@@ -50,0 +51,0 @@ ],

@@ -174,24 +174,15 @@ ![Node.js CI](https://github.com/amqp/rhea/workflows/Node.js%20CI/badge.svg)

The options argument is an object that may contain any of the
following fields:
The options argument is an object that may contain node library
[socket.connect](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener)
and
[tls.connect](https://nodejs.org/api/tls.html#tlsconnectoptions-callback)
options and any of the following fields:
* host
* port
* host - `socket.connect` option, defaults to localhost
* port - `socket.connect` option, defaults to 5672
* transport - undefined, 'tcp' or 'tls', determines if
`socket.connect` or `tls.connect` options are accepted
* username
* password
* container_id (overrides the container identifier)
* hostname
* ca (if using tls)
* servername (if using tls)
* key (if using tls with client auth)
* cert (if using tls with client auth)
* transport
* sasl_init_hostname
* idle_time_out
* channel_max
* max_frame_size
* outgoing_locales
* incoming_locales
* sender_options
* receiver_options
* reconnect

@@ -211,2 +202,18 @@ * if true (the default), the library will automatically attempt to

between a set of different host/port combinations)
As well as Container options common for both client and server:
* id - connection name
* container_id - (overrides the container identifier)
* hostname - to present to remote in the open frame (defaults to host)
* max_frame_size
* channel_max
* idle_time_out
* outgoing_locales - in open frame
* incoming_locales - in open frame
* offered_capabilities - in open frame
* desired_capabilities - in open frame
* properties - in open frame
* sender_options - defaults for open_sender
* receiver_options - defaults for open_receiver
* non_fatal_errors - an array of error conditions which if received

@@ -217,9 +224,2 @@ on connection close from peer should not prevent reconnect (by

If the transport is TLS, the options may additionally specify a
'servername' property. This allows the SNI to be controlled separately
from the host option. If servername is not specified, the SNI will
default to the host. If using TLS options for 'ca', 'cert' and 'key'
may also be specified (see
https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options)
If options is undefined, the client will attempt to obtain default

@@ -238,7 +238,7 @@ options from a JSON config file. This file is of similar structure to

* port
* user (note not username)
* user - (note not username)
* password
* sasl (a nested object with field enabled)
* sasl - (a nested object with field enabled)
* sasl_mechanisms
* tls (a nested object with fields key, cert, ca for paths to
* tls - (a nested object with fields key, cert, ca for paths to
correspoding files)

@@ -252,5 +252,17 @@ * verify

The options argument is an object that may contain node library
[net.createServer](https://nodejs.org/api/net.html#netcreateserveroptions-connectionlistener)
and its
[server.listen](https://nodejs.org/api/net.html#serverlistenoptions-callback)
or
[tls.createServer](https://nodejs.org/api/tls.html#tlscreateserveroptions-secureconnectionlistener)
and its [server.listen](https://nodejs.org/api/tls.html#serverlisten)
options, most AMQP Container fields listed for `connect` and any of the
following fields:
The options argument is an object that may contain any of the
following fields:
* transport - undefined, 'tcp' or 'tls', determines if
`net.createServer` or `tls.createServer` options are accepted
* host

@@ -328,2 +340,12 @@ * port

And attach frame fields:
* snd_settle_mode
* rcv_settle_mode
* unsettled
* max_message_size
* offered_capabilities
* desired_capabilities
* properties
Note: If the link doesn't specify a value for the credit_window and

@@ -359,2 +381,4 @@ autoaccept options, the connection options are consulted followed by

And attach frame fields as for `open_receiver`.
Note: If the link doesn't specify a value for the autosettle option,

@@ -361,0 +385,0 @@ the connection options are consulted followed by the container

@@ -6,3 +6,3 @@ {

"newLine": "LF",
"target": "es5",
"target": "es2018",
"moduleResolution": "node",

@@ -14,3 +14,3 @@ "noImplicitReturns": true,

"lib": [
"es2015"
"es2018"
]

@@ -17,0 +17,0 @@ },

/// <reference types="node" />
import { EndpointState } from "./endpoint";
import { Session, Delivery } from "./session";
import { Transport } from "./transport";
import { Sender, Receiver, link } from "./link";
import { Socket } from "net";
import { NetConnectOpts, ListenOptions, Socket } from "net";
import { frames } from "./frames";
import { EventEmitter } from "events";
import { Container } from "./container";
import { PeerCertificate } from "tls";
import { ConnectionOptions as TlsConnectionOptions, PeerCertificate, TlsOptions } from "tls";
import { ConnectionError } from "./errors";

@@ -65,36 +63,12 @@

/**
* Defines the options that can be provided while creating a connection.
* @interface ConnectionOptions
* Defines the common options that can be provided for client and server connections.
* @interface CommonConnectionOptions
* @extends EndpointOptions
*/
export interface ConnectionOptions extends EndpointOptions {
interface CommonConnectionOptions extends EndpointOptions {
/**
* @property {string} [username] - The username.
* @property {string} [hostname] - The hostname presented in `open` frame, defaults to host.
*/
username?: string;
/**
* @property {string} [host] - The host to connect to.
*/
host?: string;
/**
* @property {string} [hostname] - The hostname to connect to.
*/
hostname?: string;
/**
* @property {string} [servername] - The name of the server.
*/
servername?: string;
/**
* @property {string} [sasl_init_hostname] - The hostname for initialising sasl.
*/
sasl_init_hostname?: string;
/**
* @property {number} [port] - The port number (5671 or 5672) at which to connect to.
*/
port?: number;
/**
* @property {string} [transport] - The transport option. This is ignored if connection_details is set.
*/
transport?: "tls" | "ssl" | "tcp";
/**
* @property {string} [container_id] The id of the source container. If not provided then

@@ -113,3 +87,3 @@ * this will be the id (a guid string) of the assocaited container object. When this property is

/**
* @property {string} [id] A unqiue name for the connection. If not provided then this will be
* @property {string} [id] A unique name for the connection. If not provided then this will be
* a string in the following format: "connection-<counter>".

@@ -119,30 +93,2 @@ */

/**
* @property {boolean} [reconnect] if true (default), the library will automatically attempt to
* reconnect if disconnected.
* - if false, automatic reconnect will be disabled
* - if it is a numeric value, it is interpreted as the delay between
* reconnect attempts (in milliseconds)
*/
reconnect?: boolean | number;
/**
* @property {number} [reconnect_limit] maximum number of reconnect attempts.
* Applicable only when reconnect is true.
*/
reconnect_limit?: number;
/**
* @property {number} [initial_reconnect_delay] - Time to wait in milliseconds before
* attempting to reconnect. Applicable only when reconnect is true or a number is
* provided for reconnect.
*/
initial_reconnect_delay?: number;
/**
* @property {number} [max_reconnect_delay] - Maximum reconnect delay in milliseconds
* before attempting to reconnect. Applicable only when reconnect is true.
*/
max_reconnect_delay?: number;
/**
* @property {string} [password] - The secret key to be used while establishing the connection.
*/
password?: string;
/**
* @property {number} [max_frame_size] The largest frame size that the sending peer

@@ -185,41 +131,106 @@ * is able to accept on this connection. Default: 4294967295

receiver_options?: ReceiverOptions;
}
/**
* Defines the common options that can be provided for client connections.
* @interface TcpTransportOptions
*/
interface NetTransportOptions {
/**
* @property {Function} [connection_details] A function which if specified will be invoked to get the options
* to use (e.g. this can be used to alternate between a set of different host/port combinations)
* @property {string} [transport] - The transport option. This is ignored if connection_details is set.
*/
connection_details?: (options: ConnectionOptions | number) => ConnectionDetails;
transport?: "tcp";
}
/**
* Defines the common options that can be provided for TLS client connections.
* @interface TlsTransportOptions
*/
interface TlsTransportOptions {
/**
* @property {string[]} [non_fatal_errors] An array of error conditions which if received on connection close
* from peer should not prevent reconnect (by default this only includes `"amqp:connection:forced"`).
* @property {string} transport - The transport option to request TLS connection. This is ignored if connection_details is set.
*/
non_fatal_errors?: string[];
transport: "tls" | "ssl";
}
/**
* Defines the common options that can be provided for client connections.
* @interface ClientConnectionOptions
* @extends CommonConnectionOptions
*/
interface ClientConnectionOptions extends CommonConnectionOptions {
/**
* @property {boolean} [all_errors_non_fatal] Determines if rhea's auto-reconnect should attempt reconnection on all fatal errors
* @property {string} [username] - The username.
*/
all_errors_non_fatal?: boolean,
username?: string;
/**
* @property {string} [key] The private key of the certificate to be used with tls connection option
* @property {string} [sasl_init_hostname] - The hostname for initialising sasl.
*/
key?: string,
sasl_init_hostname?: string;
/**
* @property {string} [cert] The certificate to be used with tls connection option
* @property {boolean} [reconnect] if true (default), the library will automatically attempt to
* reconnect if disconnected.
* - if false, automatic reconnect will be disabled
* - if it is a numeric value, it is interpreted as the delay between
* reconnect attempts (in milliseconds)
*/
cert?: string,
reconnect?: boolean | number;
/**
* @property {string} [ca] The CA certificate used for signing certificate to be used with tls connection option
* @property {number} [reconnect_limit] maximum number of reconnect attempts.
* Applicable only when reconnect is true.
*/
ca?: string,
reconnect_limit?: number;
/**
* @property {boolean} [requestCert] Flag to indicate client authentication to be used with tls connection option
* This is used in opening socket by nodejs
* @property {number} [initial_reconnect_delay] - Time to wait in milliseconds before
* attempting to reconnect. Applicable only when reconnect is true or a number is
* provided for reconnect.
*/
requestCert?: boolean,
initial_reconnect_delay?: number;
/**
* @property {boolean} [rejectUnauthorized] Flag to indicate if certificate is self signed to be used with tls connection option
* This is used in opening socket by nodejs
* @property {number} [max_reconnect_delay] - Maximum reconnect delay in milliseconds
* before attempting to reconnect. Applicable only when reconnect is true.
*/
rejectUnauthorized?: boolean
max_reconnect_delay?: number;
/**
* @property {string} [password] - The secret key to be used while establishing the connection.
*/
password?: string;
/**
* @property {Function} [connection_details] A function which if specified will be invoked to get the options
* to use (e.g. this can be used to alternate between a set of different host/port combinations)
*/
connection_details?: (conn_established_counter: number) => ConnectionDetails;
/**
* @property {string[]} [non_fatal_errors] An array of error conditions which if received on connection close
* from peer should not prevent reconnect (by default this only includes `"amqp:connection:forced"`).
*/
non_fatal_errors?: string[];
/**
* @property {boolean} [all_errors_non_fatal] Determines if rhea's auto-reconnect should attempt reconnection on all fatal errors
*/
all_errors_non_fatal?: boolean;
}
type NetClientConnectionOptions = NetTransportOptions & ClientConnectionOptions & NetConnectOpts
type TlsClientConnectionOptions = TlsTransportOptions & ClientConnectionOptions & TlsConnectionOptions
export type ConnectionOptions = NetClientConnectionOptions | TlsClientConnectionOptions;
/** `net.createServer` options that have no own type in @types/node@10.17.60 */
type NetOptions = { allowHalfOpen?: boolean, pauseOnConnect?: boolean }
/**
* Defines the options that can be provided while creating a server connection.
*/
type NetServerConnectionOptions = NetTransportOptions & CommonConnectionOptions & ListenOptions & NetOptions
/**
* Defines the options that can be provided while creating a TLS server connection.
*/
type TlsServerConnectionOptions = TlsTransportOptions & CommonConnectionOptions & ListenOptions & TlsOptions
/**
* Defines the options that can be provided while creating a server connection.
*/
export type ServerConnectionOptions = NetServerConnectionOptions | TlsServerConnectionOptions
/**
* Defines the common set of options that can be provided while creating a link (sender, receiver).

@@ -294,2 +305,3 @@ * @interface LinkOptions

* @interface TerminusOptions
* @extends BaseTerminusOptions
*/

@@ -306,2 +318,3 @@ export interface TerminusOptions extends BaseTerminusOptions {

* @interface TargetTerminusOptions
* @extends BaseTerminusOptions
*/

@@ -318,2 +331,3 @@ export interface TargetTerminusOptions extends BaseTerminusOptions {

* @interface Source
* @extends TerminusOptions
*/

@@ -548,3 +562,4 @@ export interface Source extends TerminusOptions {

* @interface Message
* @extends MessageProperties, MessageHeader
* @extends MessageProperties
* @extends MessageHeader
*/

@@ -551,0 +566,0 @@ export interface Message extends MessageProperties, MessageHeader {

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

import { EventEmitter } from "events";
import { Connection, ConnectionOptions } from "./connection";
import { ListenOptions, Server, Socket } from "net";
import { TlsOptions, Server as TlsServer, ConnectionOptions as TlsConnectionOptions } from "tls";
import { Connection, ConnectionOptions, ServerConnectionOptions, TlsServerConnectionOptions } from "./connection";
import { Server, Socket } from "net";
import { Server as TlsServer, ConnectionOptions as TlsConnectionOptions } from "tls";
import { message } from "./message";

@@ -27,3 +27,4 @@ import { types } from "./types";

create_connection(options?: ConnectionOptions): Connection;
listen(options: ListenOptions | TlsOptions): Server | TlsServer;
listen(options: TlsServerConnectionOptions): TlsServer;
listen(options: ServerConnectionOptions): Server;
create_container(options?: ContainerOptions): Container;

@@ -30,0 +31,0 @@ get_option(name: string, default_value: any): any;

@@ -7,4 +7,4 @@ /// <reference types="node" />

EndpointOptions, LinkOptions, ReceiverOptions, SenderOptions, TerminusOptions,
ConnectionEvents, MessageHeader, OnAmqpEvent, Source, TargetTerminusOptions,
ConnectionDetails
ConnectionEvents, MessageHeader, OnAmqpEvent, ServerConnectionOptions, Source,
TargetTerminusOptions, ConnectionDetails
} from "./connection";

@@ -11,0 +11,0 @@ export { ConnectionError, ProtocolError, TypeError, SimpleError } from "./errors";

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc