Skip to content

Commit

Permalink
chore: 0.3.0 release prep
Browse files Browse the repository at this point in the history
This change:

- Updates the package version around the codebase
- Updates the CHANGELOG
- Updates the upcoming feature list in the README
- Adds UPGRADING.md to provide more guidance for upgrading
  • Loading branch information
AndyTWF committed Dec 9, 2024
1 parent 30a2cbc commit 6eb703b
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 7 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

This contains only the most important and/or user-facing changes; for a full changelog, see the commit history.

## [0.3.0](https://github.com/ably/ably-chat-js/tree/0.3.0) (2024-12-11)

### Breaking Changes

Please see `UPGRADING.md` for full guidance on upgrading from version 0.2.1 and before.

- The default typing timeout has now been reduced to 5 seconds. [#361](https://github.com/ably/ably-chat-js/pull/361)
- Room and Connection status types have been renamed. [#382](https://github.com/ably/ably-chat-js/pull/382)
- Renamed the `timeserial` field on the `Message` type to `serial`. Messages may now be compared for global order by string comparison of this field.
- `Rooms.get` is now asynchronous and returns a `Promise` that will resolve once any `release` operations on the room are complete. [#387](https://github.com/ably/ably-chat-js/pull/387).
- The `Room.channel` property is now an instance of `Ably.RealtimeChannel`, rather than a `Promise`. [#387](https://github.com/ably/ably-chat-js/pull/387)
- In React, accessing the room via `useRoom`, or properties of the room via other hooks, now returns `ValueType | undefined`. Once the room's promise is resolved (see above), this will update to the actual value. [#387](https://github.com/ably/ably-chat-js/pull/387)
- The default Room status is now `Initialized`. The `Initializing` status is retained for use in React when the room has not yet been resolved. [#387](https://github.com/ably/ably-chat-js/pull/387)
- The `direction` argument to message history has been replaced by `orderBy`, which uses a new enum `OrderBy` with values `OldestFirst` and `NewestFirst`. Its behavior is identical to `direction: forwards | backwards`.

### New Features

- Added new fields and to Messages to support editing and deleting. [#362](https://github.com/ably/ably-chat-js/pull/362)
- Added the ability to delete messages in the chat. [#365](https://github.com/ably/ably-chat-js/pull/365)
- Added the ability to edit messages in the chat. [#378](https://github.com/ably/ably-chat-js/pull/378)

### Fixed Bugs

- The Room will now transition immediately to `released` if `release` is called whilst its status is `Initialized`. [#400](https://github.com/ably/ably-chat-js/pull/400)
- When paginating messages (e.g. via `getPreviousMessages`) the objects returned by successive pages will now fully implement the `Message` interface. Previously they were simple JSON objects after the first page. [#403](https://github.com/ably/ably-chat-js/pull/403).
- Fixed a bug whereby a room may get stuck in the `Suspended` status after network issues. [#409](https://github.com/ably/ably-chat-js/pull/409)

### Other Changes

- `ably-chat` is no longer a reserved key on Message and Reaction metadata/headers. [#374](https://github.com/ably/ably-chat-js/pull/374)

## [0.2.1](https://github.com/ably/ably-chat-js/tree/0.2.1) (2024-09-18)

- Fixed a bug that can lead to unhandled promise rejections and error logs when a room is released prior to initialization, particularly in React [#352](https://github.com/ably/ably-chat-js/pull/352)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, customer support, or social interactions in SaaS products. Built on [Ably's](https://ably.com/) core service, it abstracts complex details to enable efficient chat architectures.

> [!IMPORTANT]
> This SDK is currently under development. If you are interested in being an early adopter and providing feedback then you can [sign up to the private beta](https://forms.gle/vB2kXhCXrTQpzHLu5) and are welcome to [provide us with feedback](https://forms.gle/mBw9M53NYuCBLFpMA). Coming soon: chat moderation, editing and deleting messages.
> This SDK is currently under development. If you are interested in being an early adopter and providing feedback then you can [sign up to the private beta](https://forms.gle/vB2kXhCXrTQpzHLu5) and are welcome to [provide us with feedback](https://forms.gle/mBw9M53NYuCBLFpMA). Coming soon: chat moderation, simplified granular permissions and message reactions.
Get started using the [📚 documentation](https://ably.com/docs/products/chat) and [🚀check out the live demo](https://ably-livestream-chat-demo.vercel.app/), or [📘 browse the API reference](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/).

Expand Down
103 changes: 103 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Upgrade Guide

This guide provides detailed instructions on how to upgrade between major versions of the Chat SDK.

## <= 0.2.1 to 0.3.0

### Room and Connection Status Types

**Expected Impact: High**

These have been renamed for greater clarity. The key changes are that the `RoomStatus` and `ConnectionStatus` identifiers are now enumerations of the possible statuses, whereas before they were an interface name. Furthermore, the current status is now presented as the property `status`, rather than the property `current`.

| Action | Before | After |
| -------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------- |
| Get the “current” status of a room | `room.status.current` | `room.status` |
| Get the “current” error related to the room status | `room.status.error` | `room.error` |
| Subscribe to room status updates | `room.status.onChange` | `room.onStatusChange` |
| Remove all room status subscribers | `room.status.offAll` | `room.offAllStatusChange` |
| Compare the room status to some value | `roomStatus === RoomLifecycle.Attached` | `roomStatus === RoomStatus.Attached` |
| Get the “current” connection status | `chat.connection.status.current` | `chat.connection.status` |
| Get the “current” error related to the connection status | `chat.connection.status.error` | `chat.connection.error` |
| Subscribe to connection status updates | `chat.connection.status.onChange` | `chat.connection.onStatusChange` |
| Remove all connection status subscribers | `chat.connection.status.offAll` | `chat.connection.offAllStatusChange` |
| Compare the connection status to some value | `connectionStatus === ConnectionLifecycle.Connected` | `connectionStatus === ConnectionStatus.Connected` |

### Creating a Room Is Now Asynchronous

**Expected Impact: High**

The `Rooms.get` method is now asynchronous, returning a `Promise` which will resolve when the `Room` object is ready. If a `release` operation is in progress for the room, it shall wait for this
process to complete before resolving.

Before:

```ts
const room = chat.rooms.get('basketball-stream', { typing: { timeoutMs: 500 } });
```

After:

```ts
const room = await chat.rooms.get('basketball-stream', { typing: { timeoutMs: 500 } });
```

As a result, the `channel` property of various features (e.g. `messages.channel`) now returns an `Ably.RealtimeChannel` rather than a `Promise`.

### Default Room Status

**Expected Impact: Medium**

The default status of a newly created room is now `Initialized`. It was previously `Initializing`. `Initializing` is still used in React when the room is not yet resolved.

### Message Timeserial Field Rename

**Expected Impact: Medium**

This field has been renamed, so all occurrences of `message.timeserial` should now be changed to `message.serial`.

If you wish to, messages may now be compared for global ordering by comparing their `serial` strings.

```ts
const message1First = message1.serial < message2.serial;
```

The `before` and `after` methods are still available and will be kept for simplicity and autocomplete convenience.

### History Direction Parameter Removed

**Expected Impact: Medium**

The `direction` argument to message history has been replaced by `orderBy`, which uses a new enum `OrderBy` with values `OldestFirst` and `NewestFirst`. Its behavior is identical to `direction: forwards | backwards`.

Before:

```ts
const historicalMessages = await room.messages.get({ direction: 'backwards', limit: 50 });
```

After:

```ts
const historicalMessages = await room.messages.get({ orderBy: OrderBy.NewestFirst, limit: 50 });
```

### React Hooks Room Property Values

**Expected Impact: Low**

In previous versions of React Hooks, properties of the Room (e.g. `room.messages`) and the room itself were returned as `ValueType`. These are now returned as `ValueType | undefined`.

The value will be updated once the internal call to `Rooms.get()` has resolved.

### Typing Timeout

**Expected Impact: Low**

The default is now 5 seconds.

If you wish to retain the old behavior, change your `RoomOptions` when creating a `Room` as follows:

```ts
const room = await chat.rooms.get('basketball-stream', { typing: { timeoutMs: 500 } });
```
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"Failable",
"livestreams",
"livestream",
"clonedeep"
"clonedeep",
"timeserial"
],
// This will ignore anything that's formatted like a lexicographically ordered timeserial
"ignoreRegExpList": ["/\\d{14}-\\d{3}@.*/"],
Expand Down
2 changes: 1 addition & 1 deletion demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ably/chat",
"version": "0.2.1",
"version": "0.3.0",
"description": "Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, customer support, or social interactions in SaaS products.",
"type": "module",
"main": "dist/chat/ably-chat.umd.cjs",
Expand Down
2 changes: 1 addition & 1 deletion src/core/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Update this when you release a new version
export const VERSION = '0.2.1';
export const VERSION = '0.3.0';
export const CHANNEL_OPTIONS_AGENT_STRING = `chat-js/${VERSION}`;
export const DEFAULT_CHANNEL_OPTIONS = { params: { agent: CHANNEL_OPTIONS_AGENT_STRING } };

0 comments on commit 6eb703b

Please sign in to comment.