-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add AmplifyOutputs types based on the CLI Gen2 client con…
…fig schema (#4859)
- Loading branch information
Showing
29 changed files
with
1,148 additions
and
11 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
74 changes: 74 additions & 0 deletions
74
packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.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,74 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/analytics/analytics_outputs.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/auth/auth_outputs.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/data/data_outputs.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/notifications/notifications_outputs.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/storage/storage_outputs.dart'; | ||
import 'package:meta/meta.dart'; | ||
|
||
part 'amplify_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs} | ||
/// The amplify outputs generated by Amplify Gen 2 for | ||
/// Amplify libraries to communicate with backend services. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AmplifyOutputs | ||
with AWSEquatable<AmplifyOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs} | ||
@internal | ||
const AmplifyOutputs({ | ||
this.schema, | ||
required this.version, | ||
this.analytics, | ||
this.auth, | ||
this.data, | ||
this.notifications, | ||
this.storage, | ||
this.custom, | ||
}); | ||
|
||
factory AmplifyOutputs.fromJson(Map<String, Object?> json) => | ||
_$AmplifyOutputsFromJson(json); | ||
|
||
/// The json schema for amplify output json object. | ||
final String? schema; | ||
|
||
/// The schema version. | ||
final String version; | ||
|
||
/// {@macro amplify_core.amplify_outputs.analytics_outputs} | ||
final AnalyticsOutputs? analytics; | ||
|
||
/// {@macro amplify_core.amplify_outputs.auth_outputs} | ||
final AuthOutputs? auth; | ||
|
||
/// {@macro amplify_core.amplify_outputs.data_outputs} | ||
final DataOutputs? data; | ||
|
||
/// {@macro amplify_core.amplify_outputs.notifications_outputs} | ||
final NotificationsOutputs? notifications; | ||
|
||
/// {@macro amplify_core.amplify_outputs.storage_outputs} | ||
final StorageOutputs? storage; | ||
|
||
/// The custom outputs generated by Amplify Gen 2. | ||
/// | ||
/// Amplify Categories do not use custom outputs. | ||
final Map<String, dynamic>? custom; | ||
|
||
@override | ||
List<Object?> get props => | ||
[schema, version, analytics, auth, data, notifications, storage, custom]; | ||
|
||
@override | ||
String get runtimeTypeName => 'AmplifyOutputs'; | ||
|
||
@override | ||
Map<String, Object?> toJson() { | ||
return _$AmplifyOutputsToJson(this); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.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,36 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
|
||
part 'amazon_pinpoint_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs.amazon_pinpoint} | ||
/// The Amplify Gen 2 output for Amazon Pinpoint. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AmazonPinpointOutputs | ||
with AWSEquatable<AmazonPinpointOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs.amazon_pinpoint} | ||
const AmazonPinpointOutputs({required this.awsRegion, required this.appId}); | ||
|
||
factory AmazonPinpointOutputs.fromJson(Map<String, Object?> json) => | ||
_$AmazonPinpointOutputsFromJson(json); | ||
|
||
/// The AWS region of Amazon Pinpoint resources. | ||
final String awsRegion; | ||
|
||
/// The Amazon Pinpoint App ID. | ||
final String appId; | ||
|
||
@override | ||
List<Object?> get props => [awsRegion, appId]; | ||
|
||
@override | ||
String get runtimeTypeName => 'AmazonPinpointOutputs'; | ||
|
||
@override | ||
Object? toJson() { | ||
return _$AmazonPinpointOutputsToJson(this); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
packages/amplify_core/lib/src/config/amplify_outputs/analytics/analytics_outputs.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,34 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.dart'; | ||
|
||
part 'analytics_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs.analytics_outputs} | ||
/// The Amplify Gen 2 output for Analytics category. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AnalyticsOutputs | ||
with AWSEquatable<AnalyticsOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs.analytics_outputs} | ||
const AnalyticsOutputs({this.amazonPinpoint}); | ||
|
||
factory AnalyticsOutputs.fromJson(Map<String, Object?> json) => | ||
_$AnalyticsOutputsFromJson(json); | ||
|
||
/// {@macro amplify_core.amplify_outputs.amazon_pinpoint} | ||
final AmazonPinpointOutputs? amazonPinpoint; | ||
|
||
@override | ||
List<Object?> get props => [amazonPinpoint]; | ||
|
||
@override | ||
String get runtimeTypeName => 'AnalyticsOutputs'; | ||
|
||
@override | ||
Map<String, Object?> toJson() { | ||
return _$AnalyticsOutputsToJson(this); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/amplify_core/lib/src/config/amplify_outputs/analytics/analytics_outputs.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
94 changes: 94 additions & 0 deletions
94
packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.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,94 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/auth/mfa.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/auth/oauth_outputs.dart'; | ||
import 'package:amplify_core/src/config/amplify_outputs/auth/password_policy.dart'; | ||
|
||
part 'auth_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs.auth_outputs} | ||
/// The Amplify Gen 2 outputs for Auth category. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AuthOutputs | ||
with AWSEquatable<AuthOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs.auth_outputs} | ||
const AuthOutputs({ | ||
required this.awsRegion, | ||
this.userPoolId, | ||
this.userPoolClientId, | ||
this.identityPoolId, | ||
this.passwordPolicy, | ||
this.oauth, | ||
this.standardRequiredAttributes, | ||
this.usernameAttributes, | ||
this.userVerificationTypes, | ||
this.unauthenticatedIdentitiesEnabled = true, | ||
this.mfaConfiguration, | ||
this.mfaMethods, | ||
}); | ||
|
||
factory AuthOutputs.fromJson(Map<String, Object?> json) => | ||
_$AuthOutputsFromJson(json); | ||
|
||
/// The AWS region of Amazon Cognito resources. | ||
final String awsRegion; | ||
|
||
/// The Cognito User Pool ID. | ||
final String? userPoolId; | ||
|
||
/// The Cognito User Pool Client ID. | ||
final String? userPoolClientId; | ||
|
||
/// The Cognito Identity Pool ID. | ||
final String? identityPoolId; | ||
|
||
/// {@macro amplifyCore.amplify_outputs.password_policy} | ||
final PasswordPolicy? passwordPolicy; | ||
|
||
/// {@macro amplify_core.amplify_outputs.oauth_outputs} | ||
final OAuthOutputs? oauth; | ||
|
||
/// The Cognito User Pool standard attributes required for sign up. | ||
final List<CognitoUserAttributeKey>? standardRequiredAttributes; | ||
|
||
/// The Cognito User Pool username attributes. | ||
final List<CognitoUserAttributeKey>? usernameAttributes; | ||
|
||
/// The Cognito User Pool verification type. | ||
final List<CognitoUserAttributeKey>? userVerificationTypes; | ||
|
||
/// Enables unauthenticated identities. | ||
final bool unauthenticatedIdentitiesEnabled; | ||
|
||
/// {@macro amplify_core.amplify_outputs.maf_enforcement} | ||
final MfaEnforcement? mfaConfiguration; | ||
|
||
/// {@macro amplify_core.amplify_outputs.maf_method} | ||
final List<MfaMethod>? mfaMethods; | ||
|
||
@override | ||
List<Object?> get props => [ | ||
awsRegion, | ||
userPoolId, | ||
userPoolClientId, | ||
identityPoolId, | ||
oauth, | ||
standardRequiredAttributes, | ||
usernameAttributes, | ||
userVerificationTypes, | ||
unauthenticatedIdentitiesEnabled, | ||
mfaConfiguration, | ||
mfaMethods, | ||
]; | ||
|
||
@override | ||
String get runtimeTypeName => 'AuthOutputs'; | ||
|
||
@override | ||
Object? toJson() { | ||
return _$AuthOutputsToJson(this); | ||
} | ||
} |
Oops, something went wrong.