@relaybus/rabbitmq 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -296,6 +296,12 @@ type RabbitMqJsonEnvelopeMapping = JsonEnvelopeMapping<'message-id-property'>;
|
|
|
296
296
|
* @throws ConfigurationError for an incomplete or self-overlapping mapping.
|
|
297
297
|
*/
|
|
298
298
|
declare function jsonEnvelope(mapping: RabbitMqJsonEnvelopeMapping): RabbitMqCodec;
|
|
299
|
+
/**
|
|
300
|
+
* The event a {@link RabbitMqTransport} with `codec` hands to the bus for `message`: the codec's
|
|
301
|
+
* `decode`, with what it leaves out filled in (see `DecodedEvent`). Throws for a malformed
|
|
302
|
+
* message. For codec contract tests (`rabbitMqCodecContract` of `@relaybus/testing`).
|
|
303
|
+
*/
|
|
304
|
+
declare function decodeRabbitMqMessage(codec: RabbitMqCodec, message: AmqpMessage): EventEnvelope;
|
|
299
305
|
|
|
300
306
|
/** Connection settings accepted by `amqplib.connect`, given as an object instead of a URL. */
|
|
301
307
|
interface BrokerConnectionSettings {
|
|
@@ -502,4 +508,5 @@ declare class RabbitMqTransport extends SubscribingTransport {
|
|
|
502
508
|
close(options?: CloseOptions): Promise<void>;
|
|
503
509
|
}
|
|
504
510
|
|
|
505
|
-
export {
|
|
511
|
+
export { AmqpLimitExceededError, MalformedMessageError, RabbitMqPublishRejectedError, RabbitMqTransport, RabbitMqUnavailableError, RabbitMqUnencodableEventError, UnroutableMessageError, UnserializablePayloadError, cloudEventsBinary, cloudEventsStructured, decodeCloudEvent, decodeRabbitMqMessage, jsonEnvelope, plainJsonDecoder };
|
|
512
|
+
export type { AmqpChannel, AmqpConfirmChannel, AmqpConnection, AmqpMessage, AmqpMessageProperties, AmqpPublishOptions, BrokerConnectionSettings, DecodedEvent, EncodedMessage, PlainJsonDecoderOptions, PlainJsonMessage, RabbitMqCodec, RabbitMqJsonEnvelopeMapping, RabbitMqMessageDecoder, RabbitMqTransportOptions, ReconnectOptions, RedeliveryOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -296,6 +296,12 @@ type RabbitMqJsonEnvelopeMapping = JsonEnvelopeMapping<'message-id-property'>;
|
|
|
296
296
|
* @throws ConfigurationError for an incomplete or self-overlapping mapping.
|
|
297
297
|
*/
|
|
298
298
|
declare function jsonEnvelope(mapping: RabbitMqJsonEnvelopeMapping): RabbitMqCodec;
|
|
299
|
+
/**
|
|
300
|
+
* The event a {@link RabbitMqTransport} with `codec` hands to the bus for `message`: the codec's
|
|
301
|
+
* `decode`, with what it leaves out filled in (see `DecodedEvent`). Throws for a malformed
|
|
302
|
+
* message. For codec contract tests (`rabbitMqCodecContract` of `@relaybus/testing`).
|
|
303
|
+
*/
|
|
304
|
+
declare function decodeRabbitMqMessage(codec: RabbitMqCodec, message: AmqpMessage): EventEnvelope;
|
|
299
305
|
|
|
300
306
|
/** Connection settings accepted by `amqplib.connect`, given as an object instead of a URL. */
|
|
301
307
|
interface BrokerConnectionSettings {
|
|
@@ -502,4 +508,5 @@ declare class RabbitMqTransport extends SubscribingTransport {
|
|
|
502
508
|
close(options?: CloseOptions): Promise<void>;
|
|
503
509
|
}
|
|
504
510
|
|
|
505
|
-
export {
|
|
511
|
+
export { AmqpLimitExceededError, MalformedMessageError, RabbitMqPublishRejectedError, RabbitMqTransport, RabbitMqUnavailableError, RabbitMqUnencodableEventError, UnroutableMessageError, UnserializablePayloadError, cloudEventsBinary, cloudEventsStructured, decodeCloudEvent, decodeRabbitMqMessage, jsonEnvelope, plainJsonDecoder };
|
|
512
|
+
export type { AmqpChannel, AmqpConfirmChannel, AmqpConnection, AmqpMessage, AmqpMessageProperties, AmqpPublishOptions, BrokerConnectionSettings, DecodedEvent, EncodedMessage, PlainJsonDecoderOptions, PlainJsonMessage, RabbitMqCodec, RabbitMqJsonEnvelopeMapping, RabbitMqMessageDecoder, RabbitMqTransportOptions, ReconnectOptions, RedeliveryOptions };
|
package/dist/index.js
CHANGED
|
@@ -809,6 +809,12 @@ function requireMessageId(message) {
|
|
|
809
809
|
}
|
|
810
810
|
return id;
|
|
811
811
|
}
|
|
812
|
+
function decodeRabbitMqMessage(codec, message) {
|
|
813
|
+
if (codec === cloudEventsBinary) {
|
|
814
|
+
return decodeEnvelope(message);
|
|
815
|
+
}
|
|
816
|
+
return completeDecodedEvent(codec.decode(message), message);
|
|
817
|
+
}
|
|
812
818
|
var REDELIVERIES_HEADER = "x-relaybus-redeliveries";
|
|
813
819
|
var FIRST_FAILURE_HEADER = "x-relaybus-first-failure-at";
|
|
814
820
|
var DEAD_LETTER_REASON_HEADER = "x-relaybus-dead-letter-reason";
|
|
@@ -1014,7 +1020,7 @@ function resolveCodec({
|
|
|
1014
1020
|
}
|
|
1015
1021
|
return {
|
|
1016
1022
|
encode: chosen.encode,
|
|
1017
|
-
decode: (message) =>
|
|
1023
|
+
decode: (message) => decodeRabbitMqMessage(chosen, message)
|
|
1018
1024
|
};
|
|
1019
1025
|
}
|
|
1020
1026
|
function resolveConnect(options) {
|
|
@@ -1583,6 +1589,6 @@ var RabbitMqTransport = class extends SubscribingTransport {
|
|
|
1583
1589
|
}
|
|
1584
1590
|
};
|
|
1585
1591
|
|
|
1586
|
-
export { AmqpLimitExceededError, MalformedMessageError, RabbitMqPublishRejectedError, RabbitMqTransport, RabbitMqUnavailableError, RabbitMqUnencodableEventError, UnroutableMessageError, UnserializablePayloadError, cloudEventsBinary, cloudEventsStructured, decodeCloudEvent, jsonEnvelope, plainJsonDecoder };
|
|
1592
|
+
export { AmqpLimitExceededError, MalformedMessageError, RabbitMqPublishRejectedError, RabbitMqTransport, RabbitMqUnavailableError, RabbitMqUnencodableEventError, UnroutableMessageError, UnserializablePayloadError, cloudEventsBinary, cloudEventsStructured, decodeCloudEvent, decodeRabbitMqMessage, jsonEnvelope, plainJsonDecoder };
|
|
1587
1593
|
//# sourceMappingURL=index.js.map
|
|
1588
1594
|
//# sourceMappingURL=index.js.map
|