Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws_common): removed JS streamed requests #5797

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'package:meta/meta.dart';
/// {@template amplify_core.auth_user_attribute_key}
/// A user attribute identifier.
/// {@endtemplate}
/// {@hideConstantImplementations}
@immutable
abstract class AuthUserAttributeKey
with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'package:amplify_core/amplify_core.dart';
/// [here](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html).
///
/// Use [CognitoUserAttributeKey.custom] to create a custom Cognito attribute.
/// {@hideConstantImplementations}
class CognitoUserAttributeKey extends AuthUserAttributeKey {
const CognitoUserAttributeKey._(this._key, {this.readOnly = false})
: isCustom = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:convert';

import 'package:amplify_core/amplify_core.dart';
import 'package:amplify_datastore/src/native_plugin.g.dart';
import 'package:collection/collection.dart';

/// Convert a [NativeGraphQLResponse] to a [GraphQLResponse]
GraphQLRequest<String> nativeRequestToGraphQLRequest(
Expand Down Expand Up @@ -85,7 +84,7 @@ NativeGraphQLResponse graphQLResponseToNativeResponse(
/// from a [GraphQLResponse]
String _buildPayloadJson(GraphQLResponse<String> response) {
final data = jsonDecode(response.data ?? '{}');
final errors = response.errors.whereNotNull().map((e) => e.toJson()).toList();
final errors = response.errors.nonNulls.map((e) => e.toJson()).toList();
return jsonEncode({
'data': data,
'errors': errors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ class GraphQLRequestFactory {
upperOutput = '(\$filter: ModelSubscription${modelName}FilterInput)';
lowerOutput = r'(filter: $filter)';
}
default:
throw const ApiOperationException(
'GraphQL Request Operation is currently unsupported',
recoverySuggestion: 'please use a supported GraphQL operation',
);
}

return DocumentInputs(upperOutput, lowerOutput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ class StateMachineBloc
}
}
yield* _checkUserVerification();
default:
break;
}
} on AuthNotAuthorizedException {
/// The .failAuthentication flag available in the DefineAuthChallenge Lambda trigger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ class _FormWrapperView extends StatelessAuthenticatorComponent {
form,
],
);
break;
}

return Padding(padding: padding, child: layout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ class _SignInTextFieldState extends _SignInFormFieldState<String>
return (v) => state.username = v;
case SignInField.password:
return (v) => state.password = v;
default:
return super.onChanged;
}
}

Expand Down
8 changes: 1 addition & 7 deletions packages/aws_common/lib/src/http/aws_http_client_js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,7 @@ class AWSHttpClientImpl extends AWSHttpClient {
requestProgressController.close();
},
).takeUntil(cancelTrigger.future);
Object body;
if (request.scheme == 'http' ||
supportedProtocols.supports(AlpnProtocol.http1_1)) {
body = Uint8List.fromList(await collectBytes(stream));
} else {
body = stream;
}
final body = Uint8List.fromList(await collectBytes(stream));

if (completer.isCanceled) return;
final resp = await fetch(
Expand Down
Loading