Skip to content

Commit

Permalink
feat(fdc): Restrict exports of firebase_data_connect (#13403)
Browse files Browse the repository at this point in the history
  • Loading branch information
maneesht authored Sep 26, 2024
1 parent 6010085 commit 4bdd947
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,20 @@

library firebase_data_connect;

import 'dart:async';
import 'package:intl/intl.dart';
export 'src/firebase_data_connect.dart';
export 'src/common/common_library.dart'
show
ConnectorConfig,
DataConnectError,
DataConnectErrorCode,
Serializer,
Deserializer,
CallerSDKType;
export 'src/core/empty_serializer.dart' show emptySerializer;
export 'src/core/ref.dart'
show MutationRef, OperationRef, OperationResult, QueryRef, QueryResult;

import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:flutter/foundation.dart';

import 'src/common/common_library.dart';
import 'src/network/transport_library.dart'
if (dart.library.io) 'src/network/grpc_library.dart'
if (dart.library.html) 'src/network/rest_library.dart';

export 'src/common/common_library.dart';

part 'src/core/empty_serializer.dart';
part 'src/core/ref.dart';
part 'src/firebase_data_connect.dart';
part 'src/optional.dart';
part 'src/timestamp.dart';
part 'src/any_value.dart';
export 'src/optional.dart'
show Optional, OptionalState, nativeFromJson, nativeToJson;
export 'src/timestamp.dart' show Timestamp;
export 'src/any_value.dart' show AnyValue, defaultSerializer;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of firebase_data_connect;

class AnyValue {
AnyValue(this.value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of firebase_data_connect;

// Empty serializer to be used when a null variable is passed.
String emptySerializer(void _) {
return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of firebase_data_connect;
import 'dart:async';

import '../../firebase_data_connect.dart';
import '../common/common_library.dart';

/// Result of an Operation Request (query/mutation).
class OperationResult<Data, Variables> {
Expand Down Expand Up @@ -35,7 +38,6 @@ abstract class OperationRef<Data, Variables> {
}

/// Tracks currently active queries, and emits events when a new query is executed.
@visibleForTesting
class QueryManager {
QueryManager(this.dataConnect);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of firebase_data_connect;
import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:firebase_data_connect/src/core/ref.dart';
import 'package:flutter/foundation.dart';
import './network/transport_library.dart'
if (dart.library.io) './network/grpc_library.dart'
if (dart.library.html) './network/rest_library.dart';

/// DataConnect class
class FirebaseDataConnect extends FirebasePluginPlatform {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of firebase_data_connect;
import 'package:intl/intl.dart';

import 'common/common_library.dart';

/// Keeps track of whether the value has been set or not
enum OptionalState { unset, set }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

part of firebase_data_connect;

/// Timestamp class is a custom class that allows for storing of nanoseconds.
class Timestamp {
// ignore: use_raw_strings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'dart:convert';

import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import 'dart:async';

import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:firebase_data_connect/src/core/ref.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:firebase_data_connect/src/core/ref.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'dart:convert';

import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:firebase_data_connect/src/network/rest_library.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_data_connect/firebase_data_connect.dart';
import 'package:firebase_data_connect/src/common/common_library.dart';
import 'package:firebase_data_connect/src/network/transport_library.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void main() {

test('nativeFromJson correctly deserializes primitive types', () {
expect(nativeFromJson<String>('42'), equals('42'));
expect(nativeFromJson<int>(42), equals(42));
expect(nativeFromJson<bool>(true), equals(true));
expect(nativeFromJson<String>('Test'), equals('Test'));
});
Expand Down

0 comments on commit 4bdd947

Please sign in to comment.