-
Notifications
You must be signed in to change notification settings - Fork 240
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
- Loading branch information
Nika Hassani
committed
May 8, 2024
1 parent
d4a6de9
commit 27dd25d
Showing
29 changed files
with
1,150 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
66 changes: 66 additions & 0 deletions
66
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,66 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart'; | ||
|
||
part 'amplify_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs} | ||
/// The amplify outputs generated by Amplify CLI Gen2 for | ||
/// Amplify libraries to communicate with backend services. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AmplifyOutputs | ||
with AWSEquatable<AmplifyOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs} | ||
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 CLI Gen2. | ||
/// 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.
37 changes: 37 additions & 0 deletions
37
packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint.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,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 'amazon_pinpoint.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs.amazon_pinpoint} | ||
/// The Amazon Pinpoint outputs used by Analytics category plugin | ||
/// to communicate with backend services. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AmazonPinpoint | ||
with AWSEquatable<AmazonPinpoint>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs.amazon_pinpoint} | ||
const AmazonPinpoint({required this.awsRegion, required this.appId}); | ||
|
||
factory AmazonPinpoint.fromJson(Map<String, Object?> json) => | ||
_$AmazonPinpointFromJson(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 => 'AmazonPinpoint'; | ||
|
||
@override | ||
Object? toJson() { | ||
return _$AmazonPinpointToJson(this); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
// 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.dart'; | ||
|
||
part 'analytics_outputs.g.dart'; | ||
|
||
/// {@template amplify_core.amplify_outputs.analytics_outputs} | ||
/// The analytics outputs used by Analytics category plugin | ||
/// to communicate with backend services. | ||
/// {@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 AmazonPinpoint? 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.
95 changes: 95 additions & 0 deletions
95
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,95 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'package:amplify_core/amplify_core.dart' hide MfaConfiguration, MfaType; | ||
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 auth outputs used by Auth category plugin | ||
/// to communicate with backend services. | ||
/// {@endtemplate} | ||
@zAmplifyOutputsSerializable | ||
class AuthOutputs | ||
with AWSEquatable<AuthOutputs>, AWSSerializable, AWSDebuggable { | ||
/// {@macro amplify_core.amplify_outputs.auth_outputs} | ||
const AuthOutputs({ | ||
required this.awsRegion, | ||
required this.userPoolId, | ||
required 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.