Skip to content

Latest commit

 

History

History
165 lines (94 loc) · 8.84 KB

CHANGELOG.md

File metadata and controls

165 lines (94 loc) · 8.84 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

0.14.1 - 2024-10-27

Changed

0.14.0 - 2024-10-18

Fixed

  • Fixed default state type when creating sessions and channels with createSession and createChannel being set to unknown instead of DefaultSessionState and DefaultChannelState, respectively.
  • Fixed package directly exporting a single object containing exports, breaking named imports when using ESModules, and instead dual-export two separate builds to support both ESM and CJS.

Removed

  • Dropped support for Node 17 and below.

0.13.0 - 2024-08-23

Added

  • Added the ability to set an initial value for the state property in the Session and Channel constructor options objects.

Removed

  • Removed constraints that enforced that State generics passed to Session and Channel extend from Record<string, unknown>.

0.12.1 - 2024-05-24

Fixed

  • Fixed types for channel and session emitted event names.

0.12.0 - 2024-05-10

Added

0.11.0 - 2024-02-08

Added

  • Added the SseError custom error object that wraps all thrown errors.

Changed

  • Update the Session#push method to throw if the session is not connected.

Fixed

  • Fixed session not detecting a response stream disconnect.

0.10.0 - 2023-09-28

Added

  • Added the Session#batch method that can be used to batch multiple events into a single transmission over the wire.
  • Added the EventBuffer class that can be used to write raw spec-compliant SSE fields into a text buffer that can be sent directly over the wire.

Deprecated

  • Deprecate the Session .event, .data, .id, .retry, .comment, .dispatch and .flush methods in favour of using event buffers instead.

0.9.0 - 2023-08-14

Added

  • Added the ability to type the state property of sessions registered with a Channel via an optional second generic argument to the Channel constructor.
  • Added the DefaultChannelState interface that may be used via module augmentation to alter the default channel state type for all channels.

Changed

0.8.0 - 2022-06-02

Added

  • Added an internal data buffer to Session that buffers written data internally until it is flushed to the client using the new Session#flush method.
  • Added the Pragma, X-Accel-Buffering headers and add additional values to the Cache-Control default header to further disable all forms of caching.
  • Added support for supplying the Node HTTP/2 compatibility API Http2ServerRequest and Http2ServerResponse objects to the Session constructor req and res parameters, respectively.

Changed

  • Update the Session#event, Session#data, Session#id, Session#retry and Session#comment methods to write to the internal data buffer instead of sending the field data over the wire immediately.
  • Update the Session#dispatch method to only write a newline (and to the internal data buffer) and not flush the written data to the client.
  • Update the Channel#broadcast method to generate its own custom event ID and thus add it as an additional argument to its broadcast event callback function.
  • Update the Channel#register and Channel#deregister to not do anything if the channel is already registered or deregistered, respectively.
  • Update the Session constructor options header field to overwrite conflicting default headers instead of being ignored.
  • Update auto-generated event IDs to be guaranteed to be a cryptographically unique string instead of a pseudorandomly generated string of eight characters.

Fixed

  • Fixed the Channel session-disconnected being fired after instead of before the session is deregistered.

Removed

  • Removed the ability to pass null to Session#id. Give no arguments at all instead.

0.7.1 - 2022-01-11

Fixed

  • Removed type-declarations generated from unit testing files.

0.7.0 - 2022-01-08

Added

  • Added the ability to the Session#push method to set a custom event ID.
  • Added a new Session push event that is emitted with the event data, name and ID when the Session#push method is called.
  • Added the Channel#state property to have a safe namespace for keeping information attached to the channel.

Changed

  • Update the arguments for the Session#push and Channel#broadcast methods and their corresponding emitted event callbacks to always have the event data first and event name as an optional argument second.
  • Update the Channel#broadcast method options TypeScript typings to explicitly mandate a boolean return-type instead of allowing any truthy or falsy value.
  • Update the Channel#broadcast method event name argument to be optional and default to "message" if not given.
  • Update the Session#state generic argument to default to a new SessionState interface that can be augmented via declaration merging to override the session state type for all session objects without explicitly providing a generic argument to each reference to Session.
  • Rename the Session and Channel Events interfaces to SessionEvents and ChannelEvents respectively and export them publicly allowing the user to properly type non-inlined event handler callback functions.

0.6.0 - 2021-10-28

Added

  • Added the Session#iterate method that allows processing iterables and sending yielded values to the client as events.
  • Added types for Session and Channel event listener callback function arguments.
  • Added the ability to type Session#state using an optional generic argument for createSession and the Session constructor.

Changed

0.5.0 - 2021-07-17

Added

Fixed

0.4.0 - 2021-07-09

Added

Fixed

  • Fixed an issue where installing the package using npm would throw an error mandating it be installed with pnpm.