Releases: EventStore/EventStore-Client-NodeJS
@eventstore/[email protected]
@eventstore/[email protected]
Features
- Added tracing instrumentation for the append and subscribe operations
v6.2.1
v6.2.0
Features
Changed
Updated error handling to use NotFoundError
instead of UnknownError
in projection operations when the projection doesn't exist
- Previously, the server was returning UnknownError when a projection didn't exist. EventStoreDB now returns NotFoundError. This change updates the client to use NotFoundError instead of UnknownError when a projection doesn't exist. View
⚠️ This only affects users who are using EventStoreDB versions 24.6 and greater.
Expect CancelledError when node is terminated to align with server version 24.4
- EventStoreDB recently configured the ShutdownTimeout to 5s after being set to 30s in recent .NET releases resulting to different error status code returned from the server. The client now expects a CancelledError when the node is terminated. View
️
⚠️ This only affects users who are using EventStoreDB versions 24.4 and greater.
Miscellaneous
- The tests are now run against Node LTS (v20.12.2 as of this release).
- We are now using tsdoc for documentation comments as eslint-plugin-jsdoc does not support NodeJS versions below 18.
v6.1.0
Features
- Add support for caught up and fell behind subscription message View
Enhancements
- Increase test coverage for reconnection View
- Use dynamic tags instead of hardcoding esdb versions View
- Update TypeScript, ESLint and other dependencies View
- Update grpc-js to 1.9.12 View
Thanks
🎉 Thanks for @jokesterfr and @Imanghvs for their contributions! 🎉
v6.0.0
Breaking changes
CancelledError
is now thrown when a stream is cancelled by the server
Previously, we would throw an UnavailableError
when the server was unavailable to take a request, or a stream was cancelled by the server. This release now throws a CancelledError
when the stream is cancelled, allowing users to distinguish between them.
If users are catching UnavailableError
on a stream for this situation, they should now be looking for a CancelledError
. View
Before:
try {
for await (const event of client.readStream("my_stream")) {
// do something
}
} catch (error) {
if (isCommandError(error)) {
if (error.type === ErrorType.UNAVAILABLE) {
// Server is unavailable to take request
// _OR_
// Stream was cancelled by server
}
}
}
After:
try {
for await (const event of client.readStream("my_stream")) {
// do something
}
} catch (error) {
if (isCommandError(error)) {
if (error.type === ErrorType.CANCELLED) {
// Stream was cancelled by server
}
if (error.type === ErrorType.UNAVAILABLE) {
// Server is unavailable to take request
}
}
}
Bug Fixes
- fix out of bounds value for stream revision View
v5.0.1
v5.0.0
Breaking changes
RecordedEvent["created"]
is now a Date
Previously, a recorded event's created property was being returned in ticks, a 64bit integer in 100ns precision. As well as being an unusual format, this was being parsed into a Number
, so was unsafe. This release changes the property to be represented by a Date
.
Before:
created
was an unsafe "ticks" since epoch:
for await (const { event } of client.readStream(STREAM_NAME)) {
// 16675621600650000 (greater than Number.MAX_SAFE_INTEGER)
console.log(event?.created);
}
After:
created
is a Date
:
for await (const { event } of client.readStream(STREAM_NAME)) {
// 2022-11-04T11:42:40.065Z
console.log(event?.created);
}
v4.0.0
Breaking changes
Add emitEnabled
option to createProjection
.
Due to a bug on the server, previously, the trackEmittedStreams
option was setting emitEnabled
, and not trackEmittedStreams
. This release adds the emitEnabled
option and corrects the behaviour of trackEmittedStreams
, with a polyfill for earlier server versions. View
Before:
Setting trackEmittedStreams
would enable emitting, but not track streams.
await client.createProjection(PROJECTION_NAME, projectionQuery, {
trackEmittedStreams: true,
});
After:
Setting emitEnabled
works as expected:
await client.createProjection(PROJECTION_NAME, projectionQuery, {
emitEnabled: true,
});
Setting both emitEnabled
and trackEmittedStreams
works as expected:
await client.createProjection(PROJECTION_NAME, projectionQuery, {
emitEnabled: true,
trackEmittedStreams: true,
});
Setting only trackEmittedStreams
will be rejected by the server:
// incorrect
await client.createProjection(PROJECTION_NAME, projectionQuery, {
trackEmittedStreams: true,
});
Features
Add position to events from stream
When connected to a server that supports it (>22.6), events read from a stream will include their commit and prepare position. View
Bug Fixes
- Prevent multiple appends within the same event loop creating many batches, and improve backpressure. View
- Destroy read stream if stream is not found. View
- Only swallow unimplemented errors when creating server-features. View
Removal of Deprecated Apis
v3.4.0
Features
Add retry count to persistent subscription events
Adds retryCount
property to events from subscribeToPersistentSubscriptionToStream
and subscribeToPersistentSubscriptionToAll
View
const subscription = client.subscribeToPersistentSubscriptionToStream(
STREAM_NAME,
GROUP_NAME
);
for await (const event of subscription) {
try {
console.log(
`handling event ${event.event?.type} with retryCount ${event.retryCount}`
);
await handleEvent(event);
await subscription.ack(event);
} catch (error) {
await subscription.nack(PARK, error.toString(), event);
}
}