Repository navigation
Description
Summary
Dart enum names should be singular, since the type names one value rather than the set. Most of this repository already follows that: of 51 distinct enums, only a handful are plural, and all of them are ports of realtime-js / gotrue-js names rather than deliberate choices.
#1404 fixed the first one (SocketStates → SocketState) because it was in the way of that PR. This issue covers the rest.
The remaining plural enums
| Enum | Location | Exported? | Breaking? |
|---|---|---|---|
ChannelStates |
realtime_client/lib/src/constants.dart:46 |
No | No |
ChannelEvents |
realtime_client/lib/src/constants.dart:48 |
No | No |
RealtimeListenTypes |
realtime_client/lib/src/types.dart:116 |
No, explicitly hiden |
No |
PostgresTypes |
realtime_client/lib/src/transformers.dart:8 |
Yes | Yes |
Only PostgresTypes is reachable by consumers, so only it actually needs to wait for v3. The other three are already unreachable:
ChannelStatesis omitted from theshowlist on thesrc/constants.dartexport. It only ever appears as the privateRealtimeChannel._statefield, surfaced through theisClosed/isErrored/isJoined/isJoining/isLeavinggetters, so it never appears in a public signature.ChannelEventsis likewise omitted from thatshowlist. Its only signature use is@internal Push push(...).RealtimeListenTypesis named in thehideclause on thesrc/types.dartexport. Its only signature use is@internal Future<ChannelResponse> send(...).
Two extensions should be renamed alongside their enums: ChannelEventsExtended and ToType (on RealtimeListenTypes).
Proposed change
ChannelStates→ChannelStateChannelEvents→ChannelEventRealtimeListenTypes→RealtimeListenTypePostgresTypes→PostgresType
None of the enum values change, and no behaviour changes. ChannelEvents.eventName() keeps producing the same phx_* wire strings.
Because the first three are already internal, they can land before v3. PostgresTypes is the only one that needs the major version.
Capability matrix
None of the four are currently registered in sdk-compliance.yaml, and the symbol extractor picks up all four today, so a rename will trip the Check public API against capability matrix job the same way #1404 did.
The extractor skips @internal declarations (verified: RealtimeClient.disconnectOnEmptyChannelsAfter and RealtimeChannel.send are both absent from its output). So for the three internal enums, adding @internal is both the accurate annotation and enough to keep them out of the matrix. PostgresType is genuinely public and should be registered under the appropriate realtime.* feature.
Also plural, outside this scope
AuthenticatorAssuranceLevels(gotrue/lib/src/types/mfa.dart:354) has the same defect and is public: it types thecurrentLevelandnextLevelfields on the MFA types. Renaming it toAuthenticatorAssuranceLevelis breaking and would belong in v3 too. Left out of the table above because it is gotrue rather than realtime, but worth folding in if this is done as one sweep.SupabaseEventTypesis already@Deprecated, so it needs nothing beyond eventual removal.FactorStatus,RealtimeHeartbeatStatus, andRealtimeSubscribeStatusend insbut are singular ("status"), andLoadTableSnapshotsnames a set selection (all/refs) where the plural reads correctly. No change needed for any of these.
Activity
refactor(realtime)!: clean up connection naming on RealtimeClient (#1404
refactor!: singularize plural enum names and fold enum extensions in (#…