diff --git a/Amplify/Categories/DataStore/Model/ModelIdentifiable.swift b/Amplify/Categories/DataStore/Model/ModelIdentifiable.swift index 9946e0878a..e5ecebe2f2 100644 --- a/Amplify/Categories/DataStore/Model/ModelIdentifiable.swift +++ b/Amplify/Categories/DataStore/Model/ModelIdentifiable.swift @@ -121,7 +121,7 @@ public extension DefaultModelIdentifier { // MARK: - Persistable + stringValue private extension Persistable { var stringValue: String { - var value: String = switch self { + let value: String = switch self { case let self as Temporal.Date: self.iso8601String diff --git a/Amplify/Core/Support/ChildTask.swift b/Amplify/Core/Support/ChildTask.swift index e83022094c..490d49e9ea 100644 --- a/Amplify/Core/Support/ChildTask.swift +++ b/Amplify/Core/Support/ChildTask.swift @@ -35,25 +35,28 @@ actor ChildTask: BufferingSequence { var value: Success { get async throws { - try await withTaskCancellationHandler(handler: { - Task { - await cancel() - } - }, operation: { - try await withCheckedThrowingContinuation { continuation in - if isCancelled { - // immediately cancel is already cancelled - continuation.resume(throwing: CancellationError()) - } else if let result = storedResult { - // immediately send result if it is available - valueContinuations.append(continuation) - send(result) - } else { - // capture contination to use later - valueContinuations.append(continuation) + try await withTaskCancellationHandler( + operation: { + try await withCheckedThrowingContinuation { continuation in + if isCancelled { + // immediately cancel is already cancelled + continuation.resume(throwing: CancellationError()) + } else if let result = storedResult { + // immediately send result if it is available + valueContinuations.append(continuation) + send(result) + } else { + // capture contination to use later + valueContinuations.append(continuation) + } + } + }, + onCancel: { + Task { + await cancel() } } - }) + ) } } diff --git a/Amplify/DevMenu/Trigger/LongPressGestureRecognizer.swift b/Amplify/DevMenu/Trigger/LongPressGestureRecognizer.swift index 8e373b81c0..38c62c8ffa 100644 --- a/Amplify/DevMenu/Trigger/LongPressGestureRecognizer.swift +++ b/Amplify/DevMenu/Trigger/LongPressGestureRecognizer.swift @@ -10,7 +10,7 @@ import Foundation import UIKit /// A class for recognizing long press gesture which notifies a `TriggerDelegate` of the event -class LongPressGestureRecognizer: NSObject, @preconcurrency TriggerRecognizer, UIGestureRecognizerDelegate { +class LongPressGestureRecognizer: NSObject, TriggerRecognizer, UIGestureRecognizerDelegate { weak var triggerDelegate: TriggerDelegate? weak var uiWindow: UIWindow? diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift index 0d14167c70..dbd2685d12 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift @@ -58,7 +58,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } Task { try await Task.sleep(nanoseconds: 80 * 1_000) - await appSyncClient.subject.send(.success(.init(id: nil, payload: nil, type: .connectionAck))) + appSyncClient.subject.send(.success(.init(id: nil, payload: nil, type: .connectionAck))) } await fulfillment(of: [finishExpectation], timeout: timeout + 1) } @@ -90,7 +90,7 @@ class AppSyncRealTimeClientTests: XCTestCase { } Task { try await Task.sleep(nanoseconds: 80 * 1_000) - await appSyncClient.subject.send(.success(.init( + appSyncClient.subject.send(.success(.init( id: id, payload: .object([ "errors": .array([ @@ -133,7 +133,7 @@ class AppSyncRealTimeClientTests: XCTestCase { Task { try await Task.sleep(nanoseconds: 80 * 1_000) - await appSyncClient.subject.send(.success(.init( + appSyncClient.subject.send(.success(.init( id: id, payload: .object([ "errors": .array([ @@ -180,7 +180,7 @@ class AppSyncRealTimeClientTests: XCTestCase { Task { try await Task.sleep(nanoseconds: 80 * 1_000) - await appSyncClient.subject.send(.success(.init( + appSyncClient.subject.send(.success(.init( id: id, payload: .object([ "errors": .array([ diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+AppSyncSigner.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+AppSyncSigner.swift index 737b31ad57..0b4eeb9255 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+AppSyncSigner.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+AppSyncSigner.swift @@ -111,7 +111,7 @@ extension AWSCognitoAuthPlugin { return nil } - var headers = urlRequest.allHTTPHeaderFields ?? [:] + let headers = urlRequest.allHTTPHeaderFields ?? [:] let httpMethod = (urlRequest.httpMethod?.uppercased()) .flatMap(HTTPMethodType.init(rawValue:)) ?? .get diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthorizationConfiguration.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthorizationConfiguration.swift index 20aacc9ac6..125cf90c21 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthorizationConfiguration.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthorizationConfiguration.swift @@ -19,7 +19,7 @@ struct InitializeAuthorizationConfiguration: Action { ) async { // ATM this is a no-op action logVerbose("\(#fileID) Starting execution", environment: environment) - var event = switch storedCredentials { + let event = switch storedCredentials { case .noCredentials: AuthorizationEvent(eventType: .configure) default: diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/FetchAuthorizationSession/InformSessionError.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/FetchAuthorizationSession/InformSessionError.swift index a4ff138435..ebf8b7a72f 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/FetchAuthorizationSession/InformSessionError.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/FetchAuthorizationSession/InformSessionError.swift @@ -19,7 +19,7 @@ struct InformSessionError: Action { func execute(withDispatcher dispatcher: EventDispatcher, environment: Environment) async { logVerbose("\(#fileID) Starting execution", environment: environment) - var event: AuthorizationEvent = switch error { + let event: AuthorizationEvent = switch error { case .service(let serviceError): if isNotAuthorizedError(serviceError) { .init(eventType: .throwError( diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthChallengeType.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthChallengeType.swift index 01244d5e77..709cee0006 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthChallengeType.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthChallengeType.swift @@ -34,7 +34,7 @@ enum AuthChallengeType { } -extension CognitoIdentityProviderClientTypes.ChallengeNameType: Codable { +extension CognitoIdentityProviderClientTypes.ChallengeNameType: @retroactive Decodable, @retroactive Encodable { var authChallengeType: AuthChallengeType { switch self { case .customChallenge: diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/Helpers/FetchAuthSessionOperationHelper.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/Helpers/FetchAuthSessionOperationHelper.swift index 6d4f8a0ace..c713b55e76 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/Helpers/FetchAuthSessionOperationHelper.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/Helpers/FetchAuthSessionOperationHelper.swift @@ -75,7 +75,7 @@ class FetchAuthSessionOperationHelper { ) async throws -> AuthSession { if forceRefresh || !credentials.areValid() { - var event = switch credentials { + let event = switch credentials { case .identityPoolWithFederation(let federatedToken, let identityId, _): AuthorizationEvent(eventType: .startFederationToIdentityPool(federatedToken, identityId)) case .noCredentials: diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Service/ErrorMapping/AuthErrorConvertible.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Service/ErrorMapping/AuthErrorConvertible.swift index 507903c9af..6221452a2f 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Service/ErrorMapping/AuthErrorConvertible.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Service/ErrorMapping/AuthErrorConvertible.swift @@ -19,5 +19,3 @@ extension AuthError: AuthErrorConvertible { return self } } - -extension AuthError: @unchecked Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/UserTasks/AWSAuthAttributeResendConfirmationCodeTask.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/UserTasks/AWSAuthAttributeResendConfirmationCodeTask.swift index cfe2a2dac7..a420bdcb37 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/UserTasks/AWSAuthAttributeResendConfirmationCodeTask.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/UserTasks/AWSAuthAttributeResendConfirmationCodeTask.swift @@ -48,7 +48,7 @@ class AWSAuthAttributeResendConfirmationCodeTask: AuthAttributeResendConfirmatio func initiateGettingVerificationCode(with accessToken: String) async throws -> AuthCodeDeliveryDetails { let userPoolService = try userPoolFactory() - let clientMetaData = (request.options.pluginOptions as? AWSAttributeResendConfirmationCodeOptions)?.metadata ?? [:] + let clientMetaData = (request.options.pluginOptions as? AWSSendUserAttributeVerificationCodeOptions)?.metadata ?? [:] let input = GetUserAttributeVerificationCodeInput( accessToken: accessToken, diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift index c99c757636..896ccdf63b 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift @@ -549,8 +549,6 @@ class AWSAuthFederationToIdentityPoolTests: BaseAuthorizationTests { XCTFail("Should throw Auth Error with invalid state \(error)") return } - } catch { - XCTFail("Should throw Auth Error \(error)") } } catch { @@ -633,8 +631,6 @@ class AWSAuthFederationToIdentityPoolTests: BaseAuthorizationTests { XCTFail("Should throw Auth Error with invalid state \(error)") return } - } catch { - XCTFail("Should throw Auth Error \(error)") } } catch { XCTFail("Received failure with error \(error)") @@ -730,8 +726,6 @@ class AWSAuthFederationToIdentityPoolTests: BaseAuthorizationTests { XCTFail("Should throw Auth Error with invalid state \(error)") return } - } catch { - XCTFail("Should throw Auth Error \(error)") } } catch { XCTFail("Received failure with error \(error)") diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ChangePasswordInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ChangePasswordInput+Codable.swift index 549981032a..5a1eb55326 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ChangePasswordInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ChangePasswordInput+Codable.swift @@ -9,7 +9,7 @@ import AWSCognitoIdentityProvider import ClientRuntime // Already conforms to encodable -extension ChangePasswordInput: Decodable { +extension ChangePasswordInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case accessToken = "AccessToken" diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ConfirmDeviceInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ConfirmDeviceInput+Codable.swift index ee926761e5..191b317016 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ConfirmDeviceInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ConfirmDeviceInput+Codable.swift @@ -9,7 +9,7 @@ import AWSCognitoIdentity import AWSCognitoIdentityProvider import ClientRuntime -extension ConfirmDeviceInput: Decodable { +extension ConfirmDeviceInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case accessToken case deviceKey diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/DeleteUserInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/DeleteUserInput+Codable.swift index 2eb24fd7ea..4c19ebac09 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/DeleteUserInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/DeleteUserInput+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension DeleteUserInput: Decodable { +extension DeleteUserInput: @retroactive Decodable { public init(from decoder: Decoder) throws { self.init() diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ForgotPasswordInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ForgotPasswordInput+Codable.swift index 9eeca91844..37e329d7d5 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ForgotPasswordInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/ForgotPasswordInput+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension ForgotPasswordInput: Decodable { +extension ForgotPasswordInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case username case clientId diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetCredentialsForIdentityInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetCredentialsForIdentityInput+Codable.swift index d9eb4a09b6..83782cf1c5 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetCredentialsForIdentityInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetCredentialsForIdentityInput+Codable.swift @@ -9,7 +9,7 @@ import AWSCognitoIdentity import AWSCognitoIdentityProvider import ClientRuntime -extension GetCredentialsForIdentityInput: Decodable { +extension GetCredentialsForIdentityInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case logins case identityId diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetIdInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetIdInput+Codable.swift index 6dd40e1a95..b57d5d3485 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetIdInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GetIdInput+Codable.swift @@ -9,7 +9,7 @@ import AWSCognitoIdentity import AWSCognitoIdentityProvider import ClientRuntime -extension GetIdInput: Decodable { +extension GetIdInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case logins } diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GlobalSignOutInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GlobalSignOutInput+Codable.swift index dd2ab4fc15..e5820a9265 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GlobalSignOutInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/GlobalSignOutInput+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension GlobalSignOutInput: Decodable { +extension GlobalSignOutInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case accessToken } diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/InitiateAuthInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/InitiateAuthInput+Codable.swift index ac6413eb42..7cf79232fe 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/InitiateAuthInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/InitiateAuthInput+Codable.swift @@ -9,7 +9,7 @@ import AWSCognitoIdentity import AWSCognitoIdentityProvider import ClientRuntime -extension InitiateAuthInput: Decodable { +extension InitiateAuthInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case authFlow case authParameters @@ -32,4 +32,4 @@ extension InitiateAuthInput: Decodable { } } -extension CognitoIdentityProviderClientTypes.AuthFlowType: Decodable { } +extension CognitoIdentityProviderClientTypes.AuthFlowType: @retroactive Decodable { } diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RespondToAuthChallengeInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RespondToAuthChallengeInput+Codable.swift index e568cca58b..1b95666dad 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RespondToAuthChallengeInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RespondToAuthChallengeInput+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension RespondToAuthChallengeInput: Decodable { +extension RespondToAuthChallengeInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case clientId diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RevokeTokenInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RevokeTokenInput+Codable.swift index 5235a793db..974e774ded 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RevokeTokenInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/RevokeTokenInput+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension RevokeTokenInput: Decodable { +extension RevokeTokenInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case token case clientId diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/SignUpInput+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/SignUpInput+Codable.swift index 5a606ad18a..510773209e 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/SignUpInput+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Input/SignUpInput+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension SignUpInput: Decodable { +extension SignUpInput: @retroactive Decodable { enum CodingKeys: String, CodingKey { case username case password diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ChangePasswordOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ChangePasswordOutputResponse+Codable.swift index d4c2c0210f..563b05a26e 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ChangePasswordOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ChangePasswordOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import SmithyHTTPAPI -extension ChangePasswordOutput: Codable { +extension ChangePasswordOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: String, CodingKey { case httpResponse diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ConfirmDeviceOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ConfirmDeviceOutputResponse+Codable.swift index 618b596846..180351a180 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ConfirmDeviceOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ConfirmDeviceOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension ConfirmDeviceOutput: Codable { +extension ConfirmDeviceOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case userConfirmationNecessary = "UserConfirmationNecessary" diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/DeleteUserOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/DeleteUserOutputResponse+Codable.swift index f8ee9da2c6..98b2b6555e 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/DeleteUserOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/DeleteUserOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension DeleteUserOutput: Codable { +extension DeleteUserOutput: @retroactive Decodable, @retroactive Encodable { public init(from decoder: Swift.Decoder) throws { self.init() diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ForgotPasswordOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ForgotPasswordOutputResponse+Codable.swift index 0c35be603a..b956fc2e0a 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ForgotPasswordOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/ForgotPasswordOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension ForgotPasswordOutput: Codable { +extension ForgotPasswordOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case codeDeliveryDetails = "CodeDeliveryDetails" @@ -30,7 +30,7 @@ extension ForgotPasswordOutput: Codable { } -extension CognitoIdentityProviderClientTypes.CodeDeliveryDetailsType: Decodable { +extension CognitoIdentityProviderClientTypes.CodeDeliveryDetailsType: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case attributeName = "AttributeName" case deliveryMedium = "DeliveryMedium" @@ -50,4 +50,4 @@ extension CognitoIdentityProviderClientTypes.CodeDeliveryDetailsType: Decodable } } -extension CognitoIdentityProviderClientTypes.DeliveryMediumType: Decodable {} +extension CognitoIdentityProviderClientTypes.DeliveryMediumType: @retroactive Decodable {} diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift index aa0876ff71..b39268bb83 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetCredentialsForIdentityOutputResponse+Codable.swift @@ -9,7 +9,7 @@ import AWSCognitoIdentity import ClientRuntime import Foundation -extension GetCredentialsForIdentityOutput: Codable { +extension GetCredentialsForIdentityOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case credentials = "Credentials" case identityId = "IdentityId" @@ -29,7 +29,7 @@ extension GetCredentialsForIdentityOutput: Codable { } } -extension CognitoIdentityClientTypes.Credentials: Decodable { +extension CognitoIdentityClientTypes.Credentials: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case accessKeyId = "AccessKeyId" case expiration = "Expiration" diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetIdOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetIdOutputResponse+Codable.swift index e9bfb0904e..90c4f8070b 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetIdOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GetIdOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentity import ClientRuntime -extension GetIdOutput: Codable { +extension GetIdOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case identityId = "IdentityId" } diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GlobalSignOutOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GlobalSignOutOutputResponse+Codable.swift index 4bcd8a68aa..7978963b3e 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GlobalSignOutOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/GlobalSignOutOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension GlobalSignOutOutput: Codable { +extension GlobalSignOutOutput: @retroactive Decodable, @retroactive Encodable { public init(from decoder: Swift.Decoder) throws { self.init() diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/HttpResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/HttpResponse+Codable.swift index 9fd654c597..58f6eb7890 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/HttpResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/HttpResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import SmithyHTTPAPI -extension SmithyHTTPAPI.HTTPResponse: Codable { } +extension SmithyHTTPAPI.HTTPResponse: @retroactive Decodable, @retroactive Encodable { } enum HTTPResponseCodingKeys: String, CodingKey { case statusCode diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/InitiateAuthOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/InitiateAuthOutputResponse+Codable.swift index cd6c80b822..26cde0ef0f 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/InitiateAuthOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/InitiateAuthOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension InitiateAuthOutput: Codable { +extension InitiateAuthOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case authenticationResult = "AuthenticationResult" @@ -45,7 +45,7 @@ extension InitiateAuthOutput: Codable { } -extension CognitoIdentityProviderClientTypes.AuthenticationResultType: Decodable { +extension CognitoIdentityProviderClientTypes.AuthenticationResultType: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case accessToken = "AccessToken" case expiresIn = "ExpiresIn" @@ -71,7 +71,7 @@ extension CognitoIdentityProviderClientTypes.AuthenticationResultType: Decodable } } -extension CognitoIdentityProviderClientTypes.NewDeviceMetadataType: Decodable { +extension CognitoIdentityProviderClientTypes.NewDeviceMetadataType: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case deviceGroupKey = "DeviceGroupKey" case deviceKey = "DeviceKey" diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RespondToAuthChallengeOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RespondToAuthChallengeOutputResponse+Codable.swift index 696282db3f..7ba991d920 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RespondToAuthChallengeOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RespondToAuthChallengeOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension RespondToAuthChallengeOutput: Codable { +extension RespondToAuthChallengeOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case authenticationResult = "AuthenticationResult" case challengeName = "ChallengeName" diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RevokeTokenOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RevokeTokenOutputResponse+Codable.swift index 8ba83d4185..4e355c4b13 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RevokeTokenOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/RevokeTokenOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension RevokeTokenOutput: Codable { +extension RevokeTokenOutput: @retroactive Decodable, @retroactive Encodable { public init(from decoder: Swift.Decoder) throws { self.init() diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/SignUpOutputResponse+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/SignUpOutputResponse+Codable.swift index 202138a402..b638eb6685 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/SignUpOutputResponse+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Cognito/Response/SignUpOutputResponse+Codable.swift @@ -8,7 +8,7 @@ import AWSCognitoIdentityProvider import ClientRuntime -extension SignUpOutput: Codable { +extension SignUpOutput: @retroactive Decodable, @retroactive Encodable { enum CodingKeys: Swift.String, Swift.CodingKey { case codeDeliveryDetails = "CodeDeliveryDetails" case userConfirmed = "UserConfirmed" diff --git a/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreAttributes.swift b/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreAttributes.swift index bbbab1d275..c045a4e87b 100644 --- a/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreAttributes.swift +++ b/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreAttributes.swift @@ -21,7 +21,7 @@ extension KeychainStoreAttributes { var query: [String: Any] = [ KeychainStore.Constants.Class: itemClass, KeychainStore.Constants.AttributeService: service, - KeychainStore.Constants.UseDataProtectionKeyChain: kCFBooleanTrue + KeychainStore.Constants.UseDataProtectionKeyChain: kCFBooleanTrue as Any ] if let accessGroup { diff --git a/AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AuthModeStrategyTests.swift b/AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AuthModeStrategyTests.swift index 76933a96eb..435bb37ba8 100644 --- a/AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AuthModeStrategyTests.swift +++ b/AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AuthModeStrategyTests.swift @@ -159,14 +159,14 @@ class AuthModeStrategyTests: XCTestCase { /// Model with two auth rules private struct ModelWithOwnerAndPublicAuth: Model { - public let id: String + let id: String - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { model in + static let schema = defineSchema { model in model.authRules = [ rule(allow: .owner, provider: .userPools, operations: [.create, .read, .update, .delete]), rule(allow: .public, provider: .apiKey, operations: [.create, .read, .update, .delete]) @@ -176,14 +176,14 @@ private struct ModelWithOwnerAndPublicAuth: Model { /// Model with multiple auth rules with equal strategy private struct ModelWithMultiplePublicRules: Model { - public let id: String + let id: String - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { model in + static let schema = defineSchema { model in model.authRules = [ rule(allow: .public, provider: .iam, operations: [.create, .read, .update, .delete]), rule(allow: .public, provider: .apiKey, operations: [.create, .read, .update, .delete]), @@ -195,14 +195,14 @@ private struct ModelWithMultiplePublicRules: Model { /// Model with two auth rules but no auth provider private struct ModelNoProvider: Model { - public let id: String + let id: String - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { model in + static let schema = defineSchema { model in model.authRules = [ rule(allow: .owner, operations: [.create, .read, .update, .delete]), rule(allow: .public, operations: [.read]) @@ -212,14 +212,14 @@ private struct ModelNoProvider: Model { /// Model with multiple auth rules but no auth provider private struct ModelAllStrategies: Model { - public let id: String + let id: String - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { model in + static let schema = defineSchema { model in model.authRules = [ rule(allow: .owner, provider: .userPools, operations: [.create, .read, .update, .delete]), rule(allow: .public, provider: .iam, operations: [.read]), @@ -231,14 +231,14 @@ private struct ModelAllStrategies: Model { /// Model with custom auth rule private struct ModelWithCustomStrategy: Model { - public let id: String + let id: String - public enum CodingKeys: String, ModelKey { + enum CodingKeys: String, ModelKey { case id } - public static let keys = CodingKeys.self + static let keys = CodingKeys.self - public static let schema = defineSchema { model in + static let schema = defineSchema { model in model.authRules = [ rule(allow: .public, provider: .iam, operations: [.create, .read, .update, .delete]), rule(allow: .custom, provider: .function, operations: [.create, .read, .update, .delete]), diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthCognitoTests/AWSDataStoreCategoryPluginAuthIntegrationTests.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthCognitoTests/AWSDataStoreCategoryPluginAuthIntegrationTests.swift index 70515e9d5b..b49e4df6ee 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthCognitoTests/AWSDataStoreCategoryPluginAuthIntegrationTests.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthCognitoTests/AWSDataStoreCategoryPluginAuthIntegrationTests.swift @@ -85,7 +85,7 @@ extension AWSDataStoreCategoryPluginAuthIntegrationTests { private struct ModelsRegistration: AmplifyModelRegistration { var version: String = "version" - public func registerModels(registry: ModelRegistry.Type) { + func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: TodoExplicitOwnerField.self) ModelRegistry.register(modelType: TodoImplicitOwnerField.self) } diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/16/AWSDataStoreAWSURLSortKeyTest.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/16/AWSDataStoreAWSURLSortKeyTest.swift index e7785430f2..3f41ed0fb9 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/16/AWSDataStoreAWSURLSortKeyTest.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/16/AWSDataStoreAWSURLSortKeyTest.swift @@ -23,7 +23,7 @@ private struct TestModels: AmplifyModelRegistration { ModelRegistry.register(modelType: Post16.self) } - public let version: String = "test" + let version: String = "test" } diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/17/AWSDataStoreAWSEmailSortKeyTest.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/17/AWSDataStoreAWSEmailSortKeyTest.swift index 53b650e780..e7548fab85 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/17/AWSDataStoreAWSEmailSortKeyTest.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/17/AWSDataStoreAWSEmailSortKeyTest.swift @@ -23,7 +23,7 @@ private struct TestModels: AmplifyModelRegistration { ModelRegistry.register(modelType: Post17.self) } - public let version: String = "test" + let version: String = "test" } diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/18/AWSDataStoreAWSPhoneSortKeyTest.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/18/AWSDataStoreAWSPhoneSortKeyTest.swift index 33b422b510..24e679bc6d 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/18/AWSDataStoreAWSPhoneSortKeyTest.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/18/AWSDataStoreAWSPhoneSortKeyTest.swift @@ -23,7 +23,7 @@ private struct TestModels: AmplifyModelRegistration { ModelRegistry.register(modelType: Post18.self) } - public let version: String = "test" + let version: String = "test" } diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/19/AWSDataStoreAWSIPAddressSortKeyTest.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/19/AWSDataStoreAWSIPAddressSortKeyTest.swift index 065042f783..17f70a733d 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/19/AWSDataStoreAWSIPAddressSortKeyTest.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/19/AWSDataStoreAWSIPAddressSortKeyTest.swift @@ -23,7 +23,7 @@ private struct TestModels: AmplifyModelRegistration { ModelRegistry.register(modelType: Post19.self) } - public let version: String = "test" + let version: String = "test" } diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/20/AWSDataStoreAWSTimestampSortKeyTest.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/20/AWSDataStoreAWSTimestampSortKeyTest.swift index 12e981f542..cd9691b3a5 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/20/AWSDataStoreAWSTimestampSortKeyTest.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/20/AWSDataStoreAWSTimestampSortKeyTest.swift @@ -23,7 +23,7 @@ private struct TestModels: AmplifyModelRegistration { ModelRegistry.register(modelType: Post20.self) } - public let version: String = "test" + let version: String = "test" } diff --git a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/9/AWSDataStoreCompositeSortKeyIdentifierTest.swift b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/9/AWSDataStoreCompositeSortKeyIdentifierTest.swift index 644b19e428..4428dfa6a7 100644 --- a/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/9/AWSDataStoreCompositeSortKeyIdentifierTest.swift +++ b/AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginCPKTests/PrimaryKey/9/AWSDataStoreCompositeSortKeyIdentifierTest.swift @@ -21,7 +21,7 @@ private struct TestModels: AmplifyModelRegistration { ModelRegistry.register(modelType: Comment9.self) } - public let version: String = "test" + let version: String = "test" } class AWSDataStoreCompositeSortKeyIdentifierTest: XCTestCase { diff --git a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Endpoint/PinpointClientTypes+Codable.swift b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Endpoint/PinpointClientTypes+Codable.swift index 28619dcab3..b2dbb20878 100644 --- a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Endpoint/PinpointClientTypes+Codable.swift +++ b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Endpoint/PinpointClientTypes+Codable.swift @@ -8,7 +8,7 @@ import AWSPinpoint import Foundation -extension PinpointClientTypes.EndpointLocation: Codable, Equatable { +extension PinpointClientTypes.EndpointLocation: @retroactive Decodable, @retroactive Encodable, @retroactive Equatable { private enum CodingKeys: CodingKey { case city case country @@ -53,7 +53,7 @@ extension PinpointClientTypes.EndpointLocation: Codable, Equatable { } } -extension PinpointClientTypes.EndpointDemographic: Codable, Equatable { +extension PinpointClientTypes.EndpointDemographic: @retroactive Decodable, @retroactive Encodable, Equatable { private enum CodingKeys: CodingKey { case appVersion case locale @@ -106,7 +106,7 @@ extension PinpointClientTypes.EndpointDemographic: Codable, Equatable { } } -extension PinpointClientTypes.EndpointUser: Codable, Equatable { +extension PinpointClientTypes.EndpointUser: @retroactive Decodable, @retroactive Encodable, @retroactive Equatable { private enum CodingKeys: CodingKey { case userAttributes case userId diff --git a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/SDKModels+AmplifyStringConvertible.swift b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/SDKModels+AmplifyStringConvertible.swift index 7ac9d99bfd..4470dfe406 100644 --- a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/SDKModels+AmplifyStringConvertible.swift +++ b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/SDKModels+AmplifyStringConvertible.swift @@ -8,10 +8,14 @@ import AWSPinpoint import Foundation +extension PutEventsInput: @retroactive CustomStringConvertible {} extension PutEventsInput: AmplifyStringConvertible {} +extension PutEventsOutput: @retroactive CustomStringConvertible {} extension PutEventsOutput: AmplifyStringConvertible {} +extension UpdateEndpointInput: @retroactive CustomStringConvertible {} extension UpdateEndpointInput: AmplifyStringConvertible {} +extension UpdateEndpointOutput: @retroactive CustomStringConvertible {} extension UpdateEndpointOutput: AmplifyStringConvertible {} diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Dependency/TranscribeStreamingClientTypes+Decodable.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Dependency/TranscribeStreamingClientTypes+Decodable.swift index 7579667a60..e583d32492 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Dependency/TranscribeStreamingClientTypes+Decodable.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Dependency/TranscribeStreamingClientTypes+Decodable.swift @@ -8,7 +8,7 @@ import AWSTranscribeStreaming import Foundation -extension TranscribeStreamingClientTypes.TranscriptEvent: Decodable { +extension TranscribeStreamingClientTypes.TranscriptEvent: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case transcript = "Transcript" } @@ -24,7 +24,7 @@ extension TranscribeStreamingClientTypes.TranscriptEvent: Decodable { } } -extension TranscribeStreamingClientTypes.Transcript: Decodable { +extension TranscribeStreamingClientTypes.Transcript: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case results = "Results" } @@ -37,7 +37,7 @@ extension TranscribeStreamingClientTypes.Transcript: Decodable { } } -extension TranscribeStreamingClientTypes.Result: Decodable { +extension TranscribeStreamingClientTypes.Result: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case alternatives = "Alternatives" case channelId = "ChannelId" @@ -73,7 +73,7 @@ extension TranscribeStreamingClientTypes.Result: Decodable { } } -extension TranscribeStreamingClientTypes.Alternative: Decodable { +extension TranscribeStreamingClientTypes.Alternative: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case entities = "Entities" case items = "Items" @@ -96,7 +96,7 @@ extension TranscribeStreamingClientTypes.Alternative: Decodable { } } -extension TranscribeStreamingClientTypes.Entity: Decodable { +extension TranscribeStreamingClientTypes.Entity: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case category = "Category" case confidence = "Confidence" @@ -119,7 +119,7 @@ extension TranscribeStreamingClientTypes.Entity: Decodable { } } -extension TranscribeStreamingClientTypes.Item: Decodable { +extension TranscribeStreamingClientTypes.Item: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case confidence = "Confidence" case content = "Content" @@ -146,7 +146,7 @@ extension TranscribeStreamingClientTypes.Item: Decodable { } } -extension TranscribeStreamingClientTypes.LanguageWithScore: Decodable { +extension TranscribeStreamingClientTypes.LanguageWithScore: @retroactive Decodable { private enum CodingKeys: String, CodingKey { case languageCode = "LanguageCode" case score = "Score" @@ -164,6 +164,6 @@ extension TranscribeStreamingClientTypes.LanguageWithScore: Decodable { } } -extension TranscribeStreamingClientTypes.ItemType: Decodable {} +extension TranscribeStreamingClientTypes.ItemType: @retroactive Decodable {} -extension TranscribeStreamingClientTypes.LanguageCode: Decodable {} +extension TranscribeStreamingClientTypes.LanguageCode: @retroactive Decodable {} diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift index 28bc6e8917..fe7e8dfc36 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift @@ -45,11 +45,16 @@ public final class FaceLivenessSession: LivenessService { self.websocket = websocket websocket.onMessageReceived { [weak self] result in - self?.receive(result: result) ?? .stopAndInvalidateSession + guard let receiveResult = self?.receive(result: result) else { + self?.removeLivenessEventListeners() + return .stopAndInvalidateSession + } + return receiveResult } websocket.onSocketClosed { [weak self] closeCode in self?.onComplete(.unexpectedClosure(closeCode)) + self?.removeLivenessEventListeners() } websocket.onServerDateReceived { [weak self] serverDate in @@ -57,6 +62,10 @@ public final class FaceLivenessSession: LivenessService { } } + deinit { + Amplify.log.verbose("\(#fileID)-\(#function)") + } + public var onServiceException: (FaceLivenessSessionError) -> Void = { _ in } public func register( @@ -77,18 +86,19 @@ public final class FaceLivenessSession: LivenessService { } public func closeSocket(with code: URLSessionWebSocketTask.CloseCode) { - livenessServiceDispatchQueue.async { - self.websocket.close(with: code) + Amplify.log.verbose("\(#fileID)-\(#function): closeSocket with code: \(code)") + livenessServiceDispatchQueue.async { [weak self] in + self?.websocket.close(with: code) } } public func initializeLivenessStream( withSessionID sessionID: String, - - userAgent: String = "", + userAgent: String = "", challenges: [Challenge] = FaceLivenessSession.supportedChallenges, options: FaceLivenessSession.Options ) throws { + Amplify.log.verbose("\(#fileID)-\(#function): Initialize liveness stream") var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: false) components?.queryItems = [ URLQueryItem(name: "session-id", value: sessionID), @@ -108,8 +118,8 @@ public final class FaceLivenessSession: LivenessService { savedURLForReconnect = url let signedConnectionURL = signer.sign(url: url) - livenessServiceDispatchQueue.async { - self.websocket.open(url: signedConnectionURL) + livenessServiceDispatchQueue.async { [weak self] in + self?.websocket.open(url: signedConnectionURL) } } @@ -117,8 +127,10 @@ public final class FaceLivenessSession: LivenessService { _ event: LivenessEvent, eventDate: @escaping () -> Date = Date.init ) { - livenessServiceDispatchQueue.async { - let encodedPayload = self.eventStreamEncoder.encode( + Amplify.log.verbose("\(#fileID)-\(#function): Sending websocket event: \(event)") + livenessServiceDispatchQueue.async { [weak self] in + guard let self else { return } + let encodedPayload = eventStreamEncoder.encode( payload: event.payload, headers: [ ":content-type": .string("application/json"), @@ -128,18 +140,18 @@ public final class FaceLivenessSession: LivenessService { ) let dateForSigning: Date - if let serverDate = self.serverDate { + if let serverDate { dateForSigning = serverDate } else { dateForSigning = eventDate() } - let signedPayload = self.signer.signWithPreviousSignature( + let signedPayload = signer.signWithPreviousSignature( payload: encodedPayload, dateHeader: (key: ":date", value: dateForSigning) ) - let encodedEvent = self.eventStreamEncoder.encode( + let encodedEvent = eventStreamEncoder.encode( payload: encodedPayload, headers: [ ":date": .timestamp(dateForSigning), @@ -147,25 +159,30 @@ public final class FaceLivenessSession: LivenessService { ] ) - self.websocket.send( + websocket.send( message: .data(encodedEvent), - onError: { _ in } + onError: { error in + Amplify.log.verbose("\(#fileID)-\(#function): Error sending web socket message: \(error)") + } ) } } private func fallbackDecoding(_ message: EventStream.Message) -> WebSocketSession.WebSocketMessageResult { - // We only care about two events above. // Just in case the header value changes (it shouldn't) // We'll try to decode each of these events if let payload = try? JSONDecoder().decode(ServerSessionInformationEvent.self, from: message.payload) { + Amplify.log.verbose("\(#fileID)-\(#function): Fallback decoding server session information: \(payload)") let sessionConfiguration = sessionConfiguration(from: payload) serverEventListeners[.challenge]?(sessionConfiguration) } else if let payload = try? JSONDecoder().decode(ChallengeEvent.self, from: message.payload) { + Amplify.log.verbose("\(#fileID)-\(#function): Fallback decoding challenge: \(payload)") let challenge = challenge(from: payload) challengeTypeListeners[.challenge]?(challenge) - } else if (try? JSONDecoder().decode(DisconnectEvent.self, from: message.payload)) != nil { + } else if let payload = try? JSONDecoder().decode(DisconnectEvent.self, from: message.payload) { + Amplify.log.verbose("\(#fileID)-\(#function): Fallback decoding disconnect: \(payload)") onComplete(.disconnectionEvent) + removeLivenessEventListeners() return .stopAndInvalidateSession } return .continueToReceive @@ -179,6 +196,7 @@ public final class FaceLivenessSession: LivenessService { if let eventType = message.headers.first(where: { $0.name == ":event-type" }) { let serverEvent = LivenessEventKind.Server(rawValue: eventType.value) + Amplify.log.verbose("\(#fileID)-\(#function): Received server event: \(serverEvent)") switch serverEvent { case .challenge: // :event-type ChallengeEvent @@ -199,22 +217,24 @@ public final class FaceLivenessSession: LivenessService { case .disconnect: // :event-type DisconnectionEvent onComplete(.disconnectionEvent) + removeLivenessEventListeners() return .stopAndInvalidateSession default: return .continueToReceive } } else if let exceptionType = message.headers.first(where: { $0.name == ":exception-type" }) { let exceptionEvent = LivenessEventKind.Exception(rawValue: exceptionType.value) - Amplify.log.verbose("\(#function): Received exception: \(exceptionEvent)") + Amplify.log.verbose("\(#fileID)-\(#function): Received exception: \(exceptionEvent)") guard exceptionEvent == .invalidSignature, connectingState == .normal, let savedURLForReconnect, let serverDate else { if let runtimeError = URLSessionWebSocketTask.CloseCode(rawValue: 4_005) { - Amplify.log.verbose("\(#function): Closing websocket with runtime error") + Amplify.log.verbose("\(#fileID)-\(#function): Closing websocket with runtime error") closeSocket(with: runtimeError) } onServiceException(.init(event: exceptionEvent)) + removeLivenessEventListeners() return .stopAndInvalidateSession } @@ -228,12 +248,21 @@ public final class FaceLivenessSession: LivenessService { return fallbackDecoding(message) } } catch { + Amplify.log.verbose("\(#fileID)-\(#function): Error decoding web socket message: \(error)") + removeLivenessEventListeners() return .stopAndInvalidateSession } case .success: return .continueToReceive - case .failure: + case .failure(let error): + Amplify.log.verbose("\(#fileID)-\(#function): Failure result in web socket message: \(error)") + removeLivenessEventListeners() return .stopAndInvalidateSession } } + + private func removeLivenessEventListeners() { + serverEventListeners.removeAll() + challengeTypeListeners.removeAll() + } } diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSessionRepresentable.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSessionRepresentable.swift index 5ded682295..328f2b6e80 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSessionRepresentable.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSessionRepresentable.swift @@ -21,8 +21,7 @@ public protocol LivenessService { func initializeLivenessStream( withSessionID sessionID: String, - - userAgent: String, + userAgent: String, challenges: [Challenge], options: FaceLivenessSession.Options ) throws diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/WebSocketSession.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/WebSocketSession.swift index 9dd1e85c49..33917ada94 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/WebSocketSession.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/WebSocketSession.swift @@ -31,6 +31,11 @@ final class WebSocketSession { ) } + deinit { + Amplify.log.verbose("\(#fileID)-\(#function)") + task?.cancel(with: .normalClosure, reason: nil) + } + func onMessageReceived(_ receive: @escaping (Result) -> WebSocketMessageResult) { receiveMessage = receive } @@ -92,17 +97,22 @@ final class WebSocketSession { ) } - final class Delegate: NSObject, URLSessionWebSocketDelegate, URLSessionTaskDelegate { + final class Delegate: NSObject, URLSessionWebSocketDelegate { var onClose: (URLSessionWebSocketTask.CloseCode) -> Void = { _ in } var onOpen: () -> Void = {} var onServerDateReceived: (Date?) -> Void = { _ in } + deinit { + Amplify.log.verbose("\(#fileID).Delegate-\(#function)") + } + // MARK: - URLSessionWebSocketDelegate methods func urlSession( _ session: URLSession, webSocketTask: URLSessionWebSocketTask, didOpenWithProtocol protocol: String? ) { + Amplify.log.verbose("\(#fileID)-\(#function): Web socket task didOpen") onOpen() } @@ -112,6 +122,7 @@ final class WebSocketSession { didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data? ) { + Amplify.log.verbose("\(#fileID)-\(#function): Web socket task didCloseWith: \(closeCode)") onClose(closeCode) } @@ -123,7 +134,7 @@ final class WebSocketSession { ) { guard let httpResponse = metrics.transactionMetrics.first?.response as? HTTPURLResponse, let dateString = httpResponse.value(forHTTPHeaderField: "Date") else { - Amplify.log.verbose("\(#function): Couldn't find Date header in URLSession metrics") + Amplify.log.verbose("\(#fileID)-\(#function): Couldn't find Date header in URLSession metrics") onServerDateReceived(nil) return } @@ -133,13 +144,29 @@ final class WebSocketSession { dateFormatter.dateFormat = "EEE, d MMM yyyy HH:mm:ss z" dateFormatter.timeZone = TimeZone(secondsFromGMT: 0) guard let serverDate = dateFormatter.date(from: dateString) else { - Amplify.log.verbose("\(#function): Error parsing Date header in expected format") + Amplify.log.verbose("\(#fileID)-\(#function): Error parsing Date header in expected format") onServerDateReceived(nil) return } onServerDateReceived(serverDate) } + + func urlSession( + _ session: URLSession, + task: URLSessionTask, + didCompleteWithError error: Error? + ) { + Amplify.log.verbose("\(#fileID)-\(#function): Session task didCompleteWithError : \(error)") + } + + // MARK: - URLSessionDelegate methods + func urlSession( + _ session: URLSession, + didBecomeInvalidWithError error: Error? + ) { + Amplify.log.verbose("\(#fileID)-\(#function): Session task didBecomeInvalidWithError : \(error)") + } } enum WebSocketMessageResult { diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/DefaultStorageTransferDatabase.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/DefaultStorageTransferDatabase.swift index 172b150fc8..3703f50f3e 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/DefaultStorageTransferDatabase.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/DefaultStorageTransferDatabase.swift @@ -122,7 +122,7 @@ class DefaultStorageTransferDatabase { let subTasks = pair.value.filter { $0.partNumber != nil }.compactMap(\.subTask) // all parts are defaulted to pending - for (index, subTask) in subTasks.enumerated() { + for (_, subTask) in subTasks.enumerated() { guard subTask.partNumber <= parts.count, subTask.partNumber > 0 else { continue } let index = subTask.partNumber - 1 diff --git a/AmplifyTestCommon/TestExtensions.swift b/AmplifyTestCommon/TestExtensions.swift index 2cef8b7c87..fa926ea156 100644 --- a/AmplifyTestCommon/TestExtensions.swift +++ b/AmplifyTestCommon/TestExtensions.swift @@ -8,4 +8,4 @@ /// A set of extensions used in testing /// Enable tests to `throw` string literals -extension String: Error { } +extension String: @retroactive Error { }