@azure/event-hubs 5.8.0-alpha.20220401.1 → 5.8.0-alpha.20220406.7
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/CHANGELOG.md +14 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/dist-esm/src/dataTransformer.js +1 -1
- package/dist-esm/src/dataTransformer.js.map +1 -1
- package/dist-esm/src/eventDataAdapter.js +3 -3
- package/dist-esm/src/eventDataAdapter.js.map +1 -1
- package/dist-esm/src/impl/partitionAssigner.js +1 -1
- package/dist-esm/src/impl/partitionAssigner.js.map +1 -1
- package/dist-esm/src/impl/{patitionKeyToIdMapper.js → partitionKeyToIdMapper.js} +10 -5
- package/dist-esm/src/impl/partitionKeyToIdMapper.js.map +1 -0
- package/dist-esm/src/util/constants.js +1 -1
- package/dist-esm/src/util/constants.js.map +1 -1
- package/package.json +3 -2
- package/types/3.1/event-hubs.d.ts +4 -4
- package/types/latest/event-hubs.d.ts +4 -4
- package/dist-esm/src/impl/patitionKeyToIdMapper.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
## 5.8.0-beta.
|
|
3
|
+
## 5.8.0-beta.4 (Unreleased)
|
|
4
4
|
|
|
5
5
|
### Features Added
|
|
6
6
|
|
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
### Other Changes
|
|
12
12
|
|
|
13
|
+
## 5.8.0-beta.3 (2022-04-05)
|
|
14
|
+
|
|
15
|
+
### Breaking Changes
|
|
16
|
+
- `MessageWithMetadata` has been renamed to `MessageContent`.
|
|
17
|
+
- `MessageContent`'s `body` has been renamed to `data`.
|
|
18
|
+
- `MessageAdapter`'s `consumeMessage` and `produceMessage` have been renamed to `consume` and `produce`.
|
|
19
|
+
|
|
20
|
+
### Bugs Fixed
|
|
21
|
+
- The Uint8Array payload was being stringified first before it gets sent which caused the receiver to treat it as an object instead of a Uint8Array. This is now fixed and Uint8Array is being treated the same as a Buffer.
|
|
22
|
+
- The hashing algorithm used to map partition keys to IDs in the buffered producer is no longer sensitive to the endianness of the local machine [Issue #21190](https://github.com/Azure/azure-sdk-for-js/issues/21190).
|
|
23
|
+
|
|
24
|
+
### Other Changes
|
|
25
|
+
|
|
13
26
|
- Updated our `@azure/core-tracing` dependency to the latest version (1.0.0). There are no changes from the previous beta; however, please see below for changes from the previous minor version:
|
|
14
27
|
- Notable changes include Removal of `@opentelemetry/api` as a transitive dependency and ensuring that the active context is properly propagated.
|
|
15
28
|
- Customers who would like to continue using OpenTelemetry driven tracing should visit our [OpenTelemetry Instrumentation](https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk) package for instructions.
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ function _interopNamespace(e) {
|
|
|
35
35
|
|
|
36
36
|
var isBuffer__default = /*#__PURE__*/_interopDefaultLegacy(isBuffer);
|
|
37
37
|
var os__namespace = /*#__PURE__*/_interopNamespace(os);
|
|
38
|
-
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
39
38
|
|
|
40
39
|
// Copyright (c) Microsoft Corporation.
|
|
41
40
|
/**
|
|
@@ -394,7 +393,7 @@ const defaultDataTransformer = {
|
|
|
394
393
|
else if (bodyType === "sequence") {
|
|
395
394
|
result = rheaPromise.message.sequence_section(body);
|
|
396
395
|
}
|
|
397
|
-
else if (isBuffer__default["default"](body)) {
|
|
396
|
+
else if (isBuffer__default["default"](body) || body instanceof Uint8Array) {
|
|
398
397
|
result = rheaPromise.message.data_section(body);
|
|
399
398
|
}
|
|
400
399
|
else if (body === null && bodyType === "data") {
|
|
@@ -493,7 +492,7 @@ function isRheaAmqpSection(possibleSection) {
|
|
|
493
492
|
*/
|
|
494
493
|
const packageJsonInfo = {
|
|
495
494
|
name: "@azure/event-hubs",
|
|
496
|
-
version: "5.8.0-beta.
|
|
495
|
+
version: "5.8.0-beta.4",
|
|
497
496
|
};
|
|
498
497
|
/**
|
|
499
498
|
* @internal
|
|
@@ -5087,13 +5086,21 @@ class BatchingPartitionChannel {
|
|
|
5087
5086
|
}
|
|
5088
5087
|
|
|
5089
5088
|
// Copyright (c) Microsoft Corporation.
|
|
5089
|
+
// Licensed under the MIT license.
|
|
5090
|
+
/* eslint-disable no-fallthrough */
|
|
5090
5091
|
function mapPartitionKeyToId(partitionKey, partitionCount) {
|
|
5091
|
-
const
|
|
5092
|
-
const hashedParitionKey = castToInt16(hash.c ^ hash.b);
|
|
5092
|
+
const hashedParitionKey = hashPartitionKey(partitionKey);
|
|
5093
5093
|
return Math.abs(hashedParitionKey % partitionCount);
|
|
5094
5094
|
}
|
|
5095
|
+
/**
|
|
5096
|
+
* @internal
|
|
5097
|
+
*/
|
|
5098
|
+
function hashPartitionKey(partitionKey) {
|
|
5099
|
+
const hash = computeHash(Buffer.from(partitionKey, "utf8"));
|
|
5100
|
+
return castToInt16(hash.c ^ hash.b);
|
|
5101
|
+
}
|
|
5095
5102
|
function readUInt32(data, offset) {
|
|
5096
|
-
return
|
|
5103
|
+
return data.readUInt32LE(offset);
|
|
5097
5104
|
}
|
|
5098
5105
|
function castToInt16(n) {
|
|
5099
5106
|
return new Int16Array([n])[0];
|
|
@@ -5522,11 +5529,11 @@ class EventHubBufferedProducerClient {
|
|
|
5522
5529
|
*/
|
|
5523
5530
|
function createEventDataAdapter(params = {}) {
|
|
5524
5531
|
return {
|
|
5525
|
-
|
|
5532
|
+
produce: ({ data: body, contentType }) => {
|
|
5526
5533
|
return Object.assign(Object.assign({}, params), { body,
|
|
5527
5534
|
contentType });
|
|
5528
5535
|
},
|
|
5529
|
-
|
|
5536
|
+
consume: (message) => {
|
|
5530
5537
|
const { body, contentType } = message;
|
|
5531
5538
|
if (body === undefined) {
|
|
5532
5539
|
throw new Error("Expected the body field to be defined");
|
|
@@ -5539,7 +5546,7 @@ function createEventDataAdapter(params = {}) {
|
|
|
5539
5546
|
* If the raw response was parsed as JSON, we need to convert it to a Uint8Array,
|
|
5540
5547
|
* otherwise, leave the payload as is.
|
|
5541
5548
|
*/
|
|
5542
|
-
|
|
5549
|
+
data: typeof body === "object" ? Uint8Array.from(Object.values(body)) : body,
|
|
5543
5550
|
contentType,
|
|
5544
5551
|
};
|
|
5545
5552
|
},
|