-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: remove deprecated auth types
- Loading branch information
1 parent
5d080ce
commit e975914
Showing
56 changed files
with
69 additions
and
1,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
packages/amplify_core/lib/src/config/auth/cognito/auth.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/amplify_core/test/config/utils/remove_deprecated_key.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/// Removes keys that are no longer supported in the config as of Amplify | ||
/// Flutter version 2. | ||
/// | ||
/// The tests in this directory test against real configs generated by the Gen1 | ||
/// CLI and assert that serializing a json object to an AmplifyConfig and back | ||
/// to JSON does not change the shape. Deprecated keys will not be present in | ||
/// the output and need to be removed before comparison. | ||
void removeDeprecatedKeys(Map<String, Object?> object) { | ||
removeKey( | ||
object, | ||
[ | ||
'auth', | ||
'plugins', | ||
'awsCognitoAuthPlugin', | ||
'Auth', | ||
'DefaultCustomAuth', | ||
'authenticationFlowType', | ||
], | ||
); | ||
removeKey( | ||
object, | ||
[ | ||
'auth', | ||
'plugins', | ||
'awsCognitoAuthPlugin', | ||
'Auth', | ||
'Default', | ||
'authenticationFlowType', | ||
], | ||
); | ||
} | ||
|
||
/// Removes a deeply nested key from a map if it exists in the map. | ||
/// | ||
/// [path] is the path to the deeply nested key. | ||
/// | ||
/// Example | ||
/// ``` | ||
/// final obj = { | ||
/// 'foo': { | ||
/// 'bar': { | ||
/// 'baz':'val' | ||
/// } | ||
/// } | ||
/// } | ||
/// print(obj); // => {'foo': {'bar': {'baz': 'val'}}} | ||
/// removeKey(obj, ['foo', 'bar', 'baz']); | ||
/// print(obj); // => {'foo': {'bar': {}}} | ||
/// | ||
/// ``` | ||
void removeKey(Map<String, Object?> object, List<String> path) { | ||
if (path.isEmpty) return; | ||
if (path.length == 1) { | ||
object.removeWhere((key, value) => key == path.first); | ||
} else if (object.containsKey(path.first) && | ||
object[path.first] is Map<String, Object?>) { | ||
removeKey(object[path.first] as Map<String, Object?>, path.sublist(1)); | ||
} | ||
} |
Oops, something went wrong.