Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): update swift sdk dependency version to 0.26.0 #3248

Merged
merged 23 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
aeaa5d4
base
atierian Sep 28, 2023
eec34b0
fix: resolve compiler errors in AWSPluginsCore after sdk update (#3247)
atierian Sep 28, 2023
8c3eefa
fix: update sdk error handling in AWSCognitoAuthPlugin (#3251)
atierian Sep 29, 2023
e3a49ce
fix: new error handling in auth plugin unit test suites (#3254)
atierian Sep 29, 2023
0051fa4
fix: misc. changes to AWSAPIPlugin (#3255)
atierian Sep 29, 2023
d2b7476
fix: error handling changes in geo and geo test suite (#3256)
atierian Sep 29, 2023
59e7837
fix: error handling and misc. in storage plugin (#3258)
atierian Oct 2, 2023
a231b99
fix(cloudwatch-logging): clientruntime name changes for sdk update (#…
atierian Oct 2, 2023
7f07ac4
fix(predictions): new error handling and tests (#3257)
atierian Oct 2, 2023
f9ab142
fix(push-notifications): error handling (#3262)
atierian Oct 2, 2023
a2e878c
fix(analytics): update error handling (#3261)
atierian Oct 2, 2023
3ad5911
fix(analytics): user-agent patch (#3264)
atierian Oct 2, 2023
bacddcb
fix(analytics): add missing headers prop (#3267)
atierian Oct 3, 2023
3735f80
fix(analytics): add explicit return cause 5.7 (#3268)
atierian Oct 3, 2023
d898ea3
fix(internal-pinpoint-tests): update tests for new sdk version (#3275)
atierian Oct 4, 2023
0e2d760
fix(core): add user-agent client engine (#3274)
atierian Oct 4, 2023
ba2247b
fix(pinpoint-requests-registry-tests): target executed request in tes…
atierian Oct 4, 2023
937de0c
fix(storage-test): use identity comparison operators not XCTest metho…
atierian Oct 5, 2023
f042a1c
rebase main
atierian Oct 5, 2023
c56ff92
fix(predictions): use readData on textToSpeech bytestream (#3280)
atierian Oct 5, 2023
6322946
fix(geo): remove error helper mapping tests
atierian Oct 5, 2023
6117f76
fix: remaining integration tests for sdk update (#3283)
atierian Oct 9, 2023
a76284a
fix: add AuthErrorConvertible conformance to CommonRuntimeError (#3287)
atierian Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/integ_test_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
auth-integration-test-iOS:
runs-on: macos-12
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
Expand All @@ -32,6 +32,8 @@ jobs:
with:
project_path: ./AmplifyPlugins/Auth/Tests/AuthHostApp/
scheme: AuthIntegrationTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest'
xcode_path: '/Applications/Xcode_14.3.app'

auth-integration-test-tvOS:
runs-on: macos-13
Expand Down Expand Up @@ -90,7 +92,7 @@ jobs:
xcode_path: '/Applications/Xcode_14.3.app'

auth-ui-integration-test-iOS:
runs-on: macos-12
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
Expand All @@ -113,3 +115,5 @@ jobs:
with:
project_path: ./AmplifyPlugins/Auth/Tests/AuthHostedUIApp/
scheme: AuthHostedUIApp
destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest'
xcode_path: '/Applications/Xcode_14.3.app'
4 changes: 3 additions & 1 deletion .github/workflows/integ_test_predictions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
predictions-integration-test-iOS:
continue-on-error: true
timeout-minutes: 30
runs-on: macos-12
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
Expand All @@ -37,6 +37,8 @@ jobs:
with:
project_path: ./AmplifyPlugins/Predictions/Tests/PredictionsHostApp
scheme: AWSPredictionsPluginIntegrationTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest'
xcode_path: '/Applications/Xcode_14.3.app'

predictions-integration-test-tvOS:
continue-on-error: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

struct APIKeyURLRequestInterceptor: URLRequestInterceptor {

private let userAgent = AmplifyAWSServiceConfiguration.frameworkMetaData().description
private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib
let apiKeyProvider: APIKeyProvider

init(apiKeyProvider: APIKeyProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct AuthTokenURLRequestInterceptor: URLRequestInterceptor {

static let AWSDateISO8601DateFormat2 = "yyyyMMdd'T'HHmmss'Z'"

private let userAgent = AmplifyAWSServiceConfiguration.frameworkMetaData().description
private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib
let authTokenProvider: AuthTokenProvider

init(authTokenProvider: AuthTokenProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct IAMURLRequestInterceptor: URLRequestInterceptor {
let iamCredentialsProvider: IAMCredentialsProvider
let region: AWSRegionType
let endpointType: AWSAPICategoryPluginEndpointType
private let userAgent = AmplifyAWSServiceConfiguration.frameworkMetaData().description
private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib

init(iamCredentialsProvider: IAMCredentialsProvider,
region: AWSRegionType,
Expand All @@ -42,7 +42,8 @@ struct IAMURLRequestInterceptor: URLRequestInterceptor {
let httpMethod = (request.httpMethod?.uppercased())
.flatMap(HttpMethodType.init(rawValue:)) ?? .get

let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? []
let queryItems = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems?
.map { ClientRuntime.URLQueryItem(name: $0.name, value: $0.value)} ?? []

let requestBuilder = SdkHttpRequestBuilder()
.withHost(host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class IAMAuthInterceptor: AuthInterceptorAsync {
RealtimeProviderConstants.amzDate.lowercased(),
RealtimeProviderConstants.iamSecurityTokenKey.lowercased()]

let authProvider: CredentialsProvider
let authProvider: CredentialsProviding
let region: AWSRegionType

init(_ authProvider: CredentialsProvider, region: AWSRegionType) {
init(_ authProvider: CredentialsProviding, region: AWSRegionType) {
self.authProvider = authProvider
self.region = region
}
Expand Down Expand Up @@ -60,8 +60,8 @@ class IAMAuthInterceptor: AuthInterceptorAsync {
guard var urlComponents = URLComponents(url: request.url, resolvingAgainstBaseURL: false) else {
return request
}
let headerQuery = URLQueryItem(name: RealtimeProviderConstants.header, value: base64Auth)
let payloadQuery = URLQueryItem(name: RealtimeProviderConstants.payload, value: payloadBase64)
let headerQuery = Foundation.URLQueryItem(name: RealtimeProviderConstants.header, value: base64Auth)
let payloadQuery = Foundation.URLQueryItem(name: RealtimeProviderConstants.payload, value: payloadBase64)
urlComponents.queryItems = [headerQuery, payloadQuery]
guard let signedUrl = urlComponents.url else {
return request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class AWSGraphQLSubscriptionTaskRunner<R: Decodable>: InternalTaskRunner,
let subscriptionConnectionFactory: SubscriptionConnectionFactory
let authService: AWSAuthServiceBehavior
var apiAuthProviderFactory: APIAuthProviderFactory
private let userAgent = AmplifyAWSServiceConfiguration.frameworkMetaData().description
private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib

var subscriptionConnection: SubscriptionConnection?
var subscriptionItem: SubscriptionItem?
private var running = false
Expand Down Expand Up @@ -203,7 +203,7 @@ final public class AWSGraphQLSubscriptionOperation<R: Decodable>: GraphQLSubscri
let pluginConfig: AWSAPICategoryPluginConfiguration
let subscriptionConnectionFactory: SubscriptionConnectionFactory
let authService: AWSAuthServiceBehavior
private let userAgent = AmplifyAWSServiceConfiguration.frameworkMetaData().description
private let userAgent = AmplifyAWSServiceConfiguration.userAgentLib

var subscriptionConnection: SubscriptionConnection?
var subscriptionItem: SubscriptionItem?
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

import Foundation
import Amplify
import AWSPinpoint
import ClientRuntime

extension AWSPinpoint.BadRequestException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}

extension AWSPinpoint.ForbiddenException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}

extension AWSPinpoint.InternalServerErrorException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}

extension AWSPinpoint.MethodNotAllowedException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}

extension AWSPinpoint.NotFoundException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}

extension AWSPinpoint.PayloadTooLargeException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}

extension AWSPinpoint.TooManyRequestsException: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
.unknown(properties.message ?? "", self)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

import Foundation
import Amplify

protocol AnalyticsErrorConvertible {
var analyticsError: AnalyticsError { get }
}

extension AnalyticsError: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
self
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
// SPDX-License-Identifier: Apache-2.0
//

import Amplify
import AWSPinpoint
import ClientRuntime
import Foundation
import Amplify
import AwsCommonRuntimeKit

class AnalyticsErrorHelper {
enum AnalyticsErrorHelper {
static func getDefaultError(_ error: Error) -> AnalyticsError {
if let sdkError = error as? SdkError<PutEventsOutputError>{
return sdkError.analyticsError
switch error {
case let error as AnalyticsErrorConvertible:
return error.analyticsError
default:
return getDefaultError(error as NSError)
}

if let analyticsError = error as? AnalyticsError {
return analyticsError
}

return getDefaultError(error as NSError)
}

static func getDefaultError(_ error: NSError) -> AnalyticsError {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

import Foundation
import Amplify
@_spi(InternalAWSPinpoint) import InternalAWSPinpoint
import AwsCommonRuntimeKit

extension CommonRunTimeError: AnalyticsErrorConvertible {
var analyticsError: AnalyticsError {
switch self {
case .crtError(let crtError):
let errorDescription = isConnectivityError
? AWSPinpointErrorConstants.deviceOffline.errorDescription
: crtError.message
return .unknown(errorDescription, self)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-crt-swift",
"state" : {
"revision" : "6feec6c3787877807aa9a00fad09591b96752376",
"version" : "0.6.1"
"revision" : "997904873945e074aaf5c51ea968d9a84684525a",
"version" : "0.13.0"
}
},
{
"identity" : "aws-sdk-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-sdk-swift.git",
"state" : {
"revision" : "24bae88a2391fe75da8a940a544d1ef6441f5321",
"version" : "0.13.0"
"revision" : "ace826dbfe96e7e3103fe7f45f815b8a590bcf21",
"version" : "0.26.0"
}
},
{
Expand All @@ -57,10 +57,10 @@
{
"identity" : "smithy-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/smithy-swift",
"location" : "https://github.com/smithy-lang/smithy-swift",
"state" : {
"revision" : "7b28da158d92cd06a3549140d43b8fbcf64a94a6",
"version" : "0.15.0"
"revision" : "eed3f3d8e5aa704fcd60bb227b0fc89bf3328c42",
"version" : "0.30.0"
}
},
{
Expand Down Expand Up @@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/MaxDesiatov/XMLCoder.git",
"state" : {
"revision" : "b1e944cbd0ef33787b13f639a5418d55b3bed501",
"version" : "0.17.1"
"revision" : "80b4a1646399b8e4e0ce80711653476a85bd5e37",
"version" : "0.17.0"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import AWSCognitoIdentity
import AWSCognitoIdentityProvider
import AWSPluginsCore
import ClientRuntime
@_spi(FoundationClientEngine) import AWSPluginsCore
import AWSClientRuntime
@_spi(PluginHTTPClientEngine) import AWSPluginsCore
@_spi(InternalHttpEngineProxy) import AWSPluginsCore

extension AWSCognitoAuthPlugin {

Expand Down Expand Up @@ -87,29 +89,17 @@ extension AWSCognitoAuthPlugin {
switch authConfiguration {
case .userPools(let userPoolConfig), .userPoolsAndIdentityPools(let userPoolConfig, _):
let configuration = try CognitoIdentityProviderClient.CognitoIdentityProviderClientConfiguration(
endpointResolver: userPoolConfig.endpoint?.resolver,
frameworkMetadata: AmplifyAWSServiceConfiguration.frameworkMetaData(),
region: userPoolConfig.region
region: userPoolConfig.region,
serviceSpecific: .init(endpointResolver: userPoolConfig.endpoint?.resolver)
)

if var httpClientEngineProxy = httpClientEngineProxy {
let httpClientEngine: HttpClientEngine
#if os(iOS) || os(macOS)
// networking goes through CRT
httpClientEngine = configuration.httpClientEngine
#else
// networking goes through Foundation
httpClientEngine = FoundationClientEngine()
#endif
httpClientEngineProxy.target = httpClientEngine
configuration.httpClientEngine = httpClientEngineProxy
httpClientEngineProxy.target = baseClientEngine(for: configuration)
configuration.httpClientEngine = UserAgentSettingClientEngine(
target: httpClientEngineProxy
)
} else {
#if os(iOS) || os(macOS) // no-op
#else
// For any platform except iOS or macOS
// Use Foundation instead of CRT for networking.
configuration.httpClientEngine = FoundationClientEngine()
#endif
configuration.httpClientEngine = .userAgentEngine(for: configuration)
}

return CognitoIdentityProviderClient(config: configuration)
Expand All @@ -122,16 +112,9 @@ extension AWSCognitoAuthPlugin {
switch authConfiguration {
case .identityPools(let identityPoolConfig), .userPoolsAndIdentityPools(_, let identityPoolConfig):
let configuration = try CognitoIdentityClient.CognitoIdentityClientConfiguration(
frameworkMetadata: AmplifyAWSServiceConfiguration.frameworkMetaData(),
region: identityPoolConfig.region
)

#if os(iOS) || os(macOS) // no-op
#else
// For any platform except iOS or macOS
// Use Foundation instead of CRT for networking.
configuration.httpClientEngine = FoundationClientEngine()
#endif
configuration.httpClientEngine = .userAgentEngine(for: configuration)

return CognitoIdentityClient(config: configuration)
default:
Expand Down
Loading
Loading