Releases: nats-io/nats.deno
v1.6.1
What's Changed
[FIX] StreamUpdateConfig
, StreamConfig
and jsm.streams.update()
signature by @aricart in #258
[FIX] [NODE] Node.js v17.5.0 introduced a change that makes nats.js seems to go in an loop that exceeds the stack - this issue is only on node where we specifically remapped subarray into slice as subarray was copying memory by @aricart in #259
[DOCS] typo in docs by @Jarema in #257
New Contributors
Full Changelog: v1.6.0...v1.6.1
v1.6.0
What's Changed
The following changes affect the "nats-base-client" which is shared by all the supported JavaScript clients:
- [FIX] [JETSTREAM] NATS server 2.7 behavior changes @aricart in #249
- mixing
no_wait
andexpires
on JetStream pull consumers changed. If no messages were available the server honors theexpires
. If a client specifiesno_wait
the JavaScript client will clear out theexpires
. This behaves as previous releases. - server can now return a
408
error when an expires in a pull request triggers. This error was not trapped directly by the pull consumer, so it ended the request with an error, which terminated any iterators with an error, when simply there are no messages, and client should just be re-pulling on it's own timer. - nats server 2.7 now supports ephemeral pull consumers.
- mixing
- [FEAT] [JETSTREAM] new pull consumer and ephemeral consumer options
inactive_threashold
(informs the server the maximum amount of time an inactive ephemeral consumer should be allowed to exist),max_batch
specifies the maximum number of messages that a pull consumer should be able to specify, andmax_expires
the max amount of time that a pull request with anexpires
should be allowed to remain active by @aricart in #251 - [FEAT] [JETSTREAM] add support for
nak()
with a delay - a JetStream message may now benak
and provide an argument for specifying how long the server should back-off before resending the message by @aricart in #253 - [FIX] hostPort parsing relies on built-in
new URL()
for parsing. JavaScript URL only correctly handleshttp/s
protocols. If port80
was specified, the URL parsing code discarded the port (as it matched the protocol), thus activating the logic to set the default port of4222
as added. by @aricart in #254 - [FIX] added constraint to reject
ConnectionOptions
when bothservers
andport
are specified. by @aricart in #255 - [FIX] processing of
ConnectionOptions
processedport
property beforeservers
by @aricart in #248
Full Changelog: v1.5.0...v1.6.0
v1.5.0
What's Changed
Changes to the Deno client
These changes are only specific to the Deno client
- [BREAKING] Deno APIs for handling Tls connections has changed. Deno versions lower than 1.16.x are incompatible. This change effectively sets Deno 1.16.x as the lowest supported version. by @aricart in #232
Changes to NBC library
These changes are shared by all NATS.io supported JavaScript clients.
- [FEAT] JetStream APIs for JavaScript are no longer preview. Note that Materialized views APIs are marked as beta and subject to change. by @aricart in #234
- [FEAT] JetStreamManager API added
consumers.update()
. TheConsumerUpdateConfig
provides some introspection into fields that can be modified. Modifying a consumer is only supported on servers 2.6.4 or better. @aricart in #229 - [CHANGE] JetStreamManager API
streams.update()
now requires the name of the stream. TheStreamUpdateConfig
provides some introspection into fields that can be modified. The previous API is shimmed, however, the shim will be removed on a future release. by @aricart in #230 and #235 - [FIX] Fixed an issue where a fast path for text encoding/decoding of NATS protocol messages (non-payload) didn't handle UTF code-points (ie when using username/password that contained these characters). All encoding decoding of protocol messages now uses TextEncoder/Decoder. by @aricart in #238
- [CHANGE] [BETA] KV
keys()
now returns an iterator rather than a list of keys. If using the beta API you must change your code as no shim is possible by @aricart in #240 - [FIX] Documentation typos. by @MrMYHuang in #244
- [FEAT] added support for custom reviver in JSONCodec by @tommyo in #242
- [FEAT] added support for KV prefix handling by @aricart in #239
New Contributors
- @MrMYHuang made their first contribution in #244
- @tommyo made their first contribution in #242
Full Changelog: v1.4.0...v1.5.0
v1.4.0
What's Changed
- [FEAT] JS consumer
bind
by @aricart in #217 - [FIX]
Auth
is not exported FIX #218 by @aricart in #219 - [FEAT] Allow access to consumer info in watch for internal extenders by @aricart in #220
- [FEAT] Allow access to JetStreamSubscriptionInfoable for downstream internal extenders by @aricart in #221
- [CHANGE] Kv.keys() returns an iterator by @aricart in #224
- [FIX] removed the conditional check on setting KvEntry.delta, as the pending are now properly reported by @aricart in #225
- [FEAT] surface JS errors as per ADR-7 by @aricart in #227
Full Changelog: v1.3.1...v1.4.0
v1.3.1
What's Changed
[FIX] validating a request, which returns a promise, could result in an exception being thrown - because the function isn't async the promise in those environments wasn't (correctly so) rejected, thus failed tests and possibly raised conditions that would require additional try/catch logic than necessary. #216
Full Changelog: v1.3.0...v1.3.1
v1.3.0
What's Changed
- [FIX]
break
from within an iterator now properly closes a subscription #190 - [ENHANCE] some exceptions now include a trace of the API where the call happened - for example timeouts/requests, this helps to understand what timed out or failed #196 and #199
- [FIX] partial frames during a connect's peek of the info block could fail and thus creating other issues downstream related to connection errors #201
- [FEAT] DNS names are now resolved by the client by #202 and #206
JetStream Changes
- [UPDATE] KV materialized views - the KV API is now acccessible under
nc.jetstream().views.kv()
. #213, #214 - [FEAT] Ordered Consumer #215
- [FIX] remove
name
from ConsumerConfig - this property doesn't exist in ConsumerConfig #210 - [FIX] flow control/protocol messages are now handled when they would be dispatched #208
- [FIX] The consumer options now match go client. Also exposed newly added consumer/stream options #211
- [FIX]
redelivered
property on js message was not reporting redeliveries by #200
Some features such as KV purge, require at least 2.6.3 nats-server, and raise errors on older servers.
Full Changelog: v1.2.0...v1.3.0
v1.2.0
BREAKING CHANGES
This release contains a set of changes that are API-breaking for JetStream. Since the JetStream APIs on the JavaScript clients are Preview, only the minor version of the client has been bumped. Because of these changes, you should carefully read the Breaking Changes section to ensure you are not affected.
JetStream Push Consumers In Queue Groups
The Push Consumer Queue feature has changed. A new nats-server (2.4.0) is in the works that modifies how this feature works.
The new JavaScript clients have been modified to work with the new server and will fail to work with an existing server using push consumers with queue groups.
Previously it was possible to create a push consumer and properly get it working in a queue group with a regular NatsConnection#subscribe
or NatsConnection#jetstream()#subscribe()
if all queue subscriptions used the same queue name and no plain (non-queue) subscriptions were used.
If the mix of subscriptions and queues referenced the same consumer but provided different queue names or no queue names, the delivery of messages was incorrect and could create conditions where some messages were seen in duplicate or have unexpected side effects.
The new nats-server changes will make an old consumer configuration with a queue group a noop - the server will not send messages to the client. To enable a queue group to work on a consumer:
- The consumer configuration must specify a
deliver_group
matching the queue group name. - Configurations that use the consumer with a non-matching queue group will be invalid.
- Configurations that use a queue group consumer without a queue group will be invalid.
The nats client for JavaScript on 1.2.0 and beyond, enforces the above rules, so an Error is thrown from NatsConnection#jetstream().subscribe()
for configurations that try to use the queue group incorrectly.
Because an old server will not report deliver_group
for the consumer, any jetstream#subscribe()
that attempts to specify a queue group will fail the validation.
If you are creating nats your own nats subscription to handle the consumer, and have an old server, you may continue to do that until you upgrade the server, at which point the nets-server will stop delivering messages to your client. Please do ensure that you don't use the consumer from different queue groups in the meanwhile.
JetStreamManager#streams#getMessage(number)
This API has been removed (it was deprecated and printing console messages). To retrieve a message by its sequence,
replace with JetStreamManager#streams#getMessage({seq: number})
.
Other Changes
-
[FIX] JetStream
ConsumerInfo
type was not exported. Also changesSequencePair
to be namedSequenceInfo
to match changes in the server. These types were only referenced fromConsumerInfo
which was not exported. -
[FEAT] Added
DeliveryPolicy#LastPerSubject
which allows a consumer to get the last message for each subject in a stream. -
[FIX] Exported functions
millis(ns: number):number
andnanos(millis: number):number
to allow conversion between these number types.millis()
converts nanoseconds to millis, andnanos() millis to nanoseconds) - some of the JetStream APIs expose these values and the client may want to translate to something more meaningful. Note future versions may change the return values of these functions to
bigint`. -
[FIX]
Stats
(NatsConnection#stats(): Stats) andServerInfo
(NatsConnection#info
),PubAck
(return type forJetStream#publish()
, are now exported types. -
[FEAT] Exported
isNatsError()
,checkJsError()
,isFlowControlMsg()
,isHeartbeatMsg
as these are sometimes useful for lower level subscriptions handling JetStream messages. -
[FEAT]
PubAck
now reports adomain
field representing the JetStream domain if set or returning an empty string. This feature requires a newer server. -
[FIX] ConsumerConfig now have fields
deliver_group
,description
.
v1.1.0
This release addresses compatibility with JetStream features introduced in recent nats-server releases, as well as addresses some minor issues. These fixes/enhancements are all part of the NBC (nats-base-client) library on which all JavaScript clients are based.
NATS
-
[FIX] Fixed a bug when parsing headers that stopped if the header contained a non-default status, non-OK messages may contain additional header entries
-
[FEAT] exposed
closed
property forSubscription
objects. The property is a promise that when resolved notifies that the subscription has stopped processing messages.
JetStream
-
[FIX] exposed
erase
argument forjsm.stream.deleteMessage()
-
[FIX] marked
StreamConfig
duplicate_window
to be Nanos -
[FEAT] added
max_msgs_per_subject
toStreamConfig
-
[FEAT] added
idle_heartbeat
andflow_control
toConsumerConfig
-
[FEAT] added util
isHeartbeatMsg()
and exposedisFlowControlMsg()
as these may be useful for direct NATS subscribers processing JetStream messages -
[FEAT] added support for JetStream
domain
inJetStreamOptions
. When a JetStream client is created with this option, the string value in the option is used to auto-generate the prefix used to access JetStream apis ($JS.<domain>.API
). This option must be set matching a similar option set on the NATS server. -
[FEAT]
JetStreamAccountStats
reportsdomain
when set on the server (returned when callingjsm.getAccountInfo()
). -
[FEAT] [BREAKING] Slight change to JSM streams
getMessage()
the API the second argument changed from a sequence number to be either{seq: #}
orlast_by_subject: "my.subject"
, this enables the feature for retrieving the last message in a stream with the specified subject. For the next couple releases the number argument will be shimmed to{seq: number}
but the shim will be removed before release. If you are using the deprecated API the client will print a message. The JetStream features in the JavaScript clients are pre-release and subject to changes. -
[FEAT] added
lastSubjectSequence
toexpect
inJetStreamPublishOptions
, this enables clients to assert that the last sequence on a subject is as expected (no new messages have been received on that subject). -
[FEAT] added the ability to purge streams by subject, sequence, or trimming to a specific number of messages.
-
[FEAT] exposed
JsHeaders
enum with possible headers from JetStream (LastStreamSeqHdr
/LastConsumerSeqHdr
) which are sent on heartbeats. Also addedStreamSourceHdr
, which is possible when a message is coming from a source. -
[FIX] corrected optional fields from
StreamSource
-
[FIX] exported isFlowControlMsg/isHeartbeatMsg, LastForMsgRequest, SeqMsgRequest
-
[FIX] added documentation on these features along with samples.