diff --git a/.github/workflows/conventional-commits-lint.js b/.github/workflows/conventional-commits-lint.js index aa9e56c2..d68fa636 100644 --- a/.github/workflows/conventional-commits-lint.js +++ b/.github/workflows/conventional-commits-lint.js @@ -16,6 +16,7 @@ const ALLOWED_CONVENTIONAL_COMMIT_PREFIXES = [ "chore", "style", "test", + "refactor", ]; const object = process.argv[2]; @@ -102,4 +103,4 @@ if (failed) { process.exit(1); } -process.exit(0); \ No newline at end of file +process.exit(0); diff --git a/Sources/PostgREST/PostgrestClient.swift b/Sources/PostgREST/PostgrestClient.swift index 4172c7fa..a2b52677 100644 --- a/Sources/PostgREST/PostgrestClient.swift +++ b/Sources/PostgREST/PostgrestClient.swift @@ -53,7 +53,7 @@ public final class PostgrestClient: Sendable { } } - let _configuration: LockIsolated + private let _configuration: LockIsolated public var configuration: Configuration { _configuration.value } /// Creates a PostgREST client with the specified configuration. diff --git a/Sources/Realtime/V2/CallbackManager.swift b/Sources/Realtime/V2/CallbackManager.swift index 33d5537a..22f67276 100644 --- a/Sources/Realtime/V2/CallbackManager.swift +++ b/Sources/Realtime/V2/CallbackManager.swift @@ -16,7 +16,15 @@ final class CallbackManager: @unchecked Sendable { var callbacks: [RealtimeCallback] = [] } - let mutableState = LockIsolated(MutableState()) + private let mutableState = LockIsolated(MutableState()) + + var serverChanges: [PostgresJoinConfig] { + mutableState.serverChanges + } + + var callbacks: [RealtimeCallback] { + mutableState.callbacks + } @discardableResult func addBroadcastCallback( diff --git a/Sources/Realtime/V2/WebSocketClient.swift b/Sources/Realtime/V2/WebSocketClient.swift index 435a35a6..331ef710 100644 --- a/Sources/Realtime/V2/WebSocketClient.swift +++ b/Sources/Realtime/V2/WebSocketClient.swift @@ -42,7 +42,7 @@ final class WebSocket: NSObject, URLSessionWebSocketDelegate, WebSocketClient, @ var stream: SocketStream? } - let mutableState = LockIsolated(MutableState()) + private let mutableState = LockIsolated(MutableState()) init(config: RealtimeClientV2.Configuration) { realtimeURL = config.realtimeWebSocketURL diff --git a/Sources/_Helpers/EventEmitter.swift b/Sources/_Helpers/EventEmitter.swift index c58dac1e..3e24c12b 100644 --- a/Sources/_Helpers/EventEmitter.swift +++ b/Sources/_Helpers/EventEmitter.swift @@ -30,7 +30,7 @@ public final class ObservationToken: Sendable { package final class EventEmitter: Sendable { public typealias Listener = @Sendable (Event) -> Void - let listeners = LockIsolated<[ObjectIdentifier: Listener]>([:]) + private let listeners = LockIsolated<[ObjectIdentifier: Listener]>([:]) public let lastEvent: LockIsolated let emitsLastEventWhenAttaching: Bool diff --git a/Tests/RealtimeTests/CallbackManagerTests.swift b/Tests/RealtimeTests/CallbackManagerTests.swift index cbd37607..8f399d87 100644 --- a/Tests/RealtimeTests/CallbackManagerTests.swift +++ b/Tests/RealtimeTests/CallbackManagerTests.swift @@ -36,14 +36,14 @@ final class CallbackManagerTests: XCTestCase { XCTAssertEqual(callbackManager.addPresenceCallback { _ in }, 3) - XCTAssertEqual(callbackManager.mutableState.value.callbacks.count, 3) + XCTAssertEqual(callbackManager.callbacks.count, 3) callbackManager.removeCallback(id: 2) callbackManager.removeCallback(id: 3) - XCTAssertEqual(callbackManager.mutableState.value.callbacks.count, 1) + XCTAssertEqual(callbackManager.callbacks.count, 1) XCTAssertFalse( - callbackManager.mutableState.value.callbacks + callbackManager.callbacks .contains(where: { $0.id == 2 || $0.id == 3 }) ) } @@ -62,7 +62,7 @@ final class CallbackManagerTests: XCTestCase { callbackManager.setServerChanges(changes: changes) - XCTAssertEqual(callbackManager.mutableState.value.serverChanges, changes) + XCTAssertEqual(callbackManager.serverChanges, changes) } func testTriggerPostgresChanges() {