@azure/event-hubs 5.7.0-alpha.20220118.1 → 5.7.0-alpha.20220126.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.js +32 -0
- package/dist/index.js.map +1 -1
- package/dist-esm/src/eventDataAdapter.js +31 -0
- package/dist-esm/src/eventDataAdapter.js.map +1 -0
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/package.json +1 -1
- package/types/3.1/event-hubs.d.ts +67 -0
- package/types/latest/event-hubs.d.ts +71 -0
package/dist/index.js
CHANGED
|
@@ -5111,6 +5111,37 @@ class EventHubBufferedProducerClient {
|
|
|
5111
5111
|
}
|
|
5112
5112
|
}
|
|
5113
5113
|
|
|
5114
|
+
// Copyright (c) Microsoft Corporation.
|
|
5115
|
+
// Licensed under the MIT license.
|
|
5116
|
+
/**
|
|
5117
|
+
* A function that constructs an event data adapter. That adapter can be used
|
|
5118
|
+
* with `@azure/schema-registry-avro` to encode and decode body in event data.
|
|
5119
|
+
*
|
|
5120
|
+
* @param params - parameters to create the event data
|
|
5121
|
+
* @returns An event data adapter that can produce and consume event data
|
|
5122
|
+
*/
|
|
5123
|
+
function createEventDataAdapter(params = {}) {
|
|
5124
|
+
return {
|
|
5125
|
+
produceMessage: ({ body, contentType }) => {
|
|
5126
|
+
return Object.assign(Object.assign({}, params), { body,
|
|
5127
|
+
contentType });
|
|
5128
|
+
},
|
|
5129
|
+
consumeMessage: (message) => {
|
|
5130
|
+
const { body, contentType } = message;
|
|
5131
|
+
if (body === undefined || !(body instanceof Uint8Array)) {
|
|
5132
|
+
throw new Error("Expected the body field to be defined and have a Uint8Array");
|
|
5133
|
+
}
|
|
5134
|
+
if (contentType === undefined) {
|
|
5135
|
+
throw new Error("Expected the contentType field to be defined");
|
|
5136
|
+
}
|
|
5137
|
+
return {
|
|
5138
|
+
body,
|
|
5139
|
+
contentType,
|
|
5140
|
+
};
|
|
5141
|
+
},
|
|
5142
|
+
};
|
|
5143
|
+
}
|
|
5144
|
+
|
|
5114
5145
|
Object.defineProperty(exports, 'MessagingError', {
|
|
5115
5146
|
enumerable: true,
|
|
5116
5147
|
get: function () {
|
|
@@ -5126,6 +5157,7 @@ Object.defineProperty(exports, 'RetryMode', {
|
|
|
5126
5157
|
exports.EventHubBufferedProducerClient = EventHubBufferedProducerClient;
|
|
5127
5158
|
exports.EventHubConsumerClient = EventHubConsumerClient;
|
|
5128
5159
|
exports.EventHubProducerClient = EventHubProducerClient;
|
|
5160
|
+
exports.createEventDataAdapter = createEventDataAdapter;
|
|
5129
5161
|
exports.earliestEventPosition = earliestEventPosition;
|
|
5130
5162
|
exports.latestEventPosition = latestEventPosition;
|
|
5131
5163
|
exports.logger = logger;
|