diff --git a/.github/composite_actions/get_platform_parameters/action.yml b/.github/composite_actions/get_platform_parameters/action.yml index ad4024b29e..55d1300511 100644 --- a/.github/composite_actions/get_platform_parameters/action.yml +++ b/.github/composite_actions/get_platform_parameters/action.yml @@ -42,7 +42,7 @@ runs: - id: get-xcode-version run: | LATEST_XCODE_VERSION=16.2.0 - MINIMUM_XCODE_VERSION=15.0.1 + MINIMUM_XCODE_VERSION=16.1.0 INPUT_XCODE_VERSION=${{ inputs.xcode_version }} @@ -71,7 +71,7 @@ runs: ;; iOS/*) DEVICE="iPhone 15" - OS_VERSION="17.0" + OS_VERSION="17.0.1" ;; tvOS/latest) DEVICE="Apple TV 4K (3rd generation)" diff --git a/Amplify/Amplify.swift b/Amplify/Amplify.swift index fdc88954a3..0f2b8dc7da 100644 --- a/Amplify/Amplify.swift +++ b/Amplify/Amplify.swift @@ -20,44 +20,83 @@ import Foundation /// available at initialization. /// /// - Tag: Amplify -public class Amplify { +public class Amplify: @unchecked Sendable { /// If `true`, `configure()` has already been invoked, and subsequent calls to `configure` will throw a /// ConfigurationError.amplifyAlreadyConfigured error. /// /// - Tag: Amplify.isConfigured - static var isConfigured = false + private static let isConfiguredAtomic = AtomicValue(initialValue: false) + static var isConfigured: Bool { + get { isConfiguredAtomic.get() } + set { isConfiguredAtomic.set(newValue) } + } // Storage for the categories themselves, which will be instantiated during configuration, and cleared during reset. - // It is not supported to mutate these category properties. They are `var` to support the `reset()` method for - // ease of testing. + // All category properties are protected with AtomicValue for thread safety. /// - Tag: Amplify.Analytics - public static internal(set) var Analytics = AnalyticsCategory() + private static let analyticsAtomic = AtomicValue(initialValue: AnalyticsCategory()) + public static internal(set) var Analytics: AnalyticsCategory { + get { analyticsAtomic.get() } + set { analyticsAtomic.set(newValue) } + } /// - Tag: Amplify.API - public static internal(set) var API: APICategory = APICategory() + private static let apiAtomic = AtomicValue(initialValue: APICategory()) + public static internal(set) var API: APICategory { + get { apiAtomic.get() } + set { apiAtomic.set(newValue) } + } /// - Tag: Amplify.Auth - public static internal(set) var Auth = AuthCategory() + private static let authAtomic = AtomicValue(initialValue: AuthCategory()) + public static internal(set) var Auth: AuthCategory { + get { authAtomic.get() } + set { authAtomic.set(newValue) } + } /// - Tag: Amplify.DataStore - public static internal(set) var DataStore = DataStoreCategory() + private static let dataStoreAtomic = AtomicValue(initialValue: DataStoreCategory()) + public static internal(set) var DataStore: DataStoreCategory { + get { dataStoreAtomic.get() } + set { dataStoreAtomic.set(newValue) } + } /// - Tag: Amplify.Geo - public static internal(set) var Geo = GeoCategory() + private static let geoAtomic = AtomicValue(initialValue: GeoCategory()) + public static internal(set) var Geo: GeoCategory { + get { geoAtomic.get() } + set { geoAtomic.set(newValue) } + } /// - Tag: Amplify.Hub - public static internal(set) var Hub = HubCategory() + private static let hubAtomic = AtomicValue(initialValue: HubCategory()) + public static internal(set) var Hub: HubCategory { + get { hubAtomic.get() } + set { hubAtomic.set(newValue) } + } /// - Tag: Amplify.Notifications - public static internal(set) var Notifications = NotificationsCategory() + private static let notificationsAtomic = AtomicValue(initialValue: NotificationsCategory()) + public static internal(set) var Notifications: NotificationsCategory { + get { notificationsAtomic.get() } + set { notificationsAtomic.set(newValue) } + } /// - Tag: Amplify.Predictions - public static internal(set) var Predictions = PredictionsCategory() + private static let predictionsAtomic = AtomicValue(initialValue: PredictionsCategory()) + public static internal(set) var Predictions: PredictionsCategory { + get { predictionsAtomic.get() } + set { predictionsAtomic.set(newValue) } + } /// - Tag: Amplify.Storage - public static internal(set) var Storage = StorageCategory() + private static let storageAtomic = AtomicValue(initialValue: StorageCategory()) + public static internal(set) var Storage: StorageCategory { + get { storageAtomic.get() } + set { storageAtomic.set(newValue) } + } /// Special case category. We protect this with an AtomicValue because it is used by reset() /// methods during setup & teardown of tests diff --git a/Amplify/Categories/API/Operation/GraphQLOperation.swift b/Amplify/Categories/API/Operation/GraphQLOperation.swift index 28ebf62a88..1319100d13 100644 --- a/Amplify/Categories/API/Operation/GraphQLOperation.swift +++ b/Amplify/Categories/API/Operation/GraphQLOperation.swift @@ -10,7 +10,7 @@ open class GraphQLOperation: AmplifyOperation< GraphQLOperationRequest, GraphQLResponse, APIError -> { } +>, @unchecked Sendable { } /// GraphQL Subscription Operation open class GraphQLSubscriptionOperation: AmplifyInProcessReportingOperation< @@ -18,7 +18,7 @@ open class GraphQLSubscriptionOperation: AmplifyInProcessReporting GraphQLSubscriptionEvent, Void, APIError -> { } +>, @unchecked Sendable { } public extension HubPayload.EventName.API { /// eventName for HubPayloads emitted by this operation diff --git a/Amplify/Categories/API/Response/SubscriptionEvent.swift b/Amplify/Categories/API/Response/SubscriptionEvent.swift index eca6747532..cd28df39b7 100644 --- a/Amplify/Categories/API/Response/SubscriptionEvent.swift +++ b/Amplify/Categories/API/Response/SubscriptionEvent.swift @@ -6,7 +6,7 @@ // /// Event for subscription -public enum GraphQLSubscriptionEvent { +public enum GraphQLSubscriptionEvent where T: Decodable, T: Sendable { /// The subscription's connection state has changed. case connection(SubscriptionConnectionState) diff --git a/Amplify/Categories/Auth/AuthCategory+UserBehavior.swift b/Amplify/Categories/Auth/AuthCategory+UserBehavior.swift index 6589e03083..ab51dcd49a 100644 --- a/Amplify/Categories/Auth/AuthCategory+UserBehavior.swift +++ b/Amplify/Categories/Auth/AuthCategory+UserBehavior.swift @@ -9,7 +9,10 @@ import Foundation extension AuthCategory: AuthCategoryUserBehavior { - public func getCurrentUser() async throws -> AuthUser { + /// Retrieve the current logged in user + /// + /// - Returns: Current logged in user + public func getCurrentUser() async throws -> any AuthUser { try await plugin.getCurrentUser() } diff --git a/Amplify/Categories/Auth/AuthCategoryUserBehavior.swift b/Amplify/Categories/Auth/AuthCategoryUserBehavior.swift index ad9d106eaf..04d3337d42 100644 --- a/Amplify/Categories/Auth/AuthCategoryUserBehavior.swift +++ b/Amplify/Categories/Auth/AuthCategoryUserBehavior.swift @@ -9,9 +9,10 @@ import Foundation public protocol AuthCategoryUserBehavior: AnyObject { - /// Returns the currently logged in user. + /// Retrieve the current logged in user /// - func getCurrentUser() async throws -> AuthUser + /// - Returns: Current logged in user + func getCurrentUser() async throws -> any AuthUser /// Fetch user attributes for the current user. /// diff --git a/Amplify/Categories/Auth/Models/AuthCodeDeliveryDetails.swift b/Amplify/Categories/Auth/Models/AuthCodeDeliveryDetails.swift index 1f73a5ec0e..b595b63eba 100644 --- a/Amplify/Categories/Auth/Models/AuthCodeDeliveryDetails.swift +++ b/Amplify/Categories/Auth/Models/AuthCodeDeliveryDetails.swift @@ -26,3 +26,5 @@ public struct AuthCodeDeliveryDetails { } extension AuthCodeDeliveryDetails: Equatable {} + +extension AuthCodeDeliveryDetails: Sendable {} diff --git a/Amplify/Categories/Auth/Models/AuthDevice.swift b/Amplify/Categories/Auth/Models/AuthDevice.swift index 269455efef..8b32dbe11f 100644 --- a/Amplify/Categories/Auth/Models/AuthDevice.swift +++ b/Amplify/Categories/Auth/Models/AuthDevice.swift @@ -8,7 +8,7 @@ import Foundation /// Device used by the user to sign in -public protocol AuthDevice { +public protocol AuthDevice: Sendable { /// Device id var id: String { get } diff --git a/Amplify/Categories/Auth/Models/AuthFactorType.swift b/Amplify/Categories/Auth/Models/AuthFactorType.swift index 9dce5a8bfc..e1aec8c345 100644 --- a/Amplify/Categories/Auth/Models/AuthFactorType.swift +++ b/Amplify/Categories/Auth/Models/AuthFactorType.swift @@ -25,3 +25,5 @@ public enum AuthFactorType: String { case webAuthn #endif } + +extension AuthFactorType: Sendable { } diff --git a/Amplify/Categories/Auth/Models/AuthSession.swift b/Amplify/Categories/Auth/Models/AuthSession.swift index b5f7c3c4c8..d7b44fe84d 100644 --- a/Amplify/Categories/Auth/Models/AuthSession.swift +++ b/Amplify/Categories/Auth/Models/AuthSession.swift @@ -8,7 +8,7 @@ import Foundation /// Defines the auth session behavior -public protocol AuthSession { +public protocol AuthSession: Sendable { /// True if the current user has signed in /// diff --git a/Amplify/Categories/Auth/Models/AuthSignInStep.swift b/Amplify/Categories/Auth/Models/AuthSignInStep.swift index bf7f75101a..ddf583773f 100644 --- a/Amplify/Categories/Auth/Models/AuthSignInStep.swift +++ b/Amplify/Categories/Auth/Models/AuthSignInStep.swift @@ -77,3 +77,5 @@ public enum AuthSignInStep { } extension AuthSignInStep: Equatable { } + +extension AuthSignInStep: Sendable { } diff --git a/Amplify/Categories/Auth/Models/AuthSignUpStep.swift b/Amplify/Categories/Auth/Models/AuthSignUpStep.swift index 861f6840cf..8c0afeb183 100644 --- a/Amplify/Categories/Auth/Models/AuthSignUpStep.swift +++ b/Amplify/Categories/Auth/Models/AuthSignUpStep.swift @@ -24,3 +24,5 @@ public enum AuthSignUpStep { /// Sign up is complete case done } + +extension AuthSignUpStep: Sendable { } diff --git a/Amplify/Categories/Auth/Models/AuthUpdateAttributeStep.swift b/Amplify/Categories/Auth/Models/AuthUpdateAttributeStep.swift index eb289e7eb7..a3af991702 100644 --- a/Amplify/Categories/Auth/Models/AuthUpdateAttributeStep.swift +++ b/Amplify/Categories/Auth/Models/AuthUpdateAttributeStep.swift @@ -18,3 +18,5 @@ public enum AuthUpdateAttributeStep { /// Update Attribute step is `done` when the update attribute flow is complete. case done } + +extension AuthUpdateAttributeStep: Sendable { } diff --git a/Amplify/Categories/Auth/Models/AuthUser.swift b/Amplify/Categories/Auth/Models/AuthUser.swift index c583cda7e6..da8d4eda27 100644 --- a/Amplify/Categories/Auth/Models/AuthUser.swift +++ b/Amplify/Categories/Auth/Models/AuthUser.swift @@ -6,7 +6,7 @@ // /// Defines the protocol for an auth user -public protocol AuthUser { +public protocol AuthUser: Sendable { /// User name of the auth user var username: String { get } diff --git a/Amplify/Categories/Auth/Models/AuthUserAttribute.swift b/Amplify/Categories/Auth/Models/AuthUserAttribute.swift index 7990ffe276..bdd7952395 100644 --- a/Amplify/Categories/Auth/Models/AuthUserAttribute.swift +++ b/Amplify/Categories/Auth/Models/AuthUserAttribute.swift @@ -90,3 +90,7 @@ public enum AuthUserAttributeKey { extension AuthUserAttributeKey: Hashable {} extension AuthUserAttributeKey: Equatable {} + +extension AuthUserAttributeKey: Sendable {} + +extension AuthUserAttribute: Sendable {} diff --git a/Amplify/Categories/Auth/Models/AuthWebAuthnCredential.swift b/Amplify/Categories/Auth/Models/AuthWebAuthnCredential.swift index f99be622d6..cf68f2e44d 100644 --- a/Amplify/Categories/Auth/Models/AuthWebAuthnCredential.swift +++ b/Amplify/Categories/Auth/Models/AuthWebAuthnCredential.swift @@ -35,9 +35,11 @@ public struct AuthListWebAuthnCredentialsResult { } } +extension AuthListWebAuthnCredentialsResult: Sendable { } + /// Defines a WebAuthn credential /// - Tag: AuthWebAuthnCredential -public protocol AuthWebAuthnCredential { +public protocol AuthWebAuthnCredential: Sendable { /// The credential's ID var credentialId: String { get } diff --git a/Amplify/Categories/Auth/Models/DeliveryDestination.swift b/Amplify/Categories/Auth/Models/DeliveryDestination.swift index 17a417d8ec..f45bdcc622 100644 --- a/Amplify/Categories/Auth/Models/DeliveryDestination.swift +++ b/Amplify/Categories/Auth/Models/DeliveryDestination.swift @@ -24,3 +24,5 @@ public enum DeliveryDestination { } extension DeliveryDestination: Equatable { } + +extension DeliveryDestination: Sendable { } diff --git a/Amplify/Categories/Auth/Models/MFAType.swift b/Amplify/Categories/Auth/Models/MFAType.swift index 4fa23c8a38..ce8b378a20 100644 --- a/Amplify/Categories/Auth/Models/MFAType.swift +++ b/Amplify/Categories/Auth/Models/MFAType.swift @@ -16,3 +16,5 @@ public enum MFAType: String { /// Email Service linked with an email case email } + +extension MFAType: Sendable { } diff --git a/Amplify/Categories/Auth/Models/TOTPSetupDetails.swift b/Amplify/Categories/Auth/Models/TOTPSetupDetails.swift index 7f84610180..165912706d 100644 --- a/Amplify/Categories/Auth/Models/TOTPSetupDetails.swift +++ b/Amplify/Categories/Auth/Models/TOTPSetupDetails.swift @@ -42,3 +42,5 @@ public struct TOTPSetupDetails { } extension TOTPSetupDetails: Equatable { } + +extension TOTPSetupDetails: Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthAssociateWebAuthnCredentialRequest.swift b/Amplify/Categories/Auth/Request/AuthAssociateWebAuthnCredentialRequest.swift index de2f4e547b..b410b8546c 100644 --- a/Amplify/Categories/Auth/Request/AuthAssociateWebAuthnCredentialRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthAssociateWebAuthnCredentialRequest.swift @@ -37,4 +37,6 @@ public extension AuthAssociateWebAuthnCredentialRequest { } } } + +extension AuthAssociateWebAuthnCredentialRequest.Options: @unchecked Sendable { } #endif diff --git a/Amplify/Categories/Auth/Request/AuthAttributeResendConfirmationCodeRequest.swift b/Amplify/Categories/Auth/Request/AuthAttributeResendConfirmationCodeRequest.swift index 4c514c97fb..2718847043 100644 --- a/Amplify/Categories/Auth/Request/AuthAttributeResendConfirmationCodeRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthAttributeResendConfirmationCodeRequest.swift @@ -39,3 +39,5 @@ public extension AuthAttributeResendConfirmationCodeRequest { } } } + +extension AuthAttributeResendConfirmationCodeRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthAttributeSendVerificationCodeRequest.swift b/Amplify/Categories/Auth/Request/AuthAttributeSendVerificationCodeRequest.swift index ec5f0a4683..4af430c68d 100644 --- a/Amplify/Categories/Auth/Request/AuthAttributeSendVerificationCodeRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthAttributeSendVerificationCodeRequest.swift @@ -39,3 +39,5 @@ public extension AuthSendUserAttributeVerificationCodeRequest { } } } + +extension AuthSendUserAttributeVerificationCodeRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthAutoSignInRequest.swift b/Amplify/Categories/Auth/Request/AuthAutoSignInRequest.swift index c7cd21ef40..cbd5a312a9 100644 --- a/Amplify/Categories/Auth/Request/AuthAutoSignInRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthAutoSignInRequest.swift @@ -32,3 +32,5 @@ public extension AuthAutoSignInRequest { } } } + +extension AuthAutoSignInRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthChangePasswordRequest.swift b/Amplify/Categories/Auth/Request/AuthChangePasswordRequest.swift index d385b95d52..cc507f85fe 100644 --- a/Amplify/Categories/Auth/Request/AuthChangePasswordRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthChangePasswordRequest.swift @@ -42,3 +42,5 @@ public extension AuthChangePasswordRequest { } } } + +extension AuthChangePasswordRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthConfirmResetPasswordRequest.swift b/Amplify/Categories/Auth/Request/AuthConfirmResetPasswordRequest.swift index c4e0be2e19..ad74cd8992 100644 --- a/Amplify/Categories/Auth/Request/AuthConfirmResetPasswordRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthConfirmResetPasswordRequest.swift @@ -47,3 +47,5 @@ public extension AuthConfirmResetPasswordRequest { } } } + +extension AuthConfirmResetPasswordRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthConfirmSignInRequest.swift b/Amplify/Categories/Auth/Request/AuthConfirmSignInRequest.swift index cff8e863dc..72d0316d99 100644 --- a/Amplify/Categories/Auth/Request/AuthConfirmSignInRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthConfirmSignInRequest.swift @@ -52,3 +52,5 @@ public extension AuthConfirmSignInRequest { #endif } } + +extension AuthConfirmSignInRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthConfirmSignUpRequest.swift b/Amplify/Categories/Auth/Request/AuthConfirmSignUpRequest.swift index 464afab0da..de15a90445 100644 --- a/Amplify/Categories/Auth/Request/AuthConfirmSignUpRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthConfirmSignUpRequest.swift @@ -40,3 +40,5 @@ public extension AuthConfirmSignUpRequest { } } } + +extension AuthConfirmSignUpRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthConfirmUserAttributeRequest.swift b/Amplify/Categories/Auth/Request/AuthConfirmUserAttributeRequest.swift index 57650da6cb..de40900ff8 100644 --- a/Amplify/Categories/Auth/Request/AuthConfirmUserAttributeRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthConfirmUserAttributeRequest.swift @@ -42,3 +42,5 @@ public extension AuthConfirmUserAttributeRequest { } } } + +extension AuthConfirmUserAttributeRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthDeleteWebAuthnCredentialRequest.swift b/Amplify/Categories/Auth/Request/AuthDeleteWebAuthnCredentialRequest.swift index edbe68105d..a15d755ff3 100644 --- a/Amplify/Categories/Auth/Request/AuthDeleteWebAuthnCredentialRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthDeleteWebAuthnCredentialRequest.swift @@ -36,3 +36,5 @@ public extension AuthDeleteWebAuthnCredentialRequest { } } } + +extension AuthDeleteWebAuthnCredentialRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthFetchDevicesRequest.swift b/Amplify/Categories/Auth/Request/AuthFetchDevicesRequest.swift index 65a9aaa3f7..eb7369a61f 100644 --- a/Amplify/Categories/Auth/Request/AuthFetchDevicesRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthFetchDevicesRequest.swift @@ -32,3 +32,5 @@ public extension AuthFetchDevicesRequest { } } } + +extension AuthFetchDevicesRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthFetchSessionRequest.swift b/Amplify/Categories/Auth/Request/AuthFetchSessionRequest.swift index debdb449e4..5f02a7c14d 100644 --- a/Amplify/Categories/Auth/Request/AuthFetchSessionRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthFetchSessionRequest.swift @@ -42,6 +42,8 @@ public extension AuthFetchSessionRequest { } } +extension AuthFetchSessionRequest.Options: @unchecked Sendable { } + extension AuthFetchSessionRequest.Options { public static func forceRefresh() -> AuthFetchSessionRequest.Options { return AuthFetchSessionRequest.Options(forceRefresh: true) diff --git a/Amplify/Categories/Auth/Request/AuthFetchUserAttributesRequest.swift b/Amplify/Categories/Auth/Request/AuthFetchUserAttributesRequest.swift index 12cb54a3b5..ea1131759f 100644 --- a/Amplify/Categories/Auth/Request/AuthFetchUserAttributesRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthFetchUserAttributesRequest.swift @@ -32,3 +32,5 @@ public extension AuthFetchUserAttributesRequest { } } } + +extension AuthFetchUserAttributesRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthForgetDeviceRequest.swift b/Amplify/Categories/Auth/Request/AuthForgetDeviceRequest.swift index 530c0e1f4b..ab1c6f5eb5 100644 --- a/Amplify/Categories/Auth/Request/AuthForgetDeviceRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthForgetDeviceRequest.swift @@ -39,3 +39,5 @@ public extension AuthForgetDeviceRequest { } } } + +extension AuthForgetDeviceRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthListWebAuthnCredentialsRequest.swift b/Amplify/Categories/Auth/Request/AuthListWebAuthnCredentialsRequest.swift index 4d97431782..b0f4ea0126 100644 --- a/Amplify/Categories/Auth/Request/AuthListWebAuthnCredentialsRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthListWebAuthnCredentialsRequest.swift @@ -60,3 +60,5 @@ public extension AuthListWebAuthnCredentialsRequest { } } } + +extension AuthListWebAuthnCredentialsRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthRememberDeviceRequest.swift b/Amplify/Categories/Auth/Request/AuthRememberDeviceRequest.swift index 3da839d0d9..4c3001b2ed 100644 --- a/Amplify/Categories/Auth/Request/AuthRememberDeviceRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthRememberDeviceRequest.swift @@ -32,3 +32,5 @@ public extension AuthRememberDeviceRequest { } } } + +extension AuthRememberDeviceRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthResendSignUpCodeRequest.swift b/Amplify/Categories/Auth/Request/AuthResendSignUpCodeRequest.swift index ff9af6eb6b..eb44c71cfd 100644 --- a/Amplify/Categories/Auth/Request/AuthResendSignUpCodeRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthResendSignUpCodeRequest.swift @@ -36,3 +36,5 @@ public extension AuthResendSignUpCodeRequest { } } } + +extension AuthResendSignUpCodeRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthResetPasswordRequest.swift b/Amplify/Categories/Auth/Request/AuthResetPasswordRequest.swift index 79038d6406..c21f260a3f 100644 --- a/Amplify/Categories/Auth/Request/AuthResetPasswordRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthResetPasswordRequest.swift @@ -36,3 +36,5 @@ public extension AuthResetPasswordRequest { } } } + +extension AuthResetPasswordRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthSignInRequest.swift b/Amplify/Categories/Auth/Request/AuthSignInRequest.swift index 057babd76d..1e8fa58f74 100644 --- a/Amplify/Categories/Auth/Request/AuthSignInRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthSignInRequest.swift @@ -54,3 +54,5 @@ public extension AuthSignInRequest { #endif } } + +extension AuthSignInRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthSignOutRequest.swift b/Amplify/Categories/Auth/Request/AuthSignOutRequest.swift index fd3343e750..59aa316f1d 100644 --- a/Amplify/Categories/Auth/Request/AuthSignOutRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthSignOutRequest.swift @@ -54,6 +54,8 @@ public extension AuthSignOutRequest { } +extension AuthSignOutRequest.Options: @unchecked Sendable { } + #if os(iOS) || os(macOS) || os(visionOS) extension AuthSignOutRequest.Options { public static func presentationAnchor(_ anchor: AuthUIPresentationAnchor) -> AuthSignOutRequest.Options { diff --git a/Amplify/Categories/Auth/Request/AuthSignUpRequest.swift b/Amplify/Categories/Auth/Request/AuthSignUpRequest.swift index e8145e454f..a145a4abea 100644 --- a/Amplify/Categories/Auth/Request/AuthSignUpRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthSignUpRequest.swift @@ -45,3 +45,5 @@ public extension AuthSignUpRequest { } } } + +extension AuthSignUpRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthUpdateUserAttributeRequest.swift b/Amplify/Categories/Auth/Request/AuthUpdateUserAttributeRequest.swift index be3b978526..dce07808af 100644 --- a/Amplify/Categories/Auth/Request/AuthUpdateUserAttributeRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthUpdateUserAttributeRequest.swift @@ -37,3 +37,5 @@ public extension AuthUpdateUserAttributeRequest { } } } + +extension AuthUpdateUserAttributeRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthUpdateUserAttributesRequest.swift b/Amplify/Categories/Auth/Request/AuthUpdateUserAttributesRequest.swift index 32a87a794d..459e3aeac2 100644 --- a/Amplify/Categories/Auth/Request/AuthUpdateUserAttributesRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthUpdateUserAttributesRequest.swift @@ -37,3 +37,5 @@ public extension AuthUpdateUserAttributesRequest { } } } + +extension AuthUpdateUserAttributesRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Request/AuthWebUISignInRequest.swift b/Amplify/Categories/Auth/Request/AuthWebUISignInRequest.swift index 1946770d02..767ceb8212 100644 --- a/Amplify/Categories/Auth/Request/AuthWebUISignInRequest.swift +++ b/Amplify/Categories/Auth/Request/AuthWebUISignInRequest.swift @@ -50,4 +50,6 @@ public extension AuthWebUISignInRequest { } } } + +extension AuthWebUISignInRequest.Options: @unchecked Sendable { } #endif diff --git a/Amplify/Categories/Auth/Request/VerifyTOTPSetupRequest.swift b/Amplify/Categories/Auth/Request/VerifyTOTPSetupRequest.swift index 4a03d3ff21..b4dcb31f10 100644 --- a/Amplify/Categories/Auth/Request/VerifyTOTPSetupRequest.swift +++ b/Amplify/Categories/Auth/Request/VerifyTOTPSetupRequest.swift @@ -38,3 +38,5 @@ public extension VerifyTOTPSetupRequest { } } } + +extension VerifyTOTPSetupRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Auth/Result/AuthResetPasswordResult.swift b/Amplify/Categories/Auth/Result/AuthResetPasswordResult.swift index e8550776d5..0c4ab4de2f 100644 --- a/Amplify/Categories/Auth/Result/AuthResetPasswordResult.swift +++ b/Amplify/Categories/Auth/Result/AuthResetPasswordResult.swift @@ -26,6 +26,8 @@ public struct AuthResetPasswordResult { extension AuthResetPasswordResult: Equatable {} +extension AuthResetPasswordResult: Sendable {} + /// The next step in Auth.resetPassword api public enum AuthResetPasswordStep { @@ -42,3 +44,5 @@ public enum AuthResetPasswordStep { } extension AuthResetPasswordStep: Equatable {} + +extension AuthResetPasswordStep: Sendable {} diff --git a/Amplify/Categories/Auth/Result/AuthSignInResult.swift b/Amplify/Categories/Auth/Result/AuthSignInResult.swift index 836c7fbd6f..2bd5f59bc5 100644 --- a/Amplify/Categories/Auth/Result/AuthSignInResult.swift +++ b/Amplify/Categories/Auth/Result/AuthSignInResult.swift @@ -30,3 +30,5 @@ public struct AuthSignInResult { self.nextStep = nextStep } } + +extension AuthSignInResult: Sendable { } diff --git a/Amplify/Categories/Auth/Result/AuthSignOutResult.swift b/Amplify/Categories/Auth/Result/AuthSignOutResult.swift index d5d467653a..31e0ca8e64 100644 --- a/Amplify/Categories/Auth/Result/AuthSignOutResult.swift +++ b/Amplify/Categories/Auth/Result/AuthSignOutResult.swift @@ -7,6 +7,6 @@ import Foundation -public protocol AuthSignOutResult { +public protocol AuthSignOutResult: Sendable { } diff --git a/Amplify/Categories/Auth/Result/AuthSignUpResult.swift b/Amplify/Categories/Auth/Result/AuthSignUpResult.swift index b63154dda9..86050a8bf3 100644 --- a/Amplify/Categories/Auth/Result/AuthSignUpResult.swift +++ b/Amplify/Categories/Auth/Result/AuthSignUpResult.swift @@ -33,3 +33,5 @@ public struct AuthSignUpResult { self.userID = userID } } + +extension AuthSignUpResult: Sendable { } diff --git a/Amplify/Categories/Auth/Result/AuthUpdateAttributeResult.swift b/Amplify/Categories/Auth/Result/AuthUpdateAttributeResult.swift index 26338ac62c..fd049a7922 100644 --- a/Amplify/Categories/Auth/Result/AuthUpdateAttributeResult.swift +++ b/Amplify/Categories/Auth/Result/AuthUpdateAttributeResult.swift @@ -22,3 +22,5 @@ public struct AuthUpdateAttributeResult { self.nextStep = nextStep } } + +extension AuthUpdateAttributeResult: Sendable { } diff --git a/Amplify/Categories/DataStore/Subscribe/DataStoreQuerySnapshot.swift b/Amplify/Categories/DataStore/Subscribe/DataStoreQuerySnapshot.swift index 3f801cbcc8..79afac3de6 100644 --- a/Amplify/Categories/DataStore/Subscribe/DataStoreQuerySnapshot.swift +++ b/Amplify/Categories/DataStore/Subscribe/DataStoreQuerySnapshot.swift @@ -9,7 +9,7 @@ import Foundation /// A snapshot of the items from DataStore, the changes since last snapshot, and whether this model has /// finished syncing and subscriptions are active -public struct DataStoreQuerySnapshot { +public struct DataStoreQuerySnapshot where M: Model, M: Sendable { /// All model instances from the local store public let items: [M] @@ -22,5 +22,3 @@ public struct DataStoreQuerySnapshot { self.isSynced = isSynced } } - -extension DataStoreQuerySnapshot: Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageDownloadDataRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageDownloadDataRequest.swift index 73cf9f57fc..dae3a36812 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageDownloadDataRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageDownloadDataRequest.swift @@ -128,3 +128,5 @@ public extension StorageDownloadDataRequest { } } } + +extension StorageDownloadDataRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageDownloadFileRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageDownloadFileRequest.swift index cc68d539bd..3bc76e85c7 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageDownloadFileRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageDownloadFileRequest.swift @@ -116,3 +116,5 @@ public extension StorageDownloadFileRequest { } } } + +extension StorageDownloadFileRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageGetURLRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageGetURLRequest.swift index c86db0b4ba..0cd51ae9f6 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageGetURLRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageGetURLRequest.swift @@ -128,3 +128,5 @@ public extension StorageGetURLRequest { } } } + +extension StorageGetURLRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageListRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageListRequest.swift index 0c66976aeb..469ad71d8f 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageListRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageListRequest.swift @@ -169,3 +169,6 @@ public extension StorageListRequest.Options { } } } + +extension StorageListRequest.Options: @unchecked Sendable { } +extension StorageListRequest.Options.SubpathStrategy: Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageRemoveRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageRemoveRequest.swift index 39b10e099d..33724d2148 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageRemoveRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageRemoveRequest.swift @@ -89,3 +89,5 @@ public extension StorageRemoveRequest { } } } + +extension StorageRemoveRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageUploadDataRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageUploadDataRequest.swift index 174aa06fc9..2fdc352c61 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageUploadDataRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageUploadDataRequest.swift @@ -139,3 +139,5 @@ public extension StorageUploadDataRequest { } } } + +extension StorageUploadDataRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Storage/Operation/Request/StorageUploadFileRequest.swift b/Amplify/Categories/Storage/Operation/Request/StorageUploadFileRequest.swift index b7c2e73830..88ab15da89 100644 --- a/Amplify/Categories/Storage/Operation/Request/StorageUploadFileRequest.swift +++ b/Amplify/Categories/Storage/Operation/Request/StorageUploadFileRequest.swift @@ -136,3 +136,5 @@ public extension StorageUploadFileRequest { } } } + +extension StorageUploadFileRequest.Options: @unchecked Sendable { } diff --git a/Amplify/Categories/Storage/Result/StorageListResult.swift b/Amplify/Categories/Storage/Result/StorageListResult.swift index 1adee4ea08..31b82903c8 100644 --- a/Amplify/Categories/Storage/Result/StorageListResult.swift +++ b/Amplify/Categories/Storage/Result/StorageListResult.swift @@ -49,6 +49,8 @@ public struct StorageListResult { public let nextToken: String? } +extension StorageListResult: Sendable { } + extension StorageListResult { /// - Tag: StorageListResultItem @@ -122,3 +124,5 @@ extension StorageListResult { } } } + +extension StorageListResult.Item: Sendable { } diff --git a/Amplify/Core/Support/AmplifyInProcessReportingOperation.swift b/Amplify/Core/Support/AmplifyInProcessReportingOperation.swift index f77e99d932..a146ca5309 100644 --- a/Amplify/Core/Support/AmplifyInProcessReportingOperation.swift +++ b/Amplify/Core/Support/AmplifyInProcessReportingOperation.swift @@ -22,7 +22,7 @@ open class AmplifyInProcessReportingOperation< InProcess, Success, Failure: AmplifyError ->: AmplifyOperation { +>: AmplifyOperation, @unchecked Sendable { public typealias InProcess = InProcess var inProcessListenerUnsubscribeToken: UnsubscribeToken? diff --git a/Amplify/Core/Support/AmplifyOperation.swift b/Amplify/Core/Support/AmplifyOperation.swift index 07d122d68c..2cb2b39e85 100644 --- a/Amplify/Core/Support/AmplifyOperation.swift +++ b/Amplify/Core/Support/AmplifyOperation.swift @@ -16,7 +16,7 @@ import Foundation /// implementation of a `dispatch` method that sends a contextualized payload to the Hub. /// /// Pausable/resumable tasks that do not require Hub dispatching should use AsynchronousOperation instead. -open class AmplifyOperation: AsynchronousOperation { +open class AmplifyOperation: AsynchronousOperation, @unchecked Sendable { /// The concrete Request associated with this operation public typealias Request = Request diff --git a/Amplify/Core/Support/AmplifyTask+OperationTaskAdapters.swift b/Amplify/Core/Support/AmplifyTask+OperationTaskAdapters.swift index 50e505bce9..2aa29e544f 100644 --- a/Amplify/Core/Support/AmplifyTask+OperationTaskAdapters.swift +++ b/Amplify/Core/Support/AmplifyTask+OperationTaskAdapters.swift @@ -12,7 +12,7 @@ import Combine public class AmplifyOperationTaskAdapter: AmplifyTask { + Failure: AmplifyError>: AmplifyTask, @unchecked Sendable { let operation: AmplifyOperation let childTask: ChildTask var resultToken: UnsubscribeToken? @@ -67,7 +67,7 @@ public class AmplifyOperationTaskAdapter: AmplifyTask, AmplifyInProcessReportingTask { + Failure: AmplifyError>: AmplifyTask, AmplifyInProcessReportingTask, @unchecked Sendable { let operation: AmplifyInProcessReportingOperation let childTask: ChildTask var resultToken: UnsubscribeToken? diff --git a/Amplify/Core/Support/AsychronousOperation.swift b/Amplify/Core/Support/AsychronousOperation.swift index 762b336e39..44496d581b 100644 --- a/Amplify/Core/Support/AsychronousOperation.swift +++ b/Amplify/Core/Support/AsychronousOperation.swift @@ -12,7 +12,7 @@ import Foundation /// from the OperationQueue after it has completed all its work. This class is not inherently thread safe. Although it /// is a subclass of Foundation's Operation, it contains private state to support pausing, resuming, and finishing, that /// must be managed by callers. -open class AsynchronousOperation: Operation { +open class AsynchronousOperation: Operation, @unchecked Sendable { /// State for this operation. @objc private enum OperationState: Int { diff --git a/Amplify/Core/Support/AtomicValue.swift b/Amplify/Core/Support/AtomicValue.swift index 3664b17377..5b78b22d16 100644 --- a/Amplify/Core/Support/AtomicValue.swift +++ b/Amplify/Core/Support/AtomicValue.swift @@ -8,7 +8,7 @@ import Foundation /// A class that wraps access to its underlying value with an NSLocking instance. -public final class AtomicValue { +public final class AtomicValue: @unchecked Sendable { let lock: NSLocking var value: Value diff --git a/Amplify/DefaultPlugins/AWSHubPlugin/Internal/HubChannelDispatcher.swift b/Amplify/DefaultPlugins/AWSHubPlugin/Internal/HubChannelDispatcher.swift index 7a3b10d54a..0d9785f12b 100644 --- a/Amplify/DefaultPlugins/AWSHubPlugin/Internal/HubChannelDispatcher.swift +++ b/Amplify/DefaultPlugins/AWSHubPlugin/Internal/HubChannelDispatcher.swift @@ -85,7 +85,7 @@ protocol HubDispatchOperationDelegate: AnyObject { var listeners: [FilteredListener] { get } } -final class HubDispatchOperation: Operation { +final class HubDispatchOperation: Operation, @unchecked Sendable { private static let thresholdForConcurrentPerform = 500 diff --git a/Amplify/DevMenu/AmplifyDevMenu.swift b/Amplify/DevMenu/AmplifyDevMenu.swift index 6a9a98955b..9fe3b8b0f6 100644 --- a/Amplify/DevMenu/AmplifyDevMenu.swift +++ b/Amplify/DevMenu/AmplifyDevMenu.swift @@ -13,7 +13,7 @@ import UIKit /// Presents a developer menu using the provided `DevMenuPresentationContextProvider` /// upon notification from a `TriggerRecognizer`. Default recognizer is a `LongPressGestureRecognizer` @MainActor -public final class AmplifyDevMenu: DevMenuBehavior, TriggerDelegate { +public final class AmplifyDevMenu: @preconcurrency DevMenuBehavior, @preconcurrency TriggerDelegate { weak var devMenuPresentationContextProvider: DevMenuPresentationContextProvider? var triggerRecognizer: TriggerRecognizer? diff --git a/Amplify/DevMenu/View/IssueReporter.swift b/Amplify/DevMenu/View/IssueReporter.swift index bcec472e1a..23a396c6a7 100644 --- a/Amplify/DevMenu/View/IssueReporter.swift +++ b/Amplify/DevMenu/View/IssueReporter.swift @@ -97,11 +97,11 @@ struct IssueReporter: View { /// Open Amplify iOS issue logging screen on Github private func reportToGithub() { Task { - let issue = await IssueInfo(issueDescription: issueDescription, + let issue = IssueInfo(issueDescription: issueDescription, includeEnvInfo: includeEnvInfo, includeDeviceInfo: includeDeviceInfo) let issueDescriptionMarkdown = - await IssueInfoHelper.generateMarkdownForIssue( + IssueInfoHelper.generateMarkdownForIssue( issue: issue) let urlString = amplifyIosNewIssueUrl + issueDescriptionMarkdown @@ -122,10 +122,10 @@ struct IssueReporter: View { /// Copy issue as a markdown string to clipboard private func copyToClipboard() { Task { - let issue = await IssueInfo(issueDescription: issueDescription, + let issue = IssueInfo(issueDescription: issueDescription, includeEnvInfo: includeEnvInfo, includeDeviceInfo: includeDeviceInfo) - let value = await IssueInfoHelper.generateMarkdownForIssue(issue: issue) + let value = IssueInfoHelper.generateMarkdownForIssue(issue: issue) #if os(iOS) UIPasteboard.general.string = value #elseif canImport(AppKit) diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift index b3a61608fb..5f073bc15e 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLOperation.swift @@ -9,7 +9,7 @@ import Amplify import AWSPluginsCore import Foundation -final public class AWSGraphQLOperation: GraphQLOperation { +final public class AWSGraphQLOperation: GraphQLOperation, @unchecked Sendable { let session: URLSessionBehavior let mapper: OperationTaskMapper diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift index 3ee8e9856f..01414ced0a 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift @@ -183,7 +183,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, } // Class is still necessary. See https://github.com/aws-amplify/amplify-swift/issues/2252 -final public class AWSGraphQLSubscriptionOperation: GraphQLSubscriptionOperation { +final public class AWSGraphQLSubscriptionOperation: GraphQLSubscriptionOperation, @unchecked Sendable { let pluginConfig: AWSAPICategoryPluginConfiguration let appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol @@ -407,7 +407,7 @@ fileprivate func toAPIError(_ errors: [Error], type: R.Type) -> AP GraphQLResponseError.error(errors) ) - case let errors as [WebSocketClient.Error]: + case _ as [WebSocketClient.Error]: return APIError.networkError("WebSocketClient connection aborted", nil, URLError(.networkConnectionLost)) default: return APIError.operationError( diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift index bb4a87396d..910713429e 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSHTTPURLResponse.swift @@ -23,7 +23,7 @@ import Foundation /// **Note**: The class inheritance to `HTTPURLResponse` is to provide above mechanism, and actual /// implementation acts as a facade that stores an instance of `HTTPURLResponse` that delegates overidden methods to /// this stored property. -public class AWSHTTPURLResponse: HTTPURLResponse { +public class AWSHTTPURLResponse: HTTPURLResponse, @unchecked Sendable { /// The body of the response, if available public let body: Data? diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift index 3680b22728..5f29748c71 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSRESTOperation.swift @@ -12,7 +12,7 @@ final public class AWSRESTOperation: AmplifyOperation< RESTOperationRequest, Data, APIError ->, RESTOperation { +>, RESTOperation, @unchecked Sendable { // Data received by the operation var data = Data() diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift index e2b405da1d..9d328b5062 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/APISwiftCompatibility/APISwiftTests.swift @@ -13,7 +13,6 @@ final class APISwiftTests: XCTestCase { func testCreateBlogMutation() { let file = S3ObjectInput(bucket: "bucket", key: "let", region: "region") let input = CreateBlogInput(name: "name", file: file) - let condition = ModelBlogConditionInput(name: .init(eq: "name")) let mutation = CreateBlogMutation(input: input) let request = GraphQLRequest( @@ -21,7 +20,7 @@ final class APISwiftTests: XCTestCase { variables: mutation.variables?.jsonObject, responseType: CreateBlogMutation.Data.self) - var expectedDocument = """ + let expectedDocument = """ mutation CreateBlog($input: CreateBlogInput!, $condition: ModelBlogConditionInput) { createBlog(input: $input, condition: $condition) { __typename diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift index 99b36943f1..c093ebb720 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift @@ -554,7 +554,6 @@ class AppSyncRealTimeClientTests: XCTestCase { func testReconnect_whenHeartBeatSignalIsNotReceived() async throws { var cancellables = Set() - let timeout = 1.0 let mockWebSocketClient = MockWebSocketClient() let mockAppSyncRequestInterceptor = MockAppSyncRequestInterceptor() let appSyncClient = AppSyncRealTimeClient( diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift index 74e1041f82..e12cd2d16a 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift @@ -46,7 +46,7 @@ class AuthTokenURLRequestInterceptorTests: XCTestCase { do { _ = try await interceptor.intercept(request).allHTTPHeaderFields } catch { - guard case .operationError(let description, _, let underlyingError) = error as? APIError, + guard case .operationError(_, _, let underlyingError) = error as? APIError, let authError = underlyingError as? AuthError, case .sessionExpired = authError else { XCTFail("Should be API.operationError with underlying AuthError.sessionExpired") diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift index 88ed40292d..7bafe39ddf 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Support/Decode/GraphQLResponseDecoderPostComment4V2Tests.swift @@ -320,7 +320,7 @@ class GraphQLResponseDecoderPostComment4V2Tests: XCTestCase, SharedTestCasesPost XCTAssertEqual(input["postID"] as? String, post.id) let decoder = GraphQLResponseDecoder(request: request.toOperationRequest(operationType: .query)) - var graphQLData: [String: JSONValue] = [ + let graphQLData: [String: JSONValue] = [ "\(request.decodePath!)": [ "id": "id", "content": "content", diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/ASFDeviceInfo.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/ASFDeviceInfo.swift index ddb5d61259..84de8d7ff9 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/ASFDeviceInfo.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/ASFDeviceInfo.swift @@ -8,7 +8,6 @@ import Foundation import Amplify -@MainActor struct ASFDeviceInfo: ASFDeviceBehavior { let id: String @@ -18,46 +17,69 @@ struct ASFDeviceInfo: ASFDeviceBehavior { } var model: String { - DeviceInfo.current.model + get async { + await MainActor.run { DeviceInfo.current.model } + } } var name: String { - DeviceInfo.current.name + get async { + await MainActor.run { DeviceInfo.current.name } + } } var type: String { - var systemInfo = utsname() - uname(&systemInfo) - return String(bytes: Data(bytes: &systemInfo.machine, - count: Int(_SYS_NAMELEN)), - encoding: .utf8) ?? DeviceInfo.current.hostName + get async { + await MainActor.run { + var systemInfo = utsname() + uname(&systemInfo) + return String(bytes: Data(bytes: &systemInfo.machine, + count: Int(_SYS_NAMELEN)), + encoding: .utf8) ?? DeviceInfo.current.hostName + } + } } var platform: String { - DeviceInfo.current.operatingSystem.name + get async { + await MainActor.run { DeviceInfo.current.operatingSystem.name } + } } var version: String { - DeviceInfo.current.operatingSystem.version + get async { + await MainActor.run { DeviceInfo.current.operatingSystem.version } + } } var thirdPartyId: String? { - DeviceInfo.current.identifierForVendor?.uuidString + get async { + await MainActor.run { DeviceInfo.current.identifierForVendor?.uuidString } + } } var height: String { - String(format: "%.0f", DeviceInfo.current.screenBounds.height) + get async { + await MainActor.run { String(format: "%.0f", DeviceInfo.current.screenBounds.height) } + } } var width: String { - String(format: "%.0f", DeviceInfo.current.screenBounds.width) + get async { + await MainActor.run { String(format: "%.0f", DeviceInfo.current.screenBounds.width) } + } } var locale: String { - return Locale.preferredLanguages[0] + get async { + await MainActor.run { Locale.preferredLanguages[0] } + } } - func deviceInfo() -> String { + func deviceInfo() async -> String { + let model = await self.model + let type = await self.type + let version = await self.version var build = "release" #if DEBUG build = "debug" diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/AdvancedSecurityBehavior.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/AdvancedSecurityBehavior.swift index c5c688972b..c230cad0cb 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/AdvancedSecurityBehavior.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/AdvancedSecurityBehavior.swift @@ -12,32 +12,32 @@ protocol AdvancedSecurityBehavior { func userContextData(for username: String, deviceInfo: ASFDeviceBehavior, appInfo: ASFAppInfoBehavior, - configuration: UserPoolConfigurationData) throws -> String + configuration: UserPoolConfigurationData) async throws -> String } protocol ASFDeviceBehavior: Sendable { var id: String { get } - var model: String { get } + var model: String { get async } - var name: String { get } + var name: String { get async } - var platform: String { get } + var platform: String { get async } - var version: String { get } + var version: String { get async } - var thirdPartyId: String? { get } + var thirdPartyId: String? { get async } - var height: String { get } + var height: String { get async } - var width: String { get } + var width: String { get async } - var locale: String { get } + var locale: String { get async } - var type: String { get } + var type: String { get async } - func deviceInfo() -> String + func deviceInfo() async -> String } protocol ASFAppInfoBehavior { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF+KeyChain.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF+KeyChain.swift index 8949aee102..47253c5ffc 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF+KeyChain.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF+KeyChain.swift @@ -33,11 +33,11 @@ extension CognitoUserPoolASF { asfDeviceId: String, asfClient: AdvancedSecurityBehavior, userPoolConfiguration: UserPoolConfigurationData) async -> String? { - let deviceInfo: ASFDeviceBehavior = await ASFDeviceInfo(id: asfDeviceId) + let deviceInfo: ASFDeviceBehavior = ASFDeviceInfo(id: asfDeviceId) let appInfo: ASFAppInfoBehavior = ASFAppInfo() do { - return try asfClient.userContextData( + return try await asfClient.userContextData( for: username, deviceInfo: deviceInfo, appInfo: appInfo, diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF.swift index 4d9568f270..a76c6a78d1 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ASF/CognitoUserPoolASF.swift @@ -30,9 +30,9 @@ struct CognitoUserPoolASF: AdvancedSecurityBehavior { func userContextData(for username: String = "unknown", deviceInfo: ASFDeviceBehavior, appInfo: ASFAppInfoBehavior, - configuration: UserPoolConfigurationData) throws -> String { + configuration: UserPoolConfigurationData) async throws -> String { - let contextData = prepareUserContextData(deviceInfo: deviceInfo, appInfo: appInfo) + let contextData = await prepareUserContextData(deviceInfo: deviceInfo, appInfo: appInfo) let payload = try prepareJsonPayload(username: username, contextData: contextData, userPoolId: configuration.poolId) @@ -43,31 +43,31 @@ struct CognitoUserPoolASF: AdvancedSecurityBehavior { } func prepareUserContextData(deviceInfo: ASFDeviceBehavior, - appInfo: ASFAppInfoBehavior) -> [String: String] { + appInfo: ASFAppInfoBehavior) async -> [String: String] { var build = "release" #if DEBUG build = "debug" #endif - let fingerPrint = deviceInfo.deviceInfo() + let fingerPrint = await deviceInfo.deviceInfo() var contextData: [String: String] = [ Self.targetSDKKey: appInfo.targetSDK, Self.appVersionKey: appInfo.version, - Self.deviceNameKey: deviceInfo.name, - Self.phoneTypeKey: deviceInfo.type, + Self.deviceNameKey: await deviceInfo.name, + Self.phoneTypeKey: await deviceInfo.type, Self.deviceIdKey: deviceInfo.id, - Self.releaseVersionKey: deviceInfo.version, - Self.platformKey: deviceInfo.platform, + Self.releaseVersionKey: await deviceInfo.version, + Self.platformKey: await deviceInfo.platform, Self.buildTypeKey: build, Self.timezoneKey: timeZoneOffet(), - Self.deviceHeightKey: deviceInfo.height, - Self.deviceWidthKey: deviceInfo.width, - Self.deviceLanguageKey: deviceInfo.locale, + Self.deviceHeightKey: await deviceInfo.height, + Self.deviceWidthKey: await deviceInfo.width, + Self.deviceLanguageKey: await deviceInfo.locale, Self.deviceFingerPrintKey: fingerPrint ] if let appName = appInfo.name { contextData[Self.appNameKey] = appName } - if let thirdPartyDeviceIdKey = deviceInfo.thirdPartyId { + if let thirdPartyDeviceIdKey = await deviceInfo.thirdPartyId { contextData[Self.thirdPartyDeviceIdKey] = thirdPartyDeviceIdKey } return contextData diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/CustomSignIn/InitiateCustomAuth.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/CustomSignIn/InitiateCustomAuth.swift index ff1c572f06..411a09499a 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/CustomSignIn/InitiateCustomAuth.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/CustomSignIn/InitiateCustomAuth.swift @@ -67,9 +67,9 @@ struct InitiateCustomAuth: Action { logVerbose("\(#fileID) Starting execution", environment: environment) let response = try await cognitoClient.initiateAuth(input: request) - return try UserPoolSignInHelper.parseResponse(response, - for: username, - signInMethod: .apiBased(.customWithoutSRP)) + return UserPoolSignInHelper.parseResponse(response, + for: username, + signInMethod: .apiBased(.customWithoutSRP)) } } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/ConfirmSignUp.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/ConfirmSignUp.swift index 44d289bce6..09afbdf606 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/ConfirmSignUp.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/ConfirmSignUp.swift @@ -66,7 +66,7 @@ extension ConfirmSignUp: CustomDebugDictionaryConvertible { "identifier": identifier, "signUpEventData": data.debugDictionary, "confirmationCode": confirmationCode.masked(), - "forceAliasCreation": forceAliasCreation + "forceAliasCreation": forceAliasCreation as Any ] } } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/InitiateSignUp.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/InitiateSignUp.swift index 67693df60f..96a404929b 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/InitiateSignUp.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignUp/InitiateSignUp.swift @@ -82,7 +82,7 @@ extension InitiateSignUp: CustomDebugDictionaryConvertible { [ "identifier": identifier, "signUpEventData": data.debugDictionary, - "attributes": attributes + "attributes": attributes as Any ] } } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift index 21df88d96b..a41a0432d2 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/ClientBehavior/AWSCognitoAuthPlugin+UserBehavior.swift @@ -98,7 +98,7 @@ public extension AWSCognitoAuthPlugin { } } - func getCurrentUser() async throws -> AuthUser { + func getCurrentUser() async throws -> any AuthUser { let taskHelper = AWSAuthTaskHelper(authStateMachine: authStateMachine) return try await taskHelper.getCurrentUser() } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthCognitoSession.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthCognitoSession.swift index 59d799e963..d063f322bc 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthCognitoSession.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthCognitoSession.swift @@ -6,7 +6,7 @@ // import Amplify -import AWSPluginsCore +@preconcurrency import AWSPluginsCore import Foundation public struct AWSAuthCognitoSession: AuthSession, @@ -64,12 +64,7 @@ public struct AWSAuthCognitoSession: AuthSession, return .failure(AuthError.signedOut( AuthPluginErrorConstants.userSubSignOutError.errorDescription, AuthPluginErrorConstants.userSubSignOutError.recoverySuggestion)) - } catch let error as AuthError { - return .failure(error) } catch { - let error = AuthError.unknown(""" - Could not retreive user sub from the fetched Cognito tokens. - """) return .failure(error) } } @@ -170,3 +165,5 @@ extension AWSAuthCognitoSession: CustomDebugStringConvertible { (debugDictionary as AnyObject).description } } + +extension AWSAuthCognitoSession: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthDevice.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthDevice.swift index b2ad2fbedd..bef6e3862d 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthDevice.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthDevice.swift @@ -42,3 +42,5 @@ public struct AWSAuthDevice: AuthDevice { self.lastModifiedDate = lastModifiedDate } } + +extension AWSAuthDevice: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthUser.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthUser.swift index 07172c8da2..b1968c2748 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthUser.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSAuthUser.swift @@ -20,3 +20,5 @@ public struct AWSAuthUser: AuthUser { public var userId: String } + +extension AWSAuthUser: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoSignOutResult.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoSignOutResult.swift index f8786e6353..a78bee9271 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoSignOutResult.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoSignOutResult.swift @@ -26,16 +26,24 @@ public enum AWSCognitoSignOutResult: AuthSignOutResult { case failed(AuthError) } +extension AWSCognitoSignOutResult: Sendable { } + public struct AWSCognitoRevokeTokenError { public let refreshToken: String public let error: AuthError } +extension AWSCognitoRevokeTokenError: Sendable { } + public struct AWSCognitoGlobalSignOutError { public let accessToken: String public let error: AuthError } +extension AWSCognitoGlobalSignOutError: Sendable { } + public struct AWSCognitoHostedUIError { public let error: AuthError } + +extension AWSCognitoHostedUIError: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoWebAuthnCredential.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoWebAuthnCredential.swift index ac328f45c4..a8f52b8d7a 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoWebAuthnCredential.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AWSCognitoWebAuthnCredential.swift @@ -26,3 +26,5 @@ public struct AWSCognitoWebAuthnCredential: AuthWebAuthnCredential { self.relyingPartyId = relyingPartyId } } + +extension AWSCognitoWebAuthnCredential: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthFlowType.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthFlowType.swift index b352e873c5..088c24307d 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthFlowType.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthFlowType.swift @@ -197,3 +197,5 @@ extension AuthFlowType { } } } + +extension AuthFlowType: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/FederateToIdentityPoolResult.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/FederateToIdentityPoolResult.swift index 63cca69272..dceab72943 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/FederateToIdentityPoolResult.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/FederateToIdentityPoolResult.swift @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 // -import AWSPluginsCore +@preconcurrency import AWSPluginsCore import Foundation public struct FederateToIdentityPoolResult { @@ -15,3 +15,5 @@ public struct FederateToIdentityPoolResult { public let identityId: String } + +extension FederateToIdentityPoolResult: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/MFAPreference.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/MFAPreference.swift index d2edb58d0f..04298e732b 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/MFAPreference.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/MFAPreference.swift @@ -25,6 +25,8 @@ public enum MFAPreference { } +extension MFAPreference: Sendable { } + extension MFAPreference { func smsSetting(isCurrentlyPreferred: Bool = false) -> CognitoIdentityProviderClientTypes.SMSMfaSettingsType { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/UserMFAPreference.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/UserMFAPreference.swift index a3724c25aa..27cf403f0a 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/UserMFAPreference.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/UserMFAPreference.swift @@ -17,3 +17,5 @@ public struct UserMFAPreference { public let preferred: MFAType? } + +extension UserMFAPreference: Sendable { } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/AuthConfigureOperation.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/AuthConfigureOperation.swift index 376ffefc4c..ef65d55c48 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/AuthConfigureOperation.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/AuthConfigureOperation.swift @@ -16,7 +16,7 @@ typealias ConfigureOperation = AmplifyOperation< Void, AuthError> -class AuthConfigureOperation: ConfigureOperation { +class AuthConfigureOperation: ConfigureOperation, @unchecked Sendable { let authConfiguration: AuthConfiguration let authStateMachine: AuthStateMachine diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Errors/AuthenticationError.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Errors/AuthenticationError.swift index 190f9cfc89..7ca10b90e6 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Errors/AuthenticationError.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Errors/AuthenticationError.swift @@ -42,7 +42,7 @@ extension AuthenticationError: Codable { switch self { case .configuration(let message): try container.encode(message, forKey: .configuration) - case .service(let message, let error): + case .service(let message, _): try container.encode(message, forKey: .service) case .unknown(let message): try container.encode(message, forKey: .unknown) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SRP/SRPSignInState+Resolver.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SRP/SRPSignInState+Resolver.swift index 2a37225a59..4fc6135209 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SRP/SRPSignInState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SRP/SRPSignInState+Resolver.swift @@ -32,7 +32,7 @@ extension SRPSignInState { switch oldState { case .notStarted: return resolveNotStarted(byApplying: srpSignInEvent) - case .initiatingSRPA(let signInEventData): + case .initiatingSRPA: return resolveInitiatingSRPA( byApplying: srpSignInEvent, from: oldState) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/HostedUI/HostedUIASWebAuthenticationSession.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/HostedUI/HostedUIASWebAuthenticationSession.swift index 4e42a50c99..e65499e037 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/HostedUI/HostedUIASWebAuthenticationSession.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/HostedUI/HostedUIASWebAuthenticationSession.swift @@ -8,7 +8,7 @@ import Foundation import Amplify #if os(iOS) || os(macOS) || os(visionOS) -import AuthenticationServices +@preconcurrency import AuthenticationServices #endif class HostedUIASWebAuthenticationSession: NSObject, HostedUISessionBehavior { @@ -62,7 +62,7 @@ class HostedUIASWebAuthenticationSession: NSObject, HostedUISessionBehavior { DispatchQueue.main.async { var canStart = true - if #available(macOS 10.15.4, iOS 13.4, *) { + if #available(macOS 12.0, iOS 13.4, *) { canStart = aswebAuthenticationSession.canStart } if canStart { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Helpers/AWSAuthTaskHelper.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Helpers/AWSAuthTaskHelper.swift index ba2e34c8a3..1e0d481e3c 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Helpers/AWSAuthTaskHelper.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Helpers/AWSAuthTaskHelper.swift @@ -72,17 +72,11 @@ class AWSAuthTaskHelper: DefaultLogger { throw AuthError.unknown("Unable to fetch auth session", nil) } - do { - let tokens = try cognitoTokenProvider.getCognitoTokens().get() - return tokens.accessToken - } catch let error as AuthError { - throw error - } catch { - throw AuthError.unknown("Unable to fetch auth session", error) - } + let tokens = try cognitoTokenProvider.getCognitoTokens().get() + return tokens.accessToken } - func getCurrentUser() async throws -> AuthUser { + func getCurrentUser() async throws -> any AuthUser { await didStateMachineConfigured() let authState = await authStateMachine.currentState diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/SetUpTOTPTask.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/SetUpTOTPTask.swift index 96c59dc9f3..f775d48ae3 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/SetUpTOTPTask.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/SetUpTOTPTask.swift @@ -52,7 +52,7 @@ class SetUpTOTPTask: AuthSetUpTOTPTask, DefaultLogger { } // Get the current user for passing in the result, so that TOTP URI could constructed - let authUser: AuthUser + let authUser: any AuthUser let currentState = await authStateMachine.currentState if case .configured(let authNState, _, _) = currentState, diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/ASFDeviceInfoTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/ASFDeviceInfoTests.swift index 130388d752..c8e8ccd13c 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/ASFDeviceInfoTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/ASFDeviceInfoTests.swift @@ -11,7 +11,7 @@ import XCTest class ASFDeviceInfoTests: XCTestCase { func testdeviceInfo() async { - let asf = await ASFDeviceInfo(id: "mockID") + let asf = ASFDeviceInfo(id: "mockID") let deviceFingerPrint = await asf.deviceInfo() XCTAssertNotNil(deviceFingerPrint) } diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/CognitoUserPoolASFTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/CognitoUserPoolASFTests.swift index b5dbf122cf..a34c0e546d 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/CognitoUserPoolASFTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/CognitoASFTests/CognitoUserPoolASFTests.swift @@ -23,8 +23,8 @@ class CognitoUserPoolASFTests: XCTestCase { /// When: userContextData is invoked /// Then: A non-empty string is returned func testUserContextData_shouldReturnData() async throws { - let deviceInfo = await ASFDeviceInfo(id: "mockedDevice") - let result = try userPool.userContextData( + let deviceInfo = ASFDeviceInfo(id: "mockedDevice") + let result = try await userPool.userContextData( for: "TestUser", deviceInfo: deviceInfo, appInfo: ASFAppInfo(), diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift index 03b6669c6f..6fe7ae9014 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/AuthorizationTests/AWSAuthFederationToIdentityPoolTests.swift @@ -505,7 +505,7 @@ class AWSAuthFederationToIdentityPoolTests: BaseAuthorizationTests { do { _ = try (session as? AuthCognitoTokensProvider)?.getCognitoTokens().get() } - catch let error as AuthError { + catch { guard case .invalidState = error else { XCTFail("Should throw Auth Error with invalid state \(error)") return @@ -585,7 +585,7 @@ class AWSAuthFederationToIdentityPoolTests: BaseAuthorizationTests { do { _ = try (session as? AuthCognitoTokensProvider)?.getCognitoTokens().get() } - catch let error as AuthError { + catch { guard case .invalidState = error else { XCTFail("Should throw Auth Error with invalid state \(error)") return @@ -678,7 +678,7 @@ class AWSAuthFederationToIdentityPoolTests: BaseAuthorizationTests { do { _ = try (session as? AuthCognitoTokensProvider)?.getCognitoTokens().get() } - catch let error as AuthError { + catch { guard case .invalidState = error else { XCTFail("Should throw Auth Error with invalid state \(error)") return diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorFetchDevicesTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorFetchDevicesTests.swift index a0606fdac9..9dfac89ba1 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorFetchDevicesTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorFetchDevicesTests.swift @@ -20,7 +20,7 @@ class DeviceBehaviorFetchDevicesTests: BasePluginTest { super.setUp() mockIdentityProvider = MockIdentityProvider( mockListDevicesOutput: { _ in - try ListDevicesOutput() + ListDevicesOutput() } ) } diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorRememberDeviceTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorRememberDeviceTests.swift index b0d262be4c..74ba8b522b 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorRememberDeviceTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TaskTests/DeviceBehaviorTests/DeviceBehaviorRememberDeviceTests.swift @@ -20,7 +20,7 @@ class DeviceBehaviorRememberDeviceTests: BasePluginTest { super.setUp() mockIdentityProvider = MockIdentityProvider( mockRememberDeviceResponse: { _ in - try UpdateDeviceStatusOutput() + UpdateDeviceStatusOutput() } ) } 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 a0cc62c640..e9cc8d33d2 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 @@ -16,7 +16,7 @@ extension ChangePasswordOutput: Codable { public init(from decoder: Decoder) throws { let containerValues = try decoder.container(keyedBy: CodingKeys.self) - guard let httpResponse = try containerValues.decodeIfPresent(HTTPResponse.self, forKey: .httpResponse) else { + guard (try containerValues.decodeIfPresent(HTTPResponse.self, forKey: .httpResponse)) != nil else { fatalError("Unable to decode http response") } self.init() 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 c602cf7108..e428e12ff4 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 @@ -7,6 +7,7 @@ import AWSCognitoIdentity import ClientRuntime +import Foundation extension GetCredentialsForIdentityOutput: Codable { enum CodingKeys: Swift.String, Swift.CodingKey { diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Results/AuthSignInResult+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Results/AuthSignInResult+Codable.swift index 8fc03da9af..8de74f63c9 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Results/AuthSignInResult+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/AuthCodableImplementations/Results/AuthSignInResult+Codable.swift @@ -30,7 +30,7 @@ extension AuthSignInResult: Codable { } } -extension AuthSignInStep: Equatable { +extension AuthSignInStep { public static func == (lhs: AuthSignInStep, rhs: AuthSignInStep) -> Bool { switch (lhs, rhs) { case (.confirmSignInWithSMSMFACode, .confirmSignInWithSMSMFACode), diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CodableStates/AuthState+Codable.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CodableStates/AuthState+Codable.swift index 0b57816f72..cc0ccc1df5 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CodableStates/AuthState+Codable.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CodableStates/AuthState+Codable.swift @@ -25,7 +25,6 @@ extension AuthState: Codable { if type == "AuthState.Configured" { let authenticationState = try values.decode(AuthenticationState.self, forKey: .authenticationState) let authorizationState = try values.decode(AuthorizationState.self, forKey: .authorizationState) - let signUpState = try values.decode(SignUpState.self, forKey: .signUpState) self = .configured( authenticationState, authorizationState, diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CognitoAPIDecoding/CognitoAPIDecodingHelper.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CognitoAPIDecoding/CognitoAPIDecodingHelper.swift index 6f80804dce..ccefda46d8 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CognitoAPIDecoding/CognitoAPIDecodingHelper.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/TestHarness/CognitoAPIDecoding/CognitoAPIDecodingHelper.swift @@ -192,7 +192,7 @@ struct CognitoAPIDecodingHelper { switch responseType { case "failure": guard case .string(let errorType) = response["errorType"], - case .string(let errorMessage) = response["errorType"] else { + case .string(_) = response["errorType"] else { fatalError() } diff --git a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/CredentialStore/CredentialStoreConfigurationTests.swift b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/CredentialStore/CredentialStoreConfigurationTests.swift index 68e3d53d2f..2460b59e47 100644 --- a/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/CredentialStore/CredentialStoreConfigurationTests.swift +++ b/AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/CredentialStore/CredentialStoreConfigurationTests.swift @@ -122,7 +122,7 @@ class CredentialStoreConfigurationTests: AWSAuthBaseTest { /// - When: /// - We invoke a new Credential store with new Auth Configuration where identity user pool gets added /// - Then: - /// - The keychain should be cleared + /// - The keychain should be NOT be cleared /// func testCredentialsMigratedOnNotSupportedConfigurationChange() { // Given @@ -147,7 +147,7 @@ class CredentialStoreConfigurationTests: AWSAuthBaseTest { // Then let credentials = try? newCredentialStore.retrieveCredential() - XCTAssertNil(credentials) + XCTAssertNotNil(credentials) } /// Test clearing of existing credentials when a configuration changes for identity pool @@ -175,8 +175,10 @@ class CredentialStoreConfigurationTests: AWSAuthBaseTest { } // When configuration changed - let newAuthConfig = AuthConfiguration.identityPools(IdentityPoolConfigurationData(poolId: "changed", - region: "changed")) + let newAuthConfig = AuthConfiguration.identityPools( + IdentityPoolConfigurationData( + poolId: "changed", + region: "changed")) let newCredentialStore = AWSCognitoAuthCredentialStore(authConfiguration: newAuthConfig) // Then diff --git a/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreMigrator.swift b/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreMigrator.swift index 580366c519..0bde84cc6e 100644 --- a/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreMigrator.swift +++ b/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreMigrator.swift @@ -29,7 +29,7 @@ public struct KeychainStoreMigrator { try? KeychainStore(service: newAttributes.service, accessGroup: newAttributes.accessGroup)._removeAll() } - var updateQuery = oldAttributes.defaultGetQuery() + let updateQuery = oldAttributes.defaultGetQuery() var updateAttributes = [String: Any]() updateAttributes[KeychainStore.Constants.AttributeService] = newAttributes.service diff --git a/AmplifyPlugins/Core/AWSPluginsCore/Model/GraphQLRequest/GraphQLRequest+Model.swift b/AmplifyPlugins/Core/AWSPluginsCore/Model/GraphQLRequest/GraphQLRequest+Model.swift index 7338fab830..dd2db8d657 100644 --- a/AmplifyPlugins/Core/AWSPluginsCore/Model/GraphQLRequest/GraphQLRequest+Model.swift +++ b/AmplifyPlugins/Core/AWSPluginsCore/Model/GraphQLRequest/GraphQLRequest+Model.swift @@ -334,7 +334,6 @@ extension GraphQLRequest: ModelGraphQLRequestFactory { includes: IncludedAssociations = { _ in [] }, limit: Int? = nil, authMode: AWSAuthorizationType? = nil) -> GraphQLRequest> { - let primaryKeysOnly = (M.rootPath != nil) ? true : false var documentBuilder = ModelBasedGraphQLDocumentBuilder(modelSchema: modelType.schema, operationType: .query) documentBuilder.add(decorator: DirectiveNameDecorator(type: .list)) diff --git a/AmplifyPlugins/Core/AWSPluginsCore/WebSocket/WebSocketClient.swift b/AmplifyPlugins/Core/AWSPluginsCore/WebSocket/WebSocketClient.swift index 21e867ab4e..3aa21e8943 100644 --- a/AmplifyPlugins/Core/AWSPluginsCore/WebSocket/WebSocketClient.swift +++ b/AmplifyPlugins/Core/AWSPluginsCore/WebSocket/WebSocketClient.swift @@ -28,7 +28,7 @@ public final actor WebSocketClient: NSObject { /// Interceptor for appending additional info before makeing the connection private var interceptor: WebSocketInterceptor? /// Internal wriable WebSocketEvent data stream - private let subject = PassthroughSubject() + nonisolated private let subject = PassthroughSubject() private let retryWithJitter = RetryWithJitter() diff --git a/AmplifyPlugins/Core/AWSPluginsCoreTests/WebSocket/LocalWebSocketServer.swift b/AmplifyPlugins/Core/AWSPluginsCoreTests/WebSocket/LocalWebSocketServer.swift index 1dc0fbd948..f1d8653d5f 100644 --- a/AmplifyPlugins/Core/AWSPluginsCoreTests/WebSocket/LocalWebSocketServer.swift +++ b/AmplifyPlugins/Core/AWSPluginsCoreTests/WebSocket/LocalWebSocketServer.swift @@ -93,7 +93,7 @@ class LocalWebSocketServer { func sendTransientFailureToConnections() { self.connections.forEach { - var metadata = NWProtocolWebSocket.Metadata(opcode: .close) + let metadata = NWProtocolWebSocket.Metadata(opcode: .close) metadata.closeCode = .protocolCode(NWProtocolWebSocket.CloseCode.Defined.internalServerError) $0.send( content: nil, diff --git a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift index a430f331f7..61ca8e6e05 100644 --- a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift +++ b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift @@ -10,6 +10,7 @@ import AwsCommonRuntimeKit import Amplify import InternalAmplifyCredentials import SmithyIdentity +import Foundation public class MockAWSAuthService: AWSAuthCredentialsProviderBehavior { diff --git a/AmplifyPlugins/Core/AmplifyCredentials/AmplifyAWSCredentialsProvider.swift b/AmplifyPlugins/Core/AmplifyCredentials/AmplifyAWSCredentialsProvider.swift index a0d6cc29c6..7c69e424ff 100644 --- a/AmplifyPlugins/Core/AmplifyCredentials/AmplifyAWSCredentialsProvider.swift +++ b/AmplifyPlugins/Core/AmplifyCredentials/AmplifyAWSCredentialsProvider.swift @@ -12,7 +12,7 @@ import Foundation import Smithy import SmithyIdentity -public class AmplifyAWSCredentialsProvider: AwsCommonRuntimeKit.CredentialsProviding { +public class AmplifyAWSCredentialsProvider: AwsCommonRuntimeKit.CredentialsProviding, @unchecked Sendable { public func getCredentials() async throws -> AwsCommonRuntimeKit.Credentials { let authSession = try await Amplify.Auth.fetchAuthSession() diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift index 29687e390c..05e7e42a5d 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift @@ -21,7 +21,7 @@ import Combine /// 3. Delete the original queried items from local store. This performs a cascade delete by default (See /// **CreateTableStatement** for more details, `on delete cascade` when creating the SQL table enables this behavior). /// 4. If sync is enabled, then submit the delete mutations to the sync engine, in the order of children to parent models. -public class CascadeDeleteOperation: AsynchronousOperation { +public class CascadeDeleteOperation: AsynchronousOperation, @unchecked Sendable { let storageAdapter: StorageEngineAdapter var syncEngine: RemoteSyncEngineBehavior? let modelType: M.Type @@ -242,11 +242,11 @@ public class CascadeDeleteOperation: AsynchronousOperation { return queriedModels } - private func collapseResults( - queryResult: DataStoreResult<[M]>?, - deleteResult: DataStoreResult<[M]>?, + private func collapseResults( + queryResult: DataStoreResult<[Q]>?, + deleteResult: DataStoreResult<[Q]>?, associatedModels: [(ModelName, Model)] - ) -> DataStoreResult> { + ) -> DataStoreResult> { guard let queryResult = queryResult else { return .failure(.unknown("queryResult not set during transaction", "coding error", nil)) @@ -519,8 +519,8 @@ public class CascadeDeleteOperation: AsynchronousOperation { // MARK: - Supporting types extension CascadeDeleteOperation { - struct QueryAndDeleteResult { - let deletedModels: [M] + struct QueryAndDeleteResult { + let deletedModels: [Q] let associatedModels: [(ModelName, Model)] } diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/StorageEngine+SyncRequirement.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/StorageEngine+SyncRequirement.swift index b6a8aac20c..d520908d21 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/StorageEngine+SyncRequirement.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/StorageEngine+SyncRequirement.swift @@ -25,21 +25,12 @@ extension StorageEngine { )) } - guard let apiGraphQL = api as? APICategoryGraphQLBehavior else { - log.info("Unable to find GraphQL API plugin for syncEngine. syncEngine will not be started") - return .failure(.configuration( - "Unable to find suitable GraphQL API plugin for syncEngine. syncEngine will not be started", - "Ensure the API category has been setup and configured for your project", - nil - )) - } - let authPluginRequired = StorageEngine.requiresAuthPlugin( api, authModeStrategy: dataStoreConfiguration.authModeStrategyType ) guard authPluginRequired else { - syncEngine.start(api: apiGraphQL, auth: nil) + syncEngine.start(api: api, auth: nil) return .success(.successfullyInitialized) } @@ -52,7 +43,7 @@ extension StorageEngine { )) } - syncEngine.start(api: apiGraphQL, auth: auth) + syncEngine.start(api: api, auth: auth) } return .success(result) diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/InitialSync/InitialSyncOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/InitialSync/InitialSyncOperation.swift index b37a860eae..4d9da933cf 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/InitialSync/InitialSyncOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/InitialSync/InitialSyncOperation.swift @@ -10,7 +10,7 @@ import AWSPluginsCore import Combine import Foundation -final class InitialSyncOperation: AsynchronousOperation { +final class InitialSyncOperation: AsynchronousOperation, @unchecked Sendable { typealias SyncQueryResult = PaginatedList private weak var api: APICategoryGraphQLBehavior? @@ -163,7 +163,7 @@ final class InitialSyncOperation: AsynchronousOperation { return } - guard let api = api else { + guard api != nil else { finish(result: .failure(DataStoreError.nilAPIHandle())) return } diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/ProcessMutationErrorFromCloudOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/ProcessMutationErrorFromCloudOperation.swift index c334745fb7..2d94b62222 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/ProcessMutationErrorFromCloudOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/ProcessMutationErrorFromCloudOperation.swift @@ -15,7 +15,7 @@ import AWSPluginsCore /// 1. When there is an APIError which is for an unauthenticated user, call the error handler. /// 2. When there is a "conditional request failed" error, then emit to the Hub a 'conditionalSaveFailed' event. /// 3. When there is a "conflict unahandled" error, trigger the conflict handler and reconcile the state of the system. -class ProcessMutationErrorFromCloudOperation: AsynchronousOperation { +class ProcessMutationErrorFromCloudOperation: AsynchronousOperation, @unchecked Sendable { typealias MutationSyncAPIRequest = GraphQLRequest typealias MutationSyncCloudResult = GraphQLOperation>.OperationResult diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/SyncMutationToCloudOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/SyncMutationToCloudOperation.swift index 40f9c04f06..9fc7293ee2 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/SyncMutationToCloudOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/OutgoingMutationQueue/SyncMutationToCloudOperation.swift @@ -13,7 +13,7 @@ import AWSPluginsCore /// Publishes a mutation event to the specified Cloud API. Upon receipt of the API response, validates to ensure it is /// not a retriable error. If it is, attempts a retry until either success or terminal failure. Upon success or /// terminal failure, publishes the event response to the appropriate ModelReconciliationQueue subject. -class SyncMutationToCloudOperation: AsynchronousOperation { +class SyncMutationToCloudOperation: AsynchronousOperation, @unchecked Sendable { typealias MutationSyncCloudResult = GraphQLOperation>.OperationResult diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/ReconcileAndLocalSave/ReconcileAndLocalSaveOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/ReconcileAndLocalSave/ReconcileAndLocalSaveOperation.swift index 7ba4449c50..4c71a58615 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/ReconcileAndLocalSave/ReconcileAndLocalSaveOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/SubscriptionSync/ReconcileAndLocalSave/ReconcileAndLocalSaveOperation.swift @@ -13,7 +13,7 @@ import AWSPluginsCore // swiftlint:disable type_body_length file_length /// Reconciles an incoming model mutation with the stored model. If there is no conflict (e.g., the incoming model has /// a later version than the stored model), then write the new data to the store. -class ReconcileAndLocalSaveOperation: AsynchronousOperation { +class ReconcileAndLocalSaveOperation: AsynchronousOperation, @unchecked Sendable { /// Disambiguation for the version of the model incoming from the remote API typealias RemoteModel = MutationSync diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/Support/CancelAwareBlockOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/Support/CancelAwareBlockOperation.swift index 7ae0d251f1..2ea1557ad4 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/Support/CancelAwareBlockOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/Support/CancelAwareBlockOperation.swift @@ -8,7 +8,7 @@ import Amplify import Foundation -final class CancelAwareBlockOperation: Operation { +final class CancelAwareBlockOperation: Operation, @unchecked Sendable { private let block: BasicClosure init(block: @escaping BasicClosure) { self.block = block diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/SQLStatementTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/SQLStatementTests.swift index 149edd2edb..31f58709a5 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/SQLStatementTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/SQLStatementTests.swift @@ -967,14 +967,6 @@ class SQLStatementTests: XCTestCase { where 1 = 1 and "root"."@@postForeignKey" = ? """ - let noJoin = """ - select - "root"."@@primaryKey" as "@@primaryKey", "root"."id" as "id", "root"."content" as "content", - "root"."createdAt" as "createdAt", "root"."updatedAt" as "updatedAt", "root"."@@postForeignKey" as "@@postForeignKey" - from "CommentWithCompositeKey" as "root" - where 1 = 1 - and "root"."@@postForeignKey" = ? - """ XCTAssertEqual(statement.stringValue, expectedStatement) } diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/StateMachineTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/StateMachineTests.swift index 5d36c0ca33..dc5edbf3f8 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/StateMachineTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Core/StateMachineTests.swift @@ -9,7 +9,7 @@ import XCTest import Combine // Testable import b/c StateMachine is an internal type -@testable import AWSDataStorePlugin +@testable @preconcurrency import AWSDataStorePlugin class StateMachineTests: XCTestCase { diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Storage/StorageEngineTestsLazyPostComment4V2Tests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Storage/StorageEngineTestsLazyPostComment4V2Tests.swift index 62f06849b6..5d7b312c83 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Storage/StorageEngineTestsLazyPostComment4V2Tests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Storage/StorageEngineTestsLazyPostComment4V2Tests.swift @@ -387,7 +387,7 @@ final class StorageEngineTestsLazyPostComment4V2Tests: StorageEngineTestsBase, S let comment2 = LazyChildComment4V2(id: "id2", content: "content", post: post2) try await saveAsync(comment2) - var posts = try await queryAsync(LazyParentPost4V2.self) + let posts = try await queryAsync(LazyParentPost4V2.self) XCTAssertEqual(posts.count, 2) guard let postId1 = posts.first(where: { $0.id == "postId1" }) else { XCTFail("Couldn't find post with `postId1`") diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/InitialSyncOperationTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/InitialSyncOperationTests.swift index 07cdd95ecb..07316b6f02 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/InitialSyncOperationTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/InitialSyncOperationTests.swift @@ -791,7 +791,8 @@ class InitialSyncOperationTests: XCTestCase { syncMetadataSaved.fulfill() } } - wait(for: [syncMetadataSaved], timeout: 1.0) + + await fulfillment(of: [syncMetadataSaved], timeout: 1.0) let apiWasQueried = expectation(description: "API was queried for a PaginatedList of AnyModel") let responder = QueryRequestResponder> { request in diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/ModelSyncedEventEmitterTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/ModelSyncedEventEmitterTests.swift index d3ee5e1a1b..809a8b9cfa 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/ModelSyncedEventEmitterTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/InitialSync/ModelSyncedEventEmitterTests.swift @@ -11,8 +11,8 @@ import Combine @testable import Amplify @testable import AmplifyTestCommon -@testable import AWSPluginsCore -@testable import AWSDataStorePlugin +@testable @preconcurrency import AWSPluginsCore +@testable @preconcurrency import AWSDataStorePlugin class ModelSyncedEventEmitterTests: XCTestCase { diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventPublisherTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventPublisherTests.swift index 3adb5410c2..25f4f1d441 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventPublisherTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/SubscriptionSync/IncomingAsyncSubscriptionEventPublisherTests.swift @@ -9,7 +9,7 @@ import XCTest @testable import Amplify @testable import AmplifyTestCommon @testable import AWSPluginsCore -@testable import AWSDataStorePlugin +@testable @preconcurrency import AWSDataStorePlugin final class IncomingAsyncSubscriptionEventPublisherTests: XCTestCase { var apiPlugin: MockAPICategoryPlugin! diff --git a/AmplifyPlugins/Geo/Tests/AWSLocationGeoPluginTests/Mocks/MockAWSClientConfiguration.swift b/AmplifyPlugins/Geo/Tests/AWSLocationGeoPluginTests/Mocks/MockAWSClientConfiguration.swift index 9e50f04e11..2df0b9e363 100644 --- a/AmplifyPlugins/Geo/Tests/AWSLocationGeoPluginTests/Mocks/MockAWSClientConfiguration.swift +++ b/AmplifyPlugins/Geo/Tests/AWSLocationGeoPluginTests/Mocks/MockAWSClientConfiguration.swift @@ -34,7 +34,7 @@ class MockEndPointResolver: EndpointResolver { } } -class MockLogAgent: LogAgent { +class MockLogAgent: LogAgent, @unchecked Sendable { func log( level: Smithy.LogAgentLevel, message: @autoclosure () -> String, diff --git a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/ActivityTrackerTests.swift b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/ActivityTrackerTests.swift index 8e0820aa39..d6756720e3 100644 --- a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/ActivityTrackerTests.swift +++ b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/ActivityTrackerTests.swift @@ -80,8 +80,8 @@ class ActivityTrackerTests: XCTestCase { stateMachine.processExpectation = expectation(description: "Application state changed") stateMachine.processExpectation?.expectedFulfillmentCount = 3 - NotificationCenter.default.post(Notification(name: Self.applicationDidMoveToBackgroundNotification)) - NotificationCenter.default.post(Notification(name: Self.applicationWillMoveToForegoundNotification)) + await NotificationCenter.default.post(Notification(name: Self.applicationDidMoveToBackgroundNotification)) + await NotificationCenter.default.post(Notification(name: Self.applicationWillMoveToForegoundNotification)) await NotificationCenter.default.post(Notification(name: Self.applicationWillTerminateNotification)) await fulfillment(of: [stateMachine.processExpectation!], timeout: 1) diff --git a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/AnalyticsClientTests.swift b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/AnalyticsClientTests.swift index 4e0be941ca..723ea9ecb7 100644 --- a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/AnalyticsClientTests.swift +++ b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/AnalyticsClientTests.swift @@ -152,7 +152,7 @@ class AnalyticsClientTests: XCTestCase { } } -private class MockTransaction: SKPaymentTransaction { +private class MockTransaction: SKPaymentTransaction, @unchecked Sendable { private let _transactionId: String private let _payment: SKPayment private class MockPayment: SKPayment { @@ -183,7 +183,7 @@ private class MockTransaction: SKPaymentTransaction { } } -private class MockProduct: SKProduct { +private class MockProduct: SKProduct, @unchecked Sendable { private let _productId: String private let _price: Double diff --git a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EndpointClientTests.swift b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EndpointClientTests.swift index 693a3b6787..e72be8504f 100644 --- a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EndpointClientTests.swift +++ b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EndpointClientTests.swift @@ -182,7 +182,6 @@ class EndpointClientTests: XCTestCase { func testConvertToPublicEndpoint_shouldReturnPublicEndpoint() async { let endpointProfile = await endpointClient.currentEndpointProfile() let publicEndpoint = endpointClient.convertToPublicEndpoint(endpointProfile) - let mockModel = MockEndpointInformationProvider() XCTAssertNotNil(publicEndpoint) XCTAssertNil(publicEndpoint.address) XCTAssertEqual(publicEndpoint.attributes?.count, 0) diff --git a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EventRecorderTests.swift b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EventRecorderTests.swift index ee604010b9..a3dd35c738 100644 --- a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EventRecorderTests.swift +++ b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/EventRecorderTests.swift @@ -136,7 +136,7 @@ class EventRecorderTests: XCTestCase { storage.events = [ event1, event2 ] pinpointClient.putEventsResult = .failure(NonRetryableError()) do { - let events = try await recorder.submitAllEvents() + _ = try await recorder.submitAllEvents() XCTFail("Expected error") } catch { XCTAssertEqual(pinpointClient.putEventsCount, 1) @@ -160,7 +160,7 @@ class EventRecorderTests: XCTestCase { storage.events = [ event1, event2 ] pinpointClient.putEventsResult = .failure(RetryableError()) do { - let events = try await recorder.submitAllEvents() + _ = try await recorder.submitAllEvents() XCTFail("Expected error") } catch { XCTAssertEqual(pinpointClient.putEventsCount, 1) @@ -184,7 +184,7 @@ class EventRecorderTests: XCTestCase { storage.events = [ event1, event2 ] pinpointClient.putEventsResult = .failure(ConnectivityError()) do { - let events = try await recorder.submitAllEvents() + _ = try await recorder.submitAllEvents() XCTFail("Expected error") } catch { XCTAssertEqual(pinpointClient.putEventsCount, 1) @@ -210,7 +210,7 @@ private struct NonRetryableError: Error, ModeledError { static var isThrottling = false } -private class ConnectivityError: NSError { +private class ConnectivityError: NSError, @unchecked Sendable { init() { super.init( domain: "ConnectivityError", diff --git a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/PinpointRequestsRegistryTests.swift b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/PinpointRequestsRegistryTests.swift index 9843a89e54..0e7ac38d0c 100644 --- a/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/PinpointRequestsRegistryTests.swift +++ b/AmplifyPlugins/Internal/Tests/InternalAWSPinpointUnitTests/PinpointRequestsRegistryTests.swift @@ -103,7 +103,7 @@ private class MockHttpClientEngine: HTTPClient { func close() async {} } -private class MockLogAgent: LogAgent { +private class MockLogAgent: LogAgent, @unchecked Sendable { let name = "MockLogAgent" var level: LogAgentLevel = .info diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Consumer/CloudWatchLoggingConsumer.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Consumer/CloudWatchLoggingConsumer.swift index bdcc17c458..0e0fd93850 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Consumer/CloudWatchLoggingConsumer.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Consumer/CloudWatchLoggingConsumer.swift @@ -113,20 +113,13 @@ extension CloudWatchLoggingConsumer: LogBatchConsumer { // to avoid potential race conditions with incomplete state if logStreamName == nil { - do { - // Explicitly capture self to avoid potential memory issues - let streamName = await self.formatter.formattedStreamName() - // Check if self is still valid and streamName is not nil before assigning - if !streamName.isEmpty { - self.logStreamName = streamName - } else { - // Fallback to a default if the stream name couldn't be determined - self.logStreamName = "default.\(UUID().uuidString)" - } - } catch { - // Handle any potential errors from async call - Amplify.Logging.error("Failed to get formatted stream name: \(error)") - // Fallback to a default + // Explicitly capture self to avoid potential memory issues + let streamName = await self.formatter.formattedStreamName() + // Check if self is still valid and streamName is not nil before assigning + if !streamName.isEmpty { + self.logStreamName = streamName + } else { + // Fallback to a default if the stream name couldn't be determined self.logStreamName = "default.\(UUID().uuidString)" } } @@ -138,28 +131,22 @@ extension CloudWatchLoggingConsumer: LogBatchConsumer { return } - do { - let stream = try? await self.client.describeLogStreams(input: DescribeLogStreamsInput( + let stream = try? await self.client.describeLogStreams(input: DescribeLogStreamsInput( + logGroupName: self.logGroupName, + logStreamNamePrefix: logStreamName + )).logStreams?.first(where: { stream in + return stream.logStreamName == logStreamName + }) + + if stream == nil { + _ = try? await self.client.createLogStream(input: CreateLogStreamInput( logGroupName: self.logGroupName, - logStreamNamePrefix: logStreamName - )).logStreams?.first(where: { stream in - return stream.logStreamName == logStreamName - }) - - if stream == nil { - _ = try? await self.client.createLogStream(input: CreateLogStreamInput( - logGroupName: self.logGroupName, - logStreamName: logStreamName - )) - } - - // Mark as complete only after all operations finished - ensureLogStreamExistsComplete = true - } catch { - Amplify.Logging.error("Error ensuring log stream exists: \(error)") - // Still mark as complete to avoid getting stuck in a failed state - ensureLogStreamExistsComplete = true + logStreamName: logStreamName + )) } + + // Mark as complete only after all operations finished + ensureLogStreamExistsComplete = true } private func sendLogEvents(_ entries: [LogEntry]) async throws { diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Persistence/LogFile.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Persistence/LogFile.swift index 03ee67607a..82aa7b1b9a 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Persistence/LogFile.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Persistence/LogFile.swift @@ -29,7 +29,7 @@ final class LogFile { self.fileURL = fileURL self.sizeLimitInBytes = sizeLimitInBytes self.handle = try FileHandle(forUpdating: fileURL) - if #available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *) { + if #available(macOS 12.0, iOS 13.4, watchOS 6.2, tvOS 13.4, *) { self.count = try self.handle.offset() } else { self.count = self.handle.offsetInFile @@ -67,7 +67,7 @@ final class LogFile { /// Writes the given **single line of text** represented as a /// Data to the underlying log file. func write(data: Data) throws { - if #available(macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4, *) { + if #available(macOS 12.0, iOS 13.4, watchOS 6.2, tvOS 13.4, *) { try self.handle.write(contentsOf: data) } else { self.handle.write(data) diff --git a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/AWSCloudWatchLoggingSessionControllerTests.swift b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/AWSCloudWatchLoggingSessionControllerTests.swift index 3b768b2735..6b06dd0942 100644 --- a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/AWSCloudWatchLoggingSessionControllerTests.swift +++ b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/AWSCloudWatchLoggingSessionControllerTests.swift @@ -39,7 +39,6 @@ final class AWSCloudWatchLoggingSessionControllerTests: XCTestCase { /// When: a flush log is called and fails to flush logs /// Then: a flushLogFailure Hub Event is sent to the Logging channel func testConsumeFailureSendsHubEvent() async throws { - throw XCTSkip("Temporarily disabling test which only fails on GitHub CI/CD") let hubEventExpectation = expectation(description: "Should receive the hub event") unsubscribeToken = Amplify.Hub.listen(to: .logging) { payload in switch payload.eventName { diff --git a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/CloudWatchLogConsumerTests.swift b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/CloudWatchLogConsumerTests.swift index 7fdfa20757..04f68670d8 100644 --- a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/CloudWatchLogConsumerTests.swift +++ b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/CloudWatchLogConsumerTests.swift @@ -27,7 +27,7 @@ final class CloudWatchLogConsumerTests: XCTestCase { client = MockCloudWatchLogsClient() logGroupName = UUID().uuidString logStreamName = UUID().uuidString - systemUnderTest = await CloudWatchLoggingConsumer(client: client, logGroupName: logGroupName, userIdentifier: "guest") + systemUnderTest = CloudWatchLoggingConsumer(client: client, logGroupName: logGroupName, userIdentifier: "guest") } override func tearDown() async throws { diff --git a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/LogRotationTests.swift b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/LogRotationTests.swift index de4481fd5f..d1070fb5a9 100644 --- a/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/LogRotationTests.swift +++ b/AmplifyPlugins/Logging/Tests/AWSCloudWatchLoggingPluginTests/LogRotationTests.swift @@ -178,7 +178,7 @@ final class LogRotationTests: XCTestCase { XCTAssertEqual(systemUnderTest.currentLogFile.fileURL.lastPathComponent, "amplify.1.log") try systemUnderTest.rotate() - var rotatedContents = try FileManager.default.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil) + let rotatedContents = try FileManager.default.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil) XCTAssertEqual(rotatedContents.map { $0.lastPathComponent }, [ "amplify.2.log", "amplify.1.log", diff --git a/AmplifyPlugins/Predictions/Tests/AWSPredictionsPluginUnitTests/LivenessTests/LivenessDecodingTests.swift b/AmplifyPlugins/Predictions/Tests/AWSPredictionsPluginUnitTests/LivenessTests/LivenessDecodingTests.swift index 385ea59515..b44c92bb84 100644 --- a/AmplifyPlugins/Predictions/Tests/AWSPredictionsPluginUnitTests/LivenessTests/LivenessDecodingTests.swift +++ b/AmplifyPlugins/Predictions/Tests/AWSPredictionsPluginUnitTests/LivenessTests/LivenessDecodingTests.swift @@ -207,7 +207,7 @@ class LivenessDecodingTests: XCTestCase { XCTFail("Input JSON is invalid") return } - let serverSessionInformationEvent = try JSONDecoder().decode( + _ = try JSONDecoder().decode( ServerSessionInformationEvent.self, from: data ) diff --git a/AmplifyPlugins/Predictions/Tests/CoreMLPredictionsPluginUnitTests/Mocks/MockOperationQueue.swift b/AmplifyPlugins/Predictions/Tests/CoreMLPredictionsPluginUnitTests/Mocks/MockOperationQueue.swift index 54635fe020..1be716c084 100644 --- a/AmplifyPlugins/Predictions/Tests/CoreMLPredictionsPluginUnitTests/Mocks/MockOperationQueue.swift +++ b/AmplifyPlugins/Predictions/Tests/CoreMLPredictionsPluginUnitTests/Mocks/MockOperationQueue.swift @@ -6,7 +6,7 @@ // import Foundation -public class MockOperationQueue: OperationQueue { +public class MockOperationQueue: OperationQueue, @unchecked Sendable { public var size = 0 diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift index 35c4e6f974..ab09a19dc5 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/AWSS3PreSignedURLBuilderAdapter.swift @@ -53,7 +53,7 @@ class AWSS3PreSignedURLBuilderAdapter: AWSS3PreSignedURLBuilderBehavior { expiration: expiration) case .uploadPart(let partNumber, let uploadId): let input = UploadPartInput(bucket: bucket, key: key, partNumber: partNumber, uploadId: uploadId) - preSignedUrl = try await input.customPresignURL( + preSignedUrl = try await input.presignURL( config: config, expiration: expiration) } diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/UploadPartInput+presignURL.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/UploadPartInput+presignURL.swift deleted file mode 100644 index 7b702f2300..0000000000 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Dependency/UploadPartInput+presignURL.swift +++ /dev/null @@ -1,200 +0,0 @@ -// -// Copyright Amazon.com Inc. or its affiliates. -// All Rights Reserved. -// -// SPDX-License-Identifier: Apache-2.0 - -import Foundation -import AWSS3 -@_spi(SmithyReadWrite) import ClientRuntime -@_spi(UnknownAWSHTTPServiceError) @_spi(SmithyReadWrite) @_spi(AWSEndpointResolverMiddleware) import AWSClientRuntime -import Smithy -import SmithyHTTPAPI -import SmithyRetries -@_spi(SmithyReadWrite) import SmithyXML - -// swiftlint:disable identifier_name -// swiftlint:disable line_length -extension UploadPartInput { - func customPresignURL( - config: S3Client.S3ClientConfiguration, - expiration: Foundation.TimeInterval - ) async throws -> Foundation.URL? { - let serviceName = "S3" - let input = self - let client: (SmithyHTTPAPI.HTTPRequest, Smithy.Context) async throws -> SmithyHTTPAPI.HTTPResponse = { (_, _) in - throw Smithy.ClientError.unknownError("No HTTP client configured for presigned request") - } - let context = Smithy.ContextBuilder() - .withMethod(value: .put) - .withServiceName(value: serviceName) - .withOperation(value: "uploadPart") - .withIdempotencyTokenGenerator(value: config.idempotencyTokenGenerator) - .withLogger(value: config.telemetryProvider.loggerProvider.getLogger(name: S3Client.clientName)) - .withPartitionID(value: config.partitionID) - .withAuthSchemes(value: config.authSchemes ?? []) - .withAuthSchemeResolver(value: config.authSchemeResolver) - .withUnsignedPayloadTrait(value: false) - .withSocketTimeout(value: config.httpClientConfiguration.socketTimeout) - .withIdentityResolver(value: config.bearerTokenIdentityResolver, schemeID: "smithy.api#httpBearerAuth") - .withFlowType(value: .PRESIGN_URL) - .withExpiration(value: expiration) - .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4") - .withIdentityResolver(value: config.awsCredentialIdentityResolver, schemeID: "aws.auth#sigv4a") - .withRegion(value: config.region) - .withSigningName(value: "s3") - .withSigningRegion(value: config.signingRegion) - .withUnsignedPayloadTrait(value: true) - .build() - let builder = ClientRuntime.OrchestratorBuilder() - config.interceptorProviders.forEach { provider in - builder.interceptors.add(provider.create()) - } - config.httpInterceptorProviders.forEach { provider in - builder.interceptors.add(provider.create()) - } - builder.interceptors.add(ClientRuntime.URLPathMiddleware(UploadPartInput.customUrlPathProvider(_:))) - builder.interceptors.add(ClientRuntime.URLHostMiddleware()) - builder.deserialize(ClientRuntime.DeserializeMiddleware(UploadPartOutput.customHttpOutput(from:), CustomUploadPartOutputError.httpError(from:))) - builder.interceptors.add(ClientRuntime.LoggerMiddleware(clientLogMode: config.clientLogMode)) - builder.retryStrategy(SmithyRetries.DefaultRetryStrategy(options: config.retryStrategyOptions)) - builder.retryErrorInfoProvider(AWSClientRuntime.AWSRetryErrorInfoProvider.errorInfo(for:)) - builder.applySigner(ClientRuntime.SignerMiddleware()) - let endpointParamsBlock = { [config] (context: Smithy.Context) in - EndpointParams(accelerate: config.accelerate ?? false, bucket: input.bucket, disableMultiRegionAccessPoints: config.disableMultiRegionAccessPoints ?? false, disableS3ExpressSessionAuth: config.disableS3ExpressSessionAuth, endpoint: config.endpoint, forcePathStyle: config.forcePathStyle ?? false, key: input.key, region: config.region, useArnRegion: config.useArnRegion, useDualStack: config.useDualStack ?? false, useFIPS: config.useFIPS ?? false, useGlobalEndpoint: config.useGlobalEndpoint ?? false) - } - context.set(key: Smithy.AttributeKey(name: "EndpointParams"), value: endpointParamsBlock(context)) - builder.applyEndpoint(AWSClientRuntime.AWSEndpointResolverMiddleware(paramsBlock: endpointParamsBlock, resolverBlock: { [config] in try config.endpointResolver.resolve(params: $0) })) - builder.selectAuthScheme(ClientRuntime.AuthSchemeMiddleware()) - builder.interceptors.add(AWSClientRuntime.AWSS3ErrorWith200StatusXMLMiddleware()) - builder.interceptors.add(AWSClientRuntime.FlexibleChecksumsRequestMiddleware(requestChecksumRequired: false, checksumAlgorithm: input.checksumAlgorithm?.rawValue, checksumAlgoHeaderName: "x-amz-sdk-checksum-algorithm")) - builder.serialize(UploadPartPresignedMiddleware()) - var metricsAttributes = Smithy.Attributes() - metricsAttributes.set(key: ClientRuntime.OrchestratorMetricsAttributesKeys.service, value: "S3") - metricsAttributes.set(key: ClientRuntime.OrchestratorMetricsAttributesKeys.method, value: "UploadPart") - let op = builder.attributes(context) - .telemetry(ClientRuntime.OrchestratorTelemetry( - telemetryProvider: config.telemetryProvider, - metricsAttributes: metricsAttributes, - meterScope: serviceName, - tracerScope: serviceName - )) - .executeRequest(client) - .build() - return try await op.presignRequest(input: input).endpoint.url - } -} - -private extension UploadPartInput { - static func customUrlPathProvider(_ value: UploadPartInput) -> Swift.String? { - guard let key = value.key else { - return nil - } - return "/\(key.urlPercentEncoding(encodeForwardSlash: false))" - } -} - -private extension UploadPartOutput { - static func customHttpOutput(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> UploadPartOutput { - var value = UploadPartOutput() - if let bucketKeyEnabledHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-bucket-key-enabled") { - value.bucketKeyEnabled = Swift.Bool(bucketKeyEnabledHeaderValue) ?? false - } - if let checksumCRC32HeaderValue = httpResponse.headers.value(for: "x-amz-checksum-crc32") { - value.checksumCRC32 = checksumCRC32HeaderValue - } - if let checksumCRC32CHeaderValue = httpResponse.headers.value(for: "x-amz-checksum-crc32c") { - value.checksumCRC32C = checksumCRC32CHeaderValue - } - if let checksumSHA1HeaderValue = httpResponse.headers.value(for: "x-amz-checksum-sha1") { - value.checksumSHA1 = checksumSHA1HeaderValue - } - if let checksumSHA256HeaderValue = httpResponse.headers.value(for: "x-amz-checksum-sha256") { - value.checksumSHA256 = checksumSHA256HeaderValue - } - if let eTagHeaderValue = httpResponse.headers.value(for: "ETag") { - value.eTag = eTagHeaderValue - } - if let requestChargedHeaderValue = httpResponse.headers.value(for: "x-amz-request-charged") { - value.requestCharged = S3ClientTypes.RequestCharged(rawValue: requestChargedHeaderValue) - } - if let sseCustomerAlgorithmHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-customer-algorithm") { - value.sseCustomerAlgorithm = sseCustomerAlgorithmHeaderValue - } - if let sseCustomerKeyMD5HeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-customer-key-MD5") { - value.sseCustomerKeyMD5 = sseCustomerKeyMD5HeaderValue - } - if let ssekmsKeyIdHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption-aws-kms-key-id") { - value.ssekmsKeyId = ssekmsKeyIdHeaderValue - } - if let serverSideEncryptionHeaderValue = httpResponse.headers.value(for: "x-amz-server-side-encryption") { - value.serverSideEncryption = S3ClientTypes.ServerSideEncryption(rawValue: serverSideEncryptionHeaderValue) - } - return value - } -} - -private enum CustomUploadPartOutputError { - static func httpError(from httpResponse: SmithyHTTPAPI.HTTPResponse) async throws -> Swift.Error { - let data = try await httpResponse.data() - let responseReader = try SmithyXML.Reader.from(data: data) - let baseError = try AWSClientRuntime.RestXMLError(httpResponse: httpResponse, responseReader: responseReader, noErrorWrapping: true) - if let error = baseError.customError() { return error } - if baseError.httpResponse.statusCode == .notFound && baseError.httpResponse.body.isEmpty { - return CustomUploadPartOutputError.NotFound( - httpResponse: baseError.httpResponse, - message: baseError.requestID, - requestID: baseError.message, - requestID2: baseError.requestID2 - ) - } - switch baseError.code { - default: return try AWSClientRuntime.UnknownAWSHTTPServiceError.makeError(baseError: baseError) - } - } - - private struct NotFound: ClientRuntime.ModeledError, AWSClientRuntime.AWSS3ServiceError, ClientRuntime.HTTPError, Swift.Error { - static var typeName: Swift.String { "NotFound" } - static var fault: ClientRuntime.ErrorFault { .client } - static var isRetryable: Swift.Bool { false } - static var isThrottling: Swift.Bool { false } - var httpResponse = SmithyHTTPAPI.HTTPResponse() - var message: Swift.String? - var requestID: Swift.String? - var requestID2: Swift.String? - } -} - -private struct UploadPartPresignedMiddleware: Smithy.RequestMessageSerializer { - typealias InputType = UploadPartInput - typealias RequestType = SmithyHTTPAPI.HTTPRequest - - let id: Swift.String = "UploadPartPresignedMiddleware" - - func apply( - input: InputType, - builder: SmithyHTTPAPI.HTTPRequestBuilder, - attributes: Smithy.Context - ) throws { - builder.withQueryItem(.init( - name: "x-id", - value: "UploadPart") - ) - - guard let partNumber = input.partNumber else { - throw ClientError.invalidValue("partNumber is required and must not be nil.") - } - builder.withQueryItem(.init( - name: "partNumber".urlPercentEncoding(), - value: Swift.String(partNumber).urlPercentEncoding()) - ) - - guard let uploadId = input.uploadId else { - throw ClientError.invalidValue("uploadId is required and must not be nil.") - } - builder.withQueryItem(.init( - name: "uploadId".urlPercentEncoding(), - value: Swift.String(uploadId).urlPercentEncoding()) - ) - } -} diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadDataOperation.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadDataOperation.swift index 0a1bc25de8..105c4abf28 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadDataOperation.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadDataOperation.swift @@ -19,7 +19,7 @@ class AWSS3StorageDownloadDataOperation: AmplifyInProcessReportingOperation< Progress, Data, StorageError ->, StorageDownloadDataOperation { +>, StorageDownloadDataOperation, @unchecked Sendable { let storageConfiguration: AWSS3StoragePluginConfiguration let storageServiceProvider: AWSS3StorageServiceProvider diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadFileOperation.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadFileOperation.swift index 4605459215..2338c2c46b 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadFileOperation.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageDownloadFileOperation.swift @@ -22,7 +22,7 @@ class AWSS3StorageDownloadFileOperation: AmplifyInProcessReportingOperation< Progress, Void, StorageError ->, StorageDownloadFileOperation { +>, StorageDownloadFileOperation, @unchecked Sendable { let storageConfiguration: AWSS3StoragePluginConfiguration let storageServiceProvider: AWSS3StorageServiceProvider diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageRemoveOperation.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageRemoveOperation.swift index 12602853f3..35bbd1eedc 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageRemoveOperation.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageRemoveOperation.swift @@ -18,7 +18,7 @@ class AWSS3StorageRemoveOperation: AmplifyOperation< StorageRemoveRequest, String, StorageError ->, StorageRemoveOperation { +>, StorageRemoveOperation, @unchecked Sendable { let storageConfiguration: AWSS3StoragePluginConfiguration let storageService: AWSS3StorageServiceBehavior diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadDataOperation.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadDataOperation.swift index a2751a4a1b..eed101fa8a 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadDataOperation.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadDataOperation.swift @@ -19,7 +19,7 @@ class AWSS3StorageUploadDataOperation: AmplifyInProcessReportingOperation< Progress, String, StorageError ->, StorageUploadDataOperation { +>, StorageUploadDataOperation, @unchecked Sendable { let storageConfiguration: AWSS3StoragePluginConfiguration let storageServiceProvider: AWSS3StorageServiceProvider diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadFileOperation.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadFileOperation.swift index 10d3ceb685..6c85089ce0 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadFileOperation.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Operation/AWSS3StorageUploadFileOperation.swift @@ -19,7 +19,7 @@ class AWSS3StorageUploadFileOperation: AmplifyInProcessReportingOperation< Progress, String, StorageError ->, StorageUploadFileOperation { +>, StorageUploadFileOperation, @unchecked Sendable { let storageConfiguration: AWSS3StoragePluginConfiguration let storageServiceProvider: AWSS3StorageServiceProvider diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/FileHandle+UInt64.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/FileHandle+UInt64.swift index be6eb4bb49..220d02d400 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/FileHandle+UInt64.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Support/Internal/FileHandle+UInt64.swift @@ -34,7 +34,7 @@ extension FileHandle { } private func readData(upToCount length: Int) throws -> Data? { - if #available(iOS 13.4, macOS 10.15.4, tvOS 13.4, *) { + if #available(iOS 13.4, macOS 12.0, tvOS 13.4, *) { return try read(upToCount: length) } else { return readData(ofLength: length) diff --git a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Mocks/MockOperationQueue.swift b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Mocks/MockOperationQueue.swift index 54635fe020..1be716c084 100644 --- a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Mocks/MockOperationQueue.swift +++ b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Mocks/MockOperationQueue.swift @@ -6,7 +6,7 @@ // import Foundation -public class MockOperationQueue: OperationQueue { +public class MockOperationQueue: OperationQueue, @unchecked Sendable { public var size = 0 diff --git a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Operation/AWSS3StorageUploadFileOperationTests.swift b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Operation/AWSS3StorageUploadFileOperationTests.swift index 971ad72d80..8e41153296 100644 --- a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Operation/AWSS3StorageUploadFileOperationTests.swift +++ b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Operation/AWSS3StorageUploadFileOperationTests.swift @@ -270,7 +270,6 @@ class AWSS3StorageUploadFileOperationTests: AWSS3StorageOperationTestBase { let filePath = NSTemporaryDirectory() + UUID().uuidString + ".tmp" let fileURL = URL(fileURLWithPath: filePath) FileManager.default.createFile(atPath: filePath, contents: testData, attributes: nil) - let expectedUploadSource = UploadSource.local(fileURL) let metadata = ["mykey": "Value"] let options = StorageUploadFileRequest.Options(accessLevel: .protected, @@ -316,7 +315,6 @@ class AWSS3StorageUploadFileOperationTests: AWSS3StorageOperationTestBase { let filePath = NSTemporaryDirectory() + UUID().uuidString + ".tmp" let fileURL = URL(fileURLWithPath: filePath) FileManager.default.createFile(atPath: filePath, contents: testData, attributes: nil) - let expectedUploadSource = UploadSource.local(fileURL) let metadata = ["mykey": "Value"] let options = StorageUploadFileRequest.Options(accessLevel: .protected, @@ -408,7 +406,6 @@ class AWSS3StorageUploadFileOperationTests: AWSS3StorageOperationTestBase { let filePath = NSTemporaryDirectory() + UUID().uuidString + ".tmp" let fileURL = URL(fileURLWithPath: filePath) FileManager.default.createFile(atPath: filePath, contents: testData, attributes: nil) - let expectedUploadSource = UploadSource.local(fileURL) let metadata = ["mykey": "Value"] let options = StorageUploadFileRequest.Options(accessLevel: .protected, diff --git a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/FileHandleTests.swift b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/FileHandleTests.swift index f623af2a51..77c067da33 100644 --- a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/FileHandleTests.swift +++ b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/FileHandleTests.swift @@ -19,7 +19,6 @@ class FileHandleTests: XCTestCase { let sourceFile = try createFile(from: sourceData) XCTAssertEqual(try StorageRequestUtils.getSize(sourceFile), UInt64(sourceString.count)) - let fileSystem = FileSystem() let bytesReadLimit = 2 let fileHandle = try FileHandle(forReadingFrom: sourceFile) diff --git a/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift index d1336f66a1..726338f471 100644 --- a/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockAPICategoryPlugin.swift @@ -274,7 +274,7 @@ class MockSecondAPICategoryPlugin: MockAPICategoryPlugin { } } -class MockGraphQLOperation: GraphQLOperation { +class MockGraphQLOperation: GraphQLOperation, @unchecked Sendable { override func pause() { } @@ -289,7 +289,7 @@ class MockGraphQLOperation: GraphQLOperation { } } -class MockSubscriptionGraphQLOperation: GraphQLSubscriptionOperation { +class MockSubscriptionGraphQLOperation: GraphQLSubscriptionOperation, @unchecked Sendable { override func pause() { } @@ -305,7 +305,7 @@ class MockSubscriptionGraphQLOperation: GraphQLSubscriptionOperati } } -class MockAPIOperation: AmplifyOperation, RESTOperation { +class MockAPIOperation: AmplifyOperation, RESTOperation, @unchecked Sendable { override func pause() { } diff --git a/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift index 195c88178a..5c1fcf0ac1 100644 --- a/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockAuthCategoryPlugin.swift @@ -10,7 +10,7 @@ import Amplify class MockAuthCategoryPlugin: MessageReporter, AuthCategoryPlugin { - public func getCurrentUser() async throws -> AuthUser { + public func getCurrentUser() async throws -> any AuthUser { fatalError() } diff --git a/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift index 5ba46da457..0a103e642f 100644 --- a/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockDataStoreCategoryPlugin.swift @@ -31,7 +31,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.saveModelListener] as? SaveModelResponder { Task { - if let callback = await responder.callback((model: model, + if let callback = responder.callback((model: model, where: condition)) { completion(callback) } @@ -52,7 +52,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.queryByIdListener] as? QueryByIdResponder { Task { - if let callback = await responder.callback((modelType: modelType, id: id)) { + if let callback = responder.callback((modelType: modelType, id: id)) { completion(callback) } } @@ -73,7 +73,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.queryByIdListener] as? QueryByIdResponder { Task { - if let callback = await responder.callback((modelType: modelType, id: id)) { + if let callback = responder.callback((modelType: modelType, id: id)) { completion(callback) } } @@ -96,7 +96,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.queryModelsListener] as? QueryModelsResponder { Task { - if let result = await responder.callback((modelType: modelType, + if let result = responder.callback((modelType: modelType, where: predicate, sort: sortInput, paginate: paginationInput)) { @@ -113,7 +113,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { notify("queryByPredicate") if let responder = responders[.queryModelsListener] as? QueryModelsResponder { - if let result = await responder.callback((modelType: modelType, + if let result = responder.callback((modelType: modelType, where: predicate, sort: sortInput, paginate: paginationInput)) { @@ -136,7 +136,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.queryByIdListener] as? QueryByIdResponder { Task { - if let callback = await responder.callback((modelType: modelType, id: id.stringValue)) { + if let callback = responder.callback((modelType: modelType, id: id.stringValue)) { completion(callback) } } @@ -158,7 +158,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { Task { - if let callback = await responder.callback((modelType: modelType, id: id)) { + if let callback = responder.callback((modelType: modelType, id: id)) { completion(callback) } } @@ -180,7 +180,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { Task { - if let callback = await responder.callback((modelType: modelType, id: id)) { + if let callback = responder.callback((modelType: modelType, id: id)) { completion(callback) } } @@ -202,7 +202,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.deleteByIdListener] as? DeleteByIdResponder { Task { - if let callback = await responder.callback((modelType: modelType, id: id.stringValue)) { + if let callback = responder.callback((modelType: modelType, id: id.stringValue)) { completion(callback) } } @@ -222,7 +222,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.deleteModelTypeListener] as? DeleteModelTypeResponder { Task { - if let callback = await responder.callback((modelType: modelType, where: predicate)) { + if let callback = responder.callback((modelType: modelType, where: predicate)) { completion(callback) } } @@ -241,7 +241,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.deleteModelListener] as? DeleteModelResponder { Task { - if let callback = await responder.callback((model: model, + if let callback = responder.callback((model: model, where: predicate)) { completion(callback) } @@ -259,7 +259,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.clearListener] as? ClearResponder { Task { - if let callback = await responder.callback(()) { + if let callback = responder.callback(()) { completion(callback) } } @@ -275,7 +275,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.clearListener] as? ClearResponder { Task { - if let callback = await responder.callback(()) { + if let callback = responder.callback(()) { completion(callback) } } @@ -291,7 +291,7 @@ class MockDataStoreCategoryPlugin: MessageReporter, DataStoreCategoryPlugin { if let responder = responders[.stopListener] as? StopResponder { Task { - if let callback = await responder.callback(()) { + if let callback = responder.callback(()) { completion(callback) } } diff --git a/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift b/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift index bc6255567f..4345f84790 100644 --- a/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift +++ b/AmplifyTestCommon/Mocks/MockStorageCategoryPlugin.swift @@ -251,7 +251,7 @@ class MockSecondStorageCategoryPlugin: MockStorageCategoryPlugin { } class MockStorageGetURLOperation: AmplifyOperation, - StorageGetURLOperation { + StorageGetURLOperation, @unchecked Sendable { override func pause() { } @@ -270,7 +270,7 @@ StorageDownloadDataRequest, Progress, Data, StorageError ->, StorageDownloadDataOperation { +>, StorageDownloadDataOperation, @unchecked Sendable { override func pause() { } @@ -289,7 +289,7 @@ StorageDownloadFileRequest, Progress, Void, StorageError ->, StorageDownloadFileOperation { +>, StorageDownloadFileOperation, @unchecked Sendable { override func pause() { } @@ -308,7 +308,7 @@ StorageUploadDataRequest, Progress, String, StorageError ->, StorageUploadDataOperation { +>, StorageUploadDataOperation, @unchecked Sendable { override func pause() { } @@ -327,7 +327,7 @@ StorageUploadFileRequest, Progress, String, StorageError ->, StorageUploadFileOperation { +>, StorageUploadFileOperation, @unchecked Sendable { override func pause() { } @@ -342,7 +342,7 @@ StorageError } class MockStorageRemoveOperation: AmplifyOperation, - StorageRemoveOperation { + StorageRemoveOperation, @unchecked Sendable { override func pause() { } @@ -357,7 +357,7 @@ class MockStorageRemoveOperation: AmplifyOperation, - StorageListOperation { + StorageListOperation, @unchecked Sendable { override func pause() { } diff --git a/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift b/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift index 0a5b3a01d1..282ebffe2f 100644 --- a/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift +++ b/AmplifyTests/CategoryTests/Hub/AmplifyOperationHubTests.swift @@ -394,7 +394,7 @@ class MockDispatchingStorageDownloadFileOperation: AmplifyInProcessReportingOper Progress, Void, StorageError ->, StorageDownloadFileOperation { +>, StorageDownloadFileOperation, @unchecked Sendable { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.downloadFile, @@ -418,7 +418,7 @@ class MockDispatchingStorageDownloadDataOperation: AmplifyInProcessReportingOper Progress, Data, StorageError ->, StorageDownloadDataOperation { +>, StorageDownloadDataOperation, @unchecked Sendable { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.downloadData, @@ -440,7 +440,7 @@ class MockDispatchingStorageGetURLOperation: AmplifyOperation< StorageGetURLRequest, URL, StorageError ->, StorageGetURLOperation { +>, StorageGetURLOperation, @unchecked Sendable { init(request: Request, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.getURL, @@ -457,7 +457,7 @@ class MockDispatchingStorageListOperation: AmplifyOperation< StorageListRequest, StorageListResult, StorageError ->, StorageListOperation { +>, StorageListOperation, @unchecked Sendable { init(request: Request, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.list, @@ -474,7 +474,7 @@ class MockDispatchingStorageRemoveOperation: AmplifyOperation< StorageRemoveRequest, String, StorageError ->, StorageRemoveOperation { +>, StorageRemoveOperation, @unchecked Sendable { init(request: Request, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.remove, @@ -493,7 +493,7 @@ class MockDispatchingStorageUploadDataOperation: AmplifyInProcessReportingOperat Progress, String, StorageError ->, StorageUploadDataOperation { +>, StorageUploadDataOperation, @unchecked Sendable { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.uploadData, @@ -517,7 +517,7 @@ class MockDispatchingStorageUploadFileOperation: AmplifyInProcessReportingOperat Progress, String, StorageError ->, StorageUploadFileOperation { +>, StorageUploadFileOperation, @unchecked Sendable { init(request: Request, progressListener: ProgressListener? = nil, resultListener: ResultListener? = nil) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.uploadFile, @@ -539,7 +539,7 @@ class NonListeningStorageListOperation: AmplifyOperation< StorageListRequest, StorageListResult, StorageError ->, StorageListOperation { +>, StorageListOperation, @unchecked Sendable { init(request: Request) { super.init(categoryType: .storage, eventName: HubPayload.EventName.Storage.downloadFile, diff --git a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift index 0f8284a3d5..20d9d084b0 100644 --- a/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift +++ b/AmplifyTests/CategoryTests/Hub/DefaultPluginTests/DefaultHubPluginConcurrencyTests.swift @@ -6,7 +6,7 @@ // import XCTest -@testable import Amplify +@testable @preconcurrency import Amplify @testable import AmplifyTestCommon class DefaultHubPluginConcurrencyTests: XCTestCase { diff --git a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift index 6452d90e08..5abeb16152 100644 --- a/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift +++ b/AmplifyTests/CoreTests/AmplifyInProcessReportingOperationCombineTests.swift @@ -152,7 +152,7 @@ class MockPublisherInProcessOperation: AmplifyInProcessReportingOperation< String, Int, APIError -> { +>, @unchecked Sendable { typealias Responder = (MockPublisherInProcessOperation) -> Void let responder: Responder diff --git a/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift b/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift index ec85f46e58..8d77c8c384 100644 --- a/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift +++ b/AmplifyTests/CoreTests/AmplifyOperationCombineTests.swift @@ -265,7 +265,7 @@ extension HubPayloadEventName { static var mockPublisherOperation = "MockPublisherOperation" } -class MockPublisherOperation: AmplifyOperation { +class MockPublisherOperation: AmplifyOperation, @unchecked Sendable { typealias Responder = (MockPublisherOperation) -> Void let responder: Responder diff --git a/AmplifyTests/CoreTests/Operations/FastOperation.swift b/AmplifyTests/CoreTests/Operations/FastOperation.swift index cdef138d86..f3b7608b7d 100644 --- a/AmplifyTests/CoreTests/Operations/FastOperation.swift +++ b/AmplifyTests/CoreTests/Operations/FastOperation.swift @@ -69,7 +69,7 @@ public enum FastOperationError: AmplifyError { public typealias FastOperationResult = Result public typealias FastOperationResultListener = (FastOperationResult) -> Void -public class FastOperation: AmplifyOperation { +public class FastOperation: AmplifyOperation, @unchecked Sendable { public typealias TaskAdapter = AmplifyOperationTaskAdapter #if canImport(Combine) public typealias ResultPublisher = AnyPublisher diff --git a/AmplifyTests/CoreTests/Operations/LongOperation.swift b/AmplifyTests/CoreTests/Operations/LongOperation.swift index 301c66fcbe..a2190d630a 100644 --- a/AmplifyTests/CoreTests/Operations/LongOperation.swift +++ b/AmplifyTests/CoreTests/Operations/LongOperation.swift @@ -70,7 +70,7 @@ public typealias LongOperationResult = Result Void public typealias LongOperationResultListener = (LongOperationResult) -> Void -public class LongOperation: AmplifyInProcessReportingOperation { +public class LongOperation: AmplifyInProcessReportingOperation, @unchecked Sendable { public typealias TaskAdapter = AmplifyInProcessReportingOperationTaskAdapter #if canImport(Combine) public typealias ResultPublisher = AnyPublisher diff --git a/Package.resolved b/Package.resolved index b4fa872d2d..79e34cdf5f 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-crt-swift", "state" : { - "revision" : "74d970dde8a0d6b2fe1d8374767ca9793088ce2c", - "version" : "0.48.0" + "revision" : "5be6550f81c760cceb0a43c30d4149ac55c5640c", + "version" : "0.52.1" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/awslabs/aws-sdk-swift", "state" : { - "revision" : "104958a898543582bb01102616bf5d61ed237352", - "version" : "1.2.59" + "revision" : "f812c7441555058da0fcecf5314780c1770b11a1", + "version" : "1.5.14" } }, { @@ -45,13 +45,40 @@ "version" : "2.2.2" } }, + { + "identity" : "grpc-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/grpc/grpc-swift.git", + "state" : { + "revision" : "a56a157218877ef3e9625f7e1f7b2cb7e46ead1b", + "version" : "1.26.1" + } + }, + { + "identity" : "opentelemetry-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/open-telemetry/opentelemetry-swift", + "state" : { + "revision" : "ef63c346d05f4fa7c9ca883f92631fd139eb2cfe", + "version" : "1.17.1" + } + }, + { + "identity" : "opentracing-objc", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/opentracing-objc", + "state" : { + "revision" : "18c1a35ca966236cee0c5a714a51a73ff33384c1", + "version" : "0.5.2" + } + }, { "identity" : "smithy-swift", "kind" : "remoteSourceControl", "location" : "https://github.com/smithy-lang/smithy-swift", "state" : { - "revision" : "755367ae4e10004f8b5a94fbfdf3f638a1f225bc", - "version" : "0.125.0" + "revision" : "85bfbaff8a77ffc0415878de50186e6cfea30a04", + "version" : "0.151.0" } }, { @@ -63,13 +90,202 @@ "version" : "0.15.3" } }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "309a47b2b1d9b5e991f36961c983ecec72275be3", + "version" : "1.6.1" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "042e1c4d9d19748c9c228f8d4ebc97bb1e339b0b", + "version" : "1.0.4" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates.git", + "state" : { + "revision" : "870f4d5fe5fcfedc13f25d70e103150511746404", + "version" : "1.11.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "8c0c0a8b49e080e54e5e328cc552821ff07cd341", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "84b1d494118d63629a785230135f82991f02329e", + "version" : "3.13.2" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "db6eea3692638a65e2124990155cd220c2915903", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types.git", + "state" : { + "revision" : "a0a57e949a8903563aba4615869310c0ebf14c03", + "version" : "1.4.0" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "3d8596ed08bd13520157f0355e35caed215ffbfa", - "version" : "1.6.3" + "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2", + "version" : "1.6.4" + } + }, + { + "identity" : "swift-metrics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-metrics.git", + "state" : { + "revision" : "4c83e1cdf4ba538ef6e43a9bbd0bcc33a0ca46e3", + "version" : "2.7.0" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio.git", + "state" : { + "revision" : "a5fea865badcb1c993c85b0f0e8d05a4bd2270fb", + "version" : "2.85.0" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "a55c3dd3a81d035af8a20ce5718889c0dcab073d", + "version" : "1.29.0" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "5e9e99ec96c53bc2c18ddd10c1e25a3cd97c55e5", + "version" : "1.38.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "385f5bd783ffbfff46b246a7db7be8e4f04c53bd", + "version" : "2.33.0" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "decfd235996bc163b44e10b8a24997a3d2104b90", + "version" : "1.25.0" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "e0ec0f5f3af6f3e4d5e7a19d2af26b481acb6ba8", + "version" : "1.0.3" + } + }, + { + "identity" : "swift-protobuf", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-protobuf.git", + "state" : { + "revision" : "102a647b573f60f73afdce5613a51d71349fe507", + "version" : "1.30.0" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "e7187309187695115033536e8fc9b2eb87fd956d", + "version" : "2.8.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system.git", + "state" : { + "revision" : "41daa93a5d229e1548ec86ab527ce4783ca84dda", + "version" : "1.6.0" + } + }, + { + "identity" : "thrift-swift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/undefinedlabs/Thrift-Swift", + "state" : { + "revision" : "18ff09e6b30e589ed38f90a1af23e193b8ecef8e", + "version" : "1.1.2" } } ], diff --git a/Package.swift b/Package.swift index dda063d628..5d5b87709a 100644 --- a/Package.swift +++ b/Package.swift @@ -4,12 +4,12 @@ import PackageDescription let platforms: [SupportedPlatform] = [ .iOS(.v13), - .macOS(.v10_15), + .macOS(.v12), .tvOS(.v13), .watchOS(.v9) ] let dependencies: [Package.Dependency] = [ - .package(url: "https://github.com/awslabs/aws-sdk-swift", exact: "1.2.59"), + .package(url: "https://github.com/awslabs/aws-sdk-swift", exact: "1.5.14"), .package(url: "https://github.com/stephencelis/SQLite.swift.git", exact: "0.15.3"), .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", from: "2.1.0"), .package(url: "https://github.com/aws-amplify/amplify-swift-utils-notifications.git", from: "1.1.0") diff --git a/README-combine-support.md b/README-combine-support.md index c0ede123a7..07297da0f2 100644 --- a/README-combine-support.md +++ b/README-combine-support.md @@ -2,7 +2,7 @@ AWS Amplify -Amplify supports iOS 13+ and macOS 10.15+, and ships with APIs that leverage Swift Concurrency (async/await) to return values. For example, the following returns an array of type `Geo.Place` with search results for coffee shops. +Amplify supports iOS 13+ and macOS 12+, and ships with APIs that leverage Swift Concurrency (async/await) to return values. For example, the following returns an array of type `Geo.Place` with search results for coffee shops. ```swift let places = try await Amplify.Geo.search(for "coffee") diff --git a/README.md b/README.md index 7e7cb23040..3819b50eb5 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ The Amplify Library for Swift is layered on the [AWS SDK for Swift](https://aws. | Platform | Versions | Support Level | | ---------: | -------: | :-----------: | | iOS | 13+ | GA | -| macOS | 10.15+ | GA | +| macOS | 12+ | GA | | tvOS | 13+ | GA | | watchOS | 9+ | GA | | visionOS | 1+ | Preview* | @@ -63,7 +63,7 @@ This library is licensed under the Apache 2.0 License. ## Installation -Amplify requires Xcode 15.0 or later for all the supported platforms. +Amplify requires Xcode 16.0 or later for all the supported platforms. | For more detailed instructions, follow the getting started guides in our [documentation site](https://docs.amplify.aws/lib/q/platform/ios) | |-------------------------------------------------|