Skip to content

Commit ea8c907

Browse files
authored
chore: kickoff v1 release
2 parents 8c40657 + 0d7c211 commit ea8c907

File tree

23 files changed

+391
-268
lines changed

23 files changed

+391
-268
lines changed

AWSPluginsCore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$AMPLIFY_VERSION = '1.28.3'
1111
$AMPLIFY_RELEASE_TAG = "v#{$AMPLIFY_VERSION}"
1212

13-
$AWS_SDK_VERSION = '2.28.0'
13+
$AWS_SDK_VERSION = '2.29.1'
1414
$OPTIMISTIC_AWS_SDK_VERSION = "~> #{$AWS_SDK_VERSION}"
1515

1616
Pod::Spec.new do |s|

AWSPredictionsPlugin.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$AMPLIFY_VERSION = '1.28.3'
33
$AMPLIFY_RELEASE_TAG = "v#{$AMPLIFY_VERSION}"
44

5-
$AWS_SDK_VERSION = '2.28.0'
5+
$AWS_SDK_VERSION = '2.29.1'
66
$OPTIMISTIC_AWS_SDK_VERSION = "~> #{$AWS_SDK_VERSION}"
77

88
Pod::Spec.new do |s|

AmplifyPlugins.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$AMPLIFY_VERSION = '1.28.3'
1111
$AMPLIFY_RELEASE_TAG = "v#{$AMPLIFY_VERSION}"
1212

13-
$AWS_SDK_VERSION = '2.28.0'
13+
$AWS_SDK_VERSION = '2.29.1'
1414
$OPTIMISTIC_AWS_SDK_VERSION = "~> #{$AWS_SDK_VERSION}"
1515

1616
Pod::Spec.new do |s|

AmplifyPlugins/API/AWSAPICategoryPlugin/Operation/AWSGraphQLSubscriptionOperation.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ final public class AWSGraphQLSubscriptionOperation<R: Decodable>: GraphQLSubscri
189189
return
190190
} else if case ConnectionProviderError.unauthorized = error {
191191
errorDescription += ": \(APIError.UnauthorizedMessageString)"
192+
} else if case ConnectionProviderError.connection = error {
193+
errorDescription += ": connection"
194+
let error = URLError(.networkConnectionLost)
195+
dispatch(result: .failure(APIError.networkError(errorDescription, nil, error)))
196+
finish()
197+
return
192198
}
193199

194200
dispatch(result: .failure(APIError.operationError(errorDescription, "", error)))

AmplifyPlugins/API/AWSAPICategoryPluginTests/AWSAPICategoryPlugin+ConfigureTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import XCTest
1010
@testable import Amplify
1111
@testable import AWSAPICategoryPlugin
1212

