Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into integration/v2 #1544

Merged
merged 25 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7220619
Merge pull request #1485 from ably/upgrade-playwright-to-latest
lawrence-forooghian Nov 3, 2023
052c0cc
feat: add 'deriveOptions' to useChannel args
rustworthy Nov 12, 2023
c910d7c
feat: adjust 'Channel' class in 'fake' ably
rustworthy Nov 12, 2023
cf939ad
feat: add test from multiple clients
rustworthy Nov 12, 2023
51574e0
feat: add 'jmespath' lib typedefs
rustworthy Nov 12, 2023
25b1c97
feat: add complete test suite for use derived channel
rustworthy Nov 12, 2023
9bd2e77
feat: do not use async syntax for sync fake-ably ops
rustworthy Nov 13, 2023
8f998d0
feat: add derived channel usage to 'sample-app'
rustworthy Nov 13, 2023
d8f3cd6
feat: add 'jmespath' as explicit dev-dep
rustworthy Nov 15, 2023
63adfc4
feat: add derived channel usage example to 'docs/react.md'
rustworthy Nov 15, 2023
3dbd400
Merge pull request #1501 from rustworthy/feat/react-use-derived-channel
owenpearson Nov 16, 2023
7af5a4b
fix: use 'ably' as import path from react-hooks
Nov 20, 2023
a7d4b2e
ci: check if the types are wrong
Nov 20, 2023
c3c09dd
Merge pull request #1509 from ably/fix-react-hooks-ably-import
owenpearson Nov 20, 2023
64d2543
chore: bump version for 1.2.48 release
owenpearson Nov 20, 2023
1102190
chore: update changelog for 1.2.48 release
owenpearson Nov 20, 2023
3006fb8
Merge pull request #1511 from ably/release/1.2.48
owenpearson Nov 21, 2023
a9235ab
chore: bump version for react-hooks
owenpearson Nov 21, 2023
b65c244
Merge pull request #1510 from ably/attw
owenpearson Nov 21, 2023
95ef9e2
Remove some redundant type annotations
lawrence-forooghian Dec 11, 2023
8bd1706
Fix PaginatedResult.next() behaviour when no next page
lawrence-forooghian Dec 11, 2023
fdd5a56
Merge pull request #1543 from ably/1542-next-page-not-null
lawrence-forooghian Dec 11, 2023
79fdf21
Use correct request headers in Resource after re-auth
lawrence-forooghian Jan 9, 2024
809c0e9
Merge pull request #1567 from ably/1566-use-correct-request-headers-f…
lawrence-forooghian Jan 10, 2024
d36d97b
Merge remote-tracking branch 'origin/main' into 2023-12-11-merge-main…
lawrence-forooghian Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ jobs:
- run: npm run lint
- run: npm run format:check
- run: npx tsc --noEmit ably.d.ts modules.d.ts
# for some reason, this doesn't work in CI using `npx attw --pack .`
- run: npm pack
- run: npx attw ably-$(npm show ably version).tgz --summary --exclude-entrypoints 'ably/modules'
# TODO understand this unexpected-module-syntax error (https://github.com/ably/ably-js/issues/1546)
- run: npx attw ably-$(npm show ably version).tgz --summary --entrypoints 'ably/modules' --ignore-rules unexpected-module-syntax
- run: npm audit --production
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

## [1.2.48](https://github.com/ably/ably-js/tree/1.2.48) (2023-11-20)

- Enable 'derived' options in 'useChannel' hook (by @rustworthy) [\#1501](https://github.com/ably/ably-js/pull/1501)
- fix: use 'ably' as import path from react-hooks [\#1509](https://github.com/ably/ably-js/pull/1509)

## [1.2.47](https://github.com/ably/ably-js/tree/1.2.47) (2023-11-02)

- fix(react): fix issue where useChannel would error upon router navigation or hmr [\#1478](https://github.com/ably/ably-js/pull/1478)
Expand Down
2 changes: 1 addition & 1 deletion ably.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2168,8 +2168,8 @@
*/
get(name: string, channelOptions?: ChannelOptions): T;
/**
* @experimental This is a preview feature and may change in a future non-major release.

Check warning on line 2171 in ably.d.ts

View workflow job for this annotation

GitHub Actions / lint

Invalid JSDoc tag name "experimental"
* This experimental method allows you to create custom realtime data feeds by selectively subscribing

Check warning on line 2172 in ably.d.ts

View workflow job for this annotation

GitHub Actions / lint

Expected no lines between tags
* to receive only part of the data from the channel.
* See the [announcement post](https://pages.ably.com/subscription-filters-preview) for more information.
*
Expand Down Expand Up @@ -2468,7 +2468,7 @@
*
* @returns A promise which, upon success, will be fulfilled with a page of results for message and presence history, stats, and REST presence requests. Upon failure, the promise will be rejected with an {@link ErrorInfo} object which explains the error.
*/
next(): Promise<PaginatedResult<T>>;
next(): Promise<PaginatedResult<T> | null>;
/**
* Returns the `PaginatedResult` for the current page of results.
*/
Expand Down
23 changes: 23 additions & 0 deletions docs/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,29 @@ const { channel } = useChannel({ channelName: "your-channel-name", options: { ..
});
```

[Subscription filters](https://ably.com/docs/channels#filter-subscribe) are also supported:

```javascript
const deriveOptions = { filter: 'headers.email == `"[email protected]"` || headers.company == `"domain"`' }
const { channel } = useChannel({ channelName: "your-derived-channel-name", options: { ... }, deriveOptions }, (message) => {
...
});
```

Please note that attempts to publish to a derived channel (the one created or retrieved with a filter expression) will fail. In order to send messages to the channel called _"your-derived-channel-name"_ from the example above, you will need to create another channel instance without a filter expression.

```javascript
const channelName = "your-derived-channel-name";
const options = { ... };
const deriveOptions = { filter: 'headers.email == `"[email protected]"` || headers.company == `"domain"`' }
const callback = (message) => { ... };

const { channel: readOnlyChannelInstance } = useChannel({ channelName, options, deriveOptions }, callback);
const { channel: readWriteChannelInstance } = useChannel({ channelName, options }, callback); // NB! No 'deriveOptions' passed here

readWriteChannelInstance.publish("test-message", { text: "message text" });
```

---

### usePresence
Expand Down
Loading
Loading