Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
5d authored Dec 5, 2023
2 parents 54c763c + 274ca6a commit 5e2ca10
Show file tree
Hide file tree
Showing 77 changed files with 601 additions and 363 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/closed_issue_message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

name: Closed Issue Message
on:
issues:
types: [closed]
jobs:
auto_comment:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/closed-issue-message@v1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
message: |
### ⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ struct InformSessionError: Action {
switch error {
case .service(let serviceError):
if isNotAuthorizedError(serviceError) {
event = .init(eventType: .throwError(.sessionExpired))
event = .init(eventType: .throwError(
.sessionExpired(error: serviceError)))
} else {
event = .init(eventType: .receivedSessionError(error))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class ShowHostedUISignIn: NSObject, Action {

let signingInData: HostedUISigningInState

var sessionAdapter: HostedUISessionBehavior?

init(signInData: HostedUISigningInState) {
self.signingInData = signInData
}
Expand Down Expand Up @@ -48,17 +46,13 @@ class ShowHostedUISignIn: NSObject, Action {
self.logVerbose("\(#fileID) Showing url \(url.absoluteString)", environment: environment)

do {
let queryItems = try await withCheckedThrowingContinuation {
(continuation: CheckedContinuation<[URLQueryItem], Error>) in
sessionAdapter = hostedUIEnvironment.hostedUISessionFactory()
sessionAdapter?.showHostedUI(
url: url,
callbackScheme: callbackURLScheme,
inPrivate: signingInData.options.preferPrivateSession,
presentationAnchor: signingInData.presentationAnchor) { result in
continuation.resume(with: result)
}
}
let sessionAdapter = hostedUIEnvironment.hostedUISessionFactory()
let queryItems = try await sessionAdapter.showHostedUI(
url: url,
callbackScheme: callbackURLScheme,
inPrivate: signingInData.options.preferPrivateSession,
presentationAnchor: signingInData.presentationAnchor)

guard let code = queryItems.first(where: { $0.name == "code" })?.value,
let state = queryItems.first(where: { $0.name == "state" })?.value,
self.signingInData.state == state else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class ShowHostedUISignOut: NSObject, Action {
let signOutEvent: SignOutEventData
let signInData: SignedInData

var sessionAdapter: HostedUISessionBehavior?

init(signOutEvent: SignOutEventData, signInData: SignedInData) {
self.signInData = signInData
self.signOutEvent = signOutEvent
Expand All @@ -44,17 +42,12 @@ class ShowHostedUISignOut: NSObject, Action {

do {
let logoutURL = try HostedUIRequestHelper.createSignOutURL(configuration: hostedUIConfig)
_ = try await withCheckedThrowingContinuation {
(continuation: CheckedContinuation<[URLQueryItem], Error>) in
sessionAdapter = hostedUIEnvironment.hostedUISessionFactory()
sessionAdapter?.showHostedUI(url: logoutURL,
callbackScheme: callbackURLScheme,
inPrivate: false,
presentationAnchor: signOutEvent.presentationAnchor) {
result in
continuation.resume(with: result)
}
}
let sessionAdapter = hostedUIEnvironment.hostedUISessionFactory()
_ = try await sessionAdapter.showHostedUI(
url: logoutURL,
callbackScheme: callbackURLScheme,
inPrivate: false,
presentationAnchor: signOutEvent.presentationAnchor)

await sendEvent(with: nil, dispatcher: dispatcher, environment: environment)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ class FetchAuthSessionOperationHelper: DefaultLogger {
forceRefresh: forceRefresh)

case .error(let error):
if case .sessionExpired = error {
if case .sessionExpired(let error) = error {
log.verbose("Session is expired")
let session = AuthCognitoSignedInSessionHelper.makeExpiredSignedInSession()
let session = AuthCognitoSignedInSessionHelper.makeExpiredSignedInSession(
underlyingError: error)
return session
} else if case .sessionError(_, let credentials) = error {
return try await refreshIfRequired(
Expand Down Expand Up @@ -125,8 +126,9 @@ class FetchAuthSessionOperationHelper: DefaultLogger {
return try sessionResultWithFetchError(fetchError,
authenticationState: authenticationState,
existingCredentials: credentials)
case .sessionExpired:
let session = AuthCognitoSignedInSessionHelper.makeExpiredSignedInSession()
case .sessionExpired(let error):
let session = AuthCognitoSignedInSessionHelper.makeExpiredSignedInSession(
underlyingError: error)
return session
default:
let message = "Unknown error occurred"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ enum AuthorizationError: Error {
case service(error: Swift.Error)
case invalidState(message: String)
case sessionError(FetchSessionError, AmplifyCredentials)
case sessionExpired
case sessionExpired(error: Error)
}

extension AuthorizationError: AuthErrorConvertible {
var authError: AuthError {
switch self {
case .sessionExpired:
return .sessionExpired("", "", nil)
case .sessionExpired(let error):
return .sessionExpired(
"Session expired",
"Invoke Auth.signIn to re-authenticate the user",
error)
case .configuration(let message):
return .configuration(message, "")
case .service(let error):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension AuthState: CustomDebugStringConvertible {

var debugDictionary: [String: Any] {

var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]

switch self {
case .notConfigured:
Expand All @@ -36,6 +36,5 @@ extension AuthState: CustomDebugStringConvertible {

var debugDescription: String {
return (debugDictionary as AnyObject).description

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extension AuthenticationState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notConfigured:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

extension AuthorizationState: CustomDebugDictionaryConvertible {
var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]

switch self {
case .notConfigured,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,37 @@

import Foundation

extension CredentialStoreState {
extension CredentialStoreState: CustomDebugStringConvertible {
var debugDictionary: [String: Any] {
let stateTypeDictionary: [String: Any] = ["CredentialStoreState": type]
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]

switch self {
case .notConfigured:
additionalMetadataDictionary = [:]
case .migratingLegacyStore:
additionalMetadataDictionary = [:]
case .loadingStoredCredentials:
additionalMetadataDictionary = [:]
case .clearingCredentials:
case .notConfigured,
.migratingLegacyStore,
.loadingStoredCredentials,
.storingCredentials,
.clearingCredentials,
.idle:
additionalMetadataDictionary = [:]
case .clearedCredential(let dataType):
additionalMetadataDictionary = ["StoreDataType": dataType]
case .storingCredentials:
additionalMetadataDictionary = [:]
case .success:
additionalMetadataDictionary = [:]
case .error:
additionalMetadataDictionary = [:]
case .idle:
additionalMetadataDictionary = [:]
additionalMetadataDictionary = [
"clearedDataType": dataType
]
case .success(let data):
additionalMetadataDictionary = [
"savedData": data
]
case .error(let error):
additionalMetadataDictionary = [
"errorType": error
]
}
return stateTypeDictionary.merging(additionalMetadataDictionary, uniquingKeysWith: { $1 })
return [type: additionalMetadataDictionary]
}


var debugDescription: String {
return (debugDictionary as AnyObject).description
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import Foundation

extension CustomSignInState {
extension CustomSignInState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {

var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extension DeleteUserState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import Foundation

extension DeviceSRPState {
extension DeviceSRPState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {

var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import Foundation

extension FetchAuthSessionState {
extension FetchAuthSessionState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extension HostedUISignInState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import Foundation

extension MigrateSignInState {
extension MigrateSignInState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {

var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]

switch self {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import Foundation

extension RefreshSessionState {
extension RefreshSessionState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .fetchingAuthSessionWithUserPool(let state, _):
additionalMetadataDictionary = ["fetchingSession": state.debugDictionary]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import Foundation

extension SRPSignInState {
extension SRPSignInState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {

var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {
case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@

import Foundation

extension SignInChallengeState {
extension SignInChallengeState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {
var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]
switch self {

case .waitingForAnswer(let respondAuthChallenge, _),
.verifying(let respondAuthChallenge, _, _):
additionalMetadataDictionary = respondAuthChallenge.debugDictionary
case .error(let respondAuthChallenge, _, let error):
additionalMetadataDictionary = respondAuthChallenge.debugDictionary
additionalMetadataDictionary["error"] = error
additionalMetadataDictionary = respondAuthChallenge.debugDictionary.merging(
[
"error": error
],
uniquingKeysWith: {$1})
default: additionalMetadataDictionary = [:]
}
return [type: additionalMetadataDictionary]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import Foundation

extension SignInState {
extension SignInState: CustomDebugDictionaryConvertible {

var debugDictionary: [String: Any] {

var additionalMetadataDictionary: [String: Any] = [:]
let additionalMetadataDictionary: [String: Any]

switch self {

Expand All @@ -22,9 +22,13 @@ extension SignInState {
case .signingInWithHostedUI(let substate):
additionalMetadataDictionary = substate.debugDictionary
case .resolvingChallenge(let challengeState, let challengeType, let signInMethod):
additionalMetadataDictionary = challengeState.debugDictionary
additionalMetadataDictionary["challengeType"] = challengeType
additionalMetadataDictionary["signInMethod"] = signInMethod

additionalMetadataDictionary = challengeState.debugDictionary.merging(
[
"challengeType": challengeType,
"signInMethod": signInMethod
],
uniquingKeysWith: {$1})

case .notStarted:
additionalMetadataDictionary = [:]
Expand Down
Loading

0 comments on commit 5e2ca10

Please sign in to comment.