There we go, the big rebrand. The big cleanup. Some nice features that have been wanted by a good amount of people too. Like always, here's a list of all significant changes in comparison to version 4.6.7.
Breaking changes
I know these are a lot and the list is very technical. I have also written up a migration guide which is much easier to follow when migrating from Twitch.js 4.x to Twurple 5.0.
- [all] rename all packages - they're now all in the
@twurple/*
npm org - [webhooks] removed package - please migrate to EventSub (1826ab9)
- [webhooks-ngrok] removed package - please migrate to EventSub (1826ab9)
- [api] completely remove
ApiClient#kraken
- please migrate to Helix (8642d51) - [all] remove default exports - use named exports instead (2c659a5, #152)
- [all] transpile to es2019 rather than es5 (6ce0385)
- [all] remove wrongly capitalized aliases
productSKU
,averageFPS
,callAPI
,addVIP
,removeVIP
,getVIPs
,redirectURI
- use their camel cased versions instead (c6d1216, #153) - [all] remove
logLevel
config options - uselogger.minLevel
instead - [all] replace enums with type-only string unions (dbee525, #239)
- [all] remove a few legacy uses of passing single array values as non-arrays (4ed2aa4, #244)
- [auth] make
AuthProvider#tokenType
required (c824b88) - [auth] refactor
AccessToken
to an interface (46772bf) - [auth] replace
RefreshableAuthProvider
withRefreshingAuthProvider
(not a wrapper) (c1755b6, #235) - [auth] add null to TokenInfo#userId and TokenInfo#userName types (da7b9dc, #241)
- [auth] remove legacy compatibility methods (dbbc18b)
- [api] remove all follow write actions following the Twitch deprecation (494d8d9)
- [api] remove
ApiClient.withCredentials
,ApiClient.withClientCredentials
,ApiClient.callApi
,ApiClient.getAccessToken
,ApiClient.getAppAccessToken
,ApiClient.refreshAccessToken
,ApiClient.getTokenInfo
(02ba84d, #154) - [api] remove
ApiClient#getAccessToken
,ApiClient#currentScopes
andApiClient#refresh
- use the respective properties and methods directly on the underlyingAuthProvider
instead (dbbc18b) - [api] remove
ApiClient#tokenType
andApiClient#clientId
- use the respective properties directly on the underlyingAuthProvider
instead (3cb05ab) - [api] remove
ApiConfig#cheermotes
andApiClient#cheermoteDefaults
-HelixCheermoteList#getCheermoteDisplayInfo
now needs a full cheermote format object (dbbc18b) - [api] remove
ApiConfig#preAuth
andApiConfig#initialScopes
- useApiClient#requestScopes
instead (dbbc18b) - [api] remove
TwitchApiCallOptions#version
- no replacement, Kraken is gone now (dbbc18b) - [api] remove
TeamWithUsers#getUsers
- useTeamWithUsers#users
instead (dbbc18b) - [api] remove typo'd
HelixCustomReward#propmt
in favor ofprompt
(be4b8d2) - [api] change limit parameter type to number (2630fd2, #234)
- [api] erase null from a lot of shortcut methods' return types (ced061b, #243)
- [api] change default return value of ApiClient#callApi and callTwitchApi from any to unknown (f9126ec)
- [chat] always apply rate limits (b3dd2a1)
- [chat] remove
ChatClient.forTwitchClient
- use theChatClient
constructor instead (dbbc18b) - [chat] remove
ChatClient#waitForRegistration
- use theChatClient#onRegister
event instead (dbbc18b) - [chat] don't throw on join errors from config anymore; listen to the new
ChatClient#onJoinFailure
event instead (8465bdf, #254) - [pubsub] remove methods that depended on an
ApiClient
(getUser
,getChannel
,getSender
) (02ba84d, #154) - [pubsub] change
PubSubClient#registerUserListener
to take anAuthProvider
instead of anApiClient
(02ba84d, #154) - [pubsub] change
SingleUserPubSubClient
constructor to take a new property namedauthProvider
instead oftwitchClient
(see above) (02ba84d, #154) - [eventsub] remove
MiddlewareAdapter
,EventSubListener#applyMiddleware
(useEventSubMiddleware
instead) (c914a61) - [eventsub] middleware now only works with Express (02b3e01)
- [eventsub] change eventsub event path, might require a cleanup of existing events (02b3e01)
- [eventsub, chat] harmonize EventSub and ChatClient option passing to configuration objects (3542b24)
- [eventsub] disallow copying the example secret from the docs (8ba4665)
- [auth-electron] require at least Electron ^9 (62d3869)
- [common] split ChatEmote by whether we know the set ID (62f5755)
Deprecations
- [api]
ApiClient#helix
(use the contained namespaces directly on theApiClient
instance instead, e.g.apiClient.users
) (c16f970)
Features
- [all] provide access to internal data (d270955, #233)
- [all] add better logger configurability through env vars and custom logger passthrough (6e4c90d, #205, #240)
- [api] add oauth-compatible helix extensions endpoints (0f98ae6, #164)
- [api] add pagination params in all missing places (f3f2f9c, #238)
- [api] add helix api namespaces directly to
ApiClient
(c16f970) - [chat] add
ChatClient#onJoinFailure
event (8465bdf, #254) - [chat] add
onPasswordError
event to chat () - [pubsub] add
PubSubClient#onCustomTopic
for arbitrary topics (6002bfb, #229) - [eventsub] add health resource at root (02b3e01)
- [eventsub] add
onVerify
event to EventSub classes (2d9452e, #257) - [eventsub] add revocation handling and
onRevoke
event (d184f22) - [eventsub] add wrapper to hype train contributions (8ff0d06)
- [eventsub, api] add helpers for getting the reward & updating the status of redemptions (5176e80)
Fixes
- [api] fix HelixClipApi methods not passing pagination parameters (5ff33ac)
- [api, eventsub] support emotes v2 (2fa2c82, #275)
- [api] rename HelixSubscription#giftName to gifterDisplayName and fix its value (ef50f10)
- [api] don't parse strange error responses as JSON (80a76f5)
Improvements
- [all] use
return await
for better async stack traces (d934f11) - [api] override logger name for api rate limiter (8a8bcab)
- [api-call] remove query prefix from calls that don't have a query string (86b536a)
- [chat, pubsub] throw early on app token usage where user tokens are expected (3639fae)
- [eventsub] throw error on invalid host names (4a9b0c6)
- [eventsub] add duplicate ID and timestamp checks (4a651e0)