Skip to content

Releases: nats-io/nats.deno

v1.6.1

14 Feb 22:38
aaf8190
Compare
Choose a tag to compare

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

01 Feb 14:48
d4f1b48
Compare
Choose a tag to compare

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 and expires on JetStream pull consumers changed. If no messages were available the server honors the expires. If a client specifies no_wait the JavaScript client will clear out the expires. 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.
  • [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, and max_expires the max amount of time that a pull request with an expires should be allowed to remain active by @aricart in #251
  • [FEAT] [JETSTREAM] add support for nak() with a delay - a JetStream message may now be nak 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 handles http/s protocols. If port 80 was specified, the URL parsing code discarded the port (as it matched the protocol), thus activating the logic to set the default port of 4222 as added. by @aricart in #254
  • [FIX] added constraint to reject ConnectionOptions when both servers and port are specified. by @aricart in #255
  • [FIX] processing of ConnectionOptions processed port property before servers by @aricart in #248

Full Changelog: v1.5.0...v1.6.0

v1.5.0

18 Jan 23:22
3924f70
Compare
Choose a tag to compare

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(). The ConsumerUpdateConfig 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. The StreamUpdateConfig 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

Full Changelog: v1.4.0...v1.5.0

v1.4.0

11 Nov 21:46
0f902ff
Compare
Choose a tag to compare

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

02 Nov 18:55
ce4f4aa
Compare
Choose a tag to compare

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

01 Nov 20:02
2975fd4
Compare
Choose a tag to compare

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

25 Aug 21:43
dc0322e
Compare
Choose a tag to compare

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 changes SequencePair to be named SequenceInfo to match changes in the server. These types were only referenced from ConsumerInfo 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 and nanos(millis: number):number to allow conversion between these number types. millis() converts nanoseconds to millis, and nanos() 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) and ServerInfo (NatsConnection#info), PubAck (return type for JetStream#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 a domain 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

01 Jul 20:55
c45adca
Compare
Choose a tag to compare

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 for Subscription objects. The property is a promise that when resolved notifies that the subscription has stopped processing messages.

JetStream

  • [FIX] exposed erase argument for jsm.stream.deleteMessage()

  • [FIX] marked StreamConfig duplicate_window to be Nanos

  • [FEAT] added max_msgs_per_subject to StreamConfig

  • [FEAT] added idle_heartbeat and flow_control to ConsumerConfig

  • [FEAT] added util isHeartbeatMsg() and exposed isFlowControlMsg() as these may be useful for direct NATS subscribers processing JetStream messages

  • [FEAT] added support for JetStream domain in JetStreamOptions. 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 reports domain when set on the server (returned when calling jsm.getAccountInfo()).

  • [FEAT] [BREAKING] Slight change to JSM streams getMessage() the API the second argument changed from a sequence number to be either {seq: #} or last_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 to expect in JetStreamPublishOptions, 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 added StreamSourceHdr, 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.

v1.0.8

24 Jun 12:38
46c7f7b
Compare
Choose a tag to compare

[FIX] ConsumerOpts now provides the queue() option enabling Jetstream push subscribers on a durable to form a queue group. #162

v1.0.7

14 Jun 15:16
340f418
Compare
Choose a tag to compare

[FIX] Match was not exported in the mod.ts nor on internal_mod.ts (other derivatives exported it via their typescript bindings).