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

Release 2.0.0 #1709

Merged
merged 599 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
599 commits
Select commit Hold shift + click to select a range
40508c5
Merge pull request #1595 from ably/improve-run-playwright-tests
VeskeR Jan 26, 2024
04f0f16
Remove public ChannelModes type
lawrence-forooghian Jan 29, 2024
f7e28aa
Remove duplicate type names
lawrence-forooghian Jan 29, 2024
709f66a
Update recently-changed tests to use Promise-based API
lawrence-forooghian Dec 11, 2023
b647581
Update some missed tests to use Promise-based API
lawrence-forooghian Dec 11, 2023
16f3d38
Mark Rest.revokeTokens as async
lawrence-forooghian Jan 8, 2024
14ae7c9
Make Multicaster.call private
lawrence-forooghian Jan 15, 2024
1be691f
Be more explicit about a type
lawrence-forooghian Jan 15, 2024
d012125
Restrict Multicaster callback type
lawrence-forooghian Dec 11, 2023
dfaa6ba
Add a method for bridging Multicaster with promises
lawrence-forooghian Dec 7, 2023
cd6c2d8
Add whenPromiseSettles function
lawrence-forooghian Dec 11, 2023
4aa7494
Fix type of ChannelSubscriptions.removeWhere callback
lawrence-forooghian Dec 7, 2023
3e06ea9
Fix type of ChannelSubscriptions.save callback
lawrence-forooghian Dec 7, 2023
0eb0018
Fix return type of Connection.ping
lawrence-forooghian Dec 7, 2023
35970d6
Fix return type of RealtimePresence.get
lawrence-forooghian Dec 7, 2023
2c56030
Fix return type of Auth.authorize
lawrence-forooghian Dec 7, 2023
501dd74
Fix return type of Auth.requestToken
lawrence-forooghian Dec 7, 2023
66e025b
Fix return type of RealtimeChannel.subscribe
lawrence-forooghian Dec 7, 2023
602ceaf
Fix return type of RealtimeChannel.history
lawrence-forooghian Dec 8, 2023
336695a
Remove useless return
lawrence-forooghian Dec 7, 2023
5e95872
Add Promise overload signatures to some methods
lawrence-forooghian Dec 8, 2023
df28f8d
Use the promise-based version of callback/promise methods
lawrence-forooghian Dec 8, 2023
7c465d6
Remove dual callback/promise operation
lawrence-forooghian Dec 7, 2023
1ef2b2b
Convert Auth._forceNewToken to use promises
lawrence-forooghian Dec 8, 2023
ffea183
Convert Auth.getAuthParams to use promises
lawrence-forooghian Dec 8, 2023
c2f02a0
Convert Auth.getAuthHeaders to use promises
lawrence-forooghian Dec 8, 2023
9dd1515
Convert Auth.getTimestamp to use promises
lawrence-forooghian Dec 8, 2023
73b30af
Convert Auth._ensureValidAuthCredentials to use promises
lawrence-forooghian Dec 8, 2023
5b33381
Convert PaginatedResource.handlePage to use promises
lawrence-forooghian Dec 8, 2023
0d2d90c
Convert PaginatedResult.get to use promises
lawrence-forooghian Dec 8, 2023
96655af
Convert PaginatedResource request methods to use promises
lawrence-forooghian Dec 8, 2023
cd0a6c4
Convert RestChannelMixin.history to use promises
lawrence-forooghian Dec 8, 2023
9093f0d
Change RestChannel._publish to only pass error to callback
lawrence-forooghian Dec 11, 2023
564e4aa
Convert RestChannel._publish to use promises
lawrence-forooghian Dec 11, 2023
2001675
Convert Resource request methods to use promises
lawrence-forooghian Jan 5, 2024
4951ec1
Convert Resource.do to use promises
lawrence-forooghian Jan 5, 2024
da6d206
Convert message `encrypt` to use promises
lawrence-forooghian Jan 5, 2024
019c315
Convert message `encode` to use promises
lawrence-forooghian Jan 5, 2024
69b64dc
Convert message `encodeArray` to use promises
lawrence-forooghian Jan 5, 2024
499ca19
Remove leftover documentation comment
lawrence-forooghian Jan 5, 2024
1e15e53
Convert web crypto `generateRandom` to use promises
lawrence-forooghian Jan 5, 2024
ec45a10
Make ICipher.encrypt signature consistent with our other callbacks
lawrence-forooghian Jan 5, 2024
d87123d
Convert Node crypto `generateRandom` to use promises
lawrence-forooghian Jan 5, 2024
32d02a6
Convert web crypto `getIv` to use promises
lawrence-forooghian Jan 5, 2024
2f19925
Convert ICipher.encrypt to use promises
lawrence-forooghian Jan 5, 2024
509b5c4
Convert IPlatformConfig.getRandomValues to use promises
lawrence-forooghian Jan 5, 2024
b429c13
Convert IPlatformConfig.getRandomArrayBuffer to use promises
lawrence-forooghian Jan 5, 2024
be5648e
Merge pull request #1541 from ably/remove-callbacks-part-1
lawrence-forooghian Jan 31, 2024
cddc7b5
build: use `Ably` as UMD lib name
owenpearson Dec 19, 2023
b9d468c
Changes "esbuild-plugin-umd-wrapper" dependency to use ably's fork
VeskeR Feb 1, 2024
41686c0
Changes UMD wrapper to use anonymous bundles for AMD resolution
VeskeR Feb 1, 2024
d61735b
Merge pull request #1558 from ably/umd-lib-name
VeskeR Feb 2, 2024
a364a39
Revert "Remove Logger.deprecated* methods"
SimonWoolf Feb 7, 2024
717b060
Typings: update v2 typings to use createRecoveryKey() instead of reco…
SimonWoolf Feb 7, 2024
a0a61b8
Merge remote-tracking branch 'origin/main' into 2024-02-09-merge-main…
lawrence-forooghian Feb 9, 2024
d5cedcb
Merge pull request #1618 from ably/2024-02-09-merge-main-into-v2
lawrence-forooghian Feb 9, 2024
7f4e17c
Merge pull request #1601 from ably/1560-fix-typedoc-links
lawrence-forooghian Feb 15, 2024
aadae0d
Highlight that whenPromiseSettles doesn’t guarantee error type
lawrence-forooghian Feb 8, 2024
e46ba18
Create "resolved" option variables in requestToken
lawrence-forooghian Feb 1, 2024
410ec16
Tighten type of requestToken’s authOptions arg
lawrence-forooghian Feb 1, 2024
af2e916
fix: use 'ably' as import path from react-hooks
VeskeR Feb 15, 2024
d9cd505
Tighten type of requestToken’s tokenRequestCallback variable
lawrence-forooghian Feb 1, 2024
aeac6e2
Tighten type of requestToken’s tokenRequest variable
lawrence-forooghian Feb 7, 2024
5714753
Make RequestCallback’s error param non-optional
lawrence-forooghian Jan 31, 2024
e6d6bb5
Convert IPlatformHttp.checkConnectivity to use promises
lawrence-forooghian Jan 30, 2024
865f224
Convert Http.checkConnectivity to use promises
lawrence-forooghian Jan 30, 2024
6f00409
Convert IPlatformHttp.doUri to use promises
lawrence-forooghian Jan 30, 2024
c663352
Convert Http.doUri to use promises
lawrence-forooghian Jan 30, 2024
f3e09ef
Fix an argument name
lawrence-forooghian Feb 8, 2024
9e15e4c
Convert Http.do to use promises
lawrence-forooghian Jan 15, 2024
b236107
Convert web HTTP `Request` to use promises
lawrence-forooghian Jan 15, 2024
3004ccc
Convert fetchRequest to use promises
lawrence-forooghian Jan 15, 2024
d0568d7
Remove RequestCallback type assertions
lawrence-forooghian Jan 30, 2024
2cf5a6b
Rename types that refer to RequestCallback
lawrence-forooghian Jan 30, 2024
72c131e
Adds `exports."./react"` to package.json
VeskeR Feb 19, 2024
ca88735
Moves 'handler' function to 'Http._handler' in nodejs http util class
VeskeR Feb 19, 2024
7db6fe2
`npm init playwright@latest -- --ct` in `test/package/browser/template`
VeskeR Feb 21, 2024
4a9970f
`npm install @playwright/[email protected]` in `test/packa…
VeskeR Feb 21, 2024
d3b02cc
Add NPM package import test for `ably/react`
VeskeR Feb 21, 2024
c04b930
`npm install [email protected]` in `test/package/browser/template`
VeskeR Feb 21, 2024
0bffeb7
Fix package-lock.json optional dependency issue
VeskeR Feb 21, 2024
5fa866d
Merge pull request #1603 from ably/1533-remove-callbacks-from-http-code
lawrence-forooghian Feb 21, 2024
2ea1e5d
Merge pull request #1624 from ably/1619/fix-ably-import-in-react-hooks
VeskeR Feb 21, 2024
d0e9fbe
Merge pull request #1627 from ably/refactor-nodejs-http
VeskeR Feb 21, 2024
80403b0
Improve script names and file structure for `package` tests
VeskeR Feb 23, 2024
62618ae
Update README for `package` test to include `ably/react` testing info
VeskeR Feb 23, 2024
4d657fb
Removes IE8 related comment
VeskeR Feb 21, 2024
e55a33b
Removes Date.now polyfill for IE8
VeskeR Feb 21, 2024
29984da
Removes `Utils.now` function
VeskeR Feb 21, 2024
2a9fd38
Removes IE10 specific needJsonEnvelope check from web xhrrequest
VeskeR Feb 21, 2024
c92c283
Removes IE specific statusCode check from web xhrrequest
VeskeR Feb 21, 2024
3b68aeb
Removes IE specific console checks from logger
VeskeR Feb 21, 2024
c49fc76
Removes IE msCrypto from web config
VeskeR Feb 21, 2024
2fb5128
Removes IE8 only `noUpgrade` Platform.Config option
VeskeR Feb 21, 2024
5106b00
Make IPlatformConfig.getRandomArrayBuffer non-optional
VeskeR Feb 21, 2024
a7a9620
Removes fallbacks to `Math.random` in utils and web crypto
VeskeR Feb 21, 2024
59ce70a
Removes IPlatformConfig.getRandomValues function in favour of getRand…
VeskeR Feb 21, 2024
103f8ef
Fix comment
VeskeR Feb 21, 2024
07601b5
Removes unnecessary hasOwnProperty is nullish check
VeskeR Feb 21, 2024
ad0857e
Improves comments in utils
VeskeR Feb 21, 2024
b88ec14
Remove polyfill for Array.isArray in utils
VeskeR Feb 21, 2024
397523b
Remove Utils.isArray function in favour of Array.isArray
VeskeR Feb 21, 2024
37fe738
Change Utils.isEmptyArg to Utils.isNil
VeskeR Feb 21, 2024
d9ec0af
Change Utils.isNil to shorter check
VeskeR Feb 21, 2024
fc9698e
Remove polyfill for Array.prototype.indexOf in Utils
VeskeR Feb 21, 2024
1836bdd
Change Transport.shortName type to TransportName from string
VeskeR Feb 21, 2024
bc4a494
Remove Utils.arrIndexOf in favour of native Array.prototype.indexOf
VeskeR Feb 21, 2024
e5961ea
Remove Utils.arrIn in favour of native Array.prototype.includes
VeskeR Feb 21, 2024
011310a
Remove polyfill for Array.prototype.forEach in Utils
VeskeR Feb 21, 2024
42ab6cc
Remove Utils.arrForEach in favour of native Array.prototype.forEach
VeskeR Feb 21, 2024
8a8e93f
Remove Utils.safeArrForEach
VeskeR Feb 21, 2024
fcda7d3
Remove polyfill for Array.prototype.map in Utils
VeskeR Feb 21, 2024
7d2ed22
Remove Utils.arrMap in favour of native Array.prototype.map
VeskeR Feb 21, 2024
ea6992c
Remove polyfill for Array.prototype.filter in Utils
VeskeR Feb 21, 2024
218a6cd
Remove Utils.arrFilter in favour of native Array.prototype.filter
VeskeR Feb 21, 2024
7f275ce
Remove Array.prototype.find polyfill from shared_helper
VeskeR Feb 21, 2024
e5aa106
Remove polyfill for Array.prototype.every in Utils
VeskeR Feb 21, 2024
2072302
Remove Utils.arrEvery in favour of native Array.prototype.every
VeskeR Feb 21, 2024
335007d
Remove polyfill for String.prototype.trim in Utils
VeskeR Feb 21, 2024
d5fcd67
Remove Utils.trim in favour of native String.prototype.trim
VeskeR Feb 21, 2024
85f0469
Change minimal raw bundle size threshold to 95 KiB
VeskeR Feb 21, 2024
809aced
Remove IE specific code from tests
VeskeR Feb 23, 2024
9a05dc8
Remove "comma-dangle" eslint rule used for old browsers compatibility
VeskeR Feb 23, 2024
b94c52b
Use Node.js 20 in github workflows
VeskeR Feb 26, 2024
f982d68
Run CI tests for node on Node.js 16, 18, 20
VeskeR Feb 26, 2024
cc963f8
Update `engines` in `package.json` to `node >=16`
VeskeR Feb 26, 2024
f33d4c0
Merge pull request #1625 from ably/1622/fix-ably-react-import
VeskeR Feb 26, 2024
c6ff426
WIP!: `ChannelProvider` implementation draft
ttypic Feb 9, 2024
ab365de
chore: rename `channelToOptions` to show it's internal
ttypic Feb 12, 2024
5b7a340
chore: make `ChannelProvider` mandatory
ttypic Feb 12, 2024
baf68c8
refactor: use React context to store channel instance
ttypic Feb 22, 2024
5324354
chore: update example App, wording for channel without provider excep…
ttypic Feb 23, 2024
c3da490
chore: add `ChannelProvider` to the playwright check
ttypic Feb 26, 2024
4cb3b00
Add `console` and `pageerror` listeners to react-hooks package test
VeskeR Feb 26, 2024
2fc88a3
Remove node 0.8.x specific code from node platform crypto
VeskeR Feb 27, 2024
8996ff5
Update src/platform/react-hooks/src/hooks/useChannelInstance.ts
ttypic Feb 27, 2024
ec95b59
Merge pull request #1620 from ably/SDK-4083/channel-provider
ttypic Feb 27, 2024
4e5747b
Merge pull request #1629 from ably/1538/remove-old-platforms-code
VeskeR Feb 28, 2024
48a902d
Merge pull request #1639 from ably/improve-test-react-package-logs
VeskeR Feb 28, 2024
c4fc544
ci: don't check formatting in react workflow
owenpearson Feb 29, 2024
2462e9b
Merge pull request #1653 from ably/ci-remove-react-format-check
owenpearson Feb 29, 2024
581a6fd
Update platform compatibility statements in READMEs
VeskeR Feb 26, 2024
54d4c39
Change build/bundle ES target to ES2017
VeskeR Feb 26, 2024
b445729
Convert NodeCometTransport in nodejs platform to ES6 classes
VeskeR Feb 26, 2024
81f1bce
Document continued support for ably-js v1 in README
VeskeR Feb 26, 2024
cd9c61e
Document fallback transport mechanisms in the context of network cond…
VeskeR Mar 1, 2024
60aec7d
feat: add `publish` to the `useChannel` hook
ttypic Mar 1, 2024
ee71ba8
Merge pull request #1613 from ably/v2-recoverykey
SimonWoolf Mar 4, 2024
e0074b8
docs: update wording for publish
ttypic Mar 5, 2024
1e24b01
Merge pull request #1658 from ably/publish-method-to-use-channel
ttypic Mar 5, 2024
78aa0b8
docs: add `ChannelProvider` documentation
ttypic Feb 29, 2024
49a331e
docs: update derived channel note
ttypic Mar 1, 2024
7f6f400
Merge pull request #1633 from ably/1605/v2-platform-compatibility
VeskeR Mar 5, 2024
38a5720
Merge pull request #1634 from ably/1606/document-continued-support-fo…
VeskeR Mar 5, 2024
ce8ee42
Merge pull request #1664 from ably/document-fallback-transports-mecha…
VeskeR Mar 5, 2024
d37ca93
Merge pull request #1654 from ably/ECO-4635/channel-provider-docs
ttypic Mar 6, 2024
e12d300
Set `trailingComma` in `.prettierrc` to `all` and run `npm run format`
VeskeR Feb 27, 2024
9f7669d
Remove Node 12 specific code from webpack config for MochaJUnitReporter
VeskeR Feb 27, 2024
8b387f2
Remove MochaJUnitReporter bundle for Node.js in webpack
VeskeR Mar 2, 2024
9f66d1f
Merge pull request #1641 from ably/remove-more-old-code
VeskeR Mar 6, 2024
5f56c45
Revert "Replace the existing plugins mechanism"
lawrence-forooghian Mar 1, 2024
a3d8fa2
Revert "Extract delta tests into a reusable function"
lawrence-forooghian Mar 1, 2024
c2fac04
Bring Realtime constructor signatures in line with public types
lawrence-forooghian Mar 1, 2024
c63431c
Fix some terminology in moduleReport script
lawrence-forooghian Mar 4, 2024
e8c3012
Use ClientOptions.plugins for modular variant
lawrence-forooghian Mar 1, 2024
677063f
Rename ably/modules export to ably/modular
lawrence-forooghian Mar 1, 2024
8280d36
Fix incorrect whenState test name
lawrence-forooghian Feb 28, 2024
deeeda1
Fix whenState incorrectly throwing a string
lawrence-forooghian Mar 6, 2024
adea24c
Fix whenState error message
lawrence-forooghian Mar 6, 2024
0f53c51
Remove dual promise/callback operation of whenState
lawrence-forooghian Feb 26, 2024
b2b98eb
Bring whenState in line with spec and test it
lawrence-forooghian Feb 26, 2024
737a6cf
Merge pull request #1663 from ably/1662-restore-plugins-and-use-for-m…
lawrence-forooghian Mar 6, 2024
46dcda7
Merge pull request #1640 from ably/1597-implement-whenState-spec
lawrence-forooghian Mar 6, 2024
0bc007c
test: remove reference to removed 'tear_down' module
owenpearson Feb 29, 2024
8e971a6
test: if no log level set, only log failed tests
owenpearson Feb 29, 2024
96f250b
test: use mocha CLI directly for node tests
owenpearson Feb 29, 2024
86f8293
test: no explicit logLevel
owenpearson Feb 29, 2024
659ddd3
test: ensure realtime clients are disposed correctly
owenpearson Feb 29, 2024
d553b22
test: force close all realtime clients after each test
owenpearson Feb 29, 2024
92e7e49
test: use source map for node tests
owenpearson Mar 6, 2024
3066804
build: cleanup unused grunt tasks
owenpearson Mar 7, 2024
535f066
test: convert test webserver to module
owenpearson Mar 7, 2024
5ba1ae6
Rename `id` to `ablyId` in react-hooks for AblyProvider context
VeskeR Mar 7, 2024
2203596
Improve `ChannelNameAndAblyId` type for react hooks
VeskeR Mar 8, 2024
f3b5837
Narrow type used for `useChannelStateListener` hook parameter
VeskeR Mar 8, 2024
1262a77
Merge remote-tracking branch 'origin/main' into 2024-03-08-merge-main…
lawrence-forooghian Mar 8, 2024
1836e47
Changes mentions of `id` to `ablyId` in React Hooks documentation
VeskeR Mar 11, 2024
ae83131
Move `React.createContext` outside of components in react-hooks
VeskeR Feb 27, 2024
2448fb5
Make AblyContext be stored in global object
VeskeR Mar 6, 2024
d5717e4
Move context related code from AblyProvider to new AblyContext file
VeskeR Mar 6, 2024
0dff35a
Rename AblyContextType to AblyContextValue
VeskeR Mar 6, 2024
9720015
Merge pull request #1676 from ably/1637/rename-id-in-react-hooks
VeskeR Mar 11, 2024
85b54ea
Merge pull request #1643 from ably/1638/move-react-context-outside-co…
VeskeR Mar 11, 2024
a29e83f
Merge pull request #1682 from ably/2024-03-08-merge-main-into-v2
lawrence-forooghian Mar 11, 2024
7dd2adc
test: dynamically add mocha config specs if no specs passed via args
owenpearson Mar 11, 2024
019de8c
test: use root_hooks.js for new hooks and fix browser not loading them
owenpearson Mar 11, 2024
cb315b4
Replace multiple `subscribe` and `unsubscribe` calls with single call…
VeskeR Mar 8, 2024
72059ed
Make PresenceMessage in `usePresence` extend Ably.PresenceMessage
VeskeR Mar 8, 2024
c485464
Merge remote-tracking branch 'origin/main' into 2024-03-13-merge-main…
lawrence-forooghian Mar 13, 2024
730c621
Split `usePresence` hook into two hooks for entering presence and sub…
VeskeR Mar 8, 2024
fe9d009
Update react hooks sample app to use new `usePresence*` hooks
VeskeR Mar 8, 2024
d28ccd6
Update react hooks README with new `usePresence*` hooks
VeskeR Mar 8, 2024
c56b665
Add tests for `usePresenceListener` react hook for `onPresenceMessage…
VeskeR Mar 12, 2024
45391c5
Fix `usePresenceListener` hook did not react to `onPresenceMessageRec…
VeskeR Mar 12, 2024
9d94ec9
Merge pull request #1690 from ably/2024-03-13-merge-main-into-v2
lawrence-forooghian Mar 13, 2024
2454a28
Refactor onMount/onUnmount functions in `usePresence` hook
VeskeR Mar 12, 2024
735f27b
Add documentation for `skip` parameter to React docs
VeskeR Mar 8, 2024
75af2a4
Merge pull request #1674 from ably/1621/split-use-presence-hook
VeskeR Mar 13, 2024
8edfc0f
Merge pull request #1675 from ably/1673/document-skip-parameter
VeskeR Mar 13, 2024
a32bc6c
Merge pull request #1652 from ably/test-improvements
owenpearson Mar 14, 2024
a8a760a
Merge remote-tracking branch 'origin/main' into 2024-03-14-merge-main…
lawrence-forooghian Mar 14, 2024
c64732c
Merge pull request #1695 from ably/2024-03-14-merge-main-into-v2
lawrence-forooghian Mar 14, 2024
c32f16b
Change `PresenceEnterResult` to `PresenceResult` in react hooks
VeskeR Mar 15, 2024
a3389a8
Merge pull request #1697 from ably/fix-presence-enter-name
VeskeR Mar 15, 2024
5a7dd97
Fix `ably/modular` can't be imported in node environment
VeskeR Mar 15, 2024
779516b
Merge pull request #1696 from ably/1546/fix-attw-for-node
VeskeR Mar 18, 2024
606fd92
Fix stray second arg to modular constructor
lawrence-forooghian Mar 18, 2024
673aa5b
Improve errors for incorrect constructor args
lawrence-forooghian Mar 18, 2024
92e8a92
Merge pull request #1701 from ably/fix-stray-modules-arg
lawrence-forooghian Mar 19, 2024
48883e1
Merge pull request #1702 from ably/initialize-client-without-options
lawrence-forooghian Mar 19, 2024
36946a4
refactor: use TransportName type for `Transport.name`
owenpearson Feb 27, 2024
bee9f1c
refactor: normalise tranpsort interface, remove initialiser functions
owenpearson Feb 27, 2024
000134f
refactor!: remove XhrStreaming transport
owenpearson Feb 27, 2024
b54bcf5
feat: replace upgrade with websocket+base mechanism
owenpearson Feb 27, 2024
af0f3f1
Merge pull request #1645 from ably/no-upgrade-v2
owenpearson Mar 19, 2024
12131f9
build: use esbuild for nodejs bundle
owenpearson Mar 13, 2024
f94d587
build: catch esbuild errors for web builds
owenpearson Mar 13, 2024
7f67f68
build: use module.exports for node
owenpearson Mar 20, 2024
bb31bd1
Remove some lingering `any` from `stats()` param type
lawrence-forooghian Mar 20, 2024
54487f7
Use `useLayoutEffect` when calling `.setOptions()` in `ChannelProvider`
VeskeR Mar 20, 2024
cce80b1
Merge pull request #1691 from ably/esbuild-node
owenpearson Mar 20, 2024
2e12459
Merge pull request #1705 from ably/fix-missed-in-remove-any-from-stat…
lawrence-forooghian Mar 20, 2024
7778ea0
Add missed file to format:check
lawrence-forooghian Mar 7, 2024
1916b4c
Format all the Markdown in docs/
lawrence-forooghian Mar 7, 2024
9ee5681
Introduce directory structure for migration guides
lawrence-forooghian Mar 20, 2024
5356141
Update documentation for `request()`’s version param
lawrence-forooghian Mar 20, 2024
b44e629
Add migration guide for v2
lawrence-forooghian Mar 7, 2024
deea2b3
Merge pull request #1670 from ably/ECO-1416-v2-migration-guide
lawrence-forooghian Mar 21, 2024
b8d318a
Merge remote-tracking branch 'origin/main' into 2024-03-21-merge-main…
lawrence-forooghian Mar 21, 2024
33fa81f
Merge pull request #1707 from ably/2024-03-21-merge-main-into-v2
lawrence-forooghian Mar 21, 2024
8ddc3ac
Add migration guide for react hooks for ably-js v2
VeskeR Mar 15, 2024
679e495
Fix incorrect repo version in react hooks migration guide
VeskeR Mar 20, 2024
454d1c5
Merge pull request #1698 from ably/1684/react-hooks-v2-migration-guide
VeskeR Mar 21, 2024
c02ec56
Merge pull request #1706 from ably/1704/fix-react-hooks-double-attach
VeskeR Mar 21, 2024
7e13b2f
chore: update changelog for 2.0.0 release
VeskeR Mar 1, 2024
1a4dc28
Merge pull request #1656 from ably/1604/v2-changelog
VeskeR Mar 21, 2024
af74cf6
Merge branch 'main' into 2024-03-21-merge-main-into-v2
VeskeR Mar 21, 2024
60615e3
Merge pull request #1710 from ably/2024-03-21-merge-main-into-v2
VeskeR Mar 21, 2024
b84c64c
chore: bump version for 2.0.0 release
VeskeR Mar 21, 2024
2fed96b
Update date in changelog
VeskeR Mar 22, 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
12 changes: 7 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ module.exports = {
"plugin:security/recommended",
],
rules: {
// comma-dangle used for browser compatibility for browsers that don't support trailing commas
"comma-dangle": ["error", "always-multiline"],
"eol-last": "error",
// security/detect-object-injection just gives a lot of false positives
// see https://github.com/nodesecurity/eslint-plugin-security/issues/21
"security/detect-object-injection": "off",
"@typescript-eslint/no-var-requires": "error",
// Use typescript-eslint’s version of the no-redeclare rule, which isn’t triggered by overload signatures.
// TODO remove this once we start using the full @typescript-eslint/recommended ruleset in #958
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
},
overrides: [
{
files: ["**/*.{ts,tsx}"],
rules: {
"comma-dangle": ["error", "only-multiline"],
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
// TypeScript already enforces these rules better than any eslint setup can
"no-undef": "off",
Expand All @@ -40,7 +41,7 @@ module.exports = {
},
},
{
files: 'ably.d.ts',
files: ['ably.d.ts', 'modular.d.ts'],
extends: [
'plugin:jsdoc/recommended',
],
Expand All @@ -54,9 +55,10 @@ module.exports = {
"test",
"tools",
"scripts",
"docs",
"typedoc/generated",
"react",
"Gruntfile.js",
"grunt",
],
settings: {
jsdoc: {
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/bundle-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ jobs:
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Use Node.js 14.x
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
- run: npm ci
- name: Build bundle reports
run: |
mkdir bundle-reports
npm run sourcemap -- --html bundle-reports/index.html
npm run sourcemap:noencryption -- --html bundle-reports/noencryption.html
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: eu-west-2
Expand All @@ -37,3 +36,5 @@ jobs:
sourcePath: bundle-reports
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: bundle-report
# This step performs some validation and may fail, so it should come after the steps that we want to always execute.
- run: npm run modulereport
12 changes: 7 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ jobs:
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Use Node.js 14.x
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm run check-closure-compiler
- run: npx tsc --noEmit ably.d.ts build/ably-webworker.min.d.ts
- run: npx tsc --noEmit ably.d.ts modular.d.ts
# for some reason, this doesn't work in CI using `npx attw --pack .`
- run: npm pack
- run: npx attw ably-$(node -e "console.log(require('./package.json').version)").tgz --summary
- run: npx attw ably-$(node -e "console.log(require('./package.json').version)").tgz --summary --exclude-entrypoints 'ably/modular'
# see https://github.com/ably/ably-js/issues/1546 for why we ignore 'false-cjs' currently.
# should remove when switched to auto-generated type declaration files for modular variant of the library.
- run: npx attw ably-$(node -e "console.log(require('./package.json').version)").tgz --summary --entrypoints 'ably/modular' --ignore-rules false-cjs
- run: npm audit --production
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x

- name: Install Package Dependencies
run: npm ci
Expand All @@ -37,6 +37,6 @@ jobs:
- name: Upload Documentation
uses: ably/sdk-upload-action@v1
with:
sourcePath: docs/generated
sourcePath: typedoc/generated
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: typedoc
4 changes: 2 additions & 2 deletions .github/workflows/publish-cdn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
aws-region: us-east-1
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/prod-ably-sdk-cdn
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"
- name: Use Node.js 14.x
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 20.x
- run: npm ci
- run: node scripts/cdn_deploy.js --skipCheckout --tag=${{ github.event.inputs.version }}
3 changes: 1 addition & 2 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 20
- run: npm ci
- run: npm run format:check
- run: npm run test:react
4 changes: 2 additions & 2 deletions .github/workflows/test-browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- name: Use Node.js 16.x
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 20.x
- run: npm ci
- name: Install Playwright browsers and dependencies
run: npx playwright install --with-deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v2
with:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Test NPM package
on:
pull_request:
push:
branches:
- main

jobs:
test-npm-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Use Node.js 20.x
uses: actions/setup-node@v1
with:
node-version: 20.x
- run: npm ci
- run: npm run test:package
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ npm-debug.log
.tool-versions
build/
react/
docs/generated/
typedoc/generated/
junit/
test/support/mocha_junit_reporter/build/
19 changes: 19 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const config = {
require: ['source-map-support/register', 'test/support/modules_helper.js', 'test/support/test_helper.js'],
file: ['test/support/root_hooks.js'],
reporter: 'test/support/mocha_reporter.js',
};

// mocha has a ridiculous issue (https://github.com/mochajs/mocha/issues/4100) that command line
// specs don't override config specs; they are merged instead, so you can't run a single test file
// if you've defined specs in your config. therefore we work around it by only adding specs to the
// config if none are passed as arguments
if (!process.argv.slice(2).some(isTestFile)) {
config.spec = ['test/realtime/*.test.js', 'test/rest/*.test.js'];
}

function isTestFile(arg) {
return arg.match(/\.test.js$/);
}

module.exports = config;
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"trailingComma": "es5",
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
Expand Down
86 changes: 86 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,92 @@

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

## [2.0.0](https://github.com/ably/ably-js/tree/2.0.0) (2024-03-22)

The 2.0.0 release introduces a number of new features and QoL improvements, including a new way to remove bloat and reduce the bundle size of your ably-js client, first-class support for Promises, a more idiomatic approach to using ably-js' React Hooks, enhancements to TypeScript typings, and more.

Below is an overview of the major changes in this release.

Please refer to the ably-js v2 [lib migration guide](./docs/migration-guides/v2/lib.md) and [React Hooks migration guide](./docs/migration-guides/v2/react-hooks.md) for the full details, including a list of all breaking changes and instructions on how to address them.

### Bundle Size Reduction

The default bundle size for the web has been reduced by ~32% compared to v1 - from 234.11 KiB to 159.32 KiB. When calculated with gzip compression, the reduction is ~30%, from 82.54 KiB to 57.9 KiB.

Additionally, by utilizing the new modular variant of the library (see below) and JavaScript tree shaking, you can create your own minimal useful `Realtime` client and achieve a bundle size reduction of ~60.5% compared to v1 - from 234.11 KiB to 92.38 KiB (or ~66% for gzip: from 82.54 KiB to 28.18 KiB).

### Modular variant of the library

An ESM variant of the library is now available for browsers (but not for Node.js) via import from `ably/modular`. This modular variant of the library supports tree shaking, allowing for a reduction in the Ably bundle size within your application and improving the user experience. It can also be used by Web Workers.

### React Hooks changes

React Hooks, exported at `ably/react`, now require the new `ChannelProvider` component to define the channels you wish to use and the options for them. This addresses the complexities previously encountered with `useChannel` and `usePresence` hooks when attempting to dynamically change options for a channel and provides a more straightforward approach to set and manage these options.

The functionality of the `usePresence` hook has been split into two separate hooks: `usePresence`, which is now used only to enter presence, and `usePresenceListener`, which is used to listen for presence updates. These new hooks offer better control over the desired presence behavior in your React components.

### First-class support for Promises

The callbacks API has been entirely removed, and the library now supports promises for all its asynchronous operations by default.

### TypeScript typings

The Types namespace has been removed. All types it contained are now exported at the top level.

### Browser and Web Worker bundles

- The browser bundle now relies on the native Web Crypto API instead of CryptoJS. The `ably/build/ably.noencryption` bundle has been removed, as it is no longer necessary.
- The browser bundle can now be directly used by Web Workers. The `ably/build/ably-webworker` bundle has been removed, as it is no longer necessary.

### Supported platforms changes

- Support for Internet Explorer has been dropped.
- Support for Node.js versions lower than 16 has been dropped. The supported Node.js versions are now 16, 18, and 20.
- The minimum supported versions for major browsers are: Chrome 58, Firefox 52, Edge 79, Safari 11, and Opera 45.

<details>
<summary><b>View merged Pull Requests</b></summary>

### Breaking Changes

- Add `ChannelProvider` component to React Hooks [\#1620](https://github.com/ably/ably-js/pull/1620), [\#1654](https://github.com/ably/ably-js/pull/1654)
- Add untyped stats API [\#1522](https://github.com/ably/ably-js/pull/1522)
- Add type definitions for key returned by `generateRandomKey` [\#1320](https://github.com/ably/ably-js/pull/1320)
- Add mandatory `version` param to `Rest.request` [\#1231](https://github.com/ably/ably-js/pull/1231)
- Change `id` field to be named `ablyId` in React Hooks [\#1676](https://github.com/ably/ably-js/pull/1676)
- Change `usePresence` hook to two different hooks: for entering presence and subscribing to presence updates [\#1674](https://github.com/ably/ably-js/pull/1674)
- Change naming for enum-like namespaces in type declarations and change meaning for public `ChannelModes` type [\#1601](https://github.com/ably/ably-js/pull/1601)
- Change publishing methods to accept a `Message`-shaped object [\#1515](https://github.com/ably/ably-js/pull/1515)
- Change `Crypto.generateRandomKey` API to use Promises [\#1351](https://github.com/ably/ably-js/pull/1351)
- Change `fromEncoded()` and `fromEncodedArray()` methods on `Message` and `PresenceMessage` to be async [\#1311](https://github.com/ably/ably-js/pull/1311)
- Remove `XHRStreaming` transport support [\#1645](https://github.com/ably/ably-js/pull/1645)
- Remove code that's supporting older platforms [\#1629](https://github.com/ably/ably-js/pull/1629), [\#1633](https://github.com/ably/ably-js/pull/1633), [\#1641](https://github.com/ably/ably-js/pull/1641)
- Remove `recoveryKey` in favour of `createRecoveryKey()` on `Connection` [\#1613](https://github.com/ably/ably-js/pull/1613)
- Remove `any` from `stats()` param type [\#1561](https://github.com/ably/ably-js/pull/1561)
- Remove the dedicated Web Worker bundle `ably/build/ably-webworker` and add support for using `ably` and `ably/modular` in Web Workers [\#1550](https://github.com/ably/ably-js/pull/1550)
- Remove false class exports in type declarations [\#1524](https://github.com/ably/ably-js/pull/1524)
- Remove the `Types` namespace [\#1518](https://github.com/ably/ably-js/pull/1518)
- Remove `noencryption` variant of the library [\#1500](https://github.com/ably/ably-js/pull/1500)
- Remove public callbacks API [\#1358](https://github.com/ably/ably-js/pull/1358)
- Remove CryptoJS library and replace it with the Web Crypto API in web bundle [\#1299](https://github.com/ably/ably-js/pull/1299), [\#1325](https://github.com/ably/ably-js/pull/1325), [\#1333](https://github.com/ably/ably-js/pull/1333)
- Remove `ably-commonjs*.js` files [\#1229](https://github.com/ably/ably-js/pull/1229)
- Remove deprecated APIs [\#1227](https://github.com/ably/ably-js/pull/1227)
- Remove deprecated `fromEncoded*` type declarations [\#1222](https://github.com/ably/ably-js/pull/1222)
- Remove deprecated `ClientOptions` parameters [\#1221](https://github.com/ably/ably-js/pull/1221)
- Remove the `ClientOptions.log` property and replace it with separate `logLevel` and `logHandler` properties [\#1216](https://github.com/ably/ably-js/pull/1216)
- Remove support for JSONP [\#1215](https://github.com/ably/ably-js/pull/1215)
- Fix `whenState` inconsistent behavior in `Connection` and `RealtimeChannel` [\#1640](https://github.com/ably/ably-js/pull/1640)
- Fix the type definition of `Crypto.getDefaultParams` [\#1352](https://github.com/ably/ably-js/pull/1352)

### Features

- Add `publish` function to the `useChannel` hook [\#1658](https://github.com/ably/ably-js/pull/1658)
- Add logs to all HTTP activity [\#1581](https://github.com/ably/ably-js/pull/1581)

</details>

[Full Changelog](https://github.com/ably/ably-js/compare/1.2.50...2.0.0)

## [1.2.50](https://github.com/ably/ably-js/tree/1.2.50) (2024-03-21)

- Add new logging API to `ClientOptions` and add a deprecation warning for the old one [\#1671](https://github.com/ably/ably-js/pull/1671)
Expand Down
19 changes: 9 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
4. Commit your changes (`git commit -am 'Add some feature'`)
5. Ensure you have added suitable tests and the test suite is passing(`npm test`)
6. Ensure the [type definitions](https://github.com/ably/ably-js/blob/main/ably.d.ts) have been updated if the public API has changed
7. Ensure you stick to the version of JS used by the library (currently ES5). (The minfication task (`npm run grunt -- closureCompiler:ably.js`) will enforce that you stick to ES5 syntax, but will not enforce that you don't use, for example, new methods)
8. Push the branch (`git push origin my-new-feature`)
9. Create a new Pull Request
7. Push the branch (`git push origin my-new-feature`)
8. Create a new Pull Request

## Release Process

Expand All @@ -30,7 +29,7 @@

## Building the library

To build the library, simply run `npm run build`. Building the library currently requires NodeJS <= v16.
To build the library, simply run `npm run build`. Building the library currently requires NodeJS >= v16.

Since webpack builds are slow, commands are also available to only build the output for specific platforms (eg `npm run build:node`), see [package.json](./package.json) for the full list of available commands

Expand All @@ -46,27 +45,27 @@ Run the Mocha test suite

npm run test:node

Or run just one test file
You can pass any Mocha CLI arguments and flags to the test:node script after the `--` separator, for example running one test file:

npm run test:node -- --file=test/realtime/auth.test.js
npm run test:node -- test/realtime/auth.test.js

Or run just one test

npm run test:node -- --file=test/rest/status.test.js --grep=test_name_here
npm run test:node -- --grep=test_name_here

Or run test skipping the build

npm run test:node:skip-build -- --file=test/rest/status.test.js --grep=test_name_here
npm run test:node:skip-build -- test/rest/status.test.js --grep=test_name_here

### Debugging the mocha tests locally with a debugger

Run the following command to launch tests with the debugger enabled. The tests will block until you attach a debugger.

node --inspect-brk=9229 node_modules/.bin/grunt test:node
node --inspect-brk=9229 node_modules/.bin/mocha

Alternatively you can also run the tests for single file

node --inspect-brk=9229 node_modules/.bin/grunt test:node --test=test/realtime/auth.test.js
node --inspect-brk=9229 node_modules/.bin/mocha test/realtime/auth.test.js

The included vscode launch config allows you to launch and attach the debugger in one step, simply open the test
file you want to run and start debugging. Note that breakpoint setting for realtime code will be within the
Expand Down
Loading
Loading