13-
class AWSAPICategoryPluginConfigureTests: AWSAPICategoryPluginTestBase {
13+
class AWSAPICategoryPluginConfigureTests {
1414

1515
func testPluginKey() {
16+
let apiPlugin = AWSAPIPlugin()
1617
XCTAssertEqual(apiPlugin.key, "awsAPIPlugin")
1718
}
1819

AmplifyPlugins/API/AWSAPICategoryPluginTests/AWSAPICategoryPluginTestBase.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class AWSAPICategoryPluginTestBase: XCTestCase {
3030
let testPath = "testPath"
3131

3232
override func setUp() {
33+
Amplify.reset()
3334
apiPlugin = AWSAPIPlugin()
3435

3536
let authService = MockAWSAuthService()
@@ -62,7 +63,6 @@ class AWSAPICategoryPluginTestBase: XCTestCase {
6263
XCTFail("Failed to create endpoint config")
6364
}
6465

65-
Amplify.reset()
6666
let config = AmplifyConfiguration()
6767
do {
6868
try Amplify.configure(config)
@@ -72,9 +72,6 @@ class AWSAPICategoryPluginTestBase: XCTestCase {
7272
}
7373

7474
override func tearDown() {
75-
if let api = apiPlugin {
76-
api.reset {
77-
}
78-
}
75+
Amplify.reset()
7976
}
8077
}

AmplifyPlugins/API/AWSAPICategoryPluginTests/Operation/GraphQLSubscribeTests.swift

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class GraphQLSubscribeTests: OperationTestBase {
3333
var subscriptionItem: SubscriptionItem!
3434
var subscriptionEventHandler: SubscriptionEventHandler!
3535

36+
var expectedCompletionFailureError: APIError?
37+
3638
override func setUpWithError() throws {
3739
try super.setUpWithError()
3840

@@ -122,7 +124,23 @@ class GraphQLSubscribeTests: OperationTestBase {
122124
/// - The value handler is not invoked with with a data value
123125
/// - The value handler is invoked with a disconnection message
124126
/// - The completion handler is invoked with an error termination
125-
func testConnectionError() throws {
127+
func testConnectionErrorWithLimitExceeded() throws {
128+
receivedCompletionFinish.shouldTrigger = false
129+
receivedCompletionFailure.shouldTrigger = true
130+
receivedConnected.shouldTrigger = false
131+
receivedDisconnected.shouldTrigger = false
132+
receivedSubscriptionEventData.shouldTrigger = false
133+
receivedSubscriptionEventError.shouldTrigger = false
134+
135+
subscribe()
136+
wait(for: [onSubscribeInvoked], timeout: 0.05)
137+
138+
subscriptionEventHandler(.failed(ConnectionProviderError.limitExceeded(nil)), subscriptionItem)
139+
expectedCompletionFailureError = APIError.operationError("", "", ConnectionProviderError.limitExceeded(nil))
140+
waitForExpectations(timeout: 0.05)
141+
}
142+
143+
func testConnectionErrorWithSubscriptionError() throws {
126144
receivedCompletionFinish.shouldTrigger = false
127145
receivedCompletionFailure.shouldTrigger = true
128146
receivedConnected.shouldTrigger = false
@@ -134,8 +152,42 @@ class GraphQLSubscribeTests: OperationTestBase {
134152
wait(for: [onSubscribeInvoked], timeout: 0.05)
135153

136154
subscriptionEventHandler(.connection(.connecting), subscriptionItem)
137-
subscriptionEventHandler(.failed("Error"), subscriptionItem)
155+
subscriptionEventHandler(.failed(ConnectionProviderError.subscription("", nil)), subscriptionItem)
156+
expectedCompletionFailureError = APIError.operationError("", "", ConnectionProviderError.subscription("", nil))
157+
waitForExpectations(timeout: 0.05)
158+
}
159+
160+
func testConnectionErrorWithConnectionUnauthorizedError() throws {
161+
receivedCompletionFinish.shouldTrigger = false
162+
receivedCompletionFailure.shouldTrigger = true
163+
receivedConnected.shouldTrigger = false
164+
receivedDisconnected.shouldTrigger = false
165+
receivedSubscriptionEventData.shouldTrigger = false
166+
receivedSubscriptionEventError.shouldTrigger = false
138167

168+
subscribe()
169+
wait(for: [onSubscribeInvoked], timeout: 0.05)
170+
171+
subscriptionEventHandler(.connection(.connecting), subscriptionItem)
172+
subscriptionEventHandler(.failed(ConnectionProviderError.unauthorized), subscriptionItem)
173+
expectedCompletionFailureError = APIError.operationError("", "", ConnectionProviderError.unauthorized)
174+
waitForExpectations(timeout: 0.05)
175+
}
176+
177+
func testConnectionErrorWithConnectionProviderConnectionError() throws {
178+
receivedCompletionFinish.shouldTrigger = false
179+
receivedCompletionFailure.shouldTrigger = true
180+
receivedConnected.shouldTrigger = false
181+
receivedDisconnected.shouldTrigger = false
182+
receivedSubscriptionEventData.shouldTrigger = false
183+
receivedSubscriptionEventError.shouldTrigger = false
184+
185+
subscribe()
186+
wait(for: [onSubscribeInvoked], timeout: 0.05)
187+
188+
subscriptionEventHandler(.connection(.connecting), subscriptionItem)
189+
subscriptionEventHandler(.failed(ConnectionProviderError.connection), subscriptionItem)
190+
expectedCompletionFailureError = APIError.networkError("", nil, URLError(.networkConnectionLost))
139191
waitForExpectations(timeout: 0.05)
140192
}
141193

@@ -286,7 +338,11 @@ class GraphQLSubscribeTests: OperationTestBase {
286338
}
287339
}, completionListener: { result in
288340
switch result {
289-
case .failure:
341+
case .failure(let error):
342+
if let apiError = error as? APIError,
343+
let expectedError = self.expectedCompletionFailureError {
344+
XCTAssertEqual(apiError, expectedError)
345+
}
290346
self.receivedCompletionFailure.fulfill()
291347
case .success:
292348
self.receivedCompletionFinish.fulfill()
@@ -296,3 +352,43 @@ class GraphQLSubscribeTests: OperationTestBase {
296352
return operation
297353
}
298354
}
355+
356+
extension APIError: Equatable {
357+
public static func == (lhs: APIError, rhs: APIError) -> Bool {
358+
switch (lhs, rhs) {
359+
case (.unknown, .unknown),
360+
(.invalidConfiguration, .invalidConfiguration),
361+
(.httpStatusError, .httpStatusError),
362+
(.pluginError, .pluginError):
363+
return true
364+
case (.operationError(_, _, let lhs), .operationError(_, _, let rhs)):
365+
if let lhs = lhs as? ConnectionProviderError, let rhs = rhs as? ConnectionProviderError {
366+
switch (lhs, rhs) {
367+
case (.connection, .connection),
368+
(.jsonParse, .jsonParse),
369+
(.limitExceeded, .limitExceeded),
370+
(.subscription, .subscription),
371+
(.unauthorized, .unauthorized),
372+
(.unknown, .unknown):
373+
return true
374+
default:
375+
return false
376+
}
377+
} else if lhs == nil && rhs == nil {
378+
return true
379+
} else {
380+
return false
381+
}
382+
case (.networkError(_, _, let lhs), .networkError(_, _, let rhs)):
383+
if let lhs = lhs as? URLError, let rhs = rhs as? URLError {
384+
return lhs.code == rhs.code
385+
} else if lhs == nil && rhs == nil {
386+
return true
387+
} else {
388+
return false
389+
}
390+
default:
391+
return false
392+
}
393+
}
394+
}

AmplifyPlugins/API/Podfile.lock

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,40 @@ PODS:
33
- Amplify/Default (= 1.28.3)
44
- Amplify/Default (1.28.3)
55
- AmplifyPlugins/AWSCognitoAuthPlugin (1.28.3):
6-
- AWSAuthCore (~> 2.28.0)
7-
- AWSCognitoIdentityProvider (~> 2.28.0)
8-
- AWSCognitoIdentityProviderASF (~> 2.28.0)
9-
- AWSCore (~> 2.28.0)
10-
- AWSMobileClient (~> 2.28.0)
6+
- AWSAuthCore (~> 2.29.1)
7+
- AWSCognitoIdentityProvider (~> 2.29.1)
8+
- AWSCognitoIdentityProviderASF (~> 2.29.1)
9+
- AWSCore (~> 2.29.1)
10+
- AWSMobileClient (~> 2.29.1)
1111
- AWSPluginsCore (= 1.28.3)
1212
- AmplifyTestCommon (1.28.3):
1313
- Amplify (= 1.28.3)
1414
- AmplifyTestCommon/AWSPluginsTestCommon (= 1.28.3)
1515
- CwlPreconditionTesting (~> 2.0)
1616
- AmplifyTestCommon/AWSPluginsTestCommon (1.28.3):
1717
- Amplify (= 1.28.3)
18-
- AWSCore (~> 2.28.0)
19-
- AWSMobileClient (~> 2.28.0)
18+
- AWSCore (~> 2.29.1)
19+
- AWSMobileClient (~> 2.29.1)
2020
- AWSPluginsCore (= 1.28.3)
2121
- CwlPreconditionTesting (~> 2.0)
2222
- AppSyncRealTimeClient (2.1.1):
2323
- Starscream (~> 4.0.4)
24-
- AWSAuthCore (2.28.3):
25-
- AWSCore (= 2.28.3)
26-
- AWSCognitoIdentityProvider (2.28.3):
27-
- AWSCognitoIdentityProviderASF (= 2.28.3)
28-
- AWSCore (= 2.28.3)
29-
- AWSCognitoIdentityProviderASF (2.28.3):
30-
- AWSCore (= 2.28.3)
31-
- AWSCore (2.28.3)
32-
- AWSMobileClient (2.28.3):
33-
- AWSAuthCore (= 2.28.3)
34-
- AWSCognitoIdentityProvider (= 2.28.3)
35-
- AWSCognitoIdentityProviderASF (= 2.28.3)
36-
- AWSCore (= 2.28.3)
24+
- AWSAuthCore (2.29.1):
25+
- AWSCore (= 2.29.1)
26+
- AWSCognitoIdentityProvider (2.29.1):
27+
- AWSCognitoIdentityProviderASF (= 2.29.1)
28+
- AWSCore (= 2.29.1)
29+
- AWSCognitoIdentityProviderASF (2.29.1):
30+
- AWSCore (= 2.29.1)
31+
- AWSCore (2.29.1)
32+
- AWSMobileClient (2.29.1):
33+
- AWSAuthCore (= 2.29.1)
34+
- AWSCognitoIdentityProvider (= 2.29.1)
35+
- AWSCognitoIdentityProviderASF (= 2.29.1)
36+
- AWSCore (= 2.29.1)
3737
- AWSPluginsCore (1.28.3):
3838
- Amplify (= 1.28.3)
39-
- AWSCore (~> 2.28.0)
39+
- AWSCore (~> 2.29.1)
4040
- CwlCatchException (2.1.1):
4141
- CwlCatchExceptionSupport (~> 2.1.1)
4242
- CwlCatchExceptionSupport (2.1.1)
@@ -58,7 +58,7 @@ DEPENDENCIES:
5858
- AWSPluginsCore (from `../../`)
5959
- CwlPreconditionTesting (from `https://github.com/mattgallagher/CwlPreconditionTesting.git`, tag `2.1.0`)
6060
- SwiftFormat/CLI (= 0.44.17)
61-
- SwiftLint
61+
- SwiftLint (= 0.49.1)
6262

6363
SPEC REPOS:
6464
trunk:
@@ -96,15 +96,15 @@ CHECKOUT OPTIONS:
9696

9797
SPEC CHECKSUMS:
9898
Amplify: e89b493fc2fe840ac044bd4ddf71ad9828f8c364
99-
AmplifyPlugins: 98bcd23f2c13179f75c733b887e80dd06243be5e
100-
AmplifyTestCommon: 7a6b9d4e05e2f7b4a95c912ddccea18ed1ad4ab0
99+
AmplifyPlugins: 6aa4605f70d0e252299f0638f9cd969506a7469f
100+
AmplifyTestCommon: 033836d9c3f885727bc7246078b1c5fa044276f3
101101
AppSyncRealTimeClient: 937360221f2b664c4c33ae142a60643e64f480cd
102-
AWSAuthCore: 2062ef888b45b7e4426124f7c68930b04a9fe426
103-
AWSCognitoIdentityProvider: f608ba338bc3b1676ab8a027f8c17a0a8de7fa25
104-
AWSCognitoIdentityProviderASF: 3c0a873dcb270e770da06772c7762b1648897e41
105-
AWSCore: 27c26d9c0a2f072f7aeb26337f3a5f4098eea8b8
106-
AWSMobileClient: 0b8bb9f3d7f04ee9febed719887189e86794a721
107-
AWSPluginsCore: 93f813579479fa4c5bfff58817df89e0e10f9f3b
102+
AWSAuthCore: 47c24a59f47501358803c58045b03e0fe10f451e
103+
AWSCognitoIdentityProvider: ecd914518152f6d645485b9431265eedf2ff84d0
104+
AWSCognitoIdentityProviderASF: c845b376143e69b1f34899f0572654cf816f9c5e
105+
AWSCore: aa4a494c8bbcefe97723621fa51cfb1fad15fbd1
106+
AWSMobileClient: 1c98e24ad0afcbed09febdeda4ad59fd7e7a5feb
107+
AWSPluginsCore: c3dacbb0e28c944f520c93aaa0a1a2afacc369e3
108108
CwlCatchException: 86760545af2a490a23e964d76d7c77442dbce79b
109109
CwlCatchExceptionSupport: a004322095d7101b945442c86adc7cec0650f676
110110
CwlMachBadInstructionHandler: aa1fe9f2d08b29507c150d099434b2890247e7f8

0 commit comments

Comments
 (0)