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

rhea-promise

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rhea-promise - npm Package Compare versions

Comparing version 1.2.1 to 2.0.0

58

changelog.md

@@ -0,1 +1,17 @@

### 2.0.0 - (2021-06-03)
- Updates rhea dependency to the 2.x major version, and the tslib dependency to the 2.x major version.
- Adds `CreateRequestResponseLinkOptions` as an exported interface.
#### Breaking changes
- rhea has 1 breaking change introduced in version 2.x: timestamps are not deserialized as Date objects instead of numbers.
- Updates `AwaitableSendOptions` to include the optional fields `tag` and `format` which were previously passed to `AwaitableSender.send()`. These fields are no longer positional arguments on `AwaitableSender.send()`.
- Adds `SenderSendOptions` to include the optional fields `tag` and `format` which were previously passed to `Sender.send()`. These fields are no longer positional arguments on `Sender.send()`.
- Removes `sendTimeoutInSeconds` from the `AwaitableSendOptions` that is passed to the `AwaitableSender` constructor. `timeoutInSeconds` on `AwaitableSenderOptions` can still be used to set the timeout for individual `AwaitableSender.send()` invocations.
- Renames the following TypeScript interfaces to better match the methods they apply to:
- SenderOptionsWithSession -> CreateSenderOptions
- AwaitableSenderOptionsWithSession -> CreateAwaitableSenderOptions
- ReceiverOptionsWithSession -> CreateReceiverOptions
### 1.2.1 - (2021-04-15)

@@ -6,2 +22,3 @@

### 1.2.0 - 2021-03-25
- Exposes the `incoming` getter on the `Session` that lets accessing size and capacity of the incoming deliveries [#79](https://github.com/amqp/rhea-promise/pull/79).

@@ -11,2 +28,3 @@ - Updates the error message for the `AbortError` to be a standard message `The operation was aborted.`.

### 1.1.0 - 2021-02-08
- All async methods now take a signal that can be used to cancel the operation. Fixes [#48](https://github.com/amqp/rhea-promise/issues/48)

@@ -18,2 +36,3 @@ - Added a `timeoutInSeconds` parameter to the `send` method on the `AwaitableSender` that overrides the timeout value for the send operation set when creating the sender.

### 1.0.0 - 2019-06-27
- Updated minimum version of `rhea` to `^1.0.8`.

@@ -25,70 +44,87 @@ - Added a read only property `id` to the `Session` object. The id property is created by concatenating session's local channel, remote channel and the connection id `"local-<number>_remote-<number>_<connection-id>"`, thus making it unique for that connection.

- The current `Sender` does not have a provision of **"awaiting"** on sending a message. The user needs to add handlers on the `Sender` for `accepted`, `rejected`, `released`, `modified` to ensure whether the message was successfully sent.
Now, we have added a new `AwaitableSender` which adds the handlers internally and provides an **awaitable** `send()` operation to the customer. Fixes [#45](https://github.com/amqp/rhea-promise/issues/45).
Now, we have added a new `AwaitableSender` which adds the handlers internally and provides an **awaitable** `send()` operation to the customer. Fixes [#45](https://github.com/amqp/rhea-promise/issues/45).
- Exporting new Errors:
- `InsufficientCreditError`: Defines the error that occurs when the Sender does not have enough credit.
- `SendOperationFailedError`: Defines the error that occurs when the Sender fails to send a message.
- `InsufficientCreditError`: Defines the error that occurs when the Sender does not have enough credit.
- `SendOperationFailedError`: Defines the error that occurs when the Sender fails to send a message.
### 0.2.0 - 2019-05-17
- Updated `OperationTimeoutError` to be a non-AMQP Error as pointed out in [#42](https://github.com/amqp/rhea-promise/issues/42). Fixed in [PR](https://github.com/amqp/rhea-promise/pull/43).
### 0.1.15 - 2019-04-10
- Export rhea types for `Typed`. [PR](https://github.com/amqp/rhea-promise/pull/36).
- Export rhea types for `WebSocketImpl` and `WebSocketInstance`. [PR](https://github.com/amqp/rhea-promise/pull/38).
- Export rhea types for `WebSocketImpl` and `WebSocketInstance`. [PR](https://github.com/amqp/rhea-promise/pull/38).
- When opening a connection fails with no error, use standard error message. [PR](https://github.com/amqp/rhea-promise/pull/27).
### 0.1.14 - 2019-03-19
- Allow websockets usage on a connection without creating a container first. [PR](https://github.com/amqp/rhea-promise/pull/32).
- New function `removeAllSessions()` on the connection to clear the internal map in rhea to ensure
sessions are not reconnected on the next `connection.open()` call. [PR](https://github.com/amqp/rhea-promise/pull/33).
- New function `removeAllSessions()` on the connection to clear the internal map in rhea to ensure
sessions are not reconnected on the next `connection.open()` call. [PR](https://github.com/amqp/rhea-promise/pull/33).
- Remove all event listeners on link and session objects when `close()` is called on them. [PR](https://github.com/amqp/rhea-promise/pull/34)
### 0.1.13 - 2018-12-11
- Throw `OperationTimeoutError` when a Promise to create/close an entity is rejected.
### 0.1.12 - 2018-11-16
- Fix a minor bug in receiver creation.
### 0.1.11 - 2018-11-15
- Added checks for some event handler methods to exist before logging information that uses node's
event handlers inbuilt functions.
event handlers inbuilt functions.
- Improved error checking while creating the receiver.
### 0.1.10 - 2018-11-01
- Provided an option to add an event handler for "settled" event on the Receiver.
### 0.1.9 - 2018-10-24
- With the usage of `importHelpers`, the tslib will be needed in package.json for installers using older versions of npm (or using yarn). [PR](https://github.com/amqp/rhea-promise/pull/16).
### 0.1.8 - 2018-10-22
- Allow setting drain property on the receiver [PR](https://github.com/amqp/rhea-promise/pull/14).
### 0.1.7 - 2018-10-19
- Fixed a bug while populating the connectionId [PR](https://github.com/amqp/rhea-promise/pull/11).
### 0.1.6 - 2018-09-28
- property `actionInitiated` is now of type `number` which is incremented when the `create`, `close`
action on an entity is under process and decremented when the action completes (succeeeded or failed).
action on an entity is under process and decremented when the action completes (succeeeded or failed).
### 0.1.5 - 2018-09-27
- Improved log statements for better debugging.
- Any type of `error` event will be emitted with a tick delay. This would give enough time for the
`create()` methods to resolve the promise.
`create()` methods to resolve the promise.
- Added a new `boolean` property `actionInitiated` which indicates whether the `create`, `close`
action on an entity is under process.
action on an entity is under process.
### 0.1.4 - 2018-09-25
- `options` is a required property of `Connection` and `Container`.
### 0.1.3 - 2018-09-25
- Transform relevant objects in rhea EventContext to rhea-promise objects.
- Ensure that `container.createConnection()` creates a connection on that container and not on
the default container.
the default container.
### 0.1.2 - 2018-09-20
- TS target to ES2015. This should help us support node.js version 6.x and above.
### 0.1.1 - 2018-09-20
- Update homepage, repository and bug urls in package.json
### 0.1.0 - 2018-09-20
- Initial version of rhea-promise.

20

dist/lib/awaitableSender.js

@@ -24,3 +24,2 @@ "use strict";

this.deliveryDispositionMap = new Map();
this.sendTimeoutInSeconds = options.sendTimeoutInSeconds || 20;
/**

@@ -116,15 +115,11 @@ * The handler that will be added on the Sender for `accepted` event. If the delivery id is

* and a valid value should be passed to the `format` argument.
* @param {Buffer | string} [tag] The message tag if any.
* @param {number} [format] The message format. Specify this if a message with custom format needs
* to be sent. `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
* @param {AwaitableSendOptions} [options] Options to configure the timeout and cancellation for
* the send operation.
* @param {AwaitableSendOptions} [options] Options to configure the timeout, cancellation for
* the send operation and the tag and message format of the message.
* @returns {Promise<Delivery>} Promise<Delivery> The delivery information about the sent message.
*/
send(msg, tag, format, options) {
send(msg, options = {}) {
return new Promise((resolve, reject) => {
log.sender("[%s] Sender '%s' on amqp session '%s', credit: %d available: %d", this.connection.id, this.name, this.session.id, this.credit, this.session.outgoing.available());
const abortSignal = options && options.abortSignal;
const timeoutInSeconds = options && options.timeoutInSeconds;
const timeoutInSeconds = options.timeoutInSeconds || 20;
if (abortSignal && abortSignal.aborted) {

@@ -136,5 +131,2 @@ const err = utils_1.createAbortError();

if (this.sendable()) {
let sendTimeoutInSeconds = this.sendTimeoutInSeconds;
if (typeof timeoutInSeconds === "number" && timeoutInSeconds > 0)
sendTimeoutInSeconds = timeoutInSeconds;
const timer = setTimeout(() => {

@@ -147,3 +139,3 @@ this.deliveryDispositionMap.delete(delivery.id);

return reject(new errorDefinitions_1.OperationTimeoutError(message));
}, sendTimeoutInSeconds * 1000);
}, timeoutInSeconds * 1000);
const onAbort = () => {

@@ -166,3 +158,3 @@ if (this.deliveryDispositionMap.has(delivery.id)) {

};
const delivery = this._link.send(msg, tag, format);
const delivery = this._link.send(msg, options.tag, options.format);
this.deliveryDispositionMap.set(delivery.id, {

@@ -169,0 +161,0 @@ resolve: (delivery) => {

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

* trying to create an amqp session or with an AbortError if the operation was cancelled.
* @param {SenderOptionsWithSession} options Optional parameters to create a sender link.
* @param {CreateSenderOptions} options Optional parameters to create a sender link.
* @return {Promise<Sender>} Promise<Sender>.

@@ -452,3 +452,3 @@ */

* trying to create an amqp session or with an AbortError if the operation was cancelled.
* @param {ReceiverOptionsWithSession} options Optional parameters to create a receiver link.
* @param {CreateReceiverOptions} options Optional parameters to create a receiver link.
* @return {Promise<Receiver>} Promise<Receiver>.

@@ -471,7 +471,6 @@ */

* @param {ReceiverOptions} receiverOptions Parameters to create a receiver.
* @param {Session} [session] The optional session on which the sender and receiver links will be
* created.
* @param {CreateRequestResponseLinkOptions} [options] Optional parameters to control how sender and receiver link creation.
* @return {Promise<ReqResLink>} Promise<ReqResLink>
*/
createRequestResponseLink(senderOptions, receiverOptions, providedSession, abortSignal) {
createRequestResponseLink(senderOptions, receiverOptions, options = {}) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {

@@ -484,2 +483,3 @@ if (!senderOptions) {

}
const { session: providedSession, abortSignal } = options;
const session = providedSession || (yield this.createSession({ abortSignal }));

@@ -486,0 +486,0 @@ const [sender, receiver] = yield Promise.all([

@@ -29,2 +29,3 @@ "use strict";

exports.Sender = sender_1.Sender;
exports.SenderSendOptions = sender_1.SenderSendOptions;
var awaitableSender_1 = require("./awaitableSender");

@@ -31,0 +32,0 @@ exports.AwaitableSender = awaitableSender_1.AwaitableSender;

@@ -26,2 +26,5 @@ "use strict";

exports.BaseSender = BaseSender;
class SenderSendOptions {
}
exports.SenderSendOptions = SenderSendOptions;
/**

@@ -40,10 +43,7 @@ * Describes the AMQP Sender.

* and a valid value should be passed to the `format` argument.
* @param {Buffer | string} [tag] The message tag if any.
* @param {number} [format] The message format. Specify this if a message with custom format needs
* to be sent. `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
* @param {SenderSendOptions} [options] Options to configure the tag and message format of the message.
* @returns {Delivery} Delivery The delivery information about the sent message.
*/
send(msg, tag, format) {
return this._link.send(msg, tag, format);
send(msg, options = {}) {
return this._link.send(msg, options.tag, options.format);
}

@@ -50,0 +50,0 @@ }

@@ -37,8 +37,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

export interface AwaitableSenderOptions extends BaseSenderOptions {
/**
* The duration in which the promise to send the message should complete (resolve/reject).
* If it is not completed, then the Promise will be rejected after timeout occurs.
* Default: `20 seconds`.
*/
sendTimeoutInSeconds?: number;
}

@@ -58,2 +52,12 @@

abortSignal?: AbortSignalLike;
/**
* The message format. Specify this if a message with custom format needs to be sent.
* `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
*/
format?: number;
/**
* The message tag if any.
*/
tag?: Buffer | string;
}

@@ -67,8 +71,2 @@

/**
* The duration in which the promise to send the message should complete (resolve/reject).
* If it is not completed, then the Promise will be rejected after timeout occurs.
* Default: `20 seconds`.
*/
sendTimeoutInSeconds: number;
/**
* @property {Map<number, PromiseLike} deliveryDispositionMap Maintains a map of delivery of

@@ -82,3 +80,2 @@ * messages that are being sent. It acts as a store for correlating the dispositions received

super(session, sender, options);
this.sendTimeoutInSeconds = options.sendTimeoutInSeconds || 20;
/**

@@ -188,11 +185,7 @@ * The handler that will be added on the Sender for `accepted` event. If the delivery id is

* and a valid value should be passed to the `format` argument.
* @param {Buffer | string} [tag] The message tag if any.
* @param {number} [format] The message format. Specify this if a message with custom format needs
* to be sent. `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
* @param {AwaitableSendOptions} [options] Options to configure the timeout and cancellation for
* the send operation.
* @param {AwaitableSendOptions} [options] Options to configure the timeout, cancellation for
* the send operation and the tag and message format of the message.
* @returns {Promise<Delivery>} Promise<Delivery> The delivery information about the sent message.
*/
send(msg: Message | Buffer, tag?: Buffer | string, format?: number, options?: AwaitableSendOptions): Promise<Delivery> {
send(msg: Message | Buffer, options: AwaitableSendOptions = {}): Promise<Delivery> {
return new Promise<Delivery>((resolve, reject) => {

@@ -204,3 +197,3 @@ log.sender("[%s] Sender '%s' on amqp session '%s', credit: %d available: %d",

const abortSignal = options && options.abortSignal;
const timeoutInSeconds = options && options.timeoutInSeconds;
const timeoutInSeconds = options.timeoutInSeconds || 20;

@@ -214,4 +207,2 @@ if (abortSignal && abortSignal.aborted) {

if (this.sendable()) {
let sendTimeoutInSeconds = this.sendTimeoutInSeconds;
if (typeof timeoutInSeconds === "number" && timeoutInSeconds > 0) sendTimeoutInSeconds = timeoutInSeconds;
const timer = setTimeout(() => {

@@ -224,3 +215,3 @@ this.deliveryDispositionMap.delete(delivery.id);

return reject(new OperationTimeoutError(message));
}, sendTimeoutInSeconds * 1000);
}, timeoutInSeconds * 1000);

@@ -247,3 +238,3 @@ const onAbort = () => {

const delivery = (this._link as RheaSender).send(msg, tag, format);
const delivery = (this._link as RheaSender).send(msg, options.tag, options.format);
this.deliveryDispositionMap.set(delivery.id, {

@@ -250,0 +241,0 @@ resolve: (delivery: any) => {

@@ -29,4 +29,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

*/
export interface SenderOptionsWithSession extends SenderOptions {
export interface CreateSenderOptions extends SenderOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createSender() operation.
*/
abortSignal?: AbortSignalLike;
}

@@ -37,6 +41,9 @@

* One can also provide a session if it was already created.
* @interface AwaitableSenderOptionsWithSession
*/
export interface AwaitableSenderOptionsWithSession extends AwaitableSenderOptions {
export interface CreateAwaitableSenderOptions extends AwaitableSenderOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createAwaitableSender() operation.
*/
abortSignal?: AbortSignalLike;
}

@@ -47,9 +54,24 @@

* a session if it was already created.
* @interface ReceiverOptionsWithSession
*/
export interface ReceiverOptionsWithSession extends ReceiverOptions {
export interface CreateReceiverOptions extends ReceiverOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createReceiver() operation.
*/
abortSignal?: AbortSignalLike;
}
/**
* Describes the options that can be provided while creating an AMQP Request-Response link. One can also provide
* a session if it was already created.
*/
export interface CreateRequestResponseLinkOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createRequestResponseLink() operation.
*/
abortSignal?: AbortSignalLike;
}
/**
* Set of options to use when running Connection.open()

@@ -638,6 +660,6 @@ */

* trying to create an amqp session or with an AbortError if the operation was cancelled.
* @param {SenderOptionsWithSession} options Optional parameters to create a sender link.
* @param {CreateSenderOptions} options Optional parameters to create a sender link.
* @return {Promise<Sender>} Promise<Sender>.
*/
async createSender(options?: SenderOptionsWithSession & { abortSignal?: AbortSignalLike; }): Promise<Sender> {
async createSender(options?: CreateSenderOptions): Promise<Sender> {
if (options && options.session && options.session.createSender) {

@@ -662,3 +684,3 @@ return options.session.createSender(options);

*/
async createAwaitableSender(options?: AwaitableSenderOptionsWithSession & { abortSignal?: AbortSignalLike; }): Promise<AwaitableSender> {
async createAwaitableSender(options?: CreateAwaitableSenderOptions): Promise<AwaitableSender> {
if (options && options.session && options.session.createAwaitableSender) {

@@ -676,6 +698,6 @@ return options.session.createAwaitableSender(options);

* trying to create an amqp session or with an AbortError if the operation was cancelled.
* @param {ReceiverOptionsWithSession} options Optional parameters to create a receiver link.
* @param {CreateReceiverOptions} options Optional parameters to create a receiver link.
* @return {Promise<Receiver>} Promise<Receiver>.
*/
async createReceiver(options?: ReceiverOptionsWithSession & { abortSignal?: AbortSignalLike; }): Promise<Receiver> {
async createReceiver(options?: CreateReceiverOptions): Promise<Receiver> {
if (options && options.session && options.session.createReceiver) {

@@ -694,8 +716,7 @@ return options.session.createReceiver(options);

* @param {ReceiverOptions} receiverOptions Parameters to create a receiver.
* @param {Session} [session] The optional session on which the sender and receiver links will be
* created.
* @param {CreateRequestResponseLinkOptions} [options] Optional parameters to control how sender and receiver link creation.
* @return {Promise<ReqResLink>} Promise<ReqResLink>
*/
async createRequestResponseLink(senderOptions: SenderOptions, receiverOptions: ReceiverOptions,
providedSession?: Session, abortSignal?: AbortSignalLike): Promise<ReqResLink> {
options: CreateRequestResponseLinkOptions = {}): Promise<ReqResLink> {
if (!senderOptions) {

@@ -707,2 +728,3 @@ throw new Error(`Please provide sender options.`);

}
const { session: providedSession, abortSignal } = options;
const session = providedSession || await this.createSession({ abortSignal });

@@ -709,0 +731,0 @@ const [sender, receiver] = await Promise.all([

@@ -17,8 +17,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

export {
Connection, ReqResLink, ConnectionOptions, ReceiverOptionsWithSession, SenderOptionsWithSession
Connection, ReqResLink, ConnectionOptions, CreateReceiverOptions, CreateAwaitableSenderOptions, CreateSenderOptions, CreateRequestResponseLinkOptions
} from "./connection";
export { Session } from "./session";
export { Receiver, ReceiverOptions } from "./receiver";
export { Sender, SenderOptions } from "./sender";
export { AwaitableSenderOptions, AwaitableSender, PromiseLike } from "./awaitableSender";
export { Sender, SenderOptions, SenderSendOptions } from "./sender";
export { AwaitableSenderOptions, AwaitableSender, PromiseLike, AwaitableSendOptions } from "./awaitableSender";
export { LinkCloseOptions } from "./link";

@@ -25,0 +25,0 @@ export {

@@ -97,2 +97,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

export class SenderSendOptions {
/**
* The message format. Specify this if a message with custom format needs to be sent.
* `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
*/
format?: number;
/**
* The message tag if any.
*/
tag?: Buffer | string;
}
/**

@@ -113,11 +126,8 @@ * Describes the AMQP Sender.

* and a valid value should be passed to the `format` argument.
* @param {Buffer | string} [tag] The message tag if any.
* @param {number} [format] The message format. Specify this if a message with custom format needs
* to be sent. `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
* @param {SenderSendOptions} [options] Options to configure the tag and message format of the message.
* @returns {Delivery} Delivery The delivery information about the sent message.
*/
send(msg: Message | Buffer, tag?: Buffer | string, format?: number): Delivery {
return (this._link as RheaSender).send(msg, tag, format);
send(msg: Message | Buffer, options: SenderSendOptions = {}): Delivery {
return (this._link as RheaSender).send(msg, options.tag, options.format);
}
}
{
"name": "rhea-promise",
"version": "1.2.1",
"version": "2.0.0",
"description": "A Promisified layer over rhea AMQP client",

@@ -10,4 +10,4 @@ "license": "Apache-2.0",

"debug": "^3.1.0",
"rhea": "^1.0.24",
"tslib": "^1.10.0"
"rhea": "^2.0.1",
"tslib": "^2.2.0"
},

@@ -14,0 +14,0 @@ "keywords": [

@@ -190,3 +190,3 @@ import * as rhea from "rhea";

const requestResponseLink = await connection.createRequestResponseLink({}, {}, session);
const requestResponseLink = await connection.createRequestResponseLink({}, {}, {session});

@@ -658,3 +658,3 @@ assert.isTrue(requestResponseLink.session.isOpen(), "Session should be open.");

abortController.abort();
const createPromise = connection.createRequestResponseLink({}, {}, undefined, abortSignal);
const createPromise = connection.createRequestResponseLink({}, {}, {abortSignal});

@@ -683,3 +683,3 @@ let abortErrorThrown = false;

// Abort the signal after passing it to createReceiver()
const createPromise = connection.createRequestResponseLink({}, {}, undefined, abortSignal);
const createPromise = connection.createRequestResponseLink({}, {}, {abortSignal});
abortController.abort();

@@ -686,0 +686,0 @@

@@ -46,6 +46,4 @@ import * as rhea from "rhea";

it("Delivery returned from `AwaitableSender.send()` is not undefined", async () => {
const sender = await connection.createAwaitableSender({
sendTimeoutInSeconds: 1,
});
const response = await sender.send({ body: "message" });
const sender = await connection.createAwaitableSender();
const response = await sender.send({ body: "message" }, { timeoutInSeconds: 1});
assert.exists(

@@ -179,3 +177,3 @@ response,

abortController.abort();
const sendPromise = sender.send({ body: "hello" }, undefined, undefined, {
const sendPromise = sender.send({ body: "hello" }, {
abortSignal,

@@ -211,3 +209,3 @@ });

abortController.abort();
const sendPromise = sender.send({ body: "hello" }, undefined, undefined, {
const sendPromise = sender.send({ body: "hello" }, {
abortSignal,

@@ -239,3 +237,3 @@ });

// Fire abort signal after passing it to send()
const sendPromise = sender.send({ body: "hello" }, undefined, undefined, {
const sendPromise = sender.send({ body: "hello" }, {
abortSignal,

@@ -242,0 +240,0 @@ });

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

export interface AwaitableSenderOptions extends BaseSenderOptions {
/**
* The duration in which the promise to send the message should complete (resolve/reject).
* If it is not completed, then the Promise will be rejected after timeout occurs.
* Default: `20 seconds`.
*/
sendTimeoutInSeconds?: number;
}

@@ -46,2 +40,12 @@ export interface AwaitableSendOptions {

abortSignal?: AbortSignalLike;
/**
* The message format. Specify this if a message with custom format needs to be sent.
* `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
*/
format?: number;
/**
* The message tag if any.
*/
tag?: Buffer | string;
}

@@ -54,8 +58,2 @@ /**

/**
* The duration in which the promise to send the message should complete (resolve/reject).
* If it is not completed, then the Promise will be rejected after timeout occurs.
* Default: `20 seconds`.
*/
sendTimeoutInSeconds: number;
/**
* @property {Map<number, PromiseLike} deliveryDispositionMap Maintains a map of delivery of

@@ -73,12 +71,8 @@ * messages that are being sent. It acts as a store for correlating the dispositions received

* and a valid value should be passed to the `format` argument.
* @param {Buffer | string} [tag] The message tag if any.
* @param {number} [format] The message format. Specify this if a message with custom format needs
* to be sent. `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
* @param {AwaitableSendOptions} [options] Options to configure the timeout and cancellation for
* the send operation.
* @param {AwaitableSendOptions} [options] Options to configure the timeout, cancellation for
* the send operation and the tag and message format of the message.
* @returns {Promise<Delivery>} Promise<Delivery> The delivery information about the sent message.
*/
send(msg: Message | Buffer, tag?: Buffer | string, format?: number, options?: AwaitableSendOptions): Promise<Delivery>;
send(msg: Message | Buffer, options?: AwaitableSendOptions): Promise<Delivery>;
}
//# sourceMappingURL=awaitableSender.d.ts.map

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

*/
export interface SenderOptionsWithSession extends SenderOptions {
export interface CreateSenderOptions extends SenderOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createSender() operation.
*/
abortSignal?: AbortSignalLike;
}

@@ -25,6 +29,9 @@ /**

* One can also provide a session if it was already created.
* @interface AwaitableSenderOptionsWithSession
*/
export interface AwaitableSenderOptionsWithSession extends AwaitableSenderOptions {
export interface CreateAwaitableSenderOptions extends AwaitableSenderOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createAwaitableSender() operation.
*/
abortSignal?: AbortSignalLike;
}

@@ -34,8 +41,22 @@ /**

* a session if it was already created.
* @interface ReceiverOptionsWithSession
*/
export interface ReceiverOptionsWithSession extends ReceiverOptions {
export interface CreateReceiverOptions extends ReceiverOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createReceiver() operation.
*/
abortSignal?: AbortSignalLike;
}
/**
* Describes the options that can be provided while creating an AMQP Request-Response link. One can also provide
* a session if it was already created.
*/
export interface CreateRequestResponseLinkOptions {
session?: Session;
/**
* A signal used to cancel the Connection.createRequestResponseLink() operation.
*/
abortSignal?: AbortSignalLike;
}
/**
* Set of options to use when running Connection.open()

@@ -291,8 +312,6 @@ */

* trying to create an amqp session or with an AbortError if the operation was cancelled.
* @param {SenderOptionsWithSession} options Optional parameters to create a sender link.
* @param {CreateSenderOptions} options Optional parameters to create a sender link.
* @return {Promise<Sender>} Promise<Sender>.
*/
createSender(options?: SenderOptionsWithSession & {
abortSignal?: AbortSignalLike;
}): Promise<Sender>;
createSender(options?: CreateSenderOptions): Promise<Sender>;
/**

@@ -310,5 +329,3 @@ * Creates an awaitable amqp sender. It either uses the provided session or creates a new one.

*/
createAwaitableSender(options?: AwaitableSenderOptionsWithSession & {
abortSignal?: AbortSignalLike;
}): Promise<AwaitableSender>;
createAwaitableSender(options?: CreateAwaitableSenderOptions): Promise<AwaitableSender>;
/**

@@ -319,8 +336,6 @@ * Creates an amqp receiver link. It either uses the provided session or creates a new one.

* trying to create an amqp session or with an AbortError if the operation was cancelled.
* @param {ReceiverOptionsWithSession} options Optional parameters to create a receiver link.
* @param {CreateReceiverOptions} options Optional parameters to create a receiver link.
* @return {Promise<Receiver>} Promise<Receiver>.
*/
createReceiver(options?: ReceiverOptionsWithSession & {
abortSignal?: AbortSignalLike;
}): Promise<Receiver>;
createReceiver(options?: CreateReceiverOptions): Promise<Receiver>;
/**

@@ -332,7 +347,6 @@ * Creates an amqp sender-receiver link. It either uses the provided session or creates a new one.

* @param {ReceiverOptions} receiverOptions Parameters to create a receiver.
* @param {Session} [session] The optional session on which the sender and receiver links will be
* created.
* @param {CreateRequestResponseLinkOptions} [options] Optional parameters to control how sender and receiver link creation.
* @return {Promise<ReqResLink>} Promise<ReqResLink>
*/
createRequestResponseLink(senderOptions: SenderOptions, receiverOptions: ReceiverOptions, providedSession?: Session, abortSignal?: AbortSignalLike): Promise<ReqResLink>;
createRequestResponseLink(senderOptions: SenderOptions, receiverOptions: ReceiverOptions, options?: CreateRequestResponseLinkOptions): Promise<ReqResLink>;
/**

@@ -339,0 +353,0 @@ * Adds event listeners for the possible events that can occur on the connection object and

export { Delivery, Message, MessageProperties, MessageHeader, EventContext as RheaEventContext, ConnectionOptions as ConnectionOptionsBase, AmqpError, Dictionary, types, message, filter, Filter, uuid_to_string, generate_uuid, string_to_uuid, LinkError, ProtocolError, LinkOptions, DeliveryAnnotations, MessageAnnotations, ReceiverEvents, SenderEvents, ConnectionEvents, SessionEvents, ContainerOptions as ContainerOptionsBase, TerminusOptions, Types, Sasl, EndpointOptions, MessageUtil, TypeError, SimpleError, Source, ConnectionError, Typed, WebSocketImpl, WebSocketInstance, TargetTerminusOptions } from "rhea";
export { EventContext, OnAmqpEvent } from "./eventContext";
export { Container, ContainerOptions } from "./container";
export { Connection, ReqResLink, ConnectionOptions, ReceiverOptionsWithSession, SenderOptionsWithSession } from "./connection";
export { Connection, ReqResLink, ConnectionOptions, CreateReceiverOptions, CreateAwaitableSenderOptions, CreateSenderOptions, CreateRequestResponseLinkOptions } from "./connection";
export { Session } from "./session";
export { Receiver, ReceiverOptions } from "./receiver";
export { Sender, SenderOptions } from "./sender";
export { AwaitableSenderOptions, AwaitableSender, PromiseLike } from "./awaitableSender";
export { Sender, SenderOptions, SenderSendOptions } from "./sender";
export { AwaitableSenderOptions, AwaitableSender, PromiseLike, AwaitableSendOptions } from "./awaitableSender";
export { LinkCloseOptions } from "./link";

@@ -10,0 +10,0 @@ export { Func, AmqpResponseStatusCode, isAmqpError, ConnectionStringParseOptions, delay, messageHeader, messageProperties, parseConnectionString, ParsedOutput } from "./util/utils";

@@ -79,2 +79,14 @@ /// <reference types="node" />

}
export declare class SenderSendOptions {
/**
* The message format. Specify this if a message with custom format needs to be sent.
* `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
*/
format?: number;
/**
* The message tag if any.
*/
tag?: Buffer | string;
}
/**

@@ -91,10 +103,7 @@ * Describes the AMQP Sender.

* and a valid value should be passed to the `format` argument.
* @param {Buffer | string} [tag] The message tag if any.
* @param {number} [format] The message format. Specify this if a message with custom format needs
* to be sent. `0` implies the standard AMQP 1.0 defined format. If no value is provided, then the
* given message is assumed to be of type Message interface and encoded appropriately.
* @param {SenderSendOptions} [options] Options to configure the tag and message format of the message.
* @returns {Delivery} Delivery The delivery information about the sent message.
*/
send(msg: Message | Buffer, tag?: Buffer | string, format?: number): Delivery;
send(msg: Message | Buffer, options?: SenderSendOptions): Delivery;
}
//# sourceMappingURL=sender.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc