Skip to content

Commit

Permalink
fix(aws_common): removed JS streamed requests (#5797)
Browse files Browse the repository at this point in the history
Removed JS streamed requests and fixed linter warnings
  • Loading branch information
tyllark authored Jan 13, 2025
1 parent 6e7a4f8 commit ea9a678
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 21 deletions.
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

0 comments on commit ea9a678

Please sign in to comment.