Comparing version 2.0.7 to 2.0.8
@@ -61,3 +61,3 @@ /* | ||
if (options.transport === undefined || options.transport === 'tcp') { | ||
server = net.createServer(options); | ||
server = net.createServer(); | ||
server.on('connection', function (socket) { | ||
@@ -64,0 +64,0 @@ new Connection(options, container).accept(socket); |
@@ -21,3 +21,3 @@ /* | ||
function ProtocolError(message) { | ||
Error.captureStackTrace(this, ProtocolError); | ||
Error.call(this); | ||
this.message = message; | ||
@@ -29,10 +29,11 @@ this.name = 'ProtocolError'; | ||
function TypeError(message) { | ||
Error.captureStackTrace(this, TypeError); | ||
ProtocolError.call(this, message); | ||
this.message = message; | ||
this.name = 'TypeError'; | ||
} | ||
util.inherits(TypeError, ProtocolError); | ||
function ConnectionError(message, condition, connection) { | ||
Error.captureStackTrace(this, ConnectionError); | ||
Error.call(this, message); | ||
this.message = message; | ||
@@ -44,2 +45,3 @@ this.name = 'ConnectionError'; | ||
} | ||
util.inherits(ConnectionError, Error); | ||
@@ -46,0 +48,0 @@ |
{ | ||
"name": "rhea", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "reactive AMQP 1.0 library", | ||
@@ -17,16 +17,16 @@ "homepage": "http://github.com/amqp/rhea", | ||
"dependencies": { | ||
"debug": "^4.3.3" | ||
"debug": "0.8.0 - 3.5.0" | ||
}, | ||
"devDependencies": { | ||
"@types/debug": "^4.1.7", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "10 -", | ||
"@types/debug": "^0.0.30", | ||
"@types/mocha": "^5.2.0", | ||
"@types/node": "^8.0.37", | ||
"browserify": "", | ||
"eslint": "^7.32.0", | ||
"eslint": "^4.19.1", | ||
"minimist": "", | ||
"mocha": "^9.1.4", | ||
"mocha": "^8.2.1", | ||
"nyc": "^15.1.0", | ||
"require-self": "^0.2.1", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.5", | ||
"ts-node": "^7.0.0", | ||
"typescript": "^3.0.1", | ||
"uglify-js": "", | ||
@@ -33,0 +33,0 @@ "ws": "^6.0.0" |
@@ -174,15 +174,24 @@ ![Node.js CI](https://github.com/amqp/rhea/workflows/Node.js%20CI/badge.svg) | ||
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: | ||
The options argument is an object that may contain any of the | ||
following fields: | ||
* 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 | ||
* host | ||
* port | ||
* 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 | ||
@@ -202,18 +211,2 @@ * 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 | ||
@@ -224,2 +217,9 @@ 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,17 +252,5 @@ * 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 | ||
@@ -340,12 +328,2 @@ * 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 | ||
@@ -381,4 +359,2 @@ 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, | ||
@@ -385,0 +361,0 @@ the connection options are consulted followed by the container |
@@ -6,3 +6,3 @@ { | ||
"newLine": "LF", | ||
"target": "es2018", | ||
"target": "es5", | ||
"moduleResolution": "node", | ||
@@ -14,3 +14,3 @@ "noImplicitReturns": true, | ||
"lib": [ | ||
"es2018" | ||
"es2015" | ||
] | ||
@@ -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 { NetConnectOpts, ListenOptions, Socket } from "net"; | ||
import { Socket } from "net"; | ||
import { frames } from "./frames"; | ||
import { EventEmitter } from "events"; | ||
import { Container } from "./container"; | ||
import { ConnectionOptions as TlsConnectionOptions, PeerCertificate, TlsOptions } from "tls"; | ||
import { PeerCertificate } from "tls"; | ||
import { ConnectionError } from "./errors"; | ||
@@ -63,12 +65,36 @@ | ||
/** | ||
* Defines the common options that can be provided for client and server connections. | ||
* @interface CommonConnectionOptions | ||
* Defines the options that can be provided while creating a connection. | ||
* @interface ConnectionOptions | ||
* @extends EndpointOptions | ||
*/ | ||
interface CommonConnectionOptions extends EndpointOptions { | ||
export interface ConnectionOptions extends EndpointOptions { | ||
/** | ||
* @property {string} [hostname] - The hostname presented in `open` frame, defaults to host. | ||
* @property {string} [username] - The username. | ||
*/ | ||
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 | ||
@@ -87,3 +113,3 @@ * this will be the id (a guid string) of the assocaited container object. When this property is | ||
/** | ||
* @property {string} [id] A unique name for the connection. If not provided then this will be | ||
* @property {string} [id] A unqiue name for the connection. If not provided then this will be | ||
* a string in the following format: "connection-<counter>". | ||
@@ -93,2 +119,30 @@ */ | ||
/** | ||
* @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 | ||
@@ -131,106 +185,41 @@ * 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 {string} [transport] - The transport option. This is ignored if connection_details is set. | ||
* @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) | ||
*/ | ||
transport?: "tcp"; | ||
} | ||
/** | ||
* Defines the common options that can be provided for TLS client connections. | ||
* @interface TlsTransportOptions | ||
*/ | ||
interface TlsTransportOptions { | ||
connection_details?: (options: ConnectionOptions | number) => ConnectionDetails; | ||
/** | ||
* @property {string} transport - The transport option to request TLS connection. This is ignored if connection_details is set. | ||
* @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"`). | ||
*/ | ||
transport: "tls" | "ssl"; | ||
} | ||
/** | ||
* Defines the common options that can be provided for client connections. | ||
* @interface ClientConnectionOptions | ||
* @extends CommonConnectionOptions | ||
*/ | ||
interface ClientConnectionOptions extends CommonConnectionOptions { | ||
non_fatal_errors?: string[]; | ||
/** | ||
* @property {string} [username] - The username. | ||
* @property {boolean} [all_errors_non_fatal] Determines if rhea's auto-reconnect should attempt reconnection on all fatal errors | ||
*/ | ||
username?: string; | ||
all_errors_non_fatal?: boolean, | ||
/** | ||
* @property {string} [sasl_init_hostname] - The hostname for initialising sasl. | ||
* @property {string} [key] The private key of the certificate to be used with tls connection option | ||
*/ | ||
sasl_init_hostname?: string; | ||
key?: string, | ||
/** | ||
* @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) | ||
* @property {string} [cert] The certificate to be used with tls connection option | ||
*/ | ||
reconnect?: boolean | number; | ||
cert?: string, | ||
/** | ||
* @property {number} [reconnect_limit] maximum number of reconnect attempts. | ||
* Applicable only when reconnect is true. | ||
* @property {string} [ca] The CA certificate used for signing certificate to be used with tls connection option | ||
*/ | ||
reconnect_limit?: number; | ||
ca?: string, | ||
/** | ||
* @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. | ||
* @property {boolean} [requestCert] Flag to indicate client authentication to be used with tls connection option | ||
* This is used in opening socket by nodejs | ||
*/ | ||
initial_reconnect_delay?: number; | ||
requestCert?: boolean, | ||
/** | ||
* @property {number} [max_reconnect_delay] - Maximum reconnect delay in milliseconds | ||
* before attempting to reconnect. Applicable only when reconnect is true. | ||
* @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 | ||
*/ | ||
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; | ||
rejectUnauthorized?: 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). | ||
@@ -305,3 +294,2 @@ * @interface LinkOptions | ||
* @interface TerminusOptions | ||
* @extends BaseTerminusOptions | ||
*/ | ||
@@ -318,3 +306,2 @@ export interface TerminusOptions extends BaseTerminusOptions { | ||
* @interface TargetTerminusOptions | ||
* @extends BaseTerminusOptions | ||
*/ | ||
@@ -331,3 +318,2 @@ export interface TargetTerminusOptions extends BaseTerminusOptions { | ||
* @interface Source | ||
* @extends TerminusOptions | ||
*/ | ||
@@ -562,4 +548,3 @@ export interface Source extends TerminusOptions { | ||
* @interface Message | ||
* @extends MessageProperties | ||
* @extends MessageHeader | ||
* @extends MessageProperties, MessageHeader | ||
*/ | ||
@@ -566,0 +551,0 @@ export interface Message extends MessageProperties, MessageHeader { |
@@ -8,5 +8,5 @@ /// <reference types="node" /> | ||
import { EventEmitter } from "events"; | ||
import { Connection, ConnectionOptions, ServerConnectionOptions, TlsServerConnectionOptions } from "./connection"; | ||
import { Server, Socket } from "net"; | ||
import { Server as TlsServer, ConnectionOptions as TlsConnectionOptions } from "tls"; | ||
import { Connection, ConnectionOptions } from "./connection"; | ||
import { ListenOptions, Server, Socket } from "net"; | ||
import { TlsOptions, Server as TlsServer, ConnectionOptions as TlsConnectionOptions } from "tls"; | ||
import { message } from "./message"; | ||
@@ -27,4 +27,3 @@ import { types } from "./types"; | ||
create_connection(options?: ConnectionOptions): Connection; | ||
listen(options: TlsServerConnectionOptions): TlsServer; | ||
listen(options: ServerConnectionOptions): Server; | ||
listen(options: ListenOptions | TlsOptions): Server | TlsServer; | ||
create_container(options?: ContainerOptions): Container; | ||
@@ -31,0 +30,0 @@ get_option(name: string, default_value: any): any; |
@@ -7,4 +7,4 @@ /// <reference types="node" /> | ||
EndpointOptions, LinkOptions, ReceiverOptions, SenderOptions, TerminusOptions, | ||
ConnectionEvents, MessageHeader, OnAmqpEvent, ServerConnectionOptions, Source, | ||
TargetTerminusOptions, ConnectionDetails | ||
ConnectionEvents, MessageHeader, OnAmqpEvent, Source, TargetTerminusOptions, | ||
ConnectionDetails | ||
} from "./connection"; | ||
@@ -11,0 +11,0 @@ export { ConnectionError, ProtocolError, TypeError, SimpleError } from "./errors"; |
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
1017955
15389
741
+ Addeddebug@3.2.7(transitive)
- Removeddebug@4.3.7(transitive)
Updateddebug@0.8.0 - 3.5.0