Skip to content

Fix/spm api bridge unit tests #4957

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

Closed
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
7 changes: 4 additions & 3 deletions packages/amplify_datastore/lib/amplify_datastore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class AmplifyDataStore extends DataStorePluginInterface
if (apiPlugin != null && gqlConfig != null) {
// ignore: invalid_use_of_protected_member
final authProviders = apiPlugin.authProviders;
final nativePlugin = _NativeAmplifyApi(authProviders);
final nativePlugin = NativeAmplifyApi(authProviders);
NativeApiPlugin.setup(nativePlugin);

final nativeBridge = NativeApiBridge();
Expand Down Expand Up @@ -288,10 +288,11 @@ class _NativeAmplifyAuthCognito
String get runtimeTypeName => '_NativeAmplifyAuthCognito';
}

class _NativeAmplifyApi
@visibleForTesting
class NativeAmplifyApi
with AWSDebuggable, AmplifyLoggerMixin
implements NativeApiPlugin {
_NativeAmplifyApi(this._authProviders);
NativeAmplifyApi(this._authProviders);

/// The registered [APIAuthProvider] instances.
final Map<APIAuthorizationType<AmplifyAuthProvider>, APIAuthProvider>
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 @@ -39,7 +38,7 @@ APIAuthorizationType? nativeToApiAuthorizationType(String? authMode) {
NativeGraphQLResponse graphQLResponseToNativeResponse(
GraphQLResponse<String> response) {
final errorJson = jsonEncode(
response.errors.whereNotNull().map((e) => e.toJson()).toList());
response.errors.map((e) => e.toJson()).toList());
return NativeGraphQLResponse(
payloadJson: response.data,
errorsJson: errorJson,
Expand Down
Loading
Loading