From f39795d80b5ccb384fc2520557cb1882a502266e Mon Sep 17 00:00:00 2001 From: Di Wu Date: Mon, 29 Apr 2024 15:28:35 -0700 Subject: [PATCH] resolve plugins build issues --- .../xcschemes/AWSPluginsSDKCore.xcscheme | 9 +++++-- .../xcschemes/Amplify-Package.xcscheme | 19 ++++++++------- .../AWSAPIPlugin/AWSAPIPlugin+Configure.swift | 9 +++---- .../Sources/AWSAPIPlugin/AWSAPIPlugin.swift | 3 ++- .../AWSAPICategoryPluginConfiguration.swift | 11 +++++---- .../AWSAPIEndpointInterceptors.swift | 5 ++-- .../APIKeyURLRequestInterceptor.swift | 1 + .../AuthTokenProviderWrapper.swift | 1 + .../AuthTokenURLRequestInterceptor.swift | 1 + .../IAMURLRequestInterceptor.swift | 1 + .../IAMAuthInterceptor.swift | 1 + .../AWSGraphQLSubscriptionTaskRunner.swift | 9 +++---- .../AppSyncRealTimeClientFactory.swift | 7 +++--- .../AppSyncRealTimeClientTests.swift | 1 + ...egoryPlugin+InterceptorBehaviorTests.swift | 1 + ...SAPICategoryPluginConfigurationTests.swift | 1 + .../AWSAPIEndpointInterceptorsTests.swift | 3 ++- .../AuthTokenURLRequestInterceptorTests.swift | 1 + .../Mocks/MockSubscription.swift | 6 ++--- .../AWSCognitoAuthPlugin+Configure.swift | 2 +- ...AWSCognitoAuthPlugin+PluginExtension.swift | 2 +- .../Support/Utils/HttpClientEngineProxy.swift | 2 +- .../AWSAuthCredentialsProviderBehavior.swift | 5 +++- ... AWSAuthService+CredentialsProvider.swift} | 5 ++-- .../AmplifyAWSCredentialsProvider.swift | 3 ++- .../AWSPluginsSDKCore/AuthTokenProvider.swift | 1 + .../IAMCredentialProvider.swift | 5 ++-- .../AWSPluginsSDKCore.xctestplan | 24 +++++++++++++++++++ .../Auth/AWSAuthServiceTests.swift | 1 + .../UserAgentSettingClientEngineTests.swift | 2 +- .../Utils/UserAgentSuffixAppenderTests.swift | 2 +- .../MockAWSAuthService.swift | 4 ++-- .../MockAWSSignatureV4Signer.swift | 1 + .../OutgoingMutationQueueNetworkTests.swift | 2 +- .../AWSLocationGeoPlugin+Configure.swift | 2 +- .../PinpointEvent+PinpointClientTypes.swift | 1 + .../PinpointClient+CredentialsProvider.swift | 2 +- .../Utils/PinpointRequestsRegistry.swift | 3 +-- ...WSCloudWatchLoggingSessionController.swift | 2 +- ...aultRemoteLoggingConstraintsProvider.swift | 1 + .../Predictions/AWSPredictionsService.swift | 2 +- .../Service/Storage/AWSS3StorageService.swift | 8 +++---- .../DefaultStorageTransferDatabaseTests.swift | 8 +++---- .../Mocks/MockCredentialsProvider.swift | 5 ++-- Package.swift | 21 ++++++++++------ 45 files changed, 135 insertions(+), 71 deletions(-) rename AmplifyPlugins/Core/AWSPluginsSDKCore/{AWSAuthCredentialsProvider.swift => AWSAuthService+CredentialsProvider.swift} (58%) create mode 100644 AmplifyPlugins/Core/AWSPluginsSDKCoreTests/AWSPluginsSDKCore.xctestplan rename AmplifyPlugins/Core/{AWSPluginsCoreTests => AWSPluginsSDKCoreTests}/Auth/AWSAuthServiceTests.swift (99%) rename AmplifyPlugins/Core/{AWSPluginsCoreTests => AWSPluginsSDKCoreTests}/Utils/UserAgentSettingClientEngineTests.swift (99%) rename AmplifyPlugins/Core/{AWSPluginsCoreTests => AWSPluginsSDKCoreTests}/Utils/UserAgentSuffixAppenderTests.swift (99%) diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/AWSPluginsSDKCore.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/AWSPluginsSDKCore.xcscheme index 595e4a2023..f18064ad33 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/AWSPluginsSDKCore.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/AWSPluginsSDKCore.xcscheme @@ -26,8 +26,13 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - shouldAutocreateTestPlan = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + + - - - - diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift index ec27a34b41..9591b353eb 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin+Configure.swift @@ -7,6 +7,7 @@ @_spi(InternalAmplifyConfiguration) import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import AwsCommonRuntimeKit public extension AWSAPIPlugin { @@ -55,7 +56,7 @@ extension AWSAPIPlugin { /// A holder for AWSAPIPlugin dependencies that provides sane defaults for /// production struct ConfigurationDependencies { - let authService: AWSAuthServiceBehavior + let authService: AWSAuthCredentialsProviderBehavior let pluginConfig: AWSAPICategoryPluginConfiguration let appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol let logLevel: Amplify.LogLevel @@ -63,7 +64,7 @@ extension AWSAPIPlugin { init( configurationValues: JSONValue, apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior? = nil, + authService: AWSAuthCredentialsProviderBehavior? = nil, appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol? = nil, logLevel: Amplify.LogLevel? = nil ) throws { @@ -90,7 +91,7 @@ extension AWSAPIPlugin { init( configuration: AmplifyOutputsData, apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior = AWSAuthService(), + authService: AWSAuthCredentialsProviderBehavior = AWSAuthService(), appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol? = nil, logLevel: Amplify.LogLevel = Amplify.Logging.logLevel ) throws { @@ -111,7 +112,7 @@ extension AWSAPIPlugin { init( pluginConfig: AWSAPICategoryPluginConfiguration, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol, logLevel: Amplify.LogLevel ) { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift index ef6bc3c86d..acd8d40513 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/AWSAPIPlugin.swift @@ -7,6 +7,7 @@ import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import Foundation final public class AWSAPIPlugin: NSObject, APICategoryPlugin, AWSAPIAuthInformation { @@ -25,7 +26,7 @@ final public class AWSAPIPlugin: NSObject, APICategoryPlugin, AWSAPIAuthInformat /// The provider for Auth services required to access protected APIs. This will be /// populated during the configuration phase, and is clearable by `reset()`. - var authService: AWSAuthServiceBehavior! + var authService: AWSAuthCredentialsProviderBehavior! /// The provider for network connections and operations. This will be populated /// during initialization, and is clearable by `reset()`. diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift index 1ea015dd7f..f52480a517 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPICategoryPluginConfiguration.swift @@ -8,6 +8,7 @@ @_spi(InternalAmplifyConfiguration) import Amplify import Foundation import AWSPluginsCore +import AWSPluginsSDKCore // Convenience typealias typealias APIEndpointName = String @@ -17,11 +18,11 @@ public struct AWSAPICategoryPluginConfiguration { private var interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] private var apiAuthProviderFactory: APIAuthProviderFactory? - private var authService: AWSAuthServiceBehavior? + private var authService: AWSAuthCredentialsProviderBehavior? init(jsonValue: JSONValue, apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior) throws { + authService: AWSAuthCredentialsProviderBehavior) throws { guard case .object(let config) = jsonValue else { throw PluginError.pluginConfigurationError( "Could not cast incoming configuration to a JSONValue `.object`", @@ -50,7 +51,7 @@ public struct AWSAPICategoryPluginConfiguration { init(configuration: AmplifyOutputsData, apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior) throws { + authService: AWSAuthCredentialsProviderBehavior) throws { guard let data = configuration.data else { throw PluginError.pluginConfigurationError( @@ -95,7 +96,7 @@ public struct AWSAPICategoryPluginConfiguration { internal init(endpoints: [APIEndpointName: EndpointConfig], interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:], apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior) { + authService: AWSAuthCredentialsProviderBehavior) { self.endpoints = endpoints self.interceptors = interceptors self.apiAuthProviderFactory = apiAuthProviderFactory @@ -215,7 +216,7 @@ public struct AWSAPICategoryPluginConfiguration { /// - Returns: dictionary of AWSAPIEndpointInterceptors indexed by API endpoint name private static func makeInterceptors(forEndpoints endpoints: [APIEndpointName: EndpointConfig], apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior) throws -> [APIEndpointName: AWSAPIEndpointInterceptors] { + authService: AWSAuthCredentialsProviderBehavior) throws -> [APIEndpointName: AWSAPIEndpointInterceptors] { var interceptors: [APIEndpointName: AWSAPIEndpointInterceptors] = [:] for (name, config) in endpoints { var interceptorsConfig = AWSAPIEndpointInterceptors(endpointName: name, diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift index 5d37dc6c6b..b58119a2b5 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Configuration/AWSAPIEndpointInterceptors.swift @@ -8,6 +8,7 @@ import Amplify import Foundation import AWSPluginsCore +import AWSPluginsSDKCore /// The order of interceptor decoration is as follows: /// 1. **prelude interceptors** @@ -22,7 +23,7 @@ struct AWSAPIEndpointInterceptors { let apiEndpointName: APIEndpointName let apiAuthProviderFactory: APIAuthProviderFactory - let authService: AWSAuthServiceBehavior? + let authService: AWSAuthCredentialsProviderBehavior? var preludeInterceptors: [URLRequestInterceptor] = [] @@ -46,7 +47,7 @@ struct AWSAPIEndpointInterceptors { init(endpointName: APIEndpointName, apiAuthProviderFactory: APIAuthProviderFactory, - authService: AWSAuthServiceBehavior? = nil) { + authService: AWSAuthCredentialsProviderBehavior? = nil) { self.apiEndpointName = endpointName self.apiAuthProviderFactory = apiAuthProviderFactory self.authService = authService diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift index e737479d9c..cc08e3fdc2 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/APIKeyURLRequestInterceptor.swift @@ -7,6 +7,7 @@ import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import Foundation struct APIKeyURLRequestInterceptor: URLRequestInterceptor { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift index bc5be0d627..99e9186ea1 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenProviderWrapper.swift @@ -7,6 +7,7 @@ import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import Foundation class AuthTokenProviderWrapper: AuthTokenProvider { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift index 80ba255a4f..108b31fce9 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/AuthTokenURLRequestInterceptor.swift @@ -7,6 +7,7 @@ import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import Foundation struct AuthTokenURLRequestInterceptor: URLRequestInterceptor { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift index fa90ff71f4..0767ff6397 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/RequestInterceptor/IAMURLRequestInterceptor.swift @@ -7,6 +7,7 @@ import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import Foundation import ClientRuntime diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift index c3d33320c2..71302c2e8b 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Interceptor/SubscriptionInterceptor/IAMAuthInterceptor.swift @@ -7,6 +7,7 @@ import Foundation @_spi(WebSocket) import AWSPluginsCore +import AWSPluginsSDKCore import Amplify import AWSClientRuntime import ClientRuntime diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift index dbc93508cc..9595c52bf0 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/Operation/AWSGraphQLSubscriptionTaskRunner.swift @@ -8,6 +8,7 @@ import Amplify import Foundation import AWSPluginsCore +import AWSPluginsSDKCore import Combine public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, InternalTaskAsyncThrowingSequence, InternalTaskThrowingChannel { @@ -25,7 +26,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, } let appSyncClientFactory: AppSyncRealTimeClientFactoryProtocol let pluginConfig: AWSAPICategoryPluginConfiguration - let authService: AWSAuthServiceBehavior + let authService: AWSAuthCredentialsProviderBehavior var apiAuthProviderFactory: APIAuthProviderFactory private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib private let subscriptionId = UUID().uuidString @@ -35,7 +36,7 @@ public class AWSGraphQLSubscriptionTaskRunner: InternalTaskRunner, init(request: Request, pluginConfig: AWSAPICategoryPluginConfiguration, appSyncClientFactory: AppSyncRealTimeClientFactoryProtocol, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, apiAuthProviderFactory: APIAuthProviderFactory) { self.request = request self.pluginConfig = pluginConfig @@ -185,7 +186,7 @@ final public class AWSGraphQLSubscriptionOperation: GraphQLSubscri let pluginConfig: AWSAPICategoryPluginConfiguration let appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol - let authService: AWSAuthServiceBehavior + let authService: AWSAuthCredentialsProviderBehavior private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib var appSyncRealTimeClient: AppSyncRealTimeClientProtocol? @@ -201,7 +202,7 @@ final public class AWSGraphQLSubscriptionOperation: GraphQLSubscri init(request: GraphQLOperationRequest, pluginConfig: AWSAPICategoryPluginConfiguration, appSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, apiAuthProviderFactory: APIAuthProviderFactory, inProcessListener: AWSGraphQLSubscriptionOperation.InProcessListener?, resultListener: AWSGraphQLSubscriptionOperation.ResultListener?) { diff --git a/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift b/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift index 1666312feb..b9b8d0b396 100644 --- a/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift +++ b/AmplifyPlugins/API/Sources/AWSAPIPlugin/SubscriptionFactory/AppSyncRealTimeClientFactory.swift @@ -9,13 +9,14 @@ import Foundation import Amplify import Combine +import AWSPluginsSDKCore @_spi(WebSocket) import AWSPluginsCore protocol AppSyncRealTimeClientFactoryProtocol { func getAppSyncRealTimeClient( for endpointConfig: AWSAPICategoryPluginConfiguration.EndpointConfig, endpoint: URL, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, authType: AWSAuthorizationType?, apiAuthProviderFactory: APIAuthProviderFactory ) async throws -> AppSyncRealTimeClientProtocol @@ -40,7 +41,7 @@ actor AppSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol { public func getAppSyncRealTimeClient( for endpointConfig: AWSAPICategoryPluginConfiguration.EndpointConfig, endpoint: URL, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, authType: AWSAuthorizationType? = nil, apiAuthProviderFactory: APIAuthProviderFactory ) throws -> AppSyncRealTimeClientProtocol { @@ -90,7 +91,7 @@ actor AppSyncRealTimeClientFactory: AppSyncRealTimeClientFactoryProtocol { private func getInterceptor( for authorizationConfiguration: AWSAuthorizationConfiguration, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, apiAuthProviderFactory: APIAuthProviderFactory ) throws -> AppSyncRequestInterceptor & WebSocketInterceptor { switch authorizationConfiguration { diff --git a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift index 5e1ed6b31c..d212211abf 100644 --- a/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift +++ b/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AppSyncRealTimeClientTests.swift @@ -11,6 +11,7 @@ import Combine @testable import Amplify @testable import AWSAPIPlugin @testable @_spi(WebSocket) import AWSPluginsCore +@testable import AWSPluginsSDKCore class AppSyncRealTimeClientTests: XCTestCase { let subscriptionRequest = """ diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift index 2974af9f4d..2dc9f136ba 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/AWSAPICategoryPlugin+InterceptorBehaviorTests.swift @@ -8,6 +8,7 @@ import XCTest @testable import AWSAPIPlugin import AWSPluginsCore +import AWSPluginsSDKCore // swiftlint:disable:next type_name class AWSAPICategoryPluginInterceptorBehaviorTests: AWSAPICategoryPluginTestBase { diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift index a2f7503f01..a89d89b8c5 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPICategoryPluginConfigurationTests.swift @@ -12,6 +12,7 @@ import Foundation @testable import AWSAPIPlugin @testable import AWSPluginsTestCommon import AWSPluginsCore +import AWSPluginsSDKCore class AWSAPICategoryPluginConfigurationTests: XCTestCase { let graphQLAPI = "graphQLAPI" diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift index a48d5fa96e..d20d4120c4 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Configuration/AWSAPIEndpointInterceptorsTests.swift @@ -8,6 +8,7 @@ import XCTest import Amplify import AWSPluginsCore +import AWSPluginsSDKCore @testable import AmplifyTestCommon @testable import AWSAPIPlugin @testable import AWSPluginsTestCommon @@ -102,7 +103,7 @@ class AWSAPIEndpointInterceptorsTests: XCTestCase { // MARK: - Test Helpers - func createAPIInterceptorConfig(authService: AWSAuthServiceBehavior = MockAWSAuthService()) -> AWSAPIEndpointInterceptors { + func createAPIInterceptorConfig(authService: AWSAuthCredentialsProviderBehavior = MockAWSAuthService()) -> AWSAPIEndpointInterceptors { return AWSAPIEndpointInterceptors( endpointName: endpointName, apiAuthProviderFactory: APIAuthProviderFactory(), diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift index 5f25a0dc9a..149fc1923b 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Interceptor/AuthTokenURLRequestInterceptorTests.swift @@ -7,6 +7,7 @@ import XCTest import AWSPluginsCore +import AWSPluginsSDKCore @testable import Amplify @testable import AmplifyTestCommon @testable import AWSAPIPlugin diff --git a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift index 2ba9f97779..7cea9cf879 100644 --- a/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift +++ b/AmplifyPlugins/API/Tests/AWSAPIPluginTests/Mocks/MockSubscription.swift @@ -11,14 +11,14 @@ import Amplify import Combine @testable import AWSAPIPlugin @_spi(WebSocket) import AWSPluginsCore +import AWSPluginsSDKCore struct MockSubscriptionConnectionFactory: AppSyncRealTimeClientFactoryProtocol { - typealias OnGetOrCreateConnection = ( AWSAPICategoryPluginConfiguration.EndpointConfig, URL, - AWSAuthServiceBehavior, + AWSAuthCredentialsProviderBehavior, AWSAuthorizationType?, APIAuthProviderFactory ) async throws -> AppSyncRealTimeClientProtocol @@ -32,7 +32,7 @@ struct MockSubscriptionConnectionFactory: AppSyncRealTimeClientFactoryProtocol { func getAppSyncRealTimeClient( for endpointConfig: AWSAPICategoryPluginConfiguration.EndpointConfig, endpoint: URL, - authService: AWSAuthServiceBehavior, + authService: AWSAuthCredentialsProviderBehavior, authType: AWSAuthorizationType?, apiAuthProviderFactory: APIAuthProviderFactory ) async throws -> AppSyncRealTimeClientProtocol { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+Configure.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+Configure.swift index 4581f1d799..d71cc35532 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+Configure.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+Configure.swift @@ -13,7 +13,7 @@ import AWSCognitoIdentityProvider import AWSPluginsCore import ClientRuntime import AWSClientRuntime -@_spi(PluginHTTPClientEngine) import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore @_spi(InternalHttpEngineProxy) import AWSPluginsCore extension AWSCognitoAuthPlugin { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+PluginExtension.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+PluginExtension.swift index 81c0d9a77e..3e0b9e8278 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+PluginExtension.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+PluginExtension.swift @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(InternalAmplifyPluginExtension) import AWSPluginsCore +@_spi(InternalAmplifyPluginExtension) import AWSPluginsSDKCore import Foundation import ClientRuntime diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Utils/HttpClientEngineProxy.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Utils/HttpClientEngineProxy.swift index 2a8864e5a1..258e42fe33 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Utils/HttpClientEngineProxy.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Utils/HttpClientEngineProxy.swift @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(InternalHttpEngineProxy) @_spi(InternalAmplifyPluginExtension) import AWSPluginsCore +@_spi(InternalHttpEngineProxy) @_spi(InternalAmplifyPluginExtension) import AWSPluginsSDKCore import ClientRuntime import Foundation diff --git a/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProviderBehavior.swift b/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProviderBehavior.swift index 80f1b3c4ee..6d6cfe9277 100644 --- a/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProviderBehavior.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProviderBehavior.swift @@ -8,7 +8,10 @@ import Foundation import Amplify import AWSClientRuntime +import AWSPluginsCore -public protocol AWSAuthCredentialsProviderBehavior { +public protocol AWSAuthCredentialsProviderBehavior: AWSAuthServiceBehavior { func getCredentialsProvider() -> CredentialsProviding } + + diff --git a/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProvider.swift b/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthService+CredentialsProvider.swift similarity index 58% rename from AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProvider.swift rename to AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthService+CredentialsProvider.swift index 8c651aefb7..ec8babe3d5 100644 --- a/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthCredentialsProvider.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCore/AWSAuthService+CredentialsProvider.swift @@ -8,9 +8,10 @@ import Foundation import Amplify import AWSClientRuntime +import AWSPluginsCore -public class AWSAuthCredentialsProvider: AWSAuthCredentialsProviderBehavior { - public func getCredentialsProvider() -> CredentialsProviding { +extension AWSAuthService: AWSAuthCredentialsProviderBehavior { + public func getCredentialsProvider() -> AWSClientRuntime.CredentialsProviding { return AmplifyAWSCredentialsProvider() } } diff --git a/AmplifyPlugins/Core/AWSPluginsSDKCore/AmplifyAWSCredentialsProvider.swift b/AmplifyPlugins/Core/AWSPluginsSDKCore/AmplifyAWSCredentialsProvider.swift index 1959aa58b5..63d1197a6d 100644 --- a/AmplifyPlugins/Core/AWSPluginsSDKCore/AmplifyAWSCredentialsProvider.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCore/AmplifyAWSCredentialsProvider.swift @@ -8,6 +8,7 @@ import Amplify import AWSClientRuntime import AwsCommonRuntimeKit +import AWSPluginsCore import Foundation public class AmplifyAWSCredentialsProvider: AWSClientRuntime.CredentialsProviding { @@ -24,7 +25,7 @@ public class AmplifyAWSCredentialsProvider: AWSClientRuntime.CredentialsProvidin } } -extension AWSCredentials { +extension AWSPluginsCore.AWSCredentials { func toAWSSDKCredentials() -> AWSClientRuntime.AWSCredentials { if let tempCredentials = self as? AWSTemporaryCredentials { diff --git a/AmplifyPlugins/Core/AWSPluginsSDKCore/AuthTokenProvider.swift b/AmplifyPlugins/Core/AWSPluginsSDKCore/AuthTokenProvider.swift index 4c79d1d77b..39f1bd43f2 100644 --- a/AmplifyPlugins/Core/AWSPluginsSDKCore/AuthTokenProvider.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCore/AuthTokenProvider.swift @@ -7,6 +7,7 @@ import Foundation import Amplify +import AWSPluginsCore public protocol AuthTokenProvider { func getUserPoolAccessToken() async throws -> String diff --git a/AmplifyPlugins/Core/AWSPluginsSDKCore/IAMCredentialProvider.swift b/AmplifyPlugins/Core/AWSPluginsSDKCore/IAMCredentialProvider.swift index 3ceee7167e..1265a9130f 100644 --- a/AmplifyPlugins/Core/AWSPluginsSDKCore/IAMCredentialProvider.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCore/IAMCredentialProvider.swift @@ -8,15 +8,16 @@ import Foundation import Amplify import AWSClientRuntime +import AWSPluginsCore public protocol IAMCredentialsProvider { func getCredentialsProvider() -> CredentialsProviding } public struct BasicIAMCredentialsProvider: IAMCredentialsProvider { - let authService: AWSAuthServiceBehavior + let authService: AWSAuthCredentialsProviderBehavior - public init(authService: AWSAuthServiceBehavior) { + public init(authService: AWSAuthCredentialsProviderBehavior) { self.authService = authService } diff --git a/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/AWSPluginsSDKCore.xctestplan b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/AWSPluginsSDKCore.xctestplan new file mode 100644 index 0000000000..ca8fdab70a --- /dev/null +++ b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/AWSPluginsSDKCore.xctestplan @@ -0,0 +1,24 @@ +{ + "configurations" : [ + { + "id" : "9D7C41C1-F847-4136-AB74-D1E17831BCDD", + "name" : "Configuration 1", + "options" : { + + } + } + ], + "defaultOptions" : { + + }, + "testTargets" : [ + { + "target" : { + "containerPath" : "container:", + "identifier" : "AWSPluginsSDKCoreTests", + "name" : "AWSPluginsSDKCoreTests" + } + } + ], + "version" : 1 +} diff --git a/AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AWSAuthServiceTests.swift b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Auth/AWSAuthServiceTests.swift similarity index 99% rename from AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AWSAuthServiceTests.swift rename to AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Auth/AWSAuthServiceTests.swift index 1dc1c19582..152a1683d9 100644 --- a/AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AWSAuthServiceTests.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Auth/AWSAuthServiceTests.swift @@ -9,6 +9,7 @@ import XCTest @testable import Amplify @testable import AWSPluginsCore +@testable import AWSPluginsSDKCore import AWSClientRuntime class AWSAuthServiceTests: XCTestCase { diff --git a/AmplifyPlugins/Core/AWSPluginsCoreTests/Utils/UserAgentSettingClientEngineTests.swift b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Utils/UserAgentSettingClientEngineTests.swift similarity index 99% rename from AmplifyPlugins/Core/AWSPluginsCoreTests/Utils/UserAgentSettingClientEngineTests.swift rename to AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Utils/UserAgentSettingClientEngineTests.swift index f395f6ef18..b141438eb7 100644 --- a/AmplifyPlugins/Core/AWSPluginsCoreTests/Utils/UserAgentSettingClientEngineTests.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Utils/UserAgentSettingClientEngineTests.swift @@ -8,7 +8,7 @@ @_spi(InternalAmplifyPluginExtension) @_spi(PluginHTTPClientEngine) @_spi(InternalHttpEngineProxy) -import AWSPluginsCore +import AWSPluginsSDKCore import ClientRuntime import XCTest diff --git a/AmplifyPlugins/Core/AWSPluginsCoreTests/Utils/UserAgentSuffixAppenderTests.swift b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Utils/UserAgentSuffixAppenderTests.swift similarity index 99% rename from AmplifyPlugins/Core/AWSPluginsCoreTests/Utils/UserAgentSuffixAppenderTests.swift rename to AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Utils/UserAgentSuffixAppenderTests.swift index 3b6b167a92..5a03770137 100644 --- a/AmplifyPlugins/Core/AWSPluginsCoreTests/Utils/UserAgentSuffixAppenderTests.swift +++ b/AmplifyPlugins/Core/AWSPluginsSDKCoreTests/Utils/UserAgentSuffixAppenderTests.swift @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 // -@_spi(InternalAmplifyPluginExtension) @_spi(InternalHttpEngineProxy) import AWSPluginsCore +@_spi(InternalAmplifyPluginExtension) @_spi(InternalHttpEngineProxy) import AWSPluginsSDKCore import ClientRuntime import XCTest diff --git a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift index d0d87929a9..9e6a38e77e 100644 --- a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift +++ b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSAuthService.swift @@ -8,9 +8,9 @@ import ClientRuntime import AWSClientRuntime import Amplify -import AWSPluginsCore +import AWSPluginsSDKCore -public class MockAWSAuthService: AWSAuthServiceBehavior { +public class MockAWSAuthService: AWSAuthCredentialsProviderBehavior { var interactions: [String] = [] var getIdentityIdError: AuthError? diff --git a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSSignatureV4Signer.swift b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSSignatureV4Signer.swift index 090010b65a..85c3178277 100644 --- a/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSSignatureV4Signer.swift +++ b/AmplifyPlugins/Core/AWSPluginsTestCommon/MockAWSSignatureV4Signer.swift @@ -8,6 +8,7 @@ import AWSPluginsCore import ClientRuntime import AWSClientRuntime +import AWSPluginsSDKCore import Foundation class MockAWSSignatureV4Signer: AWSSignatureV4Signer { diff --git a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/MutationQueue/OutgoingMutationQueueNetworkTests.swift b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/MutationQueue/OutgoingMutationQueueNetworkTests.swift index f5ccca5161..63f1acd748 100644 --- a/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/MutationQueue/OutgoingMutationQueueNetworkTests.swift +++ b/AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/MutationQueue/OutgoingMutationQueueNetworkTests.swift @@ -284,7 +284,7 @@ class OutgoingMutationQueueNetworkTests: SyncEngineTestBase { listenerDelay: TimeInterval ) -> MutateRequestResponder> { MutateRequestResponder> { _ in - try! await Task.sleep(seconds: listenerDelay) + try? await Task.sleep(seconds: listenerDelay) return .failure(.unknown("", "", self.connectionError)) } } diff --git a/AmplifyPlugins/Geo/Sources/AWSLocationGeoPlugin/AWSLocationGeoPlugin+Configure.swift b/AmplifyPlugins/Geo/Sources/AWSLocationGeoPlugin/AWSLocationGeoPlugin+Configure.swift index 7a59c3c809..acc5d5c3c6 100644 --- a/AmplifyPlugins/Geo/Sources/AWSLocationGeoPlugin/AWSLocationGeoPlugin+Configure.swift +++ b/AmplifyPlugins/Geo/Sources/AWSLocationGeoPlugin/AWSLocationGeoPlugin+Configure.swift @@ -8,7 +8,7 @@ import Foundation @_spi(InternalAmplifyConfiguration) import Amplify import AWSPluginsCore -@_spi(PluginHTTPClientEngine) import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore import AWSLocation import AWSClientRuntime diff --git a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Analytics/PinpointEvent+PinpointClientTypes.swift b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Analytics/PinpointEvent+PinpointClientTypes.swift index b198b5e45d..ba9193d111 100644 --- a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Analytics/PinpointEvent+PinpointClientTypes.swift +++ b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Analytics/PinpointEvent+PinpointClientTypes.swift @@ -7,6 +7,7 @@ import AWSPinpoint import AWSPluginsCore +import AWSPluginsSDKCore import Foundation extension PinpointEvent { diff --git a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/PinpointClient+CredentialsProvider.swift b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/PinpointClient+CredentialsProvider.swift index e93baf21c2..cc5d7c9b22 100644 --- a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/PinpointClient+CredentialsProvider.swift +++ b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Extensions/PinpointClient+CredentialsProvider.swift @@ -8,7 +8,7 @@ import AWSClientRuntime import AWSPluginsCore import AWSPinpoint -@_spi(PluginHTTPClientEngine) import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore extension PinpointClient { convenience init(region: String, credentialsProvider: CredentialsProviding) throws { diff --git a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Support/Utils/PinpointRequestsRegistry.swift b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Support/Utils/PinpointRequestsRegistry.swift index fd10c9a9fa..a6de992534 100644 --- a/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Support/Utils/PinpointRequestsRegistry.swift +++ b/AmplifyPlugins/Internal/Sources/InternalAWSPinpoint/Support/Utils/PinpointRequestsRegistry.swift @@ -8,8 +8,7 @@ import Foundation import AWSPinpoint import ClientRuntime -@_spi(PluginHTTPClientEngine) -import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore @globalActor actor PinpointRequestsRegistry { static let shared = PinpointRequestsRegistry() diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift index 76b32228ce..a23cc1ffa3 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/AWSCloudWatchLoggingSessionController.swift @@ -6,7 +6,7 @@ // import AWSPluginsCore -@_spi(PluginHTTPClientEngine) import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore import Amplify import Combine import Foundation diff --git a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift index 90bebdf058..bbfce30e3a 100644 --- a/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift +++ b/AmplifyPlugins/Logging/Sources/AWSCloudWatchLoggingPlugin/Configuration/DefaultRemoteLoggingConstraintsProvider.swift @@ -8,6 +8,7 @@ import Foundation import Amplify import AWSPluginsCore +import AWSPluginsSDKCore import AWSClientRuntime import ClientRuntime diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/Predictions/AWSPredictionsService.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/Predictions/AWSPredictionsService.swift index b90c7e0a03..d336d39552 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/Predictions/AWSPredictionsService.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/Predictions/AWSPredictionsService.swift @@ -12,7 +12,7 @@ import AWSTextract import AWSComprehend import AWSPolly import AWSPluginsCore -@_spi(PluginHTTPClientEngine) import AWSPluginsCore +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore import Foundation import ClientRuntime import AWSClientRuntime diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift index 14dd8aca32..722c5cc066 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift @@ -9,14 +9,14 @@ import Foundation import AWSS3 import Amplify import AWSPluginsCore -@_spi(PluginHTTPClientEngine) import AWSPluginsCore import ClientRuntime +@_spi(PluginHTTPClientEngine) import AWSPluginsSDKCore /// - Tag: AWSS3StorageService class AWSS3StorageService: AWSS3StorageServiceBehavior, StorageServiceProxy { // resettable values - private var authService: AWSAuthServiceBehavior? + private var authService: AWSAuthCredentialsProviderBehavior? var logger: Logger! var preSignedURLBuilder: AWSS3PreSignedURLBuilderBehavior! var awsS3: AWSS3Behavior! @@ -48,7 +48,7 @@ class AWSS3StorageService: AWSS3StorageServiceBehavior, StorageServiceProxy { storageConfiguration.sessionIdentifier } - convenience init(authService: AWSAuthServiceBehavior, + convenience init(authService: AWSAuthCredentialsProviderBehavior, region: String, bucket: String, httpClientEngineProxy: HttpClientEngineProxy? = nil, @@ -107,7 +107,7 @@ class AWSS3StorageService: AWSS3StorageServiceBehavior, StorageServiceProxy { bucket: bucket) } - init(authService: AWSAuthServiceBehavior, + init(authService: AWSAuthCredentialsProviderBehavior, storageConfiguration: StorageConfiguration = .default, storageTransferDatabase: StorageTransferDatabase = .default, fileSystem: FileSystem = .default, diff --git a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/DefaultStorageTransferDatabaseTests.swift b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/DefaultStorageTransferDatabaseTests.swift index 127c151229..cb33e77a87 100644 --- a/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/DefaultStorageTransferDatabaseTests.swift +++ b/AmplifyPlugins/Storage/Tests/AWSS3StoragePluginTests/Support/Internal/DefaultStorageTransferDatabaseTests.swift @@ -204,7 +204,7 @@ class DefaultStorageTransferDatabaseTests: XCTestCase { /// Given: A DefaultStorageTransferDatabase /// When: recover is invoked with a StorageURLSession that returns a session /// Then: A .success is returned - func testLoadPersistableTasks() { + func testLoadPersistableTasks() async { let urlSession = MockStorageURLSession( sessionTasks: [ session @@ -217,18 +217,18 @@ class DefaultStorageTransferDatabaseTests: XCTestCase { } expectation.fulfill() } - waitForExpectations(timeout: 1) + await fulfillment(of: [expectation], timeout: 1) } /// Given: A DefaultStorageTransferDatabase /// When: prepareForBackground is invoked /// Then: A callback is invoked - func testPrepareForBackground() { + func testPrepareForBackground() async { let expectation = self.expectation(description: "Prepare for Background") database.prepareForBackground() { expectation.fulfill() } - waitForExpectations(timeout: 1) + await fulfillment(of: [expectation], timeout: 1) } /// Given: The StorageTransferDatabase Type diff --git a/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift b/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift index 90a1984d6b..5b4f232074 100644 --- a/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift +++ b/AmplifyTestCommon/Mocks/MockCredentialsProvider.swift @@ -5,11 +5,12 @@ // SPDX-License-Identifier: Apache-2.0 // +import AWSPluginsCore import AWSClientRuntime import Foundation -class MockCredentialsProvider: CredentialsProviding { - func getCredentials() async throws -> AWSCredentials { +class MockCredentialsProvider: AWSClientRuntime.CredentialsProviding { + func getCredentials() async throws -> AWSClientRuntime.AWSCredentials { return AWSCredentials( accessKey: "accessKey", secret: "secret", diff --git a/Package.swift b/Package.swift index ef55356bda..b1da193f85 100644 --- a/Package.swift +++ b/Package.swift @@ -44,12 +44,10 @@ let amplifyTargets: [Target] = [ name: "AWSPluginsSDKCore", dependencies: [ "Amplify", + "AWSPluginsCore", .product(name: "AWSClientRuntime", package: "aws-sdk-swift") ], path: "AmplifyPlugins/Core/AWSPluginsSDKCore", - exclude: [ - "Info.plist" - ], resources: [ .copy("Resources/PrivacyInfo.xcprivacy") ] @@ -59,7 +57,7 @@ let amplifyTargets: [Target] = [ dependencies: [ "Amplify", "CwlPreconditionTesting", - "AWSPluginsCore" + "AWSPluginsSDKCore" ], path: "AmplifyTestCommon", exclude: [ @@ -102,6 +100,7 @@ let amplifyTargets: [Target] = [ dependencies: [ "Amplify", "AWSPluginsCore", + "AWSPluginsSDKCore", .product(name: "AWSClientRuntime", package: "aws-sdk-swift") ], path: "AmplifyPlugins/Core/AWSPluginsTestCommon", @@ -113,13 +112,21 @@ let amplifyTargets: [Target] = [ name: "AWSPluginsCoreTests", dependencies: [ "AWSPluginsCore", - "AmplifyTestCommon", - .product(name: "AWSClientRuntime", package: "aws-sdk-swift") + "AmplifyTestCommon" ], path: "AmplifyPlugins/Core/AWSPluginsCoreTests", exclude: [ "Info.plist" ] + ), + .testTarget( + name: "AWSPluginsSDKCoreTests", + dependencies: [ + "AWSPluginsSDKCore", + "AmplifyTestCommon", + .product(name: "AWSClientRuntime", package: "aws-sdk-swift") + ], + path: "AmplifyPlugins/Core/AWSPluginsSDKCoreTests" ) ] @@ -128,7 +135,7 @@ let apiTargets: [Target] = [ name: "AWSAPIPlugin", dependencies: [ .target(name: "Amplify"), - .target(name: "AWSPluginsCore") + .target(name: "AWSPluginsSDKCore") ], path: "AmplifyPlugins/API/Sources/AWSAPIPlugin", exclude: [