From 13d67230bef1eb0f4820a12f0333ce6f36981725 Mon Sep 17 00:00:00 2001 From: ekjotmultani Date: Tue, 17 Sep 2024 10:35:48 -0700 Subject: [PATCH 1/8] updating storage_outputs class for multi-bucket support --- .../storage/storage_outputs.dart | 5 +++- .../storage/storage_outputs.g.dart | 25 +++++++++++++++---- .../config/amplify_outputs/test_data.dart | 23 ++++++++++++++--- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart index 9db9356aa6..416a658cda 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart @@ -12,7 +12,7 @@ part 'storage_outputs.g.dart'; class StorageOutputs with AWSEquatable, AWSSerializable, AWSDebuggable { /// {@macro amplify_core.amplify_outputs.storage_outputs} - const StorageOutputs({required this.awsRegion, required this.bucketName}); + const StorageOutputs({required this.awsRegion, required this.bucketName, this.buckets}); factory StorageOutputs.fromJson(Map json) => _$StorageOutputsFromJson(json); @@ -23,6 +23,9 @@ class StorageOutputs /// The Amazon S3 bucket name. final String bucketName; + /// The list of buckets if there are multiple buckets for the project + final List>? buckets; + @override List get props => [awsRegion, bucketName]; diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart index 7b90421189..8b77e74549 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart @@ -16,6 +16,11 @@ StorageOutputs _$StorageOutputsFromJson(Map json) => final val = StorageOutputs( awsRegion: $checkedConvert('aws_region', (v) => v as String), bucketName: $checkedConvert('bucket_name', (v) => v as String), + buckets: $checkedConvert( + 'buckets', + (v) => (v as List?) + ?.map((e) => Map.from(e as Map)) + .toList()), ); return val; }, @@ -25,8 +30,18 @@ StorageOutputs _$StorageOutputsFromJson(Map json) => }, ); -Map _$StorageOutputsToJson(StorageOutputs instance) => - { - 'aws_region': instance.awsRegion, - 'bucket_name': instance.bucketName, - }; +Map _$StorageOutputsToJson(StorageOutputs instance) { + final val = { + 'aws_region': instance.awsRegion, + 'bucket_name': instance.bucketName, + }; + + void writeNotNull(String key, dynamic value) { + if (value != null) { + val[key] = value; + } + } + + writeNotNull('buckets', instance.buckets); + return val; +} diff --git a/packages/amplify_core/test/config/amplify_outputs/test_data.dart b/packages/amplify_core/test/config/amplify_outputs/test_data.dart index 317e7a78b4..4a1f5e7b87 100644 --- a/packages/amplify_core/test/config/amplify_outputs/test_data.dart +++ b/packages/amplify_core/test/config/amplify_outputs/test_data.dart @@ -99,9 +99,26 @@ const amplifyoutputs = '''{ ] }, "storage": { - "aws_region": "oem dks", - "bucket_name": "dolor et esse" - }, + "aws_region": "us-east-2", + "bucket_name": "amplifyTeamDrive-one-stora-testbucketgen2bucket0b8c-9ggcfqfunkjr", + "buckets": [ + { + "name": "amplifyTeamDrive-one", + "bucket_name": "amplifyTeamDrive-one-stora-testbucketgen2bucket0b8c-9ggcfqfunkjr", + "aws_region": "us-east-2" + }, + { + "name": "amplifyTeamDrive-two", + "bucket_name": "amplifyTeamDrive-two-stora-testbucketgen2bucket0b8c-2", + "aws_region": "us-east-2" + }, + { + "name": "amplifyTeamDrive-three", + "bucket_name": "amplifyTeamDrive-three-stora-testbucketgen2bucket0b8c-3", + "aws_region": "us-east-2" + } + ] +}, "version": "1" } '''; From c5c0438ad5957f82704642982357b1f3f13d70a4 Mon Sep 17 00:00:00 2001 From: ekjotmultani Date: Tue, 17 Sep 2024 14:50:21 -0700 Subject: [PATCH 2/8] seperated bucket out into its own class instead of using a map --- .../storage/storage_output_bucket.dart | 16 ++++++++++++++++ .../amplify_outputs/storage/storage_outputs.dart | 8 +++++--- .../storage/storage_outputs.g.dart | 5 +++-- 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart new file mode 100644 index 0000000000..66cc099dbc --- /dev/null +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + + + +/// {@template amplify_core.amplify_outputs.amazon_pinpoint_channel} +/// Supported channels for Amazon Pinpoint. +/// {@endtemplate} +class StorageOutputBucket { + StorageOutputBucket(this.name, this.bucketName, this.awsRegion); + factory StorageOutputBucket.fromJson(Map json) => StorageOutputBucket(json['name'].toString(), json['bucket_name'].toString(), json['aws_region'].toString()); + String name; + String bucketName; + String awsRegion; + Map toJson() => {'name':name, 'bucket_name':bucketName, 'aws_region':awsRegion}; +} diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart index 416a658cda..f6744287ac 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'package:amplify_core/amplify_core.dart'; +import 'package:amplify_core/src/config/amplify_outputs/storage/storage_output_bucket.dart'; part 'storage_outputs.g.dart'; @@ -14,6 +15,7 @@ class StorageOutputs /// {@macro amplify_core.amplify_outputs.storage_outputs} const StorageOutputs({required this.awsRegion, required this.bucketName, this.buckets}); + factory StorageOutputs.fromJson(Map json) => _$StorageOutputsFromJson(json); @@ -24,10 +26,10 @@ class StorageOutputs final String bucketName; /// The list of buckets if there are multiple buckets for the project - final List>? buckets; - + final List? buckets; + @override - List get props => [awsRegion, bucketName]; + List get props => [awsRegion, bucketName, buckets]; @override String get runtimeTypeName => 'StorageOutputs'; diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart index 8b77e74549..2fb3499954 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart @@ -19,7 +19,8 @@ StorageOutputs _$StorageOutputsFromJson(Map json) => buckets: $checkedConvert( 'buckets', (v) => (v as List?) - ?.map((e) => Map.from(e as Map)) + ?.map((e) => + StorageOutputBucket.fromJson(e as Map)) .toList()), ); return val; @@ -42,6 +43,6 @@ Map _$StorageOutputsToJson(StorageOutputs instance) { } } - writeNotNull('buckets', instance.buckets); + writeNotNull('buckets', instance.buckets?.map((e) => e.toJson()).toList()); return val; } From f22dd48de75dd06877fa2c6df79567e2de83909b Mon Sep 17 00:00:00 2001 From: ekjotmultani Date: Wed, 18 Sep 2024 11:31:25 -0700 Subject: [PATCH 3/8] made bucket_output class a proper output class like the others in amplify-flutter --- packages/amplify_core/doc/lib/auth.dart | 6 +-- .../storage/bucket_output.dart | 37 +++++++++++++++++++ .../storage/bucket_output.g.dart | 34 +++++++++++++++++ .../storage/storage_output_bucket.dart | 16 -------- .../storage/storage_outputs.dart | 4 +- .../storage/storage_outputs.g.dart | 3 +- 6 files changed, 77 insertions(+), 23 deletions(-) create mode 100644 packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart create mode 100644 packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart delete mode 100644 packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 6e48014a9b..7572dc0855 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -110,13 +110,13 @@ Future _handleSignInResult(SignInResult result) async { // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code // #docregion handle-confirm-signin-mfa-selection case AuthSignInStep.continueSignInWithMfaSelection: - final allowedMfaTypes = result.nextStep.allowedMfaTypes!; + final allowedMfaTypes = result.nextStep.allowedMfaTypes; final selection = await _promptUserPreference(allowedMfaTypes); return _handleMfaSelection(selection); // #enddocregion handle-confirm-signin-mfa-selection // #docregion handle-confirm-signin-totp-setup case AuthSignInStep.continueSignInWithTotpSetup: - final totpSetupDetails = result.nextStep.totpSetupDetails!; + final totpSetupDetails = result.nextStep.totpSetupDetails; final setupUri = totpSetupDetails.getSetupUri(appName: 'MyApp'); safePrint('Open URI to complete setup: $setupUri'); // #enddocregion handle-confirm-signin-totp-setup @@ -255,7 +255,7 @@ Future signOutGlobally() async { if (result is CognitoCompleteSignOut) { safePrint('Sign out completed successfully'); } else if (result is CognitoPartialSignOut) { - final globalSignOutException = result.globalSignOutException!; + final globalSignOutException = result.globalSignOutException; final accessToken = globalSignOutException.accessToken; // Retry the global sign out using the access token, if desired // ... diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart new file mode 100644 index 0000000000..9c09884ee3 --- /dev/null +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart @@ -0,0 +1,37 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:amplify_core/amplify_core.dart'; + +part 'bucket_output.g.dart'; + +@zAmplifyOutputsSerializable +class BucketOutput + with AWSEquatable, AWSSerializable, AWSDebuggable{ + + const BucketOutput({required this.name, required this.bucketName, required this.awsRegion}); + + factory BucketOutput.fromJson(Map json) => + _$BucketOutputFromJson(json); + + final String name; + + final String bucketName; + + final String awsRegion; + + @override + List get props => [ + name, + bucketName, + awsRegion, + ]; + + @override + String get runtimeTypeName => 'BucketOutput'; + + @override + Object? toJson() { + return _$BucketOutputToJson(this); + } +} diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart new file mode 100644 index 0000000000..331517e83e --- /dev/null +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart @@ -0,0 +1,34 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: deprecated_member_use_from_same_package + +part of 'bucket_output.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BucketOutput _$BucketOutputFromJson(Map json) => + $checkedCreate( + 'BucketOutput', + json, + ($checkedConvert) { + final val = BucketOutput( + name: $checkedConvert('name', (v) => v as String), + bucketName: $checkedConvert('bucket_name', (v) => v as String), + awsRegion: $checkedConvert('aws_region', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'bucketName': 'bucket_name', + 'awsRegion': 'aws_region' + }, + ); + +Map _$BucketOutputToJson(BucketOutput instance) => + { + 'name': instance.name, + 'bucket_name': instance.bucketName, + 'aws_region': instance.awsRegion, + }; diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart deleted file mode 100644 index 66cc099dbc..0000000000 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_output_bucket.dart +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - - - -/// {@template amplify_core.amplify_outputs.amazon_pinpoint_channel} -/// Supported channels for Amazon Pinpoint. -/// {@endtemplate} -class StorageOutputBucket { - StorageOutputBucket(this.name, this.bucketName, this.awsRegion); - factory StorageOutputBucket.fromJson(Map json) => StorageOutputBucket(json['name'].toString(), json['bucket_name'].toString(), json['aws_region'].toString()); - String name; - String bucketName; - String awsRegion; - Map toJson() => {'name':name, 'bucket_name':bucketName, 'aws_region':awsRegion}; -} diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart index f6744287ac..9a0fc949de 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'package:amplify_core/amplify_core.dart'; -import 'package:amplify_core/src/config/amplify_outputs/storage/storage_output_bucket.dart'; +import 'package:amplify_core/src/config/amplify_outputs/storage/bucket_output.dart'; part 'storage_outputs.g.dart'; @@ -26,7 +26,7 @@ class StorageOutputs final String bucketName; /// The list of buckets if there are multiple buckets for the project - final List? buckets; + final List? buckets; @override List get props => [awsRegion, bucketName, buckets]; diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart index 2fb3499954..9dac1f7c12 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart @@ -19,8 +19,7 @@ StorageOutputs _$StorageOutputsFromJson(Map json) => buckets: $checkedConvert( 'buckets', (v) => (v as List?) - ?.map((e) => - StorageOutputBucket.fromJson(e as Map)) + ?.map((e) => BucketOutput.fromJson(e as Map)) .toList()), ); return val; From cc6c55bb3d694e6ed42d9482f7ece27df19e87d3 Mon Sep 17 00:00:00 2001 From: ekjotmultani <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:42:38 -0700 Subject: [PATCH 4/8] Update auth.dart --- packages/amplify_core/doc/lib/auth.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/amplify_core/doc/lib/auth.dart b/packages/amplify_core/doc/lib/auth.dart index 7572dc0855..6e48014a9b 100644 --- a/packages/amplify_core/doc/lib/auth.dart +++ b/packages/amplify_core/doc/lib/auth.dart @@ -110,13 +110,13 @@ Future _handleSignInResult(SignInResult result) async { // #enddocregion handle-signin, handle-confirm-signin-sms, handle-confirm-signin-new-password, handle-confirm-signin-custom-challenge, handle-confirm-signin-reset-password, handle-confirm-signin-confirm-signup, handle-confirm-signin-done, handle-confirm-signin-mfa-selection, handle-confirm-signin-totp-setup, handle-confirm-signin-totp-code // #docregion handle-confirm-signin-mfa-selection case AuthSignInStep.continueSignInWithMfaSelection: - final allowedMfaTypes = result.nextStep.allowedMfaTypes; + final allowedMfaTypes = result.nextStep.allowedMfaTypes!; final selection = await _promptUserPreference(allowedMfaTypes); return _handleMfaSelection(selection); // #enddocregion handle-confirm-signin-mfa-selection // #docregion handle-confirm-signin-totp-setup case AuthSignInStep.continueSignInWithTotpSetup: - final totpSetupDetails = result.nextStep.totpSetupDetails; + final totpSetupDetails = result.nextStep.totpSetupDetails!; final setupUri = totpSetupDetails.getSetupUri(appName: 'MyApp'); safePrint('Open URI to complete setup: $setupUri'); // #enddocregion handle-confirm-signin-totp-setup @@ -255,7 +255,7 @@ Future signOutGlobally() async { if (result is CognitoCompleteSignOut) { safePrint('Sign out completed successfully'); } else if (result is CognitoPartialSignOut) { - final globalSignOutException = result.globalSignOutException; + final globalSignOutException = result.globalSignOutException!; final accessToken = globalSignOutException.accessToken; // Retry the global sign out using the access token, if desired // ... From b6f8719c8fc430232ab925e85d8b5a4056ece519 Mon Sep 17 00:00:00 2001 From: ekjotmultani Date: Wed, 18 Sep 2024 12:19:27 -0700 Subject: [PATCH 5/8] added doc comments and changed name of bucket class --- devtools_options.yaml | 3 ++ .../storage/bucket_output.dart | 37 ----------------- .../storage/bucket_outputs.dart | 41 +++++++++++++++++++ ...et_output.g.dart => bucket_outputs.g.dart} | 10 ++--- .../storage/storage_outputs.dart | 4 +- .../storage/storage_outputs.g.dart | 3 +- 6 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 devtools_options.yaml delete mode 100644 packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart create mode 100644 packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart rename packages/amplify_core/lib/src/config/amplify_outputs/storage/{bucket_output.g.dart => bucket_outputs.g.dart} (79%) diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000000..fa0b357c4f --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1,3 @@ +description: This file stores settings for Dart & Flutter DevTools. +documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states +extensions: diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart deleted file mode 100644 index 9c09884ee3..0000000000 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.dart +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -import 'package:amplify_core/amplify_core.dart'; - -part 'bucket_output.g.dart'; - -@zAmplifyOutputsSerializable -class BucketOutput - with AWSEquatable, AWSSerializable, AWSDebuggable{ - - const BucketOutput({required this.name, required this.bucketName, required this.awsRegion}); - - factory BucketOutput.fromJson(Map json) => - _$BucketOutputFromJson(json); - - final String name; - - final String bucketName; - - final String awsRegion; - - @override - List get props => [ - name, - bucketName, - awsRegion, - ]; - - @override - String get runtimeTypeName => 'BucketOutput'; - - @override - Object? toJson() { - return _$BucketOutputToJson(this); - } -} diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart new file mode 100644 index 0000000000..c3e05b87ec --- /dev/null +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart @@ -0,0 +1,41 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:amplify_core/amplify_core.dart'; + +part 'bucket_outputs.g.dart'; + +/// {@template amplify_core.amplify_outputs.bucket_outputs} +/// The Amplify Gen 2 outputs for Buckets in the Storage category. +/// {@endtemplate} +@zAmplifyOutputsSerializable +class BucketOutputs + with AWSEquatable, AWSSerializable, AWSDebuggable{ + /// {@macro amplify_core.amplify_outputs.bucket_outputs} + const BucketOutputs({required this.name, required this.bucketName, required this.awsRegion,}); + + factory BucketOutputs.fromJson(Map json) => + _$BucketOutputsFromJson(json); + + /// The user friendly name of the bucket + final String name; + /// The Amazon S3 bucket name. + final String bucketName; + /// The AWS region of Amazon S3 resources. + final String awsRegion; + + @override + List get props => [ + name, + bucketName, + awsRegion, + ]; + + @override + String get runtimeTypeName => 'BucketOutputs'; + + @override + Object? toJson() { + return _$BucketOutputsToJson(this); + } +} diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.g.dart similarity index 79% rename from packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart rename to packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.g.dart index 331517e83e..0d60c85fcc 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_output.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.g.dart @@ -2,18 +2,18 @@ // ignore_for_file: deprecated_member_use_from_same_package -part of 'bucket_output.dart'; +part of 'bucket_outputs.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -BucketOutput _$BucketOutputFromJson(Map json) => +BucketOutputs _$BucketOutputsFromJson(Map json) => $checkedCreate( - 'BucketOutput', + 'BucketOutputs', json, ($checkedConvert) { - final val = BucketOutput( + final val = BucketOutputs( name: $checkedConvert('name', (v) => v as String), bucketName: $checkedConvert('bucket_name', (v) => v as String), awsRegion: $checkedConvert('aws_region', (v) => v as String), @@ -26,7 +26,7 @@ BucketOutput _$BucketOutputFromJson(Map json) => }, ); -Map _$BucketOutputToJson(BucketOutput instance) => +Map _$BucketOutputsToJson(BucketOutputs instance) => { 'name': instance.name, 'bucket_name': instance.bucketName, diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart index 9a0fc949de..87f34ad570 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'package:amplify_core/amplify_core.dart'; -import 'package:amplify_core/src/config/amplify_outputs/storage/bucket_output.dart'; +import 'package:amplify_core/src/config/amplify_outputs/storage/bucket_outputs.dart'; part 'storage_outputs.g.dart'; @@ -26,7 +26,7 @@ class StorageOutputs final String bucketName; /// The list of buckets if there are multiple buckets for the project - final List? buckets; + final List? buckets; @override List get props => [awsRegion, bucketName, buckets]; diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart index 9dac1f7c12..40d147f387 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart @@ -19,7 +19,8 @@ StorageOutputs _$StorageOutputsFromJson(Map json) => buckets: $checkedConvert( 'buckets', (v) => (v as List?) - ?.map((e) => BucketOutput.fromJson(e as Map)) + ?.map( + (e) => BucketOutputs.fromJson(e as Map)) .toList()), ); return val; From 3fc0ce9580911ce58601087599e899ff89dc617c Mon Sep 17 00:00:00 2001 From: ekjotmultani <43255916+ekjotmultani@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:30:21 -0700 Subject: [PATCH 6/8] Delete devtools_options.yaml --- devtools_options.yaml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 devtools_options.yaml diff --git a/devtools_options.yaml b/devtools_options.yaml deleted file mode 100644 index fa0b357c4f..0000000000 --- a/devtools_options.yaml +++ /dev/null @@ -1,3 +0,0 @@ -description: This file stores settings for Dart & Flutter DevTools. -documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states -extensions: From 9114206e5c7f153e4fc2f477db553aa06fa9b0d8 Mon Sep 17 00:00:00 2001 From: ekjotmultani Date: Wed, 18 Sep 2024 13:40:33 -0700 Subject: [PATCH 7/8] added trailing commas to pass ci test --- .../lib/src/config/amplify_outputs/storage/storage_outputs.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart index 87f34ad570..10eac4b055 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart @@ -13,7 +13,7 @@ part 'storage_outputs.g.dart'; class StorageOutputs with AWSEquatable, AWSSerializable, AWSDebuggable { /// {@macro amplify_core.amplify_outputs.storage_outputs} - const StorageOutputs({required this.awsRegion, required this.bucketName, this.buckets}); + const StorageOutputs({required this.awsRegion, required this.bucketName, this.buckets,}); factory StorageOutputs.fromJson(Map json) => From e7906c727c58d07b1b7f6ac0ddabae39dd9dd0a5 Mon Sep 17 00:00:00 2001 From: ekjotmultani Date: Wed, 18 Sep 2024 14:25:35 -0700 Subject: [PATCH 8/8] ran dart format on two failing files --- .../amplify_outputs/storage/bucket_outputs.dart | 14 ++++++++++---- .../amplify_outputs/storage/storage_outputs.dart | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart index c3e05b87ec..e156f08567 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/bucket_outputs.dart @@ -9,18 +9,24 @@ part 'bucket_outputs.g.dart'; /// The Amplify Gen 2 outputs for Buckets in the Storage category. /// {@endtemplate} @zAmplifyOutputsSerializable -class BucketOutputs - with AWSEquatable, AWSSerializable, AWSDebuggable{ +class BucketOutputs + with AWSEquatable, AWSSerializable, AWSDebuggable { /// {@macro amplify_core.amplify_outputs.bucket_outputs} - const BucketOutputs({required this.name, required this.bucketName, required this.awsRegion,}); + const BucketOutputs({ + required this.name, + required this.bucketName, + required this.awsRegion, + }); factory BucketOutputs.fromJson(Map json) => _$BucketOutputsFromJson(json); /// The user friendly name of the bucket final String name; + /// The Amazon S3 bucket name. final String bucketName; + /// The AWS region of Amazon S3 resources. final String awsRegion; @@ -33,7 +39,7 @@ class BucketOutputs @override String get runtimeTypeName => 'BucketOutputs'; - + @override Object? toJson() { return _$BucketOutputsToJson(this); diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart index 10eac4b055..fec0ec0662 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.dart @@ -13,8 +13,11 @@ part 'storage_outputs.g.dart'; class StorageOutputs with AWSEquatable, AWSSerializable, AWSDebuggable { /// {@macro amplify_core.amplify_outputs.storage_outputs} - const StorageOutputs({required this.awsRegion, required this.bucketName, this.buckets,}); - + const StorageOutputs({ + required this.awsRegion, + required this.bucketName, + this.buckets, + }); factory StorageOutputs.fromJson(Map json) => _$StorageOutputsFromJson(json);