From 597fe3c7ab3edf92b3779fa1728a746d4998ea87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Wed, 29 May 2024 08:50:58 +0200 Subject: [PATCH 01/17] Take 1 --- packages/realm_dart/lib/src/app.dart | 4 ++-- packages/realm_dart/lib/src/collections.dart | 2 +- .../realm_dart/lib/src/configuration.dart | 4 ++-- packages/realm_dart/lib/src/credentials.dart | 4 ++-- .../lib/src/handles/app_handle.dart | 5 +++++ .../src/handles/async_open_task_handle.dart | 5 +++++ .../handles/collection_changes_handle.dart | 5 +++++ .../realm_dart/lib/src/handles/convert.dart | 4 ++++ .../lib/src/handles/credentials_handle.dart | 5 +++++ .../lib/src/handles/decimal128.dart | 5 +++++ .../lib/src/handles/from_native.dart | 5 +++++ .../lib/src/handles/handle_base.dart | 5 +++++ .../lib/src/handles/list_handle.dart | 5 +++++ .../lib/src/handles/map_changes_handle.dart | 5 +++++ .../lib/src/handles/map_handle.dart | 5 +++++ .../mutable_subscription_set_handle.dart | 5 +++++ .../src/{ => handles}/native/app_handle.dart | 6 +++--- .../native/async_open_task_handle.dart | 8 ++++---- .../native/collection_changes_handle.dart | 2 +- .../native/collection_handle_base.dart | 5 ++--- .../{ => handles}/native/config_handle.dart | 12 +++++------ .../lib/src/{ => handles}/native/convert.dart | 0 .../{ => handles}/native/convert_native.dart | 0 .../native/credentials_handle.dart | 2 +- .../src/{ => handles}/native/decimal128.dart | 0 .../{ => handles}/native/error_handling.dart | 2 +- .../lib/src/{ => handles}/native/ffi.dart | 0 .../src/{ => handles}/native/from_native.dart | 8 ++++---- .../src/{ => handles}/native/handle_base.dart | 3 +-- .../native/http_transport_handle.dart | 6 +++--- .../src/{ => handles}/native/list_handle.dart | 2 +- .../native/map_changes_handle.dart | 5 ++--- .../src/{ => handles}/native/map_handle.dart | 2 +- .../mutable_subscription_set_handle.dart | 2 +- .../native/notification_token_handle.dart | 2 +- .../{ => handles}/native/object_handle.dart | 2 +- .../{ => handles}/native/query_handle.dart | 0 .../{ => handles}/native/realm_bindings.dart | 0 .../src/{ => handles}/native/realm_core.dart | 6 +++--- .../{ => handles}/native/realm_handle.dart | 6 +++--- .../{ => handles}/native/realm_library.dart | 7 ++++--- .../{ => handles}/native/results_handle.dart | 2 +- .../{ => handles}/native/rooted_handle.dart | 0 .../native/scheduler_handle.dart | 0 .../{ => handles}/native/schema_handle.dart | 2 +- .../{ => handles}/native/session_handle.dart | 6 +++--- .../src/{ => handles}/native/set_handle.dart | 2 +- .../native/subscription_handle.dart | 2 +- .../native/subscription_set_handle.dart | 4 ++-- .../src/{ => handles}/native/to_native.dart | 7 +++---- .../src/{ => handles}/native/user_handle.dart | 8 ++++---- .../handles/notification_token_handle.dart | 5 +++++ .../lib/src/handles/object_handle.dart | 5 +++++ .../lib/src/handles/realm_bindings.dart | 5 +++++ .../lib/src/handles/realm_core.dart | 5 +++++ .../lib/src/handles/realm_handle.dart | 5 +++++ .../lib/src/handles/realm_library.dart | 5 +++++ .../lib/src/handles/results_handle.dart | 5 +++++ .../lib/src/handles/scheduler_handle.dart | 5 +++++ .../lib/src/handles/schema_handle.dart | 5 +++++ .../lib/src/handles/session_handle.dart | 5 +++++ .../lib/src/handles/set_handle.dart | 5 +++++ .../lib/src/handles/subscription_handle.dart | 5 +++++ .../src/handles/subscription_set_handle.dart | 5 +++++ .../lib/src/handles/user_handle.dart | 5 +++++ packages/realm_dart/lib/src/list.dart | 12 +++++------ packages/realm_dart/lib/src/logging.dart | 2 +- packages/realm_dart/lib/src/map.dart | 13 ++++++------ packages/realm_dart/lib/src/migration.dart | 2 +- packages/realm_dart/lib/src/realm_class.dart | 20 +++++++++---------- packages/realm_dart/lib/src/realm_object.dart | 10 +++++----- packages/realm_dart/lib/src/realm_web.dart | 11 ++++++++++ packages/realm_dart/lib/src/results.dart | 10 +++++----- packages/realm_dart/lib/src/scheduler.dart | 2 +- packages/realm_dart/lib/src/session.dart | 4 ++-- packages/realm_dart/lib/src/set.dart | 14 ++++++------- packages/realm_dart/lib/src/subscription.dart | 8 ++++---- packages/realm_dart/lib/src/user.dart | 2 +- packages/realm_dart/test/app_test.dart | 8 ++++---- packages/realm_dart/test/baas_helper.dart | 2 +- packages/realm_dart/test/decimal128_test.dart | 4 +--- packages/realm_dart/test/embedded_test.dart | 8 +++----- .../realm_dart/test/realm_logger_test.dart | 3 +-- packages/realm_dart/test/realm_test.dart | 2 +- .../realm_dart/test/subscription_test.dart | 2 +- packages/realm_dart/test/test.dart | 2 +- 86 files changed, 268 insertions(+), 137 deletions(-) create mode 100644 packages/realm_dart/lib/src/handles/app_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/async_open_task_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/collection_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/convert.dart create mode 100644 packages/realm_dart/lib/src/handles/credentials_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/decimal128.dart create mode 100644 packages/realm_dart/lib/src/handles/from_native.dart create mode 100644 packages/realm_dart/lib/src/handles/handle_base.dart create mode 100644 packages/realm_dart/lib/src/handles/list_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/map_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/map_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart rename packages/realm_dart/lib/src/{ => handles}/native/app_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/async_open_task_handle.dart (94%) rename packages/realm_dart/lib/src/{ => handles}/native/collection_changes_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/collection_handle_base.dart (94%) rename packages/realm_dart/lib/src/{ => handles}/native/config_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/convert.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/convert_native.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/credentials_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/decimal128.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/error_handling.dart (97%) rename packages/realm_dart/lib/src/{ => handles}/native/ffi.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/from_native.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/handle_base.dart (97%) rename packages/realm_dart/lib/src/{ => handles}/native/http_transport_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/list_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/map_changes_handle.dart (95%) rename packages/realm_dart/lib/src/{ => handles}/native/map_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/mutable_subscription_set_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/notification_token_handle.dart (97%) rename packages/realm_dart/lib/src/{ => handles}/native/object_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/query_handle.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/realm_bindings.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/realm_core.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/realm_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/realm_library.dart (90%) rename packages/realm_dart/lib/src/{ => handles}/native/results_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/rooted_handle.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/scheduler_handle.dart (100%) rename packages/realm_dart/lib/src/{ => handles}/native/schema_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/session_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/set_handle.dart (99%) rename packages/realm_dart/lib/src/{ => handles}/native/subscription_handle.dart (96%) rename packages/realm_dart/lib/src/{ => handles}/native/subscription_set_handle.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/to_native.dart (98%) rename packages/realm_dart/lib/src/{ => handles}/native/user_handle.dart (98%) create mode 100644 packages/realm_dart/lib/src/handles/notification_token_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/object_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/realm_bindings.dart create mode 100644 packages/realm_dart/lib/src/handles/realm_core.dart create mode 100644 packages/realm_dart/lib/src/handles/realm_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/realm_library.dart create mode 100644 packages/realm_dart/lib/src/handles/results_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/scheduler_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/schema_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/session_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/set_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/subscription_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/subscription_set_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/user_handle.dart create mode 100644 packages/realm_dart/lib/src/realm_web.dart diff --git a/packages/realm_dart/lib/src/app.dart b/packages/realm_dart/lib/src/app.dart index 500a71e09..78e2cc82e 100644 --- a/packages/realm_dart/lib/src/app.dart +++ b/packages/realm_dart/lib/src/app.dart @@ -10,9 +10,9 @@ import 'package:path/path.dart' as path; import '../realm.dart'; import 'credentials.dart'; +import 'handles/app_handle.dart'; +import 'handles/realm_core.dart'; import 'logging.dart'; -import 'native/app_handle.dart'; -import 'native/realm_core.dart'; import 'user.dart'; final _defaultClient = () { diff --git a/packages/realm_dart/lib/src/collections.dart b/packages/realm_dart/lib/src/collections.dart index 9609d1b06..51c7deffe 100644 --- a/packages/realm_dart/lib/src/collections.dart +++ b/packages/realm_dart/lib/src/collections.dart @@ -1,7 +1,7 @@ // Copyright 2022 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'native/collection_changes_handle.dart'; +import 'handles/collection_changes_handle.dart'; /// Contains index information about objects that moved within the same collection. class Move { diff --git a/packages/realm_dart/lib/src/configuration.dart b/packages/realm_dart/lib/src/configuration.dart index ab182afec..e22fc00bc 100644 --- a/packages/realm_dart/lib/src/configuration.dart +++ b/packages/realm_dart/lib/src/configuration.dart @@ -8,10 +8,10 @@ import 'dart:io'; import 'package:path/path.dart' as _path; import 'app.dart'; +import 'handles/from_native.dart'; +import 'handles/realm_core.dart'; import 'init.dart'; import 'logging.dart'; -import 'native/from_native.dart'; -import 'native/realm_core.dart'; import 'realm_class.dart'; import 'user.dart'; diff --git a/packages/realm_dart/lib/src/credentials.dart b/packages/realm_dart/lib/src/credentials.dart index 2d0ffb046..40291f134 100644 --- a/packages/realm_dart/lib/src/credentials.dart +++ b/packages/realm_dart/lib/src/credentials.dart @@ -4,8 +4,8 @@ import 'dart:convert'; import 'app.dart'; -import 'native/convert.dart'; -import 'native/credentials_handle.dart'; +import 'handles/convert.dart'; +import 'handles/credentials_handle.dart'; import 'user.dart'; /// An enum containing all authentication providers. These have to be enabled manually for the application before they can be used. diff --git a/packages/realm_dart/lib/src/handles/app_handle.dart b/packages/realm_dart/lib/src/handles/app_handle.dart new file mode 100644 index 000000000..47b326f03 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/app_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/app_handle.dart' + if (dart.library.js_interop) 'web/app_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/async_open_task_handle.dart new file mode 100644 index 000000000..43c4aeae2 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/async_open_task_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/async_open_task_handle.dart' + if (dart.library.js_interop) 'web/async_open_task_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/collection_changes_handle.dart b/packages/realm_dart/lib/src/handles/collection_changes_handle.dart new file mode 100644 index 000000000..8988dae68 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/collection_changes_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/collection_changes_handle.dart' + if (dart.library.js_interop) 'web/collection_changes_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/convert.dart b/packages/realm_dart/lib/src/handles/convert.dart new file mode 100644 index 000000000..1e3e6c00d --- /dev/null +++ b/packages/realm_dart/lib/src/handles/convert.dart @@ -0,0 +1,4 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/convert.dart' if (dart.library.js_interop) 'web/convert.dart'; diff --git a/packages/realm_dart/lib/src/handles/credentials_handle.dart b/packages/realm_dart/lib/src/handles/credentials_handle.dart new file mode 100644 index 000000000..c06f648f9 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/credentials_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/credentials_handle.dart' + if (dart.library.js_interop) 'web/credentials_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/decimal128.dart b/packages/realm_dart/lib/src/handles/decimal128.dart new file mode 100644 index 000000000..134d18ff5 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/decimal128.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/decimal128.dart' + if (dart.library.js) 'web/decimal128.dart'; diff --git a/packages/realm_dart/lib/src/handles/from_native.dart b/packages/realm_dart/lib/src/handles/from_native.dart new file mode 100644 index 000000000..a3e99f8f8 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/from_native.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/from_native.dart' + if (dart.library.js_interop) 'web/from_native.dart'; diff --git a/packages/realm_dart/lib/src/handles/handle_base.dart b/packages/realm_dart/lib/src/handles/handle_base.dart new file mode 100644 index 000000000..3cc73da68 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/handle_base.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/handle_base.dart' + if (dart.library.js_interop) 'web/handle_base.dart'; diff --git a/packages/realm_dart/lib/src/handles/list_handle.dart b/packages/realm_dart/lib/src/handles/list_handle.dart new file mode 100644 index 000000000..f6ebbab17 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/list_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/list_handle.dart' + if (dart.library.js_interop) 'web/list_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/map_changes_handle.dart b/packages/realm_dart/lib/src/handles/map_changes_handle.dart new file mode 100644 index 000000000..83cc550db --- /dev/null +++ b/packages/realm_dart/lib/src/handles/map_changes_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/map_changes_handle.dart' + if (dart.library.js_interop) 'web/map_changes_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/map_handle.dart b/packages/realm_dart/lib/src/handles/map_handle.dart new file mode 100644 index 000000000..afc43b6be --- /dev/null +++ b/packages/realm_dart/lib/src/handles/map_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/map_handle.dart' + if (dart.library.js_interop) 'web/map_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart new file mode 100644 index 000000000..557f97f1d --- /dev/null +++ b/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/mutable_subscription_set_handle.dart' + if (dart.library.js_interop) 'web/mutable_subscription_set_handle.dart'; diff --git a/packages/realm_dart/lib/src/native/app_handle.dart b/packages/realm_dart/lib/src/handles/native/app_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/app_handle.dart rename to packages/realm_dart/lib/src/handles/native/app_handle.dart index c766c0453..38b1900b2 100644 --- a/packages/realm_dart/lib/src/native/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/app_handle.dart @@ -6,9 +6,9 @@ import 'dart:ffi'; import 'dart:io'; import 'dart:isolate'; -import '../init.dart'; -import '../realm_class.dart'; -import '../scheduler.dart'; +import '../../init.dart'; +import '../../realm_class.dart'; +import '../../scheduler.dart'; import 'convert.dart'; import 'convert_native.dart'; import 'credentials_handle.dart'; diff --git a/packages/realm_dart/lib/src/native/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart similarity index 94% rename from packages/realm_dart/lib/src/native/async_open_task_handle.dart rename to packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart index ddd184276..ee938a75c 100644 --- a/packages/realm_dart/lib/src/native/async_open_task_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart @@ -2,11 +2,11 @@ import 'dart:ffi'; import 'package:cancellation_token/cancellation_token.dart'; import 'ffi.dart'; -import 'package:realm_dart/src/native/error_handling.dart'; -import 'package:realm_dart/src/native/realm_bindings.dart'; +import 'error_handling.dart'; +import 'realm_bindings.dart'; -import '../realm_dart.dart'; -import '../scheduler.dart'; +import '../../realm_dart.dart'; +import '../../scheduler.dart'; import 'config_handle.dart'; import 'handle_base.dart'; import 'realm_handle.dart'; diff --git a/packages/realm_dart/lib/src/native/collection_changes_handle.dart b/packages/realm_dart/lib/src/handles/native/collection_changes_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/collection_changes_handle.dart rename to packages/realm_dart/lib/src/handles/native/collection_changes_handle.dart index ba5a63e29..56a26ce93 100644 --- a/packages/realm_dart/lib/src/native/collection_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/collection_changes_handle.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../collections.dart'; +import '../../collections.dart'; import 'from_native.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/native/collection_handle_base.dart b/packages/realm_dart/lib/src/handles/native/collection_handle_base.dart similarity index 94% rename from packages/realm_dart/lib/src/native/collection_handle_base.dart rename to packages/realm_dart/lib/src/handles/native/collection_handle_base.dart index 6ac5011c0..4fbd3e235 100644 --- a/packages/realm_dart/lib/src/native/collection_handle_base.dart +++ b/packages/realm_dart/lib/src/handles/native/collection_handle_base.dart @@ -3,12 +3,11 @@ import 'dart:ffi'; -import 'package:realm_dart/src/native/rooted_handle.dart'; - -import '../realm_class.dart'; +import '../../realm_class.dart'; import 'list_handle.dart'; import 'map_handle.dart'; import 'realm_bindings.dart'; +import 'rooted_handle.dart'; abstract class CollectionHandleBase extends RootedHandleBase { CollectionHandleBase(super.root, super.pointer, super.size); diff --git a/packages/realm_dart/lib/src/native/config_handle.dart b/packages/realm_dart/lib/src/handles/native/config_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/config_handle.dart rename to packages/realm_dart/lib/src/handles/native/config_handle.dart index bb4010a70..1c0365357 100644 --- a/packages/realm_dart/lib/src/native/config_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/config_handle.dart @@ -5,13 +5,13 @@ import 'dart:async'; import 'dart:ffi'; import 'ffi.dart'; -import 'package:realm_dart/src/native/error_handling.dart'; +import 'error_handling.dart'; -import '../configuration.dart'; -import '../migration.dart'; -import '../realm_class.dart'; -import '../scheduler.dart'; -import '../user.dart'; +import '../../configuration.dart'; +import '../../migration.dart'; +import '../../realm_class.dart'; +import '../../scheduler.dart'; +import '../../user.dart'; import 'convert_native.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/native/convert.dart b/packages/realm_dart/lib/src/handles/native/convert.dart similarity index 100% rename from packages/realm_dart/lib/src/native/convert.dart rename to packages/realm_dart/lib/src/handles/native/convert.dart diff --git a/packages/realm_dart/lib/src/native/convert_native.dart b/packages/realm_dart/lib/src/handles/native/convert_native.dart similarity index 100% rename from packages/realm_dart/lib/src/native/convert_native.dart rename to packages/realm_dart/lib/src/handles/native/convert_native.dart diff --git a/packages/realm_dart/lib/src/native/credentials_handle.dart b/packages/realm_dart/lib/src/handles/native/credentials_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/credentials_handle.dart rename to packages/realm_dart/lib/src/handles/native/credentials_handle.dart index d742d9ac9..3b35dc7dd 100644 --- a/packages/realm_dart/lib/src/native/credentials_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/credentials_handle.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../credentials.dart'; +import '../../credentials.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; diff --git a/packages/realm_dart/lib/src/native/decimal128.dart b/packages/realm_dart/lib/src/handles/native/decimal128.dart similarity index 100% rename from packages/realm_dart/lib/src/native/decimal128.dart rename to packages/realm_dart/lib/src/handles/native/decimal128.dart diff --git a/packages/realm_dart/lib/src/native/error_handling.dart b/packages/realm_dart/lib/src/handles/native/error_handling.dart similarity index 97% rename from packages/realm_dart/lib/src/native/error_handling.dart rename to packages/realm_dart/lib/src/handles/native/error_handling.dart index 68f47fea8..ea18eeef7 100644 --- a/packages/realm_dart/lib/src/native/error_handling.dart +++ b/packages/realm_dart/lib/src/handles/native/error_handling.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../realm_object.dart'; +import '../../realm_object.dart'; import 'from_native.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; diff --git a/packages/realm_dart/lib/src/native/ffi.dart b/packages/realm_dart/lib/src/handles/native/ffi.dart similarity index 100% rename from packages/realm_dart/lib/src/native/ffi.dart rename to packages/realm_dart/lib/src/handles/native/ffi.dart diff --git a/packages/realm_dart/lib/src/native/from_native.dart b/packages/realm_dart/lib/src/handles/native/from_native.dart similarity index 98% rename from packages/realm_dart/lib/src/native/from_native.dart rename to packages/realm_dart/lib/src/handles/native/from_native.dart index 316331ce2..d6ab87d4b 100644 --- a/packages/realm_dart/lib/src/native/from_native.dart +++ b/packages/realm_dart/lib/src/handles/native/from_native.dart @@ -5,10 +5,10 @@ import 'dart:typed_data'; import 'ffi.dart'; -import '../app.dart'; -import '../configuration.dart'; -import '../realm_class.dart'; -import '../user.dart'; +import '../../app.dart'; +import '../../configuration.dart'; +import '../../realm_class.dart'; +import '../../user.dart'; import 'decimal128.dart'; import 'list_handle.dart'; import 'map_handle.dart'; diff --git a/packages/realm_dart/lib/src/native/handle_base.dart b/packages/realm_dart/lib/src/handles/native/handle_base.dart similarity index 97% rename from packages/realm_dart/lib/src/native/handle_base.dart rename to packages/realm_dart/lib/src/handles/native/handle_base.dart index e0a94112e..93bdadf95 100644 --- a/packages/realm_dart/lib/src/native/handle_base.dart +++ b/packages/realm_dart/lib/src/handles/native/handle_base.dart @@ -3,8 +3,7 @@ import 'dart:ffi'; -import 'package:realm_dart/src/native/error_handling.dart'; - +import 'error_handling.dart'; import 'realm_library.dart'; // Flag to enable trace on finalization. diff --git a/packages/realm_dart/lib/src/native/http_transport_handle.dart b/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/http_transport_handle.dart rename to packages/realm_dart/lib/src/handles/native/http_transport_handle.dart index afb776bfd..c7988f4d2 100644 --- a/packages/realm_dart/lib/src/native/http_transport_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart @@ -5,9 +5,9 @@ import 'dart:convert'; import 'dart:ffi'; import 'dart:io'; -import '../logging.dart'; -import '../realm_dart.dart'; -import '../scheduler.dart'; +import '../../logging.dart'; +import '../../realm_dart.dart'; +import '../../scheduler.dart'; import 'convert_native.dart'; import 'ffi.dart'; import 'handle_base.dart'; diff --git a/packages/realm_dart/lib/src/native/list_handle.dart b/packages/realm_dart/lib/src/handles/native/list_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/list_handle.dart rename to packages/realm_dart/lib/src/handles/native/list_handle.dart index 5021b5abc..4c1d330ca 100644 --- a/packages/realm_dart/lib/src/native/list_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/list_handle.dart @@ -3,7 +3,7 @@ import 'dart:ffi'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'collection_handle_base.dart'; import 'convert_native.dart'; import 'error_handling.dart'; diff --git a/packages/realm_dart/lib/src/native/map_changes_handle.dart b/packages/realm_dart/lib/src/handles/native/map_changes_handle.dart similarity index 95% rename from packages/realm_dart/lib/src/native/map_changes_handle.dart rename to packages/realm_dart/lib/src/handles/native/map_changes_handle.dart index bccfbb909..4ba4b1f81 100644 --- a/packages/realm_dart/lib/src/native/map_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/map_changes_handle.dart @@ -3,10 +3,9 @@ import 'dart:ffi'; -import 'package:realm_dart/src/native/from_native.dart'; - -import '../collections.dart'; +import '../../collections.dart'; import 'ffi.dart'; +import 'from_native.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; diff --git a/packages/realm_dart/lib/src/native/map_handle.dart b/packages/realm_dart/lib/src/handles/native/map_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/map_handle.dart rename to packages/realm_dart/lib/src/handles/native/map_handle.dart index 27a96402a..5453de7bb 100644 --- a/packages/realm_dart/lib/src/native/map_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/map_handle.dart @@ -3,7 +3,7 @@ import 'dart:ffi'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'collection_handle_base.dart'; import 'convert_native.dart'; import 'error_handling.dart'; diff --git a/packages/realm_dart/lib/src/native/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/mutable_subscription_set_handle.dart rename to packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart index 8e6a4aeab..16f5fd9ff 100644 --- a/packages/realm_dart/lib/src/native/mutable_subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'convert_native.dart'; import 'error_handling.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/native/notification_token_handle.dart b/packages/realm_dart/lib/src/handles/native/notification_token_handle.dart similarity index 97% rename from packages/realm_dart/lib/src/native/notification_token_handle.dart rename to packages/realm_dart/lib/src/handles/native/notification_token_handle.dart index eebee574e..d72f36676 100644 --- a/packages/realm_dart/lib/src/native/notification_token_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/notification_token_handle.dart @@ -1,6 +1,6 @@ import 'dart:ffi'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'collection_changes_handle.dart'; import 'from_native.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/native/object_handle.dart b/packages/realm_dart/lib/src/handles/native/object_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/object_handle.dart rename to packages/realm_dart/lib/src/handles/native/object_handle.dart index f561e1815..019e85c9e 100644 --- a/packages/realm_dart/lib/src/native/object_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/object_handle.dart @@ -3,7 +3,7 @@ import 'dart:ffi'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'collection_handle_base.dart'; import 'convert_native.dart'; import 'error_handling.dart'; diff --git a/packages/realm_dart/lib/src/native/query_handle.dart b/packages/realm_dart/lib/src/handles/native/query_handle.dart similarity index 100% rename from packages/realm_dart/lib/src/native/query_handle.dart rename to packages/realm_dart/lib/src/handles/native/query_handle.dart diff --git a/packages/realm_dart/lib/src/native/realm_bindings.dart b/packages/realm_dart/lib/src/handles/native/realm_bindings.dart similarity index 100% rename from packages/realm_dart/lib/src/native/realm_bindings.dart rename to packages/realm_dart/lib/src/handles/native/realm_bindings.dart diff --git a/packages/realm_dart/lib/src/native/realm_core.dart b/packages/realm_dart/lib/src/handles/native/realm_core.dart similarity index 98% rename from packages/realm_dart/lib/src/native/realm_core.dart rename to packages/realm_dart/lib/src/handles/native/realm_core.dart index 2b2a4830e..ae8c90a28 100644 --- a/packages/realm_dart/lib/src/native/realm_core.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_core.dart @@ -9,9 +9,9 @@ import 'package:crypto/crypto.dart'; import 'package:path/path.dart' as path; import 'package:pubspec_parse/pubspec_parse.dart'; -import '../init.dart'; -import '../realm_class.dart'; -import '../scheduler.dart'; +import '../../init.dart'; +import '../../realm_class.dart'; +import '../../scheduler.dart'; import 'convert_native.dart'; import 'error_handling.dart'; import 'ffi.dart'; diff --git a/packages/realm_dart/lib/src/native/realm_handle.dart b/packages/realm_dart/lib/src/handles/native/realm_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/realm_handle.dart rename to packages/realm_dart/lib/src/handles/native/realm_handle.dart index 91a4ac925..8f63fd6b1 100644 --- a/packages/realm_dart/lib/src/native/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_handle.dart @@ -8,9 +8,9 @@ import 'package:cancellation_token/cancellation_token.dart'; import 'ffi.dart'; import 'package:realm_common/realm_common.dart'; -import '../logging.dart'; -import '../realm_class.dart'; -import '../realm_object.dart'; +import '../../logging.dart'; +import '../../realm_class.dart'; +import '../../realm_object.dart'; import 'config_handle.dart'; import 'convert_native.dart'; import 'error_handling.dart'; diff --git a/packages/realm_dart/lib/src/native/realm_library.dart b/packages/realm_dart/lib/src/handles/native/realm_library.dart similarity index 90% rename from packages/realm_dart/lib/src/native/realm_library.dart rename to packages/realm_dart/lib/src/handles/native/realm_library.dart index 678c395b1..d4eda7514 100644 --- a/packages/realm_dart/lib/src/native/realm_library.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_library.dart @@ -1,10 +1,11 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'ffi.dart'; import 'package:realm_common/realm_common.dart'; -import 'package:realm_dart/src/init.dart'; -import 'package:realm_dart/src/native/realm_bindings.dart'; + +import '../../init.dart'; +import 'ffi.dart'; +import 'realm_bindings.dart'; const bugInTheSdkMessage = "This is likely a bug in the Realm SDK - please file an issue at https://github.com/realm/realm-dart/issues"; diff --git a/packages/realm_dart/lib/src/native/results_handle.dart b/packages/realm_dart/lib/src/handles/native/results_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/results_handle.dart rename to packages/realm_dart/lib/src/handles/native/results_handle.dart index 0f4277776..9fa5c1ab6 100644 --- a/packages/realm_dart/lib/src/native/results_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/results_handle.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'convert_native.dart'; import 'error_handling.dart'; import 'notification_token_handle.dart'; diff --git a/packages/realm_dart/lib/src/native/rooted_handle.dart b/packages/realm_dart/lib/src/handles/native/rooted_handle.dart similarity index 100% rename from packages/realm_dart/lib/src/native/rooted_handle.dart rename to packages/realm_dart/lib/src/handles/native/rooted_handle.dart diff --git a/packages/realm_dart/lib/src/native/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart similarity index 100% rename from packages/realm_dart/lib/src/native/scheduler_handle.dart rename to packages/realm_dart/lib/src/handles/native/scheduler_handle.dart diff --git a/packages/realm_dart/lib/src/native/schema_handle.dart b/packages/realm_dart/lib/src/handles/native/schema_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/schema_handle.dart rename to packages/realm_dart/lib/src/handles/native/schema_handle.dart index e11512d46..7143cb1b8 100644 --- a/packages/realm_dart/lib/src/native/schema_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/schema_handle.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; import 'ffi.dart'; import 'package:realm_common/realm_common.dart'; -import '../configuration.dart'; +import '../../configuration.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; diff --git a/packages/realm_dart/lib/src/native/session_handle.dart b/packages/realm_dart/lib/src/handles/native/session_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/session_handle.dart rename to packages/realm_dart/lib/src/handles/native/session_handle.dart index 0d0119d22..e8f20ad23 100644 --- a/packages/realm_dart/lib/src/native/session_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/session_handle.dart @@ -6,9 +6,9 @@ import 'dart:ffi'; import 'package:cancellation_token/cancellation_token.dart'; import 'ffi.dart'; -import '../realm_dart.dart'; -import '../scheduler.dart'; -import '../session.dart'; +import '../../realm_dart.dart'; +import '../../scheduler.dart'; +import '../../session.dart'; import 'convert_native.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/native/set_handle.dart b/packages/realm_dart/lib/src/handles/native/set_handle.dart similarity index 99% rename from packages/realm_dart/lib/src/native/set_handle.dart rename to packages/realm_dart/lib/src/handles/native/set_handle.dart index 6135ae620..f0a458d87 100644 --- a/packages/realm_dart/lib/src/native/set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/set_handle.dart @@ -5,7 +5,7 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../realm_dart.dart'; +import '../../realm_dart.dart'; import 'convert_native.dart'; import 'error_handling.dart'; import 'notification_token_handle.dart'; diff --git a/packages/realm_dart/lib/src/native/subscription_handle.dart b/packages/realm_dart/lib/src/handles/native/subscription_handle.dart similarity index 96% rename from packages/realm_dart/lib/src/native/subscription_handle.dart rename to packages/realm_dart/lib/src/handles/native/subscription_handle.dart index 06eb4cf87..e3ffc9d74 100644 --- a/packages/realm_dart/lib/src/native/subscription_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/subscription_handle.dart @@ -3,7 +3,7 @@ import 'dart:ffi'; -import '../realm_class.dart'; +import '../../realm_class.dart'; import 'from_native.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/native/subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/subscription_set_handle.dart rename to packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart index a4eadae0a..fa1b7883f 100644 --- a/packages/realm_dart/lib/src/native/subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart @@ -6,8 +6,8 @@ import 'dart:ffi'; import 'package:cancellation_token/cancellation_token.dart'; import 'ffi.dart'; -import '../realm_dart.dart'; -import '../scheduler.dart'; +import '../../realm_dart.dart'; +import '../../scheduler.dart'; import 'convert.dart'; import 'convert_native.dart'; import 'error_handling.dart'; diff --git a/packages/realm_dart/lib/src/native/to_native.dart b/packages/realm_dart/lib/src/handles/native/to_native.dart similarity index 98% rename from packages/realm_dart/lib/src/native/to_native.dart rename to packages/realm_dart/lib/src/handles/native/to_native.dart index 5497146fc..b18b945a9 100644 --- a/packages/realm_dart/lib/src/native/to_native.dart +++ b/packages/realm_dart/lib/src/handles/native/to_native.dart @@ -2,12 +2,11 @@ import 'dart:convert'; import 'dart:ffi'; import 'dart:typed_data'; -import 'package:realm_dart/src/native/realm_library.dart'; - -import '../realm_dart.dart'; -import '../realm_object.dart'; +import '../../realm_dart.dart'; +import '../../realm_object.dart'; import 'decimal128.dart'; import 'realm_bindings.dart'; +import 'realm_library.dart'; extension ListEx on List { Pointer toCharPtr(Allocator allocator) { diff --git a/packages/realm_dart/lib/src/native/user_handle.dart b/packages/realm_dart/lib/src/handles/native/user_handle.dart similarity index 98% rename from packages/realm_dart/lib/src/native/user_handle.dart rename to packages/realm_dart/lib/src/handles/native/user_handle.dart index 1092a0143..abacd3c87 100644 --- a/packages/realm_dart/lib/src/native/user_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/user_handle.dart @@ -7,10 +7,10 @@ import 'dart:ffi'; import 'ffi.dart'; -import '../credentials.dart'; -import '../realm_dart.dart'; -import '../scheduler.dart'; -import '../user.dart'; +import '../../credentials.dart'; +import '../../realm_dart.dart'; +import '../../scheduler.dart'; +import '../../user.dart'; import 'app_handle.dart'; import 'convert.dart'; import 'convert_native.dart'; diff --git a/packages/realm_dart/lib/src/handles/notification_token_handle.dart b/packages/realm_dart/lib/src/handles/notification_token_handle.dart new file mode 100644 index 000000000..ddca8f3cc --- /dev/null +++ b/packages/realm_dart/lib/src/handles/notification_token_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/notification_token_handle.dart' + if (dart.library.js_interop) 'web/notification_token_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/object_handle.dart b/packages/realm_dart/lib/src/handles/object_handle.dart new file mode 100644 index 000000000..2fc8c6dd7 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/object_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/object_handle.dart' + if (dart.library.js_interop) 'web/object_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/realm_bindings.dart b/packages/realm_dart/lib/src/handles/realm_bindings.dart new file mode 100644 index 000000000..4618e541b --- /dev/null +++ b/packages/realm_dart/lib/src/handles/realm_bindings.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/realm_bindings.dart' + if (dart.library.js_interop) 'web/realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/handles/realm_core.dart b/packages/realm_dart/lib/src/handles/realm_core.dart new file mode 100644 index 000000000..efff736de --- /dev/null +++ b/packages/realm_dart/lib/src/handles/realm_core.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/realm_core.dart' + if (dart.library.js_interop) 'web/realm_core.dart'; diff --git a/packages/realm_dart/lib/src/handles/realm_handle.dart b/packages/realm_dart/lib/src/handles/realm_handle.dart new file mode 100644 index 000000000..9a2522cc0 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/realm_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/realm_handle.dart' + if (dart.library.js_interop) 'web/realm_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/realm_library.dart b/packages/realm_dart/lib/src/handles/realm_library.dart new file mode 100644 index 000000000..9114328ea --- /dev/null +++ b/packages/realm_dart/lib/src/handles/realm_library.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/realm_library.dart' + if (dart.library.js_interop) 'web/realm_library.dart'; diff --git a/packages/realm_dart/lib/src/handles/results_handle.dart b/packages/realm_dart/lib/src/handles/results_handle.dart new file mode 100644 index 000000000..d4e4d4c67 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/results_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/results_handle.dart' + if (dart.library.js_interop) 'web/results_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/scheduler_handle.dart new file mode 100644 index 000000000..b0b88e593 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/scheduler_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/scheduler_handle.dart' + if (dart.library.js_interop) 'web/scheduler_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/schema_handle.dart b/packages/realm_dart/lib/src/handles/schema_handle.dart new file mode 100644 index 000000000..73445a6e2 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/schema_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/schema_handle.dart' + if (dart.library.js_interop) 'web/schema_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/session_handle.dart b/packages/realm_dart/lib/src/handles/session_handle.dart new file mode 100644 index 000000000..ff4b82552 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/session_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/session_handle.dart' + if (dart.library.js_interop) 'web/session_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/set_handle.dart b/packages/realm_dart/lib/src/handles/set_handle.dart new file mode 100644 index 000000000..1e1eb1073 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/set_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/set_handle.dart' + if (dart.library.js_interop) 'web/set_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/subscription_handle.dart b/packages/realm_dart/lib/src/handles/subscription_handle.dart new file mode 100644 index 000000000..10f79f5d7 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/subscription_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/subscription_handle.dart' + if (dart.library.js_interop) 'web/subscription_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/subscription_set_handle.dart new file mode 100644 index 000000000..452510a76 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/subscription_set_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/subscription_set_handle.dart' + if (dart.library.js_interop) 'web/subscription_set_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/user_handle.dart b/packages/realm_dart/lib/src/handles/user_handle.dart new file mode 100644 index 000000000..1060b55ea --- /dev/null +++ b/packages/realm_dart/lib/src/handles/user_handle.dart @@ -0,0 +1,5 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +export 'native/user_handle.dart' + if (dart.library.js_interop) 'web/user_handle.dart'; diff --git a/packages/realm_dart/lib/src/list.dart b/packages/realm_dart/lib/src/list.dart index c2da5baf5..4f6ae75f2 100644 --- a/packages/realm_dart/lib/src/list.dart +++ b/packages/realm_dart/lib/src/list.dart @@ -1,18 +1,18 @@ // Copyright 2021 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'dart:core'; import 'dart:async'; import 'dart:collection'; +import 'dart:core'; import 'package:collection/collection.dart' as collection; import 'collections.dart'; -import 'native/collection_changes_handle.dart'; -import 'native/handle_base.dart'; -import 'native/list_handle.dart'; -import 'native/notification_token_handle.dart'; -import 'native/object_handle.dart'; +import 'handles/collection_changes_handle.dart'; +import 'handles/handle_base.dart'; +import 'handles/list_handle.dart'; +import 'handles/notification_token_handle.dart'; +import 'handles/object_handle.dart'; import 'realm_class.dart'; import 'realm_object.dart'; import 'results.dart'; diff --git a/packages/realm_dart/lib/src/logging.dart b/packages/realm_dart/lib/src/logging.dart index 466dd8043..1555ca062 100644 --- a/packages/realm_dart/lib/src/logging.dart +++ b/packages/realm_dart/lib/src/logging.dart @@ -5,7 +5,7 @@ import 'dart:async'; import 'package:logging/logging.dart'; -import 'native/realm_core.dart'; +import 'handles/realm_core.dart'; // Using classes to make a fancy hierarchical enum sealed class LogCategory { diff --git a/packages/realm_dart/lib/src/map.dart b/packages/realm_dart/lib/src/map.dart index 093713cad..ba7e70df2 100644 --- a/packages/realm_dart/lib/src/map.dart +++ b/packages/realm_dart/lib/src/map.dart @@ -6,15 +6,14 @@ import 'dart:collection'; import 'package:collection/collection.dart' as collection; - import 'collections.dart'; -import 'native/handle_base.dart'; -import 'native/map_changes_handle.dart'; -import 'native/map_handle.dart'; -import 'native/notification_token_handle.dart'; -import 'native/object_handle.dart'; -import 'realm_object.dart'; +import 'handles/handle_base.dart'; +import 'handles/map_changes_handle.dart'; +import 'handles/map_handle.dart'; +import 'handles/notification_token_handle.dart'; +import 'handles/object_handle.dart'; import 'realm_class.dart'; +import 'realm_object.dart'; import 'results.dart'; /// RealmMap is a collection that contains key-value pairs of . diff --git a/packages/realm_dart/lib/src/migration.dart b/packages/realm_dart/lib/src/migration.dart index 86eaa0d50..7d2f4736a 100644 --- a/packages/realm_dart/lib/src/migration.dart +++ b/packages/realm_dart/lib/src/migration.dart @@ -1,7 +1,7 @@ // Copyright 2022 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'native/schema_handle.dart'; +import 'handles/schema_handle.dart'; import 'realm_class.dart'; import 'realm_object.dart'; diff --git a/packages/realm_dart/lib/src/realm_class.dart b/packages/realm_dart/lib/src/realm_class.dart index 5cc18c3fc..d4c435113 100644 --- a/packages/realm_dart/lib/src/realm_class.dart +++ b/packages/realm_dart/lib/src/realm_class.dart @@ -9,18 +9,18 @@ import 'package:collection/collection.dart'; import 'package:realm_common/realm_common.dart'; import 'configuration.dart'; +import 'handles/async_open_task_handle.dart'; +import 'handles/handle_base.dart'; +import 'handles/list_handle.dart'; +import 'handles/map_handle.dart'; +import 'handles/notification_token_handle.dart'; +import 'handles/object_handle.dart'; +import 'handles/realm_core.dart'; +import 'handles/realm_handle.dart'; +import 'handles/set_handle.dart'; import 'list.dart'; import 'logging.dart'; import 'map.dart'; -import 'native/async_open_task_handle.dart'; -import 'native/handle_base.dart'; -import 'native/list_handle.dart'; -import 'native/map_handle.dart'; -import 'native/notification_token_handle.dart'; -import 'native/object_handle.dart'; -import 'native/realm_core.dart'; -import 'native/realm_handle.dart'; -import 'native/set_handle.dart'; import 'realm_object.dart'; import 'results.dart'; import 'scheduler.dart'; @@ -88,11 +88,11 @@ export "configuration.dart" SyncError, SyncErrorHandler; export 'credentials.dart' show AuthProviderType, Credentials, EmailPasswordAuthProvider; +export 'handles/decimal128.dart' show Decimal128; export 'list.dart' show RealmList, RealmListOfObject, RealmListChanges, ListExtension; export 'logging.dart' hide RealmLoggerInternal; export 'map.dart' show RealmMap, RealmMapChanges, RealmMapOfObject; export 'migration.dart' show Migration; -export 'native/decimal128.dart' show Decimal128; export 'realm_object.dart' show AsymmetricObject, diff --git a/packages/realm_dart/lib/src/realm_object.dart b/packages/realm_dart/lib/src/realm_object.dart index b2127da63..4f2165602 100644 --- a/packages/realm_dart/lib/src/realm_object.dart +++ b/packages/realm_dart/lib/src/realm_object.dart @@ -7,14 +7,14 @@ import 'package:collection/collection.dart'; import 'package:realm_common/realm_common.dart'; import 'configuration.dart'; +import 'handles/handle_base.dart'; +import 'handles/notification_token_handle.dart'; +import 'handles/object_handle.dart'; +import 'handles/realm_library.dart'; import 'list.dart'; -import 'native/handle_base.dart'; -import 'native/notification_token_handle.dart'; -import 'native/object_handle.dart'; -import 'native/realm_library.dart'; +import 'map.dart'; import 'realm_class.dart'; import 'results.dart'; -import 'map.dart'; typedef DartDynamic = dynamic; diff --git a/packages/realm_dart/lib/src/realm_web.dart b/packages/realm_dart/lib/src/realm_web.dart new file mode 100644 index 000000000..d2b0014df --- /dev/null +++ b/packages/realm_dart/lib/src/realm_web.dart @@ -0,0 +1,11 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +//export 'realm_class.dart' hide RealmInternal; + +/// @nodoc +// is Realm loaded in Flutter or Dart +const bool isFlutterPlatform = false; + +/// @nodoc +const String realmBinaryName = 'realm_dart'; diff --git a/packages/realm_dart/lib/src/results.dart b/packages/realm_dart/lib/src/results.dart index f632bdd4d..ea054067e 100644 --- a/packages/realm_dart/lib/src/results.dart +++ b/packages/realm_dart/lib/src/results.dart @@ -6,11 +6,11 @@ import 'dart:async'; import 'package:cancellation_token/cancellation_token.dart'; import 'collections.dart'; -import 'native/collection_changes_handle.dart'; -import 'native/handle_base.dart'; -import 'native/notification_token_handle.dart'; -import 'native/object_handle.dart'; -import 'native/results_handle.dart'; +import 'handles/collection_changes_handle.dart'; +import 'handles/handle_base.dart'; +import 'handles/notification_token_handle.dart'; +import 'handles/object_handle.dart'; +import 'handles/results_handle.dart'; import 'realm_class.dart'; import 'realm_object.dart'; diff --git a/packages/realm_dart/lib/src/scheduler.dart b/packages/realm_dart/lib/src/scheduler.dart index 8c60f1ebe..aa839df04 100644 --- a/packages/realm_dart/lib/src/scheduler.dart +++ b/packages/realm_dart/lib/src/scheduler.dart @@ -7,7 +7,7 @@ import 'dart:isolate'; import 'package:realm_dart/src/logging.dart'; -import 'native/scheduler_handle.dart'; +import 'handles/scheduler_handle.dart'; import 'realm_class.dart'; final _receivePortFinalizer = Finalizer((p) => p.close()); diff --git a/packages/realm_dart/lib/src/session.dart b/packages/realm_dart/lib/src/session.dart index a99aec871..8ca8d8874 100644 --- a/packages/realm_dart/lib/src/session.dart +++ b/packages/realm_dart/lib/src/session.dart @@ -4,8 +4,8 @@ import 'dart:async'; import '../realm.dart'; -import '../src/native/realm_bindings.dart'; -import 'native/session_handle.dart'; +import 'handles/realm_bindings.dart'; +import 'handles/session_handle.dart'; import 'user.dart'; /// An object encapsulating a synchronization session. Sessions represent the diff --git a/packages/realm_dart/lib/src/set.dart b/packages/realm_dart/lib/src/set.dart index ecb5043a4..0d4d3d43b 100644 --- a/packages/realm_dart/lib/src/set.dart +++ b/packages/realm_dart/lib/src/set.dart @@ -1,20 +1,20 @@ // Copyright 2023 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'dart:core'; import 'dart:async'; import 'dart:collection'; +import 'dart:core'; import 'package:collection/collection.dart' as collection; -import 'native/collection_changes_handle.dart'; -import 'native/handle_base.dart'; -import 'native/notification_token_handle.dart'; -import 'native/object_handle.dart'; -import 'native/set_handle.dart'; +import 'collections.dart'; +import 'handles/collection_changes_handle.dart'; +import 'handles/handle_base.dart'; +import 'handles/notification_token_handle.dart'; +import 'handles/object_handle.dart'; +import 'handles/set_handle.dart'; import 'realm_class.dart'; import 'realm_object.dart'; -import 'collections.dart'; import 'results.dart'; /// RealmSet is a collection that contains no duplicate elements. diff --git a/packages/realm_dart/lib/src/subscription.dart b/packages/realm_dart/lib/src/subscription.dart index e40f86cf8..12bf8c6c1 100644 --- a/packages/realm_dart/lib/src/subscription.dart +++ b/packages/realm_dart/lib/src/subscription.dart @@ -3,10 +3,10 @@ import 'dart:core'; -import 'native/convert.dart'; -import 'native/mutable_subscription_set_handle.dart'; -import 'native/subscription_handle.dart'; -import 'native/subscription_set_handle.dart'; +import 'handles/convert.dart'; +import 'handles/mutable_subscription_set_handle.dart'; +import 'handles/subscription_handle.dart'; +import 'handles/subscription_set_handle.dart'; import 'realm_class.dart'; import 'results.dart'; diff --git a/packages/realm_dart/lib/src/user.dart b/packages/realm_dart/lib/src/user.dart index 9ff597fe8..d10347da3 100644 --- a/packages/realm_dart/lib/src/user.dart +++ b/packages/realm_dart/lib/src/user.dart @@ -6,7 +6,7 @@ import 'dart:convert'; import 'app.dart'; import 'credentials.dart'; -import 'native/user_handle.dart'; +import 'handles/user_handle.dart'; import 'realm_class.dart'; /// Describes the changes to a [User] instance - for example when the access token is updated or the user state changes. diff --git a/packages/realm_dart/test/app_test.dart b/packages/realm_dart/test/app_test.dart index 9dd41f46e..a0c3f04d5 100644 --- a/packages/realm_dart/test/app_test.dart +++ b/packages/realm_dart/test/app_test.dart @@ -4,12 +4,12 @@ import 'dart:convert'; import 'dart:io'; import 'dart:isolate'; -import 'package:test/expect.dart' hide throws; -import 'package:path/path.dart' as path; -import 'package:crypto/crypto.dart'; +import 'package:crypto/crypto.dart'; +import 'package:path/path.dart' as path; import 'package:realm_dart/realm.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; +import 'package:realm_dart/src/handles/realm_core.dart'; + import 'test.dart'; void main() { diff --git a/packages/realm_dart/test/baas_helper.dart b/packages/realm_dart/test/baas_helper.dart index 52a5a368b..975c8e248 100644 --- a/packages/realm_dart/test/baas_helper.dart +++ b/packages/realm_dart/test/baas_helper.dart @@ -7,7 +7,7 @@ import 'package:test/test.dart' as testing; import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/cli/atlas_apps/baas_client.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; +import 'package:realm_dart/src/handles/realm_core.dart'; export 'package:realm_dart/src/cli/atlas_apps/baas_client.dart' show AppName; diff --git a/packages/realm_dart/test/decimal128_test.dart b/packages/realm_dart/test/decimal128_test.dart index 85aec4ca7..59c9e1bf5 100644 --- a/packages/realm_dart/test/decimal128_test.dart +++ b/packages/realm_dart/test/decimal128_test.dart @@ -4,10 +4,8 @@ import 'dart:math'; import 'package:meta/meta.dart'; -import 'package:realm_dart/src/native/decimal128.dart'; -import 'package:test/expect.dart' hide throws; +import 'package:realm_dart/src/handles/decimal128.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; import 'test.dart'; const int defaultTimes = 100; diff --git a/packages/realm_dart/test/embedded_test.dart b/packages/realm_dart/test/embedded_test.dart index 9936d7d67..baf5c570f 100644 --- a/packages/realm_dart/test/embedded_test.dart +++ b/packages/realm_dart/test/embedded_test.dart @@ -1,15 +1,13 @@ // Copyright 2022 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'package:realm_dart/src/native/decimal128.dart'; -import 'package:test/test.dart' hide test, throws; import 'package:realm_dart/realm.dart'; -import 'package:realm_dart/src/realm_object.dart'; -import 'test.dart'; - // This is required to be able to use the API for querying embedded objects. import 'package:realm_dart/src/realm_class.dart' show RealmInternal; +import 'package:realm_dart/src/realm_object.dart'; + +import 'test.dart'; void main() { setupTests(); diff --git a/packages/realm_dart/test/realm_logger_test.dart b/packages/realm_dart/test/realm_logger_test.dart index b50cda9b1..25ef317a9 100644 --- a/packages/realm_dart/test/realm_logger_test.dart +++ b/packages/realm_dart/test/realm_logger_test.dart @@ -6,8 +6,7 @@ import 'dart:isolate'; import 'package:logging/logging.dart' hide LogRecord; import 'package:logging/logging.dart' as logging show LogRecord; import 'package:realm_dart/src/logging.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; -import 'package:test/test.dart' hide test, throws; +import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:realm_dart/realm.dart'; import 'test.dart'; diff --git a/packages/realm_dart/test/realm_test.dart b/packages/realm_dart/test/realm_test.dart index cb7c094de..3fbc772d0 100644 --- a/packages/realm_dart/test/realm_test.dart +++ b/packages/realm_dart/test/realm_test.dart @@ -8,7 +8,7 @@ import 'dart:isolate'; import 'package:path/path.dart' as p; import 'package:realm_dart/realm.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; +import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:timezone/data/latest.dart' as tz; import 'package:timezone/timezone.dart' as tz; diff --git a/packages/realm_dart/test/subscription_test.dart b/packages/realm_dart/test/subscription_test.dart index 555fd7ae6..ab9fa7f2e 100644 --- a/packages/realm_dart/test/subscription_test.dart +++ b/packages/realm_dart/test/subscription_test.dart @@ -9,7 +9,7 @@ import 'dart:typed_data'; import 'package:test/expect.dart' hide throws; import 'package:realm_dart/realm.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; +import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:realm_dart/src/subscription.dart'; import 'test.dart'; diff --git a/packages/realm_dart/test/test.dart b/packages/realm_dart/test/test.dart index f88e5d0ec..4c54c6ac2 100644 --- a/packages/realm_dart/test/test.dart +++ b/packages/realm_dart/test/test.dart @@ -12,8 +12,8 @@ import 'package:meta/meta.dart'; import 'package:path/path.dart' as _path; import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/configuration.dart'; +import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:realm_dart/src/logging.dart'; -import 'package:realm_dart/src/native/realm_core.dart'; import 'package:realm_dart/src/realm_object.dart'; import 'package:test/test.dart'; From 8d9528ec27c152ba7d3b78a94d4768dde2416c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Fri, 31 May 2024 09:12:56 +0200 Subject: [PATCH 02/17] Take 2 --- .../lib/src/handles/app_handle.dart | 37 +++++++++- .../src/handles/async_open_task_handle.dart | 19 +++++- .../handles/collection_changes_handle.dart | 8 ++- .../lib/src/handles/credentials_handle.dart | 28 +++++++- .../lib/src/handles/handle_base.dart | 8 ++- .../lib/src/handles/list_handle.dart | 31 ++++++++- .../lib/src/handles/map_changes_handle.dart | 8 ++- .../lib/src/handles/map_handle.dart | 30 +++++++- .../mutable_subscription_set_handle.dart | 17 ++++- .../lib/src/handles/native/app_handle.dart | 42 +++++++++--- .../native/async_open_task_handle.dart | 15 ++-- .../native/collection_changes_handle.dart | 5 +- .../native/collection_handle_base.dart | 6 +- .../lib/src/handles/native/config_handle.dart | 20 +++--- .../handles/native/credentials_handle.dart | 4 +- .../lib/src/handles/native/from_native.dart | 5 +- .../lib/src/handles/native/handle_base.dart | 41 +++++++---- .../handles/native/http_transport_handle.dart | 4 +- .../lib/src/handles/native/list_handle.dart | 24 +++++-- .../handles/native/map_changes_handle.dart | 5 +- .../lib/src/handles/native/map_handle.dart | 23 ++++++- .../mutable_subscription_set_handle.dart | 21 ++++-- .../native/notification_token_handle.dart | 4 +- .../handles/native/object_changes_handle.dart | 32 +++++++++ .../lib/src/handles/native/object_handle.dart | 56 ++++++++------- .../lib/src/handles/native/realm_handle.dart | 42 ++++++++++-- .../src/handles/native/results_handle.dart | 16 ++++- .../src/handles/native/scheduler_handle.dart | 10 ++- .../lib/src/handles/native/schema_handle.dart | 4 +- .../src/handles/native/session_handle.dart | 29 +++++--- .../lib/src/handles/native/set_handle.dart | 18 ++++- .../handles/native/subscription_handle.dart | 12 +++- .../native/subscription_set_handle.dart | 22 ++++-- .../lib/src/handles/native/user_handle.dart | 51 +++++++++----- .../handles/notification_token_handle.dart | 5 +- .../src/handles/object_changes_handle.dart | 9 +++ .../lib/src/handles/object_handle.dart | 54 ++++++++++++++- .../lib/src/handles/realm_handle.dart | 68 ++++++++++++++++++- .../lib/src/handles/results_handle.dart | 27 +++++++- .../lib/src/handles/scheduler_handle.dart | 11 ++- .../lib/src/handles/schema_handle.dart | 10 ++- .../lib/src/handles/session_handle.dart | 34 +++++++++- .../lib/src/handles/set_handle.dart | 33 ++++++++- .../lib/src/handles/subscription_handle.dart | 15 +++- .../src/handles/subscription_set_handle.dart | 30 +++++++- .../lib/src/handles/user_handle.dart | 32 ++++++++- .../lib/src/handles/web/app_handle.dart | 13 ++++ .../handles/web/async_open_task_handle.dart | 14 ++++ .../web/collection_changes_handle.dart | 9 +++ .../src/handles/web/credentials_handle.dart | 27 ++++++++ .../lib/src/handles/web/handle_base.dart | 9 +++ .../lib/src/handles/web/list_handle.dart | 9 +++ .../src/handles/web/map_changes_handle.dart | 9 +++ .../lib/src/handles/web/map_handle.dart | 9 +++ .../web/mutable_subscription_set_handle.dart | 9 +++ .../web/notification_token_handle.dart | 9 +++ .../handles/web/object_changes_handle.dart | 9 +++ .../lib/src/handles/web/object_handle.dart | 9 +++ .../lib/src/handles/web/realm_handle.dart | 9 +++ .../lib/src/handles/web/results_handle.dart | 9 +++ .../lib/src/handles/web/scheduler_handle.dart | 13 ++++ .../lib/src/handles/web/schema_handle.dart | 13 ++++ .../lib/src/handles/web/session_handle.dart | 9 +++ .../lib/src/handles/web/set_handle.dart | 9 +++ .../src/handles/web/subscription_handle.dart | 9 +++ .../handles/web/subscription_set_handle.dart | 9 +++ .../lib/src/handles/web/user_handle.dart | 9 +++ packages/realm_dart/lib/src/realm_class.dart | 1 - packages/realm_dart/lib/src/realm_object.dart | 4 +- packages/realm_dart/lib/src/subscription.dart | 6 +- .../realm_dart/test/subscription_test.dart | 5 +- 71 files changed, 1088 insertions(+), 177 deletions(-) create mode 100644 packages/realm_dart/lib/src/handles/native/object_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/object_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/app_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/credentials_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/handle_base.dart create mode 100644 packages/realm_dart/lib/src/handles/web/list_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/map_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/map_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/notification_token_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/object_changes_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/object_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/realm_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/results_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/scheduler_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/schema_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/session_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/set_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/subscription_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart create mode 100644 packages/realm_dart/lib/src/handles/web/user_handle.dart diff --git a/packages/realm_dart/lib/src/handles/app_handle.dart b/packages/realm_dart/lib/src/handles/app_handle.dart index 47b326f03..e2a57a8e4 100644 --- a/packages/realm_dart/lib/src/handles/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/app_handle.dart @@ -1,5 +1,38 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/app_handle.dart' - if (dart.library.js_interop) 'web/app_handle.dart'; +import '../../realm.dart'; + +import 'credentials_handle.dart'; +import 'native/app_handle.dart' if (dart.library.js_interop) 'web/app_handle.dart' as impl; +import 'user_handle.dart'; + +abstract interface class AppHandle { + factory AppHandle.from(AppConfiguration configuration) = impl.AppHandle.from; + static AppHandle? get(String id, String? baseUrl) => impl.AppHandle.get(id, baseUrl); + + String get id; + + UserHandle? get currentUser; + List get users; + Future logIn(CredentialsHandle credentials); + Future removeUser(UserHandle user); + void switchUser(UserHandle user); + Future refreshCustomData(UserHandle user); + + void reconnect(); + String get baseUrl; + Future updateBaseUrl(Uri? baseUrl); + + Future registerUser(String email, String password); + Future confirmUser(String token, String tokenId); + Future resendConfirmation(String email); + + Future completeResetPassword(String password, String token, String tokenId); + Future requestResetPassword(String email); + Future callResetPasswordFunction(String email, String password, String? argsAsJSON); + Future retryCustomConfirmationFunction(String email); + Future deleteUser(UserHandle user); + bool resetRealm(String realmPath); + Future callAppFunction(UserHandle user, String functionName, String? argsAsJSON); +} diff --git a/packages/realm_dart/lib/src/handles/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/async_open_task_handle.dart index 43c4aeae2..47d988585 100644 --- a/packages/realm_dart/lib/src/handles/async_open_task_handle.dart +++ b/packages/realm_dart/lib/src/handles/async_open_task_handle.dart @@ -1,5 +1,20 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/async_open_task_handle.dart' - if (dart.library.js_interop) 'web/async_open_task_handle.dart'; +import '../realm_class.dart'; +import 'handle_base.dart'; +import 'native/async_open_task_handle.dart' if (dart.library.js_interop) 'web/async_open_task_handle.dart' as impl; +import 'realm_handle.dart'; + +abstract interface class AsyncOpenTaskHandle extends HandleBase { + factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) = impl.AsyncOpenTaskHandle.from; + + Future openAsync(CancellationToken? cancellationToken); + void cancel(); + + AsyncOpenTaskProgressNotificationTokenHandle registerProgressNotifier( + RealmAsyncOpenProgressNotificationsController controller, + ); +} + +abstract class AsyncOpenTaskProgressNotificationTokenHandle extends HandleBase {} \ No newline at end of file diff --git a/packages/realm_dart/lib/src/handles/collection_changes_handle.dart b/packages/realm_dart/lib/src/handles/collection_changes_handle.dart index 8988dae68..e8295ba1d 100644 --- a/packages/realm_dart/lib/src/handles/collection_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/collection_changes_handle.dart @@ -1,5 +1,9 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/collection_changes_handle.dart' - if (dart.library.js_interop) 'web/collection_changes_handle.dart'; +import '../collections.dart'; +import 'handle_base.dart'; + +abstract interface class CollectionChangesHandle extends HandleBase { + CollectionChanges get changes; +} diff --git a/packages/realm_dart/lib/src/handles/credentials_handle.dart b/packages/realm_dart/lib/src/handles/credentials_handle.dart index c06f648f9..d4259374b 100644 --- a/packages/realm_dart/lib/src/handles/credentials_handle.dart +++ b/packages/realm_dart/lib/src/handles/credentials_handle.dart @@ -1,5 +1,29 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/credentials_handle.dart' - if (dart.library.js_interop) 'web/credentials_handle.dart'; +import '../credentials.dart'; +import 'handle_base.dart'; + +import 'native/credentials_handle.dart' if (dart.library.js_interop) 'web/credentials_handle.dart' as impl; + +abstract interface class CredentialsHandle extends HandleBase { + factory CredentialsHandle.anonymous(bool reuseCredentials) = impl.CredentialsHandle.anonymous; + + factory CredentialsHandle.emailPassword(String email, String password) = impl.CredentialsHandle.emailPassword; + + factory CredentialsHandle.jwt(String token) = impl.CredentialsHandle.jwt; + + factory CredentialsHandle.apple(String idToken) = impl.CredentialsHandle.apple; + + factory CredentialsHandle.facebook(String accessToken) = impl.CredentialsHandle.facebook; + + factory CredentialsHandle.googleIdToken(String idToken) = impl.CredentialsHandle.googleIdToken; + + factory CredentialsHandle.googleAuthCode(String authCode) = impl.CredentialsHandle.googleAuthCode; + + factory CredentialsHandle.function(String payload) = impl.CredentialsHandle.function; + + factory CredentialsHandle.apiKey(String key) = impl.CredentialsHandle.apiKey; + + AuthProviderType get providerType; +} diff --git a/packages/realm_dart/lib/src/handles/handle_base.dart b/packages/realm_dart/lib/src/handles/handle_base.dart index 3cc73da68..bf255de0e 100644 --- a/packages/realm_dart/lib/src/handles/handle_base.dart +++ b/packages/realm_dart/lib/src/handles/handle_base.dart @@ -1,5 +1,9 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/handle_base.dart' - if (dart.library.js_interop) 'web/handle_base.dart'; +abstract class HandleBase { + bool get released; + bool get isUnowned; + void releaseCore(); + void release(); +} diff --git a/packages/realm_dart/lib/src/handles/list_handle.dart b/packages/realm_dart/lib/src/handles/list_handle.dart index f6ebbab17..4606fe831 100644 --- a/packages/realm_dart/lib/src/handles/list_handle.dart +++ b/packages/realm_dart/lib/src/handles/list_handle.dart @@ -1,5 +1,32 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/list_handle.dart' - if (dart.library.js_interop) 'web/list_handle.dart'; +import '../realm_dart.dart'; +import 'handle_base.dart'; +import 'notification_token_handle.dart'; +import 'object_handle.dart'; +import 'realm_handle.dart'; +import 'results_handle.dart'; + +abstract interface class ListHandle extends HandleBase { + bool get isValid; + int get size; + + // TODO: Consider splitting into two methods + void addOrUpdateAt(int index, Object? value, bool insert); + // TODO: avoid taking the [realm] parameter + void addOrUpdateCollectionAt(Realm realm, int index, RealmValue value, bool insert); + ResultsHandle asResults(); + void clear(); + void deleteAll(); + // TODO: avoid taking the [realm] parameter + Object? elementAt(Realm realm, int index); + int indexOf(Object? value); + ObjectHandle insertEmbeddedAt(int index); + void move(int from, int to); + ResultsHandle query(String query, List args); + void removeAt(int index); + ListHandle? resolveIn(RealmHandle frozenRealm); + ObjectHandle setEmbeddedAt(int index); + NotificationTokenHandle subscribeForNotifications(NotificationsController controller); +} diff --git a/packages/realm_dart/lib/src/handles/map_changes_handle.dart b/packages/realm_dart/lib/src/handles/map_changes_handle.dart index 83cc550db..a90197e6b 100644 --- a/packages/realm_dart/lib/src/handles/map_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/map_changes_handle.dart @@ -1,5 +1,9 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/map_changes_handle.dart' - if (dart.library.js_interop) 'web/map_changes_handle.dart'; +import '../collections.dart'; +import 'handle_base.dart'; + +abstract interface class MapChangesHandle extends HandleBase { + MapChanges get changes; +} \ No newline at end of file diff --git a/packages/realm_dart/lib/src/handles/map_handle.dart b/packages/realm_dart/lib/src/handles/map_handle.dart index afc43b6be..2ffa43557 100644 --- a/packages/realm_dart/lib/src/handles/map_handle.dart +++ b/packages/realm_dart/lib/src/handles/map_handle.dart @@ -1,5 +1,31 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/map_handle.dart' - if (dart.library.js_interop) 'web/map_handle.dart'; +import '../realm_class.dart'; +import 'handle_base.dart'; +import 'notification_token_handle.dart'; +import 'object_handle.dart'; +import 'realm_handle.dart'; +import 'results_handle.dart'; + +abstract interface class MapHandle extends HandleBase { + bool get isValid; + ResultsHandle get keys; + int get size; + ResultsHandle get values; + + void clear(); + bool containsKey(String key); + bool containsValue(Object? value); + // TODO: avoid taking a [Realm] as parameter (wrong layer) + Object? find(Realm realm, String key); + int indexOf(Object? value); + void insert(String key, Object? value); + // TODO: avoid taking a [Realm] as parameter (wrong layer) + void insertCollection(Realm realm, String key, RealmValue value); + ObjectHandle insertEmbedded(String key); + ResultsHandle query(String query, List args); + bool remove(String key); + MapHandle? resolveIn(RealmHandle frozenRealm); + NotificationTokenHandle subscribeForNotifications(NotificationsController controller); +} diff --git a/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart index 557f97f1d..06cb2a811 100644 --- a/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart @@ -1,5 +1,18 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/mutable_subscription_set_handle.dart' - if (dart.library.js_interop) 'web/mutable_subscription_set_handle.dart'; +import 'results_handle.dart'; +import 'subscription_handle.dart'; +import 'subscription_set_handle.dart'; + +abstract interface class MutableSubscriptionSetHandle extends SubscriptionSetHandle { + SubscriptionSetHandle commit(); + + SubscriptionHandle insertOrAssignSubscription(ResultsHandle results, String? name, bool update); + + bool erase(SubscriptionHandle subscription); + bool eraseByName(String name); + bool eraseByResults(ResultsHandle results); + + void clear(); +} diff --git a/packages/realm_dart/lib/src/handles/native/app_handle.dart b/packages/realm_dart/lib/src/handles/native/app_handle.dart index 38b1900b2..1c53bbf7a 100644 --- a/packages/realm_dart/lib/src/handles/native/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/app_handle.dart @@ -8,7 +8,6 @@ import 'dart:isolate'; import '../../init.dart'; import '../../realm_class.dart'; -import '../../scheduler.dart'; import 'convert.dart'; import 'convert_native.dart'; import 'credentials_handle.dart'; @@ -19,9 +18,12 @@ import 'http_transport_handle.dart'; import 'realm_bindings.dart'; import 'realm_core.dart'; import 'realm_library.dart'; +import 'scheduler_handle.dart'; import 'user_handle.dart'; -class AppHandle extends HandleBase { +import '../app_handle.dart' as intf; + +class AppHandle extends HandleBase implements intf.AppHandle { AppHandle(Pointer pointer) : super(pointer, 16); static bool _firstTime = true; @@ -51,10 +53,12 @@ class AppHandle extends HandleBase { }); } + @override UserHandle? get currentUser { return realmLib.realm_app_get_current_user(pointer).convert(UserHandle.new); } + @override List get users => using((arena) => _getUsers(arena)); List _getUsers(Arena arena, {int expectedSize = 2}) { @@ -76,7 +80,8 @@ class AppHandle extends HandleBase { return result; } - Future removeUser(UserHandle user) { + @override + Future removeUser(covariant UserHandle user) { final completer = Completer(); realmLib .realm_app_remove_user( @@ -90,7 +95,8 @@ class AppHandle extends HandleBase { return completer.future; } - void switchUser(UserHandle user) { + @override + void switchUser(covariant UserHandle user) { using((arena) { realmLib .realm_app_switch_user( @@ -101,13 +107,16 @@ class AppHandle extends HandleBase { }); } + @override void reconnect() => realmLib.realm_app_sync_client_reconnect(pointer); + @override String get baseUrl { final customDataPtr = realmLib.realm_app_get_base_url(pointer); return customDataPtr.cast().toRealmDartString(freeRealmMemory: true)!; } + @override Future updateBaseUrl(Uri? baseUrl) { final completer = Completer(); using((arena) { @@ -124,7 +133,8 @@ class AppHandle extends HandleBase { return completer.future; } - Future refreshCustomData(UserHandle user) { + @override + Future refreshCustomData(covariant UserHandle user) { final completer = Completer(); realmLib .realm_app_refresh_custom_data( @@ -138,11 +148,13 @@ class AppHandle extends HandleBase { return completer.future; } + @override String get id { return realmLib.realm_app_get_app_id(pointer).cast().toRealmDartString()!; } - Future logIn(CredentialsHandle credentials) { + @override + Future logIn(covariant CredentialsHandle credentials) { final completer = Completer(); realmLib .realm_app_log_in_with_credentials( @@ -156,6 +168,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future registerUser(String email, String password) { final completer = Completer(); using((arena) { @@ -173,6 +186,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future confirmUser(String token, String tokenId) { final completer = Completer(); using((arena) { @@ -190,6 +204,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future resendConfirmation(String email) { final completer = Completer(); using((arena) { @@ -206,6 +221,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future completeResetPassword(String password, String token, String tokenId) { final completer = Completer(); using((arena) { @@ -224,6 +240,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future requestResetPassword(String email) { final completer = Completer(); using((arena) { @@ -240,6 +257,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future callResetPasswordFunction(String email, String password, String? argsAsJSON) { final completer = Completer(); using((arena) { @@ -258,6 +276,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override Future retryCustomConfirmationFunction(String email) { final completer = Completer(); using((arena) { @@ -274,7 +293,8 @@ class AppHandle extends HandleBase { return completer.future; } - Future deleteUser(UserHandle user) { + @override + Future deleteUser(covariant UserHandle user) { final completer = Completer(); realmLib .realm_app_delete_user( @@ -288,6 +308,7 @@ class AppHandle extends HandleBase { return completer.future; } + @override bool resetRealm(String realmPath) { return using((arena) { final didRun = arena(); @@ -302,7 +323,8 @@ class AppHandle extends HandleBase { }); } - Future callAppFunction(UserHandle user, String functionName, String? argsAsJSON) { + @override + Future callAppFunction(covariant UserHandle user, String functionName, String? argsAsJSON) { return using((arena) { final completer = Completer(); realmLib @@ -333,7 +355,7 @@ Pointer createAsyncFunctionCallbackUserdata(Completer completer) { final userdata = realmLib.realm_dart_userdata_async_new( completer, callback.cast(), - scheduler.handle.pointer, + schedulerHandle.pointer, ); return userdata.cast(); @@ -361,7 +383,7 @@ Pointer createAsyncCallbackUserdata(Completer completer) { final userdata = realmLib.realm_dart_userdata_async_new( completer, callback.cast(), - scheduler.handle.pointer, + schedulerHandle.pointer, ); return userdata.cast(); diff --git a/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart index ee938a75c..7a6d202e4 100644 --- a/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart @@ -6,14 +6,16 @@ import 'error_handling.dart'; import 'realm_bindings.dart'; import '../../realm_dart.dart'; -import '../../scheduler.dart'; import 'config_handle.dart'; import 'handle_base.dart'; import 'realm_handle.dart'; import 'realm_library.dart'; +import 'scheduler_handle.dart'; import 'session_handle.dart'; -class AsyncOpenTaskHandle extends HandleBase { +import '../async_open_task_handle.dart' as intf; + +class AsyncOpenTaskHandle extends HandleBase implements intf.AsyncOpenTaskHandle { AsyncOpenTaskHandle(Pointer pointer) : super(pointer, 32); factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) { @@ -27,7 +29,7 @@ class AsyncOpenTaskHandle extends HandleBase { if (!completer.isCancelled) { final callback = Pointer.fromFunction realm, Pointer error)>(_openRealmAsyncCallback); - final userData = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), scheduler.handle.pointer); + final userData = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), schedulerHandle.pointer); realmLib.realm_async_open_task_start( pointer, realmLib.addresses.realm_dart_async_open_task_callback, @@ -46,7 +48,7 @@ class AsyncOpenTaskHandle extends HandleBase { RealmAsyncOpenProgressNotificationsController controller, ) { final callback = Pointer.fromFunction(syncProgressCallback); - final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), schedulerHandle.pointer); return AsyncOpenTaskProgressNotificationTokenHandle( realmLib.realm_async_open_task_register_download_progress_notifier( pointer, @@ -58,7 +60,8 @@ class AsyncOpenTaskHandle extends HandleBase { } } -class AsyncOpenTaskProgressNotificationTokenHandle extends HandleBase { +class AsyncOpenTaskProgressNotificationTokenHandle extends HandleBase + implements intf.AsyncOpenTaskProgressNotificationTokenHandle { AsyncOpenTaskProgressNotificationTokenHandle(Pointer pointer) : super(pointer, 40); } @@ -75,6 +78,6 @@ void _openRealmAsyncCallback(Object userData, Pointer { +import '../collection_changes_handle.dart' as intf; + +class CollectionChangesHandle extends HandleBase implements intf.CollectionChangesHandle { CollectionChangesHandle(Pointer pointer) : super(pointer, 256); + @override CollectionChanges get changes { return using((arena) { final outNumDeletions = arena(); diff --git a/packages/realm_dart/lib/src/handles/native/collection_handle_base.dart b/packages/realm_dart/lib/src/handles/native/collection_handle_base.dart index 4fbd3e235..7342ced4f 100644 --- a/packages/realm_dart/lib/src/handles/native/collection_handle_base.dart +++ b/packages/realm_dart/lib/src/handles/native/collection_handle_base.dart @@ -7,18 +7,18 @@ import '../../realm_class.dart'; import 'list_handle.dart'; import 'map_handle.dart'; import 'realm_bindings.dart'; +import 'realm_handle.dart'; import 'rooted_handle.dart'; abstract class CollectionHandleBase extends RootedHandleBase { CollectionHandleBase(super.root, super.pointer, super.size); } - void createCollection(Realm realm, RealmValue value, Pointer Function() createList, Pointer Function() createMap) { CollectionHandleBase? collectionHandle; try { switch (value.collectionType) { case RealmCollectionType.list: - final listHandle = ListHandle(createList(), realm.handle); + final listHandle = ListHandle(createList(), realm.handle as RealmHandle); collectionHandle = listHandle; final list = realm.createList(listHandle, null); @@ -30,7 +30,7 @@ void createCollection(Realm realm, RealmValue value, Pointer Functio list.add(item); } case RealmCollectionType.map: - final mapHandle = MapHandle(createMap(), realm.handle); + final mapHandle = MapHandle(createMap(), realm.handle as RealmHandle); collectionHandle = mapHandle; final map = realm.createMap(mapHandle, null); diff --git a/packages/realm_dart/lib/src/handles/native/config_handle.dart b/packages/realm_dart/lib/src/handles/native/config_handle.dart index 1c0365357..6c1134264 100644 --- a/packages/realm_dart/lib/src/handles/native/config_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/config_handle.dart @@ -4,20 +4,20 @@ import 'dart:async'; import 'dart:ffi'; -import 'ffi.dart'; -import 'error_handling.dart'; - import '../../configuration.dart'; import '../../migration.dart'; import '../../realm_class.dart'; -import '../../scheduler.dart'; import '../../user.dart'; import 'convert_native.dart'; +import 'error_handling.dart'; +import 'ffi.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_handle.dart'; import 'realm_library.dart'; +import 'scheduler_handle.dart'; import 'schema_handle.dart'; +import 'user_handle.dart'; class ConfigHandle extends HandleBase { ConfigHandle(Pointer pointer) : super(pointer, 512); @@ -32,7 +32,7 @@ class ConfigHandle extends HandleBase { } realmLib.realm_config_set_path(configHandle.pointer, config.path.toCharPtr(arena)); - realmLib.realm_config_set_scheduler(configHandle.pointer, scheduler.handle.pointer); + realmLib.realm_config_set_scheduler(configHandle.pointer, schedulerHandle.pointer); if (config.fifoFilesFallbackPath != null) { realmLib.realm_config_set_fifo_path(configHandle.pointer, config.fifoFilesFallbackPath!.toCharPtr(arena)); @@ -87,19 +87,19 @@ class ConfigHandle extends HandleBase { realmLib.realm_config_set_in_memory(configHandle.pointer, true); } else if (config is FlexibleSyncConfiguration) { realmLib.realm_config_set_schema_mode(configHandle.pointer, realm_schema_mode.RLM_SCHEMA_MODE_ADDITIVE_DISCOVERED); - final syncConfigPtr = realmLib.realm_flx_sync_config_new(config.user.handle.pointer).raiseLastErrorIfNull(); + final syncConfigPtr = realmLib.realm_flx_sync_config_new((config.user.handle as UserHandle).pointer).raiseLastErrorIfNull(); try { realmLib.realm_sync_config_set_session_stop_policy(syncConfigPtr, config.sessionStopPolicy.index); realmLib.realm_sync_config_set_resync_mode(syncConfigPtr, config.clientResetHandler.clientResyncMode.index); final errorHandlerCallback = Pointer.fromFunction, realm_sync_error_t)>(_syncErrorHandlerCallback); - final errorHandlerUserdata = realmLib.realm_dart_userdata_async_new(config, errorHandlerCallback.cast(), scheduler.handle.pointer); + final errorHandlerUserdata = realmLib.realm_dart_userdata_async_new(config, errorHandlerCallback.cast(), schedulerHandle.pointer); realmLib.realm_sync_config_set_error_handler(syncConfigPtr, realmLib.addresses.realm_dart_sync_error_handler_callback, errorHandlerUserdata.cast(), realmLib.addresses.realm_dart_userdata_async_free); if (config.clientResetHandler.onBeforeReset != null) { final syncBeforeResetCallback = Pointer.fromFunction, Pointer)>(_syncBeforeResetCallback); - final beforeResetUserdata = realmLib.realm_dart_userdata_async_new(config, syncBeforeResetCallback.cast(), scheduler.handle.pointer); + final beforeResetUserdata = realmLib.realm_dart_userdata_async_new(config, syncBeforeResetCallback.cast(), schedulerHandle.pointer); realmLib.realm_sync_config_set_before_client_reset_handler(syncConfigPtr, realmLib.addresses.realm_dart_sync_before_reset_handler_callback, beforeResetUserdata.cast(), realmLib.addresses.realm_dart_userdata_async_free); @@ -109,7 +109,7 @@ class ConfigHandle extends HandleBase { final syncAfterResetCallback = Pointer.fromFunction, Pointer, Bool, Pointer)>( _syncAfterResetCallback); - final afterResetUserdata = realmLib.realm_dart_userdata_async_new(config, syncAfterResetCallback.cast(), scheduler.handle.pointer); + final afterResetUserdata = realmLib.realm_dart_userdata_async_new(config, syncAfterResetCallback.cast(), schedulerHandle.pointer); realmLib.realm_sync_config_set_after_client_reset_handler(syncConfigPtr, realmLib.addresses.realm_dart_sync_after_reset_handler_callback, afterResetUserdata.cast(), realmLib.addresses.realm_dart_userdata_async_free); @@ -163,7 +163,7 @@ void _syncAfterResetCallback(Object userdata, Pointer beforeHandle syncConfig, RealmHandle.unowned(realmLib.realm_from_thread_safe_reference( afterReference, - scheduler.handle.pointer, + schedulerHandle.pointer, ))); try { diff --git a/packages/realm_dart/lib/src/handles/native/credentials_handle.dart b/packages/realm_dart/lib/src/handles/native/credentials_handle.dart index 3b35dc7dd..c7ecffe0f 100644 --- a/packages/realm_dart/lib/src/handles/native/credentials_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/credentials_handle.dart @@ -11,7 +11,9 @@ import 'realm_bindings.dart'; import 'realm_library.dart'; import 'to_native.dart'; -class CredentialsHandle extends HandleBase { +import '../credentials_handle.dart' as intf; + +class CredentialsHandle extends HandleBase implements intf.CredentialsHandle { CredentialsHandle(Pointer pointer) : super(pointer, 16); factory CredentialsHandle.anonymous(bool reuseCredentials) { diff --git a/packages/realm_dart/lib/src/handles/native/from_native.dart b/packages/realm_dart/lib/src/handles/native/from_native.dart index d6ab87d4b..7f2c34c7a 100644 --- a/packages/realm_dart/lib/src/handles/native/from_native.dart +++ b/packages/realm_dart/lib/src/handles/native/from_native.dart @@ -13,6 +13,7 @@ import 'decimal128.dart'; import 'list_handle.dart'; import 'map_handle.dart'; import 'realm_bindings.dart'; +import 'realm_handle.dart'; import 'realm_library.dart'; // TODO: Duplicated in to_native.dart @@ -64,14 +65,14 @@ extension RealmValueEx on realm_value_t { throw RealmException('toDartValue called with a list argument but without a list getter'); } - final listHandle = ListHandle(getList(), realm.handle); + final listHandle = ListHandle(getList(), realm.handle as RealmHandle); return realm.createList(listHandle, null); case realm_value_type.RLM_TYPE_DICTIONARY: if (getMap == null || realm == null) { throw RealmException('toDartValue called with a list argument but without a list getter'); } - final mapHandle = MapHandle(getMap(), realm.handle); + final mapHandle = MapHandle(getMap(), realm.handle as RealmHandle); return realm.createMap(mapHandle, null); default: throw RealmException("realm_value_type $type not supported"); diff --git a/packages/realm_dart/lib/src/handles/native/handle_base.dart b/packages/realm_dart/lib/src/handles/native/handle_base.dart index 93bdadf95..0835503e8 100644 --- a/packages/realm_dart/lib/src/handles/native/handle_base.dart +++ b/packages/realm_dart/lib/src/handles/native/handle_base.dart @@ -3,9 +3,13 @@ import 'dart:ffi'; +import 'package:realm_dart/realm.dart'; + import 'error_handling.dart'; import 'realm_library.dart'; +import '../handle_base.dart' as intf; + // Flag to enable trace on finalization. // // Be aware that the trace is likely late, and it might in rare case be missing, @@ -32,33 +36,42 @@ void _tearDownFinalizationTrace(Object value, Object finalizationToken) { _traceFinalization(finalizationToken); } -abstract class HandleBase implements Finalizable { +abstract class HandleBase implements Finalizable, intf.HandleBase { late Pointer _finalizableHandle; - Pointer pointer; - bool get released => pointer == nullptr; + Pointer _pointer; + Pointer get pointer { + if (released) throw RealmError('Trying to access a released handle'); + return _pointer; + } + + @override + bool get released => _pointer == nullptr; + @override final bool isUnowned; - HandleBase(this.pointer, int size) : isUnowned = false { - pointer.raiseLastErrorIfNull(); + HandleBase(this._pointer, int size) : isUnowned = false { + _pointer.raiseLastErrorIfNull(); _finalizableHandle = realmLib.realm_attach_finalizer(this, pointer.cast(), size); if (_enableFinalizerTrace) { - _setupFinalizationTrace(this, pointer); + _setupFinalizationTrace(this, _pointer); } } - HandleBase.unowned(this.pointer) : isUnowned = true { - pointer.raiseLastErrorIfNull(); + HandleBase.unowned(this._pointer) : isUnowned = true { + _pointer.raiseLastErrorIfNull(); } @override - String toString() => "${pointer.toString()} value=${pointer.cast().value}${isUnowned ? ' (unowned)' : ''}"; + String toString() => "${_pointer.toString()} value=${_pointer.cast().value}${isUnowned ? ' (unowned)' : ''}"; /// @nodoc /// A method that will be invoked just before the handle is released. Allows to cleanup /// any custom data that inheritors are storing. + @override void releaseCore() {} + @override void release() { if (released) { return; @@ -69,21 +82,21 @@ abstract class HandleBase implements Finalizable { if (!isUnowned) { realmLib.realm_detach_finalizer(_finalizableHandle, this); - realmLib.realm_release(pointer.cast()); + realmLib.realm_release(_pointer.cast()); } - pointer = nullptr; + _pointer = nullptr; if (_enableFinalizerTrace) { - _tearDownFinalizationTrace(this, pointer); + _tearDownFinalizationTrace(this, _pointer); } } @override // ignore: hash_and_equals bool operator ==(Object other) => other is HandleBase - ? pointer == other.pointer + ? _pointer == other._pointer ? true - : realmLib.realm_equals(pointer.cast(), other.pointer.cast()) + : realmLib.realm_equals(_pointer.cast(), other._pointer.cast()) : false; } diff --git a/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart b/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart index c7988f4d2..bf4f4fec5 100644 --- a/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart @@ -7,19 +7,19 @@ import 'dart:io'; import '../../logging.dart'; import '../../realm_dart.dart'; -import '../../scheduler.dart'; import 'convert_native.dart'; import 'ffi.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; +import 'scheduler_handle.dart'; class HttpTransportHandle extends HandleBase { HttpTransportHandle(Pointer pointer) : super(pointer, 24); factory HttpTransportHandle.from(HttpClient httpClient) { final requestCallback = Pointer.fromFunction)>(_requestCallback); - final requestCallbackUserdata = realmLib.realm_dart_userdata_async_new(httpClient, requestCallback.cast(), scheduler.handle.pointer); + final requestCallbackUserdata = realmLib.realm_dart_userdata_async_new(httpClient, requestCallback.cast(), schedulerHandle.pointer); return HttpTransportHandle(realmLib.realm_http_transport_new( realmLib.addresses.realm_dart_http_request_callback, requestCallbackUserdata.cast(), diff --git a/packages/realm_dart/lib/src/handles/native/list_handle.dart b/packages/realm_dart/lib/src/handles/native/list_handle.dart index 4c1d330ca..222710e17 100644 --- a/packages/realm_dart/lib/src/handles/native/list_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/list_handle.dart @@ -16,15 +16,20 @@ import 'realm_handle.dart'; import 'realm_library.dart'; import 'results_handle.dart'; -class ListHandle extends CollectionHandleBase { +import '../list_handle.dart' as intf; + +class ListHandle extends CollectionHandleBase implements intf.ListHandle { ListHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 88); + @override bool get isValid => realmLib.realm_list_is_valid(pointer); + @override ResultsHandle asResults() { return ResultsHandle(realmLib.realm_list_to_results(pointer), root); } + @override int get size { return using((arena) { final size = arena(); @@ -33,18 +38,22 @@ class ListHandle extends CollectionHandleBase { }); } + @override void removeAt(int index) { realmLib.realm_list_erase(pointer, index).raiseLastErrorIfFalse(); } + @override void move(int from, int to) { realmLib.realm_list_move(pointer, from, to).raiseLastErrorIfFalse(); } + @override void deleteAll() { realmLib.realm_list_remove_all(pointer).raiseLastErrorIfFalse(); } + @override int indexOf(Object? value) { return using((arena) { final outIndex = arena(); @@ -64,11 +73,12 @@ class ListHandle extends CollectionHandleBase { }); } + @override void clear() { realmLib.realm_list_clear(pointer).raiseLastErrorIfFalse(); } - // TODO: avoid taking the [realm] parameter + @override Object? elementAt(Realm realm, int index) { return using((arena) { final realmValue = arena(); @@ -81,7 +91,8 @@ class ListHandle extends CollectionHandleBase { }); } - ListHandle? resolveIn(RealmHandle frozenRealm) { + @override + ListHandle? resolveIn(covariant RealmHandle frozenRealm) { return using((arena) { final resultPtr = arena>(); realmLib.realm_list_resolve_in(pointer, frozenRealm.pointer, resultPtr).raiseLastErrorIfFalse(); @@ -90,6 +101,7 @@ class ListHandle extends CollectionHandleBase { } // TODO: Consider splitting into two methods + @override void addOrUpdateAt(int index, Object? value, bool insert) { using((arena) { final realmValue = value.toNative(arena); @@ -97,20 +109,23 @@ class ListHandle extends CollectionHandleBase { }); } - // TODO: avoid taking the [realm] parameter + @override void addOrUpdateCollectionAt(Realm realm, int index, RealmValue value, bool insert) { createCollection(realm, value, () => (insert ? realmLib.realm_list_insert_list : realmLib.realm_list_set_list)(pointer, index), () => (insert ? realmLib.realm_list_insert_dictionary : realmLib.realm_list_set_dictionary)(pointer, index)); } + @override ObjectHandle setEmbeddedAt(int index) { return ObjectHandle(realmLib.realm_list_set_embedded(pointer, index), root); } + @override ObjectHandle insertEmbeddedAt(int index) { return ObjectHandle(realmLib.realm_list_insert_embedded(pointer, index), root); } + @override ResultsHandle query(String query, List args) { return using((arena) { final length = args.length; @@ -131,6 +146,7 @@ class ListHandle extends CollectionHandleBase { }); } + @override NotificationTokenHandle subscribeForNotifications(NotificationsController controller) { return NotificationTokenHandle( realmLib.realm_list_add_notification_callback( diff --git a/packages/realm_dart/lib/src/handles/native/map_changes_handle.dart b/packages/realm_dart/lib/src/handles/native/map_changes_handle.dart index 4ba4b1f81..98d695f5a 100644 --- a/packages/realm_dart/lib/src/handles/native/map_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/map_changes_handle.dart @@ -10,9 +10,12 @@ import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; -class MapChangesHandle extends HandleBase { +import '../map_changes_handle.dart' as intf; + +class MapChangesHandle extends HandleBase implements intf.MapChangesHandle { MapChangesHandle(Pointer pointer) : super(pointer, 256); + @override MapChanges get changes { return using((arena) { final outNumDeletions = arena(); diff --git a/packages/realm_dart/lib/src/handles/native/map_handle.dart b/packages/realm_dart/lib/src/handles/native/map_handle.dart index 5453de7bb..0a3877dd2 100644 --- a/packages/realm_dart/lib/src/handles/native/map_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/map_handle.dart @@ -17,9 +17,12 @@ import 'realm_handle.dart'; import 'realm_library.dart'; import 'results_handle.dart'; -class MapHandle extends CollectionHandleBase { +import '../map_handle.dart' as intf; + +class MapHandle extends CollectionHandleBase implements intf.MapHandle { MapHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 96); // TODO: check size + @override int get size { return using((arena) { final outSize = arena(); @@ -28,6 +31,7 @@ class MapHandle extends CollectionHandleBase { }); } + @override bool remove(String key) { return using((arena) { final keyNative = key.toNative(arena); @@ -37,7 +41,7 @@ class MapHandle extends CollectionHandleBase { }); } - // TODO: avoid taking the [realm] parameter + @override Object? find(Realm realm, String key) { return using((arena) { final keyNative = key.toNative(arena); @@ -55,14 +59,17 @@ class MapHandle extends CollectionHandleBase { }); } + @override bool get isValid { return realmLib.realm_dictionary_is_valid(pointer); } + @override void clear() { realmLib.realm_dictionary_clear(pointer).raiseLastErrorIfFalse(); } + @override ResultsHandle get keys { return using((arena) { final outSize = arena(); @@ -72,10 +79,12 @@ class MapHandle extends CollectionHandleBase { }); } + @override ResultsHandle get values { return ResultsHandle(realmLib.realm_dictionary_to_results(pointer), root); } + @override bool containsKey(String key) { return using((arena) { final keyNative = key.toNative(arena); @@ -85,6 +94,7 @@ class MapHandle extends CollectionHandleBase { }); } + @override int indexOf(Object? value) { return using((arena) { // TODO: how should this behave for collections @@ -95,8 +105,10 @@ class MapHandle extends CollectionHandleBase { }); } + @override bool containsValue(Object? value) => indexOf(value) > -1; + @override ObjectHandle insertEmbedded(String key) { return using((arena) { final keyNative = key.toNative(arena); @@ -104,6 +116,7 @@ class MapHandle extends CollectionHandleBase { }); } + @override void insert(String key, Object? value) { using((arena) { final keyNative = key.toNative(arena); @@ -120,6 +133,7 @@ class MapHandle extends CollectionHandleBase { }); } + @override void insertCollection(Realm realm, String key, RealmValue value) { using((arena) { final keyNative = key.toNative(arena); @@ -132,6 +146,7 @@ class MapHandle extends CollectionHandleBase { }); } + @override ResultsHandle query(String query, List args) { return using((arena) { final length = args.length; @@ -153,7 +168,8 @@ class MapHandle extends CollectionHandleBase { }); } - MapHandle? resolveIn(RealmHandle frozenRealm) { + @override + MapHandle? resolveIn(covariant RealmHandle frozenRealm) { return using((arena) { final resultPtr = arena>(); realmLib.realm_dictionary_resolve_in(pointer, frozenRealm.pointer, resultPtr).raiseLastErrorIfFalse(); @@ -161,6 +177,7 @@ class MapHandle extends CollectionHandleBase { }); } + @override NotificationTokenHandle subscribeForNotifications(NotificationsController controller) { return NotificationTokenHandle( realmLib.realm_dictionary_add_notification_callback( diff --git a/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart index 16f5fd9ff..f78264362 100644 --- a/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart @@ -15,14 +15,18 @@ import 'results_handle.dart'; import 'subscription_handle.dart'; import 'subscription_set_handle.dart'; -class MutableSubscriptionSetHandle extends SubscriptionSetHandle { +import '../mutable_subscription_set_handle.dart' as intf; + +class MutableSubscriptionSetHandle extends SubscriptionSetHandle implements intf.MutableSubscriptionSetHandle { MutableSubscriptionSetHandle(Pointer pointer, RealmHandle root) : super(pointer.cast(), root); Pointer get _mutablePointer => super.pointer.cast(); + @override SubscriptionSetHandle commit() => SubscriptionSetHandle(realmLib.realm_sync_subscription_set_commit(_mutablePointer), root); - SubscriptionHandle insertOrAssignSubscription(ResultsHandle results, String? name, bool update) { + @override + SubscriptionHandle insertOrAssignSubscription(covariant ResultsHandle results, String? name, bool update) { if (!update) { if (name != null && findByName(name) != null) { throw RealmException('Duplicate subscription with name: $name'); @@ -44,7 +48,8 @@ class MutableSubscriptionSetHandle extends SubscriptionSetHandle { }); } - bool erase(SubscriptionHandle subscription) { + @override + bool erase(covariant SubscriptionHandle subscription) { return using((arena) { final outErased = arena(); realmLib @@ -58,6 +63,7 @@ class MutableSubscriptionSetHandle extends SubscriptionSetHandle { }); } + @override bool eraseByName(String name) { return using((arena) { final outErased = arena(); @@ -72,7 +78,8 @@ class MutableSubscriptionSetHandle extends SubscriptionSetHandle { }); } - bool eraseByResults(ResultsHandle results) { + @override + bool eraseByResults(covariant ResultsHandle results) { return using((arena) { final outErased = arena(); realmLib @@ -86,5 +93,11 @@ class MutableSubscriptionSetHandle extends SubscriptionSetHandle { }); } + @override void clear() => realmLib.realm_sync_subscription_set_clear(_mutablePointer).raiseLastErrorIfFalse(); + + @override + // Workaround for weird compiler bug + // ignore: unnecessary_overrides + SubscriptionHandle? findByResults(covariant ResultsHandle results) => super.findByResults(results); } diff --git a/packages/realm_dart/lib/src/handles/native/notification_token_handle.dart b/packages/realm_dart/lib/src/handles/native/notification_token_handle.dart index d72f36676..55a7e7cc4 100644 --- a/packages/realm_dart/lib/src/handles/native/notification_token_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/notification_token_handle.dart @@ -8,7 +8,9 @@ import 'realm_handle.dart'; import 'realm_library.dart'; import 'rooted_handle.dart'; -class NotificationTokenHandle extends RootedHandleBase { +import '../notification_token_handle.dart' as intf; + +class NotificationTokenHandle extends RootedHandleBase implements intf.NotificationTokenHandle { NotificationTokenHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 32); } diff --git a/packages/realm_dart/lib/src/handles/native/object_changes_handle.dart b/packages/realm_dart/lib/src/handles/native/object_changes_handle.dart new file mode 100644 index 000000000..54e183a4c --- /dev/null +++ b/packages/realm_dart/lib/src/handles/native/object_changes_handle.dart @@ -0,0 +1,32 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'dart:ffi'; + +import 'ffi.dart'; +import 'handle_base.dart'; +import 'realm_bindings.dart'; +import 'realm_library.dart'; + +import '../object_changes_handle.dart' as intf; + +class ObjectChangesHandle extends HandleBase implements intf.ObjectChangesHandle { + ObjectChangesHandle(Pointer pointer) : super(pointer, 256); + + @override + bool get isDeleted { + return realmLib.realm_object_changes_is_deleted(pointer); + } + + @override + List get properties { + return using((arena) { + final count = realmLib.realm_object_changes_get_num_modified_properties(pointer); + + final outModified = arena(count); + realmLib.realm_object_changes_get_modified_properties(pointer, outModified, count); + + return outModified.asTypedList(count).toList(); + }); + } +} diff --git a/packages/realm_dart/lib/src/handles/native/object_handle.dart b/packages/realm_dart/lib/src/handles/native/object_handle.dart index 019e85c9e..ecc6e0eed 100644 --- a/packages/realm_dart/lib/src/handles/native/object_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/object_handle.dart @@ -1,6 +1,8 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 +// ignore_for_file: annotate_overrides + import 'dart:ffi'; import '../../realm_dart.dart'; @@ -8,10 +10,10 @@ import 'collection_handle_base.dart'; import 'convert_native.dart'; import 'error_handling.dart'; import 'ffi.dart'; -import 'handle_base.dart'; import 'list_handle.dart'; import 'map_handle.dart'; import 'notification_token_handle.dart'; +import 'object_changes_handle.dart'; import 'realm_bindings.dart'; import 'realm_handle.dart'; import 'realm_library.dart'; @@ -19,13 +21,17 @@ import 'results_handle.dart'; import 'rooted_handle.dart'; import 'set_handle.dart'; -class ObjectHandle extends RootedHandleBase { +import '../object_handle.dart' as intf; + +class ObjectHandle extends RootedHandleBase implements intf.ObjectHandle { ObjectHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 112); + @override ObjectHandle createEmbedded(int propertyKey) { return ObjectHandle(realmLib.realm_set_embedded(pointer, propertyKey), root); } + @override (ObjectHandle, int) get parent { return using((arena) { final parentPtr = arena>(); @@ -38,16 +44,20 @@ class ObjectHandle extends RootedHandleBase { }); } + @override int get classKey => realmLib.realm_object_get_table(pointer); + @override bool get isValid => realmLib.realm_object_is_valid(pointer); + @override Link get asLink { final realmLink = realmLib.realm_object_as_link(pointer); return Link(realmLink); } // TODO: avoid taking the [realm] parameter + @override Object? getValue(Realm realm, int propertyKey) { return using((arena) { final realmValue = arena(); @@ -62,6 +72,7 @@ class ObjectHandle extends RootedHandleBase { // TODO: value should be RealmValue, and perhaps this method should be combined // with setCollection? + @override void setValue(int propertyKey, Object? value, bool isDefault) { using((arena) { final realmValue = value.toNative(arena); @@ -76,22 +87,27 @@ class ObjectHandle extends RootedHandleBase { }); } + @override ListHandle getList(int propertyKey) { return ListHandle(realmLib.realm_get_list(pointer, propertyKey), root); } + @override SetHandle getSet(int propertyKey) { return SetHandle(realmLib.realm_get_set(pointer, propertyKey), root); } + @override MapHandle getMap(int propertyKey) { return MapHandle(realmLib.realm_get_dictionary(pointer, propertyKey), root); } + @override ResultsHandle getBacklinks(int sourceTableKey, int propertyKey) { return ResultsHandle(realmLib.realm_get_backlinks(pointer, sourceTableKey, propertyKey), root); } + @override void setCollection(Realm realm, int propertyKey, RealmValue value) { createCollection( realm, @@ -101,15 +117,17 @@ class ObjectHandle extends RootedHandleBase { ); } + @override String objectToString() { return realmLib.realm_object_to_string(pointer).cast().toRealmDartString(freeRealmMemory: true)!; } + @override void delete() { realmLib.realm_object_delete(pointer).raiseLastErrorIfFalse(); } - ObjectHandle? resolveIn(RealmHandle frozenRealm) { + ObjectHandle? resolveIn(covariant RealmHandle frozenRealm) { return using((arena) { final resultPtr = arena>(); realmLib.realm_object_resolve_in(pointer, frozenRealm.pointer, resultPtr).raiseLastErrorIfFalse(); @@ -117,6 +135,7 @@ class ObjectHandle extends RootedHandleBase { }); } + @override NotificationTokenHandle subscribeForNotifications(NotificationsController controller, [List? keyPaths]) { return using((arena) { final kpNative = buildAndVerifyKeyPath(keyPaths); @@ -151,16 +170,26 @@ class ObjectHandle extends RootedHandleBase { }); } + void verifyKeyPath(List? keyPaths) => buildAndVerifyKeyPath(keyPaths); + @override // equals handled by HandleBase // ignore: hash_and_equals int get hashCode => asLink.hash; } -extension type Link(realm_link_t link) { +class Link implements intf.Link { + final realm_link link; + + Link(this.link); + + @override int get targetKey => link.target; + + @override int get classKey => link.target_table; + @override int get hash => Object.hash(targetKey, classKey); } @@ -185,22 +214,3 @@ void _objectChangeCallback(Pointer userdata, Pointer controller.onError(RealmError("Error handling change notifications. Error: $e")); } } - -class ObjectChangesHandle extends HandleBase { - ObjectChangesHandle(Pointer pointer) : super(pointer, 256); - - bool get isDeleted { - return realmLib.realm_object_changes_is_deleted(pointer); - } - - List get properties { - return using((arena) { - final count = realmLib.realm_object_changes_get_num_modified_properties(pointer); - - final outModified = arena(count); - realmLib.realm_object_changes_get_modified_properties(pointer, outModified, count); - - return outModified.asTypedList(count).toList(); - }); - } -} diff --git a/packages/realm_dart/lib/src/handles/native/realm_handle.dart b/packages/realm_dart/lib/src/handles/native/realm_handle.dart index 8f63fd6b1..7bfb1b2c0 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_handle.dart @@ -25,7 +25,9 @@ import 'schema_handle.dart'; import 'session_handle.dart'; import 'subscription_set_handle.dart'; -class RealmHandle extends HandleBase { +import '../realm_handle.dart' as intf; + +class RealmHandle extends HandleBase implements intf.RealmHandle { int _counter = 0; final Map> _children = {}; @@ -41,13 +43,15 @@ class RealmHandle extends HandleBase { .raiseLastErrorIfNull()); } - int addChild(RootedHandleBase child) { + @override + int addChild(covariant RootedHandleBase child) { final id = _counter++; _children[id] = WeakReference(child); rootedHandleFinalizer.attach(this, FinalizationToken(this, id), detach: this); return id; } + @override void removeChild(int id) { final child = _children.remove(id); if (child != null) { @@ -65,6 +69,7 @@ class RealmHandle extends HandleBase { } } + @override ObjectHandle createWithPrimaryKey(int classKey, Object? primaryKey) { return using((arena) { final realmValue = primaryKey.toNative(arena); @@ -72,10 +77,12 @@ class RealmHandle extends HandleBase { }); } + @override ObjectHandle create(int classKey) { return ObjectHandle(realmLib.realm_object_create(pointer, classKey), this); } + @override ObjectHandle getOrCreateWithPrimaryKey(int classKey, Object? primaryKey) { return using((arena) { final realmValue = primaryKey.toNative(arena); @@ -92,6 +99,7 @@ class RealmHandle extends HandleBase { }); } + @override bool compact() { return using((arena) { final outDidCompact = arena(); @@ -100,11 +108,13 @@ class RealmHandle extends HandleBase { }); } + @override void writeCopy(Configuration config) { final configHandle = ConfigHandle.from(config); realmLib.realm_convert_with_config(pointer, configHandle.pointer, false).raiseLastErrorIfFalse(); } + @override ResultsHandle queryClass(int classKey, String query, List args) { return using((arena) { final length = args.length; @@ -126,40 +136,50 @@ class RealmHandle extends HandleBase { }); } + @override RealmHandle freeze() => RealmHandle(realmLib.realm_freeze(pointer)); + @override SessionHandle getSession() { return SessionHandle(realmLib.realm_sync_session_get(pointer), this); } + @override bool get isFrozen { return realmLib.realm_is_frozen(pointer.cast()); } + @override SubscriptionSetHandle get subscriptions { return SubscriptionSetHandle(realmLib.realm_sync_get_active_subscription_set(pointer), this); } + @override void disableAutoRefreshForTesting() { realmLib.realm_set_auto_refresh(pointer, false); } + @override void close() { realmLib.realm_close(pointer).raiseLastErrorIfFalse(); } + @override bool get isClosed { return realmLib.realm_is_closed(pointer); } + @override void beginWrite() { realmLib.realm_begin_write(pointer).raiseLastErrorIfFalse(); } + @override void commitWrite() { realmLib.realm_commit(pointer).raiseLastErrorIfFalse(); } + @override Future beginWriteAsync(CancellationToken? ct) { int? id; final completer = CancellableCompleter(ct, onCancel: () { @@ -186,6 +206,7 @@ class RealmHandle extends HandleBase { return completer.future; } + @override Future commitWriteAsync(CancellationToken? ct) { int? id; final completer = CancellableCompleter(ct, onCancel: () { @@ -250,6 +271,7 @@ class RealmHandle extends HandleBase { }); } + @override Future refreshAsync() async { final completer = Completer(); final callback = Pointer.fromFunction)>(_realmRefreshAsyncCallback); @@ -271,10 +293,12 @@ class RealmHandle extends HandleBase { completer.complete(true); } + @override ResultsHandle findAll(int classKey) { return ResultsHandle(realmLib.realm_object_find_all(pointer, classKey), this); } + @override ObjectHandle? find(int classKey, Object? primaryKey) { return using((arena) { final realmValue = primaryKey.toNative(arena); @@ -288,12 +312,14 @@ class RealmHandle extends HandleBase { }); } - ObjectHandle? findExisting(int classKey, ObjectHandle other) { + @override + ObjectHandle? findExisting(int classKey, covariant ObjectHandle other) { final key = realmLib.realm_object_get_key(other.pointer); return ObjectHandle(realmLib.realm_get_object(pointer, classKey, key), this); } - void renameProperty(String objectType, String oldName, String newName, SchemaHandle schema) { + @override + void renameProperty(String objectType, String oldName, String newName, covariant SchemaHandle schema) { using((arena) { realmLib .realm_schema_rename_property( @@ -307,6 +333,7 @@ class RealmHandle extends HandleBase { }); } + @override bool deleteType(String objectType) { return using((arena) { final tableDeleted = arena(); @@ -315,10 +342,12 @@ class RealmHandle extends HandleBase { }); } + @override ObjectHandle getObject(int classKey, int objectKey) { return ObjectHandle(realmLib.realm_get_object(pointer, classKey, objectKey), this); } + @override CallbackTokenHandle subscribeForSchemaNotifications(Realm realm) { return CallbackTokenHandle( realmLib.realm_add_schema_changed_callback( @@ -331,6 +360,7 @@ class RealmHandle extends HandleBase { ); } + @override RealmSchema readSchema() { return using((arena) { return _readSchema(arena); @@ -397,12 +427,14 @@ class RealmHandle extends HandleBase { return SchemaObject(baseType, type, name, result); } + @override Map getPropertiesMetadata(int classKey, String? primaryKeyName) { return using((arena) { return _getPropertiesMetadata(classKey, primaryKeyName, arena); }); } + @override RealmObjectMetadata getObjectMetadata(SchemaObject schema) { return using((arena) { final found = arena(); @@ -438,7 +470,7 @@ class RealmHandle extends HandleBase { } } -class CallbackTokenHandle extends RootedHandleBase { +class CallbackTokenHandle extends RootedHandleBase implements intf.CallbackTokenHandle { CallbackTokenHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 32); } diff --git a/packages/realm_dart/lib/src/handles/native/results_handle.dart b/packages/realm_dart/lib/src/handles/native/results_handle.dart index 9fa5c1ab6..43c32a06f 100644 --- a/packages/realm_dart/lib/src/handles/native/results_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/results_handle.dart @@ -16,9 +16,12 @@ import 'realm_handle.dart'; import 'realm_library.dart'; import 'rooted_handle.dart'; -class ResultsHandle extends RootedHandleBase { +import '../results_handle.dart' as intf; + +class ResultsHandle extends RootedHandleBase implements intf.ResultsHandle { ResultsHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 872); + @override ResultsHandle queryResults(String query, List args) { return using((arena) { final length = args.length; @@ -39,6 +42,7 @@ class ResultsHandle extends RootedHandleBase { }); } + @override int find(Object? value) { return using((arena) { final outIndex = arena(); @@ -58,10 +62,12 @@ class ResultsHandle extends RootedHandleBase { }); } + @override ObjectHandle getObjectAt(int index) { return ObjectHandle(realmLib.realm_results_get_object(pointer, index), root); } + @override int get count { return using((arena) { final countPtr = arena(); @@ -70,6 +76,7 @@ class ResultsHandle extends RootedHandleBase { }); } + @override bool isValid() { return using((arena) { final isValid = arena(); @@ -78,18 +85,22 @@ class ResultsHandle extends RootedHandleBase { }); } + @override void deleteAll() { realmLib.realm_results_delete_all(pointer).raiseLastErrorIfFalse(); } + @override ResultsHandle snapshot() { return ResultsHandle(realmLib.realm_results_snapshot(pointer), root); } - ResultsHandle resolveIn(RealmHandle realmHandle) { + @override + ResultsHandle resolveIn(covariant RealmHandle realmHandle) { return ResultsHandle(realmLib.realm_results_resolve_in(pointer, realmHandle.pointer), realmHandle); } + @override Object? elementAt(Realm realm, int index) { return using((arena) { final realmValue = arena(); @@ -102,6 +113,7 @@ class ResultsHandle extends RootedHandleBase { }); } + @override NotificationTokenHandle subscribeForNotifications(NotificationsController controller) { return NotificationTokenHandle( realmLib.realm_results_add_notification_callback( diff --git a/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart index 4ad210542..c408943bc 100644 --- a/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart @@ -3,11 +3,14 @@ import 'dart:ffi'; +import '../../scheduler.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; -class SchedulerHandle extends HandleBase { +import '../scheduler_handle.dart' as intf; + +class SchedulerHandle extends HandleBase implements intf.SchedulerHandle { SchedulerHandle._(Pointer pointer) : super(pointer, 24); factory SchedulerHandle(int isolateId, int sendPort) { @@ -15,8 +18,13 @@ class SchedulerHandle extends HandleBase { return SchedulerHandle._(schedulerPtr); } + @override void invoke(int workQueue) { final queuePointer = Pointer.fromAddress(workQueue); realmLib.realm_scheduler_perform_work(queuePointer); } } + +final schedulerHandle = scheduler.handle as SchedulerHandle; + + diff --git a/packages/realm_dart/lib/src/handles/native/schema_handle.dart b/packages/realm_dart/lib/src/handles/native/schema_handle.dart index 7143cb1b8..5ff6a38cf 100644 --- a/packages/realm_dart/lib/src/handles/native/schema_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/schema_handle.dart @@ -12,7 +12,9 @@ import 'realm_bindings.dart'; import 'realm_library.dart'; import 'to_native.dart'; -class SchemaHandle extends HandleBase { +import '../schema_handle.dart' as intf; + +class SchemaHandle extends HandleBase implements intf.SchemaHandle { SchemaHandle(Pointer pointer) : super(pointer, 24); SchemaHandle.unowned(super.pointer) : super.unowned(); diff --git a/packages/realm_dart/lib/src/handles/native/session_handle.dart b/packages/realm_dart/lib/src/handles/native/session_handle.dart index e8f20ad23..dcc3415ca 100644 --- a/packages/realm_dart/lib/src/handles/native/session_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/session_handle.dart @@ -4,38 +4,43 @@ import 'dart:ffi'; import 'package:cancellation_token/cancellation_token.dart'; -import 'ffi.dart'; import '../../realm_dart.dart'; -import '../../scheduler.dart'; import '../../session.dart'; +import '../session_handle.dart' as intf; import 'convert_native.dart'; +import 'ffi.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_handle.dart'; import 'realm_library.dart'; import 'rooted_handle.dart'; +import 'scheduler_handle.dart'; import 'user_handle.dart'; -class SessionHandle extends RootedHandleBase { +class SessionHandle extends RootedHandleBase implements intf.SessionHandle { @override bool get shouldRoot => true; SessionHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 24); + @override String get path { return realmLib.realm_sync_session_get_file_path(pointer).cast().toRealmDartString()!; } + @override ConnectionState get connectionState { final value = realmLib.realm_sync_session_get_connection_state(pointer); return ConnectionState.values[value]; } + @override UserHandle get user { return UserHandle(realmLib.realm_sync_session_get_user(pointer)); } + @override SessionState get state { final value = realmLib.realm_sync_session_get_state(pointer); return _convertCoreSessionState(value); @@ -55,14 +60,17 @@ class SessionHandle extends RootedHandleBase { } } + @override void pause() { realmLib.realm_sync_session_pause(pointer); } + @override void resume() { realmLib.realm_sync_session_resume(pointer); } + @override void raiseError(int errorCode, bool isFatal) { using((arena) { final message = "Simulated session error".toCharPtr(arena); @@ -70,11 +78,12 @@ class SessionHandle extends RootedHandleBase { }); } + @override Future waitForUpload([CancellationToken? cancellationToken]) { final completer = CancellableCompleter(cancellationToken); if (!completer.isCancelled) { final callback = Pointer.fromFunction)>(_waitCompletionCallback); - final userdata = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), schedulerHandle.pointer); realmLib.realm_sync_session_wait_for_upload_completion( pointer, realmLib.addresses.realm_dart_sync_wait_for_completion_callback, @@ -85,11 +94,12 @@ class SessionHandle extends RootedHandleBase { return completer.future; } + @override Future waitForDownload([CancellationToken? cancellationToken]) { final completer = CancellableCompleter(cancellationToken); if (!completer.isCancelled) { final callback = Pointer.fromFunction)>(_waitCompletionCallback); - final userdata = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), schedulerHandle.pointer); realmLib.realm_sync_session_wait_for_download_completion( pointer, realmLib.addresses.realm_dart_sync_wait_for_completion_callback, @@ -113,9 +123,10 @@ class SessionHandle extends RootedHandleBase { } } + @override SyncSessionNotificationTokenHandle subscribeForConnectionStateNotifications(SessionConnectionStateController controller) { final callback = Pointer.fromFunction(_onConnectionStateChange); - final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), schedulerHandle.pointer); return SyncSessionNotificationTokenHandle( realmLib.realm_sync_session_register_connection_state_change_callback( pointer, @@ -126,6 +137,7 @@ class SessionHandle extends RootedHandleBase { ); } + @override SyncSessionNotificationTokenHandle subscribeForProgressNotifications( ProgressDirection direction, ProgressMode mode, @@ -133,7 +145,7 @@ class SessionHandle extends RootedHandleBase { ) { final isStreaming = mode == ProgressMode.reportIndefinitely; final callback = Pointer.fromFunction(syncProgressCallback); - final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), schedulerHandle.pointer); return SyncSessionNotificationTokenHandle( realmLib.realm_sync_session_register_progress_notifier( pointer, @@ -147,7 +159,8 @@ class SessionHandle extends RootedHandleBase { } } -class SyncSessionNotificationTokenHandle extends HandleBase { +class SyncSessionNotificationTokenHandle extends HandleBase + implements intf.SyncSessionNotificationTokenHandle { SyncSessionNotificationTokenHandle(Pointer pointer) : super(pointer, 32); } diff --git a/packages/realm_dart/lib/src/handles/native/set_handle.dart b/packages/realm_dart/lib/src/handles/native/set_handle.dart index f0a458d87..0a2de4a01 100644 --- a/packages/realm_dart/lib/src/handles/native/set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/set_handle.dart @@ -16,13 +16,17 @@ import 'realm_library.dart'; import 'results_handle.dart'; import 'rooted_handle.dart'; -class SetHandle extends RootedHandleBase { +import '../set_handle.dart' as intf; + +class SetHandle extends RootedHandleBase implements intf.SetHandle { SetHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 96); + @override ResultsHandle get asResults { return ResultsHandle(realmLib.realm_set_to_results(pointer), root); } + @override ResultsHandle query(String query, List args) { return using((arena) { final length = args.length; @@ -43,6 +47,7 @@ class SetHandle extends RootedHandleBase { }); } + @override bool insert(Object? value) { return using((arena) { final realmValue = value.toNative(arena); @@ -54,6 +59,7 @@ class SetHandle extends RootedHandleBase { } // TODO: avoid taking the [realm] parameter + @override Object? elementAt(Realm realm, int index) { return using((arena) { final realmValue = arena(); @@ -67,6 +73,7 @@ class SetHandle extends RootedHandleBase { }); } + @override bool find(Object? value) { return using((arena) { // TODO: how should this behave for collections @@ -78,6 +85,7 @@ class SetHandle extends RootedHandleBase { }); } + @override bool remove(Object? value) { return using((arena) { // TODO: do we support sets containing mixed collections @@ -88,10 +96,12 @@ class SetHandle extends RootedHandleBase { }); } + @override void clear() { realmLib.realm_set_clear(pointer).raiseLastErrorIfFalse(); } + @override int get size { return using((arena) { final outSize = arena(); @@ -100,15 +110,18 @@ class SetHandle extends RootedHandleBase { }); } + @override bool get isValid { return realmLib.realm_set_is_valid(pointer); } + @override void deleteAll() { realmLib.realm_set_remove_all(pointer).raiseLastErrorIfFalse(); } - SetHandle? resolveIn(RealmHandle frozenRealm) { + @override + SetHandle? resolveIn(covariant RealmHandle frozenRealm) { return using((arena) { final resultPtr = arena>(); realmLib.realm_set_resolve_in(pointer, frozenRealm.pointer, resultPtr).raiseLastErrorIfFalse(); @@ -116,6 +129,7 @@ class SetHandle extends RootedHandleBase { }); } + @override NotificationTokenHandle subscribeForNotifications(NotificationsController controller) { return NotificationTokenHandle( realmLib.realm_set_add_notification_callback( diff --git a/packages/realm_dart/lib/src/handles/native/subscription_handle.dart b/packages/realm_dart/lib/src/handles/native/subscription_handle.dart index e3ffc9d74..b2b6b4fed 100644 --- a/packages/realm_dart/lib/src/handles/native/subscription_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/subscription_handle.dart @@ -9,20 +9,28 @@ import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; -class SubscriptionHandle extends HandleBase { +import '../subscription_handle.dart' as intf; +class SubscriptionHandle extends HandleBase implements intf.SubscriptionHandle{ SubscriptionHandle(Pointer pointer) : super(pointer, 184); + @override ObjectId get id => realmLib.realm_sync_subscription_id(pointer).toDart(); + @override String? get name => realmLib.realm_sync_subscription_name(pointer).toDart(); + @override String get objectClassName => realmLib.realm_sync_subscription_object_class_name(pointer).toDart()!; + @override String get queryString => realmLib.realm_sync_subscription_query_string(pointer).toDart()!; + @override DateTime get createdAt => realmLib.realm_sync_subscription_created_at(pointer).toDart(); + @override DateTime get updatedAt => realmLib.realm_sync_subscription_updated_at(pointer).toDart(); - bool equalTo(SubscriptionHandle other) => realmLib.realm_equals(pointer.cast(), other.pointer.cast()); + @override + bool equalTo(covariant SubscriptionHandle other) => realmLib.realm_equals(pointer.cast(), other.pointer.cast()); } diff --git a/packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart index fa1b7883f..271291913 100644 --- a/packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/subscription_set_handle.dart @@ -4,39 +4,44 @@ import 'dart:ffi'; import 'package:cancellation_token/cancellation_token.dart'; -import 'ffi.dart'; import '../../realm_dart.dart'; -import '../../scheduler.dart'; +import '../subscription_set_handle.dart' as intf; import 'convert.dart'; import 'convert_native.dart'; import 'error_handling.dart'; +import 'ffi.dart'; import 'mutable_subscription_set_handle.dart'; import 'realm_bindings.dart'; import 'realm_handle.dart'; import 'realm_library.dart'; import 'results_handle.dart'; import 'rooted_handle.dart'; +import 'scheduler_handle.dart'; import 'subscription_handle.dart'; - -class SubscriptionSetHandle extends RootedHandleBase { +class SubscriptionSetHandle extends RootedHandleBase implements intf.SubscriptionSetHandle { @override bool get shouldRoot => true; SubscriptionSetHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 128); + @override void refresh() => realmLib.realm_sync_subscription_set_refresh(pointer).raiseLastErrorIfFalse(); + @override int get size => realmLib.realm_sync_subscription_set_size(pointer); + @override Exception? get error { final error = realmLib.realm_sync_subscription_set_error_str(pointer); final message = error.cast().toRealmDartString(treatEmptyAsNull: true); return message.convert(RealmException.new); } + @override SubscriptionHandle operator [](int index) => SubscriptionHandle(realmLib.realm_sync_subscription_at(pointer, index)); + @override SubscriptionHandle? findByName(String name) { return using((arena) { final result = realmLib.realm_sync_find_subscription_by_name( @@ -47,7 +52,8 @@ class SubscriptionSetHandle extends RootedHandleBase realmLib.realm_sync_subscription_set_version(pointer); + @override SubscriptionSetState get state => SubscriptionSetState.values[realmLib.realm_sync_subscription_set_state(pointer)]; + @override MutableSubscriptionSetHandle toMutable() => MutableSubscriptionSetHandle(realmLib.realm_sync_make_subscription_set_mutable(pointer), root); static void _stateChangeCallback(Object userdata, int state) { @@ -68,11 +77,12 @@ class SubscriptionSetHandle extends RootedHandleBase waitForStateChange(SubscriptionSetState notifyWhen, [CancellationToken? cancellationToken]) { final completer = CancellableCompleter(cancellationToken); if (!completer.isCancelled) { final callback = Pointer.fromFunction(_stateChangeCallback); - final userdata = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(completer, callback.cast(), schedulerHandle.pointer); realmLib.realm_sync_on_subscription_set_state_change_async(pointer, notifyWhen.index, realmLib.addresses.realm_dart_sync_on_subscription_state_changed_callback, userdata.cast(), realmLib.addresses.realm_dart_userdata_async_free); } diff --git a/packages/realm_dart/lib/src/handles/native/user_handle.dart b/packages/realm_dart/lib/src/handles/native/user_handle.dart index abacd3c87..f70488d50 100644 --- a/packages/realm_dart/lib/src/handles/native/user_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/user_handle.dart @@ -5,40 +5,44 @@ import 'dart:async'; import 'dart:convert'; import 'dart:ffi'; -import 'ffi.dart'; - import '../../credentials.dart'; import '../../realm_dart.dart'; -import '../../scheduler.dart'; import '../../user.dart'; +import '../user_handle.dart' as intf; import 'app_handle.dart'; import 'convert.dart'; import 'convert_native.dart'; import 'credentials_handle.dart'; import 'error_handling.dart'; +import 'ffi.dart'; import 'handle_base.dart'; import 'realm_bindings.dart'; import 'realm_library.dart'; +import 'scheduler_handle.dart'; -class UserHandle extends HandleBase { +class UserHandle extends HandleBase implements intf.UserHandle { UserHandle(Pointer pointer) : super(pointer, 24); + @override AppHandle get app { return realmLib.realm_user_get_app(pointer).convert(AppHandle.new) ?? (throw RealmException('User does not have an associated app. This is likely due to the user being logged out.')); } + @override UserState get state { final nativeUserState = realmLib.realm_user_get_state(pointer); return UserState.values.fromIndex(nativeUserState); } + @override String get id { final idPtr = realmLib.realm_user_get_identity(pointer).raiseLastErrorIfNull(); final userId = idPtr.cast().toDartString(); return userId; } + @override List get identities { return using((arena) { return _userGetIdentities(arena); @@ -67,31 +71,37 @@ class UserHandle extends HandleBase { return result; } + @override Future logOut() async { realmLib.realm_user_log_out(pointer).raiseLastErrorIfFalse(); } + @override String? get deviceId { final deviceId = realmLib.realm_user_get_device_id(pointer).raiseLastErrorIfNull(); return deviceId.cast().toRealmDartString(treatEmptyAsNull: true, freeRealmMemory: true); } + @override UserProfile get profileData { final data = realmLib.realm_user_get_profile_data(pointer).raiseLastErrorIfNull(); final dynamic profileData = jsonDecode(data.cast().toRealmDartString(freeRealmMemory: true)!); return UserProfile(profileData as Map); } + @override String get refreshToken { final token = realmLib.realm_user_get_refresh_token(pointer).raiseLastErrorIfNull(); return token.cast().toRealmDartString(freeRealmMemory: true)!; } + @override String get accessToken { final token = realmLib.realm_user_get_access_token(pointer).raiseLastErrorIfNull(); return token.cast().toRealmDartString(freeRealmMemory: true)!; } + @override String get path { final syncConfigPtr = realmLib.realm_flx_sync_config_new(pointer).raiseLastErrorIfNull(); try { @@ -102,12 +112,14 @@ class UserHandle extends HandleBase { } } + @override String? get customData { final customDataPtr = realmLib.realm_user_get_custom_data(pointer); return customDataPtr.cast().toRealmDartString(freeRealmMemory: true, treatEmptyAsNull: true); } - Future linkCredentials(AppHandle app, CredentialsHandle credentials) { + @override + Future linkCredentials(covariant AppHandle app, covariant CredentialsHandle credentials) { final completer = Completer(); realmLib .realm_app_link_user( @@ -122,7 +134,8 @@ class UserHandle extends HandleBase { return completer.future; } - Future createApiKey(AppHandle app, String name) { + @override + Future createApiKey(covariant AppHandle app, String name) { return using((arena) { final namePtr = name.toCharPtr(arena); final completer = Completer(); @@ -141,7 +154,8 @@ class UserHandle extends HandleBase { }); } - Future fetchApiKey(AppHandle app, ObjectId id) { + @override + Future fetchApiKey(covariant AppHandle app, ObjectId id) { return using((arena) { final completer = Completer(); final nativeId = id.toNative(arena); @@ -160,7 +174,8 @@ class UserHandle extends HandleBase { }); } - Future> fetchAllApiKeys(AppHandle app) { + @override + Future> fetchAllApiKeys(covariant AppHandle app) { return using((arena) { final completer = Completer>(); realmLib @@ -177,7 +192,8 @@ class UserHandle extends HandleBase { }); } - Future deleteApiKey(AppHandle app, ObjectId id) { + @override + Future deleteApiKey(covariant AppHandle app, ObjectId id) { return using((arena) { final completer = Completer(); final nativeId = id.toNative(arena); @@ -196,7 +212,8 @@ class UserHandle extends HandleBase { }); } - Future disableApiKey(AppHandle app, ObjectId objectId) { + @override + Future disableApiKey(covariant AppHandle app, ObjectId objectId) { return using((arena) { final completer = Completer(); final nativeId = objectId.toNative(arena); @@ -216,7 +233,8 @@ class UserHandle extends HandleBase { }); } - Future enableApiKey(AppHandle app, ObjectId objectId) { + @override + Future enableApiKey(covariant AppHandle app, ObjectId objectId) { return using((arena) { final completer = Completer(); final nativeId = objectId.toNative(arena); @@ -236,9 +254,10 @@ class UserHandle extends HandleBase { }); } + @override UserNotificationTokenHandle subscribeForNotifications(UserNotificationsController controller) { final callback = Pointer.fromFunction(_userChangeCallback); - final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), scheduler.handle.pointer); + final userdata = realmLib.realm_dart_userdata_async_new(controller, callback.cast(), schedulerHandle.pointer); final notificationToken = realmLib.realm_sync_user_on_state_change_register_callback( pointer, realmLib.addresses.realm_dart_user_change_callback, @@ -249,7 +268,7 @@ class UserHandle extends HandleBase { } } -class UserNotificationTokenHandle extends HandleBase { +class UserNotificationTokenHandle extends HandleBase implements intf.UserNotificationTokenHandle { UserNotificationTokenHandle(Pointer pointer) : super(pointer, 32); } @@ -270,7 +289,7 @@ Pointer createAsyncUserCallbackUserdata(Completer completer) { final userdata = realmLib.realm_dart_userdata_async_new( completer, callback.cast(), - scheduler.handle.pointer, + schedulerHandle.pointer, ); return userdata.cast(); @@ -304,7 +323,7 @@ Pointer _createAsyncApikeyCallbackUserdata(Completer _createAsyncApikeyListCallbackUserdata(Complet final userdata = realmLib.realm_dart_userdata_async_new( completer, callback.cast(), - scheduler.handle.pointer, + schedulerHandle.pointer, ); return userdata.cast(); diff --git a/packages/realm_dart/lib/src/handles/notification_token_handle.dart b/packages/realm_dart/lib/src/handles/notification_token_handle.dart index ddca8f3cc..a1698ea02 100644 --- a/packages/realm_dart/lib/src/handles/notification_token_handle.dart +++ b/packages/realm_dart/lib/src/handles/notification_token_handle.dart @@ -1,5 +1,6 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/notification_token_handle.dart' - if (dart.library.js_interop) 'web/notification_token_handle.dart'; +import 'handle_base.dart'; + +abstract interface class NotificationTokenHandle extends HandleBase {} diff --git a/packages/realm_dart/lib/src/handles/object_changes_handle.dart b/packages/realm_dart/lib/src/handles/object_changes_handle.dart new file mode 100644 index 000000000..6a42fa2d7 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/object_changes_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'handle_base.dart'; + +abstract interface class ObjectChangesHandle extends HandleBase { + bool get isDeleted; + List get properties; +} diff --git a/packages/realm_dart/lib/src/handles/object_handle.dart b/packages/realm_dart/lib/src/handles/object_handle.dart index 2fc8c6dd7..a3ceaa60a 100644 --- a/packages/realm_dart/lib/src/handles/object_handle.dart +++ b/packages/realm_dart/lib/src/handles/object_handle.dart @@ -1,5 +1,55 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/object_handle.dart' - if (dart.library.js_interop) 'web/object_handle.dart'; +import '../realm_class.dart'; +import 'handle_base.dart'; +import 'list_handle.dart'; +import 'map_handle.dart'; +import 'notification_token_handle.dart'; +import 'realm_handle.dart'; +import 'results_handle.dart'; +import 'set_handle.dart'; + +abstract interface class ObjectHandle extends HandleBase { + ObjectHandle createEmbedded(int propertyKey); + (ObjectHandle, int) get parent; + + int get classKey; + + bool get isValid; + + Link get asLink; + + // TODO: avoid taking the [realm] parameter + Object? getValue(Realm realm, int propertyKey); + + // TODO: value should be RealmValue, and perhaps this method should be combined + // with setCollection? + void setValue(int propertyKey, Object? value, bool isDefault); + ListHandle getList(int propertyKey); + SetHandle getSet(int propertyKey); + MapHandle getMap(int propertyKey); + ResultsHandle getBacklinks(int sourceTableKey, int propertyKey); + + void setCollection(Realm realm, int propertyKey, RealmValue value); + + String objectToString(); + void delete(); + + ObjectHandle? resolveIn(RealmHandle frozenRealm); + + NotificationTokenHandle subscribeForNotifications(NotificationsController controller, [List? keyPaths]); + + void verifyKeyPath(List? keyPaths); + + @override + // equals handled by HandleBase + // ignore: hash_and_equals + int get hashCode => asLink.hash; +} + +abstract class Link { + int get targetKey; + int get classKey; + int get hash; +} diff --git a/packages/realm_dart/lib/src/handles/realm_handle.dart b/packages/realm_dart/lib/src/handles/realm_handle.dart index 9a2522cc0..a70d0817f 100644 --- a/packages/realm_dart/lib/src/handles/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/realm_handle.dart @@ -1,5 +1,69 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/realm_handle.dart' - if (dart.library.js_interop) 'web/realm_handle.dart'; +import '../realm_class.dart'; +import '../realm_object.dart'; +import 'handle_base.dart'; +import 'object_handle.dart'; +import 'results_handle.dart'; +import 'schema_handle.dart'; +import 'session_handle.dart'; +import 'subscription_set_handle.dart'; + +import 'native/realm_handle.dart' if (dart.library.js_interop) 'web/realm_handle.dart' as impl; + +abstract interface class RealmHandle extends HandleBase { + factory RealmHandle.open(Configuration config) = impl.RealmHandle.open; + + int addChild(HandleBase child); + void removeChild(int id); + + @override + void releaseCore(); + + ObjectHandle createWithPrimaryKey(int classKey, Object? primaryKey); + + ObjectHandle create(int classKey); + ObjectHandle getOrCreateWithPrimaryKey(int classKey, Object? primaryKey); + + bool compact(); + + void writeCopy(Configuration config); + ResultsHandle queryClass(int classKey, String query, List args); + RealmHandle freeze(); + SessionHandle getSession(); + bool get isFrozen; + + SubscriptionSetHandle get subscriptions; + + void disableAutoRefreshForTesting(); + void close(); + + bool get isClosed; + + void beginWrite(); + + void commitWrite(); + + Future beginWriteAsync(CancellationToken? ct); + Future commitWriteAsync(CancellationToken? ct); + bool get isWritable; + void rollbackWrite(); + bool refresh(); + Future refreshAsync(); + ResultsHandle findAll(int classKey); + ObjectHandle? find(int classKey, Object? primaryKey); + ObjectHandle? findExisting(int classKey, ObjectHandle other); + void renameProperty(String objectType, String oldName, String newName, SchemaHandle schema); + bool deleteType(String objectType); + ObjectHandle getObject(int classKey, int objectKey); + + CallbackTokenHandle subscribeForSchemaNotifications(Realm realm); + + RealmSchema readSchema(); + Map getPropertiesMetadata(int classKey, String? primaryKeyName); + + RealmObjectMetadata getObjectMetadata(SchemaObject schema); +} + +abstract class CallbackTokenHandle extends HandleBase {} diff --git a/packages/realm_dart/lib/src/handles/results_handle.dart b/packages/realm_dart/lib/src/handles/results_handle.dart index d4e4d4c67..69e05cc42 100644 --- a/packages/realm_dart/lib/src/handles/results_handle.dart +++ b/packages/realm_dart/lib/src/handles/results_handle.dart @@ -1,5 +1,28 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/results_handle.dart' - if (dart.library.js_interop) 'web/results_handle.dart'; +import 'package:realm_dart/src/handles/handle_base.dart'; +import 'package:realm_dart/src/handles/notification_token_handle.dart'; + +import '../realm_class.dart'; +import 'object_handle.dart'; +import 'realm_handle.dart'; + +abstract interface class ResultsHandle extends HandleBase { + ResultsHandle queryResults(String query, List args); + + int find(Object? value); + + ObjectHandle getObjectAt(int index); + + int get count; + + bool isValid(); + + void deleteAll(); + ResultsHandle snapshot(); + ResultsHandle resolveIn(RealmHandle realmHandle); + + Object? elementAt(Realm realm, int index); + NotificationTokenHandle subscribeForNotifications(NotificationsController controller); +} diff --git a/packages/realm_dart/lib/src/handles/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/scheduler_handle.dart index b0b88e593..3a3682a7c 100644 --- a/packages/realm_dart/lib/src/handles/scheduler_handle.dart +++ b/packages/realm_dart/lib/src/handles/scheduler_handle.dart @@ -1,5 +1,12 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/scheduler_handle.dart' - if (dart.library.js_interop) 'web/scheduler_handle.dart'; +import 'handle_base.dart'; + +import 'native/scheduler_handle.dart' if (dart.library.js_interop) 'web/scheduler_handle.dart' as impl; + +abstract interface class SchedulerHandle extends HandleBase { + factory SchedulerHandle(int isolateId, int sendPort) = impl.SchedulerHandle; + + void invoke(int workQueue); +} diff --git a/packages/realm_dart/lib/src/handles/schema_handle.dart b/packages/realm_dart/lib/src/handles/schema_handle.dart index 73445a6e2..39d153028 100644 --- a/packages/realm_dart/lib/src/handles/schema_handle.dart +++ b/packages/realm_dart/lib/src/handles/schema_handle.dart @@ -1,5 +1,11 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/schema_handle.dart' - if (dart.library.js_interop) 'web/schema_handle.dart'; +import '../configuration.dart'; +import 'handle_base.dart'; + +import 'native/schema_handle.dart' if (dart.library.js_interop) 'web/schema_handle.dart' as impl; + +abstract interface class SchemaHandle extends HandleBase { + factory SchemaHandle.from(Iterable schema) = impl.SchemaHandle.from; +} diff --git a/packages/realm_dart/lib/src/handles/session_handle.dart b/packages/realm_dart/lib/src/handles/session_handle.dart index ff4b82552..f5c3aeb15 100644 --- a/packages/realm_dart/lib/src/handles/session_handle.dart +++ b/packages/realm_dart/lib/src/handles/session_handle.dart @@ -1,5 +1,35 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/session_handle.dart' - if (dart.library.js_interop) 'web/session_handle.dart'; +import 'package:cancellation_token/cancellation_token.dart'; + +import '../session.dart'; +import 'handle_base.dart'; +import 'user_handle.dart'; + +abstract interface class SessionHandle extends HandleBase { + String get path; + ConnectionState get connectionState; + + UserHandle get user; + + SessionState get state; + + void pause(); + + void resume(); + + void raiseError(int errorCode, bool isFatal); + + Future waitForUpload([CancellationToken? cancellationToken]); + Future waitForDownload([CancellationToken? cancellationToken]); + SyncSessionNotificationTokenHandle subscribeForConnectionStateNotifications(SessionConnectionStateController controller); + + SyncSessionNotificationTokenHandle subscribeForProgressNotifications( + ProgressDirection direction, + ProgressMode mode, + SessionProgressNotificationsController controller, + ); +} + +abstract interface class SyncSessionNotificationTokenHandle extends HandleBase {} \ No newline at end of file diff --git a/packages/realm_dart/lib/src/handles/set_handle.dart b/packages/realm_dart/lib/src/handles/set_handle.dart index 1e1eb1073..bbad63523 100644 --- a/packages/realm_dart/lib/src/handles/set_handle.dart +++ b/packages/realm_dart/lib/src/handles/set_handle.dart @@ -1,5 +1,34 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/set_handle.dart' - if (dart.library.js_interop) 'web/set_handle.dart'; +import 'package:realm_dart/src/handles/handle_base.dart'; + +import '../realm_class.dart'; +import 'notification_token_handle.dart'; +import 'realm_handle.dart'; +import 'results_handle.dart'; + +abstract interface class SetHandle extends HandleBase { + ResultsHandle get asResults; + + ResultsHandle query(String query, List args); + + bool insert(Object? value); + + // TODO: avoid taking the [realm] parameter + Object? elementAt(Realm realm, int index); + bool find(Object? value); + + bool remove(Object? value); + + void clear(); + int get size; + + bool get isValid; + + void deleteAll(); + + SetHandle? resolveIn(RealmHandle frozenRealm); + + NotificationTokenHandle subscribeForNotifications(NotificationsController controller); +} diff --git a/packages/realm_dart/lib/src/handles/subscription_handle.dart b/packages/realm_dart/lib/src/handles/subscription_handle.dart index 10f79f5d7..7f3cc40e9 100644 --- a/packages/realm_dart/lib/src/handles/subscription_handle.dart +++ b/packages/realm_dart/lib/src/handles/subscription_handle.dart @@ -1,5 +1,16 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/subscription_handle.dart' - if (dart.library.js_interop) 'web/subscription_handle.dart'; +import 'package:realm_common/realm_common.dart'; + +import 'handle_base.dart'; + +abstract interface class SubscriptionHandle extends HandleBase { + ObjectId get id; + String? get name; + String get objectClassName; + String get queryString; + DateTime get createdAt; + DateTime get updatedAt; + bool equalTo(SubscriptionHandle other); +} diff --git a/packages/realm_dart/lib/src/handles/subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/subscription_set_handle.dart index 452510a76..82a2e1abe 100644 --- a/packages/realm_dart/lib/src/handles/subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/subscription_set_handle.dart @@ -1,5 +1,31 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/subscription_set_handle.dart' - if (dart.library.js_interop) 'web/subscription_set_handle.dart'; +import 'package:cancellation_token/cancellation_token.dart'; + +import '../subscription.dart'; +import 'handle_base.dart'; +import 'mutable_subscription_set_handle.dart'; +import 'results_handle.dart'; +import 'subscription_handle.dart'; + +abstract class SubscriptionSetHandle extends HandleBase { + void refresh(); + + int get size; + + Exception? get error; + + SubscriptionHandle operator [](int index); + + SubscriptionHandle? findByName(String name); + + SubscriptionHandle? findByResults(ResultsHandle results); + + int get version; + SubscriptionSetState get state; + + MutableSubscriptionSetHandle toMutable(); + + Future waitForStateChange(SubscriptionSetState notifyWhen, [CancellationToken? cancellationToken]); +} diff --git a/packages/realm_dart/lib/src/handles/user_handle.dart b/packages/realm_dart/lib/src/handles/user_handle.dart index 1060b55ea..cf498b10f 100644 --- a/packages/realm_dart/lib/src/handles/user_handle.dart +++ b/packages/realm_dart/lib/src/handles/user_handle.dart @@ -1,5 +1,33 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/user_handle.dart' - if (dart.library.js_interop) 'web/user_handle.dart'; +import 'package:realm_common/realm_common.dart'; + +import '../user.dart'; +import 'app_handle.dart'; +import 'credentials_handle.dart'; +import 'handle_base.dart'; + +abstract interface class UserHandle extends HandleBase { + AppHandle get app; + UserState get state; + String get id; + List get identities; + Future logOut(); + String? get deviceId; + UserProfile get profileData; + String get refreshToken; + String get accessToken; + String get path; + String? get customData; + Future linkCredentials(AppHandle app, CredentialsHandle credentials); + Future createApiKey(AppHandle app, String name); + Future fetchApiKey(AppHandle app, ObjectId id); + Future> fetchAllApiKeys(AppHandle app); + Future deleteApiKey(AppHandle app, ObjectId id); + Future disableApiKey(AppHandle app, ObjectId objectId); + Future enableApiKey(AppHandle app, ObjectId objectId); + UserNotificationTokenHandle subscribeForNotifications(UserNotificationsController controller); +} + +abstract interface class UserNotificationTokenHandle extends HandleBase {} diff --git a/packages/realm_dart/lib/src/handles/web/app_handle.dart b/packages/realm_dart/lib/src/handles/web/app_handle.dart new file mode 100644 index 000000000..45556bdeb --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/app_handle.dart @@ -0,0 +1,13 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../../../realm.dart'; +import '../app_handle.dart' as intf; + +class AppHandle implements intf.AppHandle { + factory AppHandle.from(AppConfiguration configuration) => throw UnsupportedError('web not supported'); + static AppHandle? get(String id, String? baseUrl) => throw UnsupportedError('web not supported'); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart new file mode 100644 index 000000000..12225d979 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart @@ -0,0 +1,14 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../async_open_task_handle.dart' as intf; + +class AsyncOpenTaskHandle implements intf.AsyncOpenTaskHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} + +abstract class AsyncOpenTaskProgressNotificationTokenHandle implements intf.AsyncOpenTaskProgressNotificationTokenHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart b/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart new file mode 100644 index 000000000..7bc265a76 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../collection_changes_handle.dart' as intf; + +class CollectionChangesHandle implements intf.CollectionChangesHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/credentials_handle.dart b/packages/realm_dart/lib/src/handles/web/credentials_handle.dart new file mode 100644 index 000000000..1077e6b4d --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/credentials_handle.dart @@ -0,0 +1,27 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../credentials_handle.dart' as intf; + +class CredentialsHandle implements intf.CredentialsHandle { + factory CredentialsHandle.anonymous(bool reuseCredentials) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.emailPassword(String email, String password) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.jwt(String token) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.apple(String idToken) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.facebook(String accessToken) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.googleIdToken(String idToken) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.googleAuthCode(String authCode) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.function(String payload) => throw UnsupportedError('web not supported'); + + factory CredentialsHandle.apiKey(String key) => throw UnsupportedError('web not supported'); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/handle_base.dart b/packages/realm_dart/lib/src/handles/web/handle_base.dart new file mode 100644 index 000000000..9d2c26ff0 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/handle_base.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../handle_base.dart' as intf; + +class HandleBase implements intf.HandleBase { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/list_handle.dart b/packages/realm_dart/lib/src/handles/web/list_handle.dart new file mode 100644 index 000000000..9f8180a35 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/list_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../list_handle.dart' as intf; + +class ListHandle implements intf.ListHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart b/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart new file mode 100644 index 000000000..9e7d0f6ed --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../map_changes_handle.dart' as intf; + +abstract class MapChangesHandle implements intf.MapChangesHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} \ No newline at end of file diff --git a/packages/realm_dart/lib/src/handles/web/map_handle.dart b/packages/realm_dart/lib/src/handles/web/map_handle.dart new file mode 100644 index 000000000..28970217a --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/map_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../map_handle.dart' as intf; + +class MapHandle implements intf.MapHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart new file mode 100644 index 000000000..69c078502 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../mutable_subscription_set_handle.dart' as intf; + +class MutableSubscriptionSetHandle implements intf.MutableSubscriptionSetHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart b/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart new file mode 100644 index 000000000..f8d1ef25a --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../notification_token_handle.dart' as intf; + +class NotificationTokenHandle implements intf.NotificationTokenHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart b/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart new file mode 100644 index 000000000..300cb34a4 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../object_changes_handle.dart' as intf; + +class ObjectChangesHandle implements intf.ObjectChangesHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/object_handle.dart b/packages/realm_dart/lib/src/handles/web/object_handle.dart new file mode 100644 index 000000000..ba1be46fd --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/object_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../object_handle.dart' as intf; + +class ObjectHandle implements intf.ObjectHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/realm_handle.dart b/packages/realm_dart/lib/src/handles/web/realm_handle.dart new file mode 100644 index 000000000..9521293dd --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/realm_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../realm_handle.dart' as intf; + +class RealmHandle implements intf.RealmHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/results_handle.dart b/packages/realm_dart/lib/src/handles/web/results_handle.dart new file mode 100644 index 000000000..142779085 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/results_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../results_handle.dart' as intf; + +class ResultsHandle implements intf.ResultsHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart new file mode 100644 index 000000000..3556a0ca8 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart @@ -0,0 +1,13 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../scheduler_handle.dart' as intf; + +class SchedulerHandle implements intf.SchedulerHandle { + factory SchedulerHandle(int isolateId, int sendPort) => throw UnsupportedError('web not supported'); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} + + diff --git a/packages/realm_dart/lib/src/handles/web/schema_handle.dart b/packages/realm_dart/lib/src/handles/web/schema_handle.dart new file mode 100644 index 000000000..ace98cf1e --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/schema_handle.dart @@ -0,0 +1,13 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:realm_dart/realm.dart'; + +import '../schema_handle.dart' as intf; + +class SchemaHandle implements intf.SchemaHandle { + factory SchemaHandle.from(Iterable schema) => throw UnsupportedError('web not supported'); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/session_handle.dart b/packages/realm_dart/lib/src/handles/web/session_handle.dart new file mode 100644 index 000000000..45f8e3ef4 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/session_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../session_handle.dart' as intf; + +class SessionHandle implements intf.SessionHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/set_handle.dart b/packages/realm_dart/lib/src/handles/web/set_handle.dart new file mode 100644 index 000000000..7eb07ad3f --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/set_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../set_handle.dart' as intf; + +class SetHandle implements intf.SetHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/subscription_handle.dart b/packages/realm_dart/lib/src/handles/web/subscription_handle.dart new file mode 100644 index 000000000..dab3f79c5 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/subscription_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../subscription_handle.dart' as intf; + +class SubscriptionHandle implements intf.SubscriptionHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart new file mode 100644 index 000000000..69d710bd4 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../subscription_set_handle.dart' as intf; + +class SubscriptionSetHandle implements intf.SubscriptionSetHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/user_handle.dart b/packages/realm_dart/lib/src/handles/web/user_handle.dart new file mode 100644 index 000000000..baeef586a --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/user_handle.dart @@ -0,0 +1,9 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../user_handle.dart' as intf; + +class UserHandle implements intf.UserHandle { + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/realm_class.dart b/packages/realm_dart/lib/src/realm_class.dart index d4c435113..ce4bcfebc 100644 --- a/packages/realm_dart/lib/src/realm_class.dart +++ b/packages/realm_dart/lib/src/realm_class.dart @@ -365,7 +365,6 @@ class Realm { T write(T Function() writeCallback) { assert(!_isFuture(), 'writeCallback must be synchronous'); final transaction = beginWrite(); - try { T result = writeCallback(); transaction.commit(); diff --git a/packages/realm_dart/lib/src/realm_object.dart b/packages/realm_dart/lib/src/realm_object.dart index 4f2165602..f9c77720b 100644 --- a/packages/realm_dart/lib/src/realm_object.dart +++ b/packages/realm_dart/lib/src/realm_object.dart @@ -9,6 +9,7 @@ import 'package:realm_common/realm_common.dart'; import 'configuration.dart'; import 'handles/handle_base.dart'; import 'handles/notification_token_handle.dart'; +import 'handles/object_changes_handle.dart'; import 'handles/object_handle.dart'; import 'handles/realm_library.dart'; import 'list.dart'; @@ -175,6 +176,7 @@ class RealmCoreAccessor implements RealmAccessor { if (listMetadata != null && _isTypeGenericObject()) { switch (listMetadata.schema.baseType) { case ObjectType.realmObject: + //ManagedRealmList._(handle, object.realm, listMetadata); return object.realm.createList(handle, listMetadata); case ObjectType.embeddedObject: return object.realm.createList(handle, listMetadata); @@ -758,7 +760,7 @@ class RealmObjectNotificationsController extends Noti throw RealmException("It is not allowed to have empty key paths."); } // throw early if the key paths are invalid - realmObject.handle.buildAndVerifyKeyPath(keyPaths); + realmObject.handle.verifyKeyPath(keyPaths); } } diff --git a/packages/realm_dart/lib/src/subscription.dart b/packages/realm_dart/lib/src/subscription.dart index 12bf8c6c1..2fc945854 100644 --- a/packages/realm_dart/lib/src/subscription.dart +++ b/packages/realm_dart/lib/src/subscription.dart @@ -111,11 +111,9 @@ enum SubscriptionSetState { /// {@category Sync} sealed class SubscriptionSet with Iterable { final Realm _realm; - SubscriptionSetHandle __handle; - SubscriptionSetHandle get _handle => __handle.nullPtrAsNull ?? (throw RealmClosedError('Cannot access a SubscriptionSet that belongs to a closed Realm')); - set _handle(SubscriptionSetHandle value) => __handle = value; + SubscriptionSetHandle _handle; - SubscriptionSet._(this._realm, this.__handle); + SubscriptionSet._(this._realm, this._handle); /// Finds an existing [Subscription] in this set by its query /// diff --git a/packages/realm_dart/test/subscription_test.dart b/packages/realm_dart/test/subscription_test.dart index ab9fa7f2e..819fbee6d 100644 --- a/packages/realm_dart/test/subscription_test.dart +++ b/packages/realm_dart/test/subscription_test.dart @@ -6,11 +6,10 @@ import 'dart:io'; import 'dart:math'; import 'dart:typed_data'; -import 'package:test/expect.dart' hide throws; - import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:realm_dart/src/subscription.dart'; + import 'test.dart'; void main() { @@ -549,7 +548,7 @@ void main() { expect(() => subscriptions.state, returnsNormally); realm.close(); - expect(() => subscriptions.state, throws()); + expect(() => subscriptions.state, throws()); }); baasTest('SyncSessionErrorCode.compensatingWrite', (configuration) async { From 531030863bf39940bdd2e02b9dbf74aa6f821c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Fri, 31 May 2024 20:33:23 +0200 Subject: [PATCH 03/17] Avoid SyncErrorCode dep on realm_binding.dart --- .../realm_dart/lib/src/configuration.dart | 10 ++--- .../lib/src/handles/app_handle.dart | 3 +- .../native/async_open_task_handle.dart | 3 ++ .../lib/src/handles/native/from_native.dart | 45 +++++++++++++++++-- .../lib/src/handles/native/realm_handle.dart | 3 ++ .../lib/src/handles/native/user_handle.dart | 3 +- .../lib/src/handles/realm_bindings.dart | 5 --- packages/realm_dart/lib/src/session.dart | 38 ++++++---------- 8 files changed, 70 insertions(+), 40 deletions(-) delete mode 100644 packages/realm_dart/lib/src/handles/realm_bindings.dart diff --git a/packages/realm_dart/lib/src/configuration.dart b/packages/realm_dart/lib/src/configuration.dart index e22fc00bc..c2e989c37 100644 --- a/packages/realm_dart/lib/src/configuration.dart +++ b/packages/realm_dart/lib/src/configuration.dart @@ -718,25 +718,23 @@ final class CompensatingWriteError extends SyncError { extension SyncErrorInternal on SyncError { static SyncError createSyncError(SyncErrorDetails error, {App? app}) { //Client reset can be requested with isClientResetRequested disregarding the ErrorCode - SyncErrorCode errorCode = SyncErrorCode.fromInt(error.code); - - return switch (errorCode) { + return switch (error.code) { SyncErrorCode.autoClientResetFailed => ClientResetError._( error.message, - errorCode, + error.code, app, error.userError, originalFilePath: error.originalFilePath, backupFilePath: error.backupFilePath, ), SyncErrorCode.clientReset => - ClientResetError._(error.message, errorCode, app, error.userError, originalFilePath: error.originalFilePath, backupFilePath: error.backupFilePath), + ClientResetError._(error.message, error.code, app, error.userError, originalFilePath: error.originalFilePath, backupFilePath: error.backupFilePath), SyncErrorCode.compensatingWrite => CompensatingWriteError._( error.message, error.userError, compensatingWrites: error.compensatingWrites, ), - _ => SyncError._(error.message, errorCode, error.userError), + _ => SyncError._(error.message, error.code, error.userError), }; } } diff --git a/packages/realm_dart/lib/src/handles/app_handle.dart b/packages/realm_dart/lib/src/handles/app_handle.dart index e2a57a8e4..58f171adf 100644 --- a/packages/realm_dart/lib/src/handles/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/app_handle.dart @@ -4,9 +4,10 @@ import '../../realm.dart'; import 'credentials_handle.dart'; -import 'native/app_handle.dart' if (dart.library.js_interop) 'web/app_handle.dart' as impl; import 'user_handle.dart'; +import 'native/app_handle.dart' if (dart.library.js_interop) 'web/app_handle.dart' as impl; + abstract interface class AppHandle { factory AppHandle.from(AppConfiguration configuration) = impl.AppHandle.from; static AppHandle? get(String id, String? baseUrl) => impl.AppHandle.get(id, baseUrl); diff --git a/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart index 7a6d202e4..2ab5450d4 100644 --- a/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/async_open_task_handle.dart @@ -24,6 +24,7 @@ class AsyncOpenTaskHandle extends HandleBase implements return AsyncOpenTaskHandle(asyncOpenTaskPtr); } + @override Future openAsync(CancellationToken? cancellationToken) { final completer = CancellableCompleter(cancellationToken); if (!completer.isCancelled) { @@ -40,10 +41,12 @@ class AsyncOpenTaskHandle extends HandleBase implements return completer.future; } + @override void cancel() { realmLib.realm_async_open_task_cancel(pointer); } + @override AsyncOpenTaskProgressNotificationTokenHandle registerProgressNotifier( RealmAsyncOpenProgressNotificationsController controller, ) { diff --git a/packages/realm_dart/lib/src/handles/native/from_native.dart b/packages/realm_dart/lib/src/handles/native/from_native.dart index 7f2c34c7a..5070035a3 100644 --- a/packages/realm_dart/lib/src/handles/native/from_native.dart +++ b/packages/realm_dart/lib/src/handles/native/from_native.dart @@ -151,7 +151,7 @@ extension RealmSyncErrorEx on realm_sync_error { return SyncErrorDetails( message, - status.error, + status.error.toSyncErrorCode(), user_code_error.toUserCodeError(), isFatal: is_fatal, isClientResetRequested: is_client_reset_requested, @@ -198,11 +198,50 @@ extension PointerRealmSyncErrorCompensatingWriteInfoEx on Pointer { SyncError toDart() { final message = ref.message.cast().toDartString(); - final details = SyncErrorDetails(message, ref.error, ref.user_code_error.toUserCodeError()); + final details = SyncErrorDetails(message, ref.error.toSyncErrorCode(), ref.user_code_error.toUserCodeError()); return SyncErrorInternal.createSyncError(details); } } +extension IntEx on int { + SyncErrorCode toSyncErrorCode() => switch (this) { + realm_errno.RLM_ERR_RUNTIME => SyncErrorCode.runtimeError, + realm_errno.RLM_ERR_BAD_CHANGESET => SyncErrorCode.badChangeset, + realm_errno.RLM_ERR_BAD_SYNC_PARTITION_VALUE => SyncErrorCode.badPartitionValue, + realm_errno.RLM_ERR_SYNC_PROTOCOL_INVARIANT_FAILED => SyncErrorCode.protocolInvariantFailed, + realm_errno.RLM_ERR_INVALID_SUBSCRIPTION_QUERY => SyncErrorCode.invalidSubscriptionQuery, + realm_errno.RLM_ERR_SYNC_CLIENT_RESET_REQUIRED => SyncErrorCode.clientReset, + realm_errno.RLM_ERR_SYNC_INVALID_SCHEMA_CHANGE => SyncErrorCode.invalidSchemaChange, + realm_errno.RLM_ERR_SYNC_PERMISSION_DENIED => SyncErrorCode.permissionDenied, + realm_errno.RLM_ERR_SYNC_SERVER_PERMISSIONS_CHANGED => SyncErrorCode.serverPermissionsChanged, + realm_errno.RLM_ERR_SYNC_USER_MISMATCH => SyncErrorCode.userMismatch, + realm_errno.RLM_ERR_SYNC_WRITE_NOT_ALLOWED => SyncErrorCode.writeNotAllowed, + realm_errno.RLM_ERR_AUTO_CLIENT_RESET_FAILED => SyncErrorCode.autoClientResetFailed, + realm_errno.RLM_ERR_WRONG_SYNC_TYPE => SyncErrorCode.wrongSyncType, + realm_errno.RLM_ERR_SYNC_COMPENSATING_WRITE => SyncErrorCode.compensatingWrite, + _ => throw RealmError("Unknown sync error code $this"), + }; +} + +extension SyncErrorCodeEx on SyncErrorCode { + int get code => switch (this) { + SyncErrorCode.runtimeError => realm_errno.RLM_ERR_RUNTIME, + SyncErrorCode.badChangeset => realm_errno.RLM_ERR_BAD_CHANGESET, + SyncErrorCode.badPartitionValue => realm_errno.RLM_ERR_BAD_SYNC_PARTITION_VALUE, + SyncErrorCode.protocolInvariantFailed => realm_errno.RLM_ERR_SYNC_PROTOCOL_INVARIANT_FAILED, + SyncErrorCode.invalidSubscriptionQuery => realm_errno.RLM_ERR_INVALID_SUBSCRIPTION_QUERY, + SyncErrorCode.clientReset => realm_errno.RLM_ERR_SYNC_CLIENT_RESET_REQUIRED, + SyncErrorCode.invalidSchemaChange => realm_errno.RLM_ERR_SYNC_INVALID_SCHEMA_CHANGE, + SyncErrorCode.permissionDenied => realm_errno.RLM_ERR_SYNC_PERMISSION_DENIED, + SyncErrorCode.serverPermissionsChanged => realm_errno.RLM_ERR_SYNC_SERVER_PERMISSIONS_CHANGED, + SyncErrorCode.userMismatch => realm_errno.RLM_ERR_SYNC_USER_MISMATCH, + SyncErrorCode.writeNotAllowed => realm_errno.RLM_ERR_SYNC_WRITE_NOT_ALLOWED, + SyncErrorCode.autoClientResetFailed => realm_errno.RLM_ERR_AUTO_CLIENT_RESET_FAILED, + SyncErrorCode.wrongSyncType => realm_errno.RLM_ERR_WRONG_SYNC_TYPE, + SyncErrorCode.compensatingWrite => realm_errno.RLM_ERR_SYNC_COMPENSATING_WRITE, + }; +} + extension ObjectEx on Object { Pointer toPersistentHandle() { return realmLib.realm_dart_object_to_persistent_handle(this); @@ -317,7 +356,7 @@ extension PlatformEx on Platform { /// @nodoc class SyncErrorDetails { final String message; - final int code; + final SyncErrorCode code; final String? path; final bool isFatal; final bool isClientResetRequested; diff --git a/packages/realm_dart/lib/src/handles/native/realm_handle.dart b/packages/realm_dart/lib/src/handles/native/realm_handle.dart index 7bfb1b2c0..c759c7ec3 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_handle.dart @@ -255,14 +255,17 @@ class RealmHandle extends HandleBase implements intf.RealmHandle { } } + @override bool get isWritable { return realmLib.realm_is_writable(pointer); } + @override void rollbackWrite() { realmLib.realm_rollback(pointer).raiseLastErrorIfFalse(); } + @override bool refresh() { return using((arena) { final didRefresh = arena(); diff --git a/packages/realm_dart/lib/src/handles/native/user_handle.dart b/packages/realm_dart/lib/src/handles/native/user_handle.dart index f70488d50..643f8b20b 100644 --- a/packages/realm_dart/lib/src/handles/native/user_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/user_handle.dart @@ -8,7 +8,6 @@ import 'dart:ffi'; import '../../credentials.dart'; import '../../realm_dart.dart'; import '../../user.dart'; -import '../user_handle.dart' as intf; import 'app_handle.dart'; import 'convert.dart'; import 'convert_native.dart'; @@ -20,6 +19,8 @@ import 'realm_bindings.dart'; import 'realm_library.dart'; import 'scheduler_handle.dart'; +import '../user_handle.dart' as intf; + class UserHandle extends HandleBase implements intf.UserHandle { UserHandle(Pointer pointer) : super(pointer, 24); diff --git a/packages/realm_dart/lib/src/handles/realm_bindings.dart b/packages/realm_dart/lib/src/handles/realm_bindings.dart deleted file mode 100644 index 4618e541b..000000000 --- a/packages/realm_dart/lib/src/handles/realm_bindings.dart +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2024 MongoDB, Inc. -// SPDX-License-Identifier: Apache-2.0 - -export 'native/realm_bindings.dart' - if (dart.library.js_interop) 'web/realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/session.dart b/packages/realm_dart/lib/src/session.dart index 8ca8d8874..6ba07de14 100644 --- a/packages/realm_dart/lib/src/session.dart +++ b/packages/realm_dart/lib/src/session.dart @@ -4,7 +4,6 @@ import 'dart:async'; import '../realm.dart'; -import 'handles/realm_bindings.dart'; import 'handles/session_handle.dart'; import 'user.dart'; @@ -232,65 +231,56 @@ enum ProgressMode { /// Error code enumeration, indicating the type of [SyncError]. enum SyncErrorCode { /// Unrecognized error code. It usually indicates incompatibility between the App Services server and client SDK versions. - runtimeError(realm_errno.RLM_ERR_RUNTIME), + runtimeError, /// The partition value specified by the user is not valid - i.e. its the wrong type or is encoded incorrectly. - badPartitionValue(realm_errno.RLM_ERR_BAD_SYNC_PARTITION_VALUE), + badPartitionValue, /// A fundamental invariant in the communication between the client and the server was not upheld. This typically indicates /// a bug in the synchronization layer and should be reported at https://github.com/realm/realm-core/issues. - protocolInvariantFailed(realm_errno.RLM_ERR_SYNC_PROTOCOL_INVARIANT_FAILED), + protocolInvariantFailed, /// The changeset is invalid. - badChangeset(realm_errno.RLM_ERR_BAD_CHANGESET), + badChangeset, /// The client attempted to create a subscription for a query is invalid/malformed. - invalidSubscriptionQuery(realm_errno.RLM_ERR_INVALID_SUBSCRIPTION_QUERY), + invalidSubscriptionQuery, /// A client reset has occurred. This error code will only be reported via a [ClientResetError] and only /// in the case manual client reset handling is required - either via [ManualRecoveryHandler] or when /// `onManualReset` is invoked on one of the automatic client reset handlers. - clientReset(realm_errno.RLM_ERR_SYNC_CLIENT_RESET_REQUIRED), + clientReset, /// The client attempted to upload an invalid schema change - either an additive schema change /// when developer mode is off or a destructive schema change. - invalidSchemaChange(realm_errno.RLM_ERR_SYNC_INVALID_SCHEMA_CHANGE), + invalidSchemaChange, /// Permission to Realm has been denied. - permissionDenied(realm_errno.RLM_ERR_SYNC_PERMISSION_DENIED), + permissionDenied, /// The server permissions for this file have changed since the last time it was used. - serverPermissionsChanged(realm_errno.RLM_ERR_SYNC_SERVER_PERMISSIONS_CHANGED), + serverPermissionsChanged, /// The user for this session doesn't match the user who originally created the file. This can happen /// if you explicitly specify the Realm file path in the configuration and you open the Realm first with /// user A, then with user B without changing the on-disk path. - userMismatch(realm_errno.RLM_ERR_SYNC_USER_MISMATCH), + userMismatch, /// Client attempted a write that is disallowed by permissions, or modifies an object /// outside the current query - this will result in a [CompensatingWriteError]. - writeNotAllowed(realm_errno.RLM_ERR_SYNC_WRITE_NOT_ALLOWED), + writeNotAllowed, /// Automatic client reset has failed. This will only be reported via [ClientResetError] /// when an automatic client reset handler was used but it failed to perform the client reset operation - /// typically due to a breaking schema change in the server schema or due to an exception occurring in the /// before or after client reset callbacks. - autoClientResetFailed(realm_errno.RLM_ERR_AUTO_CLIENT_RESET_FAILED), + autoClientResetFailed, /// The wrong sync type was used to connect to the server. This means that you're trying to connect /// to an app configured to use partition sync. - wrongSyncType(realm_errno.RLM_ERR_WRONG_SYNC_TYPE), + wrongSyncType, /// Client attempted a write that is disallowed by permissions, or modifies an /// object outside the current query, and the server undid the modification. - compensatingWrite(realm_errno.RLM_ERR_SYNC_COMPENSATING_WRITE); - - static final Map _valuesMap = {for (var value in SyncErrorCode.values) value.code: value}; - - static SyncErrorCode fromInt(int code) { - return SyncErrorCode._valuesMap[code] ?? SyncErrorCode.runtimeError; - } - - final int code; - const SyncErrorCode(this.code); + compensatingWrite; } From 74f6a64c7a2d5d77358903bc3688793b6d4a4e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Fri, 31 May 2024 20:47:26 +0200 Subject: [PATCH 04/17] Avoid dep on realm_library.dart --- packages/realm_dart/lib/src/handles/realm_library.dart | 5 ----- packages/realm_dart/lib/src/realm_object.dart | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 packages/realm_dart/lib/src/handles/realm_library.dart diff --git a/packages/realm_dart/lib/src/handles/realm_library.dart b/packages/realm_dart/lib/src/handles/realm_library.dart deleted file mode 100644 index 9114328ea..000000000 --- a/packages/realm_dart/lib/src/handles/realm_library.dart +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2024 MongoDB, Inc. -// SPDX-License-Identifier: Apache-2.0 - -export 'native/realm_library.dart' - if (dart.library.js_interop) 'web/realm_library.dart'; diff --git a/packages/realm_dart/lib/src/realm_object.dart b/packages/realm_dart/lib/src/realm_object.dart index f9c77720b..d3e32838e 100644 --- a/packages/realm_dart/lib/src/realm_object.dart +++ b/packages/realm_dart/lib/src/realm_object.dart @@ -11,7 +11,6 @@ import 'handles/handle_base.dart'; import 'handles/notification_token_handle.dart'; import 'handles/object_changes_handle.dart'; import 'handles/object_handle.dart'; -import 'handles/realm_library.dart'; import 'list.dart'; import 'map.dart'; import 'realm_class.dart'; @@ -543,7 +542,7 @@ mixin RealmObjectBase on RealmEntity implements RealmObjectBaseMarker { if (invocation.isGetter) { final name = _symbolRegex.firstMatch(invocation.memberName.toString())?.namedGroup("symbolName"); if (name == null) { - throw RealmError("Could not find symbol name for ${invocation.memberName}. $bugInTheSdkMessage"); + throw RealmError("Could not find symbol name for ${invocation.memberName}"); } return get(this, name); @@ -552,7 +551,7 @@ mixin RealmObjectBase on RealmEntity implements RealmObjectBaseMarker { if (invocation.isSetter) { final name = _symbolRegex.firstMatch(invocation.memberName.toString())?.namedGroup("symbolName"); if (name == null) { - throw RealmError("Could not find symbol name for ${invocation.memberName}. $bugInTheSdkMessage"); + throw RealmError("Could not find symbol name for ${invocation.memberName}"); } return set(this, name, invocation.positionalArguments.single); From d867a9547fbc444b02287a59cc9039a587897b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Fri, 31 May 2024 20:47:57 +0200 Subject: [PATCH 05/17] Avoid dep on from_native.dart --- .../realm_dart/lib/src/configuration.dart | 26 ++++++++++++++++++- .../lib/src/handles/from_native.dart | 5 ---- .../lib/src/handles/native/from_native.dart | 25 ------------------ 3 files changed, 25 insertions(+), 31 deletions(-) delete mode 100644 packages/realm_dart/lib/src/handles/from_native.dart diff --git a/packages/realm_dart/lib/src/configuration.dart b/packages/realm_dart/lib/src/configuration.dart index c2e989c37..8ec05fb75 100644 --- a/packages/realm_dart/lib/src/configuration.dart +++ b/packages/realm_dart/lib/src/configuration.dart @@ -8,7 +8,6 @@ import 'dart:io'; import 'package:path/path.dart' as _path; import 'app.dart'; -import 'handles/from_native.dart'; import 'handles/realm_core.dart'; import 'init.dart'; import 'logging.dart'; @@ -714,6 +713,31 @@ final class CompensatingWriteError extends SyncError { } } +/// @nodoc +class SyncErrorDetails { + final String message; + final SyncErrorCode code; + final String? path; + final bool isFatal; + final bool isClientResetRequested; + final String? originalFilePath; + final String? backupFilePath; + final List? compensatingWrites; + final Object? userError; + + SyncErrorDetails( + this.message, + this.code, + this.userError, { + this.path, + this.isFatal = false, + this.isClientResetRequested = false, + this.originalFilePath, + this.backupFilePath, + this.compensatingWrites, + }); +} + /// @nodoc extension SyncErrorInternal on SyncError { static SyncError createSyncError(SyncErrorDetails error, {App? app}) { diff --git a/packages/realm_dart/lib/src/handles/from_native.dart b/packages/realm_dart/lib/src/handles/from_native.dart deleted file mode 100644 index a3e99f8f8..000000000 --- a/packages/realm_dart/lib/src/handles/from_native.dart +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2024 MongoDB, Inc. -// SPDX-License-Identifier: Apache-2.0 - -export 'native/from_native.dart' - if (dart.library.js_interop) 'web/from_native.dart'; diff --git a/packages/realm_dart/lib/src/handles/native/from_native.dart b/packages/realm_dart/lib/src/handles/native/from_native.dart index 5070035a3..6e1814c04 100644 --- a/packages/realm_dart/lib/src/handles/native/from_native.dart +++ b/packages/realm_dart/lib/src/handles/native/from_native.dart @@ -353,31 +353,6 @@ extension PlatformEx on Platform { } } -/// @nodoc -class SyncErrorDetails { - final String message; - final SyncErrorCode code; - final String? path; - final bool isFatal; - final bool isClientResetRequested; - final String? originalFilePath; - final String? backupFilePath; - final List? compensatingWrites; - final Object? userError; - - SyncErrorDetails( - this.message, - this.code, - this.userError, { - this.path, - this.isFatal = false, - this.isClientResetRequested = false, - this.originalFilePath, - this.backupFilePath, - this.compensatingWrites, - }); -} - extension PointerRealmValueEx on Pointer { Object? toDartValue(Realm realm, Pointer Function()? getList, Pointer Function()? getMap) { if (this == nullptr) { From 04f381de12634883aafc9d06db6d075f97ecf37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Fri, 31 May 2024 21:05:18 +0200 Subject: [PATCH 06/17] Split convert.dart to avoid dart:ffi dep --- packages/realm_dart/lib/src/convert.dart | 8 ++++++++ packages/realm_dart/lib/src/credentials.dart | 2 +- packages/realm_dart/lib/src/handles/convert.dart | 4 ---- packages/realm_dart/lib/src/subscription.dart | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 packages/realm_dart/lib/src/convert.dart delete mode 100644 packages/realm_dart/lib/src/handles/convert.dart diff --git a/packages/realm_dart/lib/src/convert.dart b/packages/realm_dart/lib/src/convert.dart new file mode 100644 index 000000000..861a2719e --- /dev/null +++ b/packages/realm_dart/lib/src/convert.dart @@ -0,0 +1,8 @@ + +extension NullableObjectEx on T? { + U? convert(U Function(T) convertor) { + final self = this; + if (self == null) return null; + return convertor(self); + } +} diff --git a/packages/realm_dart/lib/src/credentials.dart b/packages/realm_dart/lib/src/credentials.dart index 40291f134..85ba0e52d 100644 --- a/packages/realm_dart/lib/src/credentials.dart +++ b/packages/realm_dart/lib/src/credentials.dart @@ -4,7 +4,7 @@ import 'dart:convert'; import 'app.dart'; -import 'handles/convert.dart'; +import 'convert.dart'; import 'handles/credentials_handle.dart'; import 'user.dart'; diff --git a/packages/realm_dart/lib/src/handles/convert.dart b/packages/realm_dart/lib/src/handles/convert.dart deleted file mode 100644 index 1e3e6c00d..000000000 --- a/packages/realm_dart/lib/src/handles/convert.dart +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2024 MongoDB, Inc. -// SPDX-License-Identifier: Apache-2.0 - -export 'native/convert.dart' if (dart.library.js_interop) 'web/convert.dart'; diff --git a/packages/realm_dart/lib/src/subscription.dart b/packages/realm_dart/lib/src/subscription.dart index 2fc945854..4afb2c5fa 100644 --- a/packages/realm_dart/lib/src/subscription.dart +++ b/packages/realm_dart/lib/src/subscription.dart @@ -3,7 +3,7 @@ import 'dart:core'; -import 'handles/convert.dart'; +import 'convert.dart'; import 'handles/mutable_subscription_set_handle.dart'; import 'handles/subscription_handle.dart'; import 'handles/subscription_set_handle.dart'; From 63aed9e09205c59d5e1119457312dbb1e39a9ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Sat, 1 Jun 2024 12:14:56 +0200 Subject: [PATCH 07/17] BREAKING CHANGE! (WIP) Avoid dep on dart:io - AppConfiguration.baseFilePath is now a String instead of a Directory. - AppConfiguration.httpClient is now a Client instead of a HttpClient. This is to avoid a dependency on dart:io in order to be compatible with package web. This is still work in progress. Missing is: - Support for timeout on web requests - Custom certificate for windows. --- packages/realm_dart/lib/src/app.dart | 43 ++++++------ .../realm_dart/lib/src/configuration.dart | 10 +-- .../lib/src/handles/native/app_handle.dart | 6 +- .../lib/src/handles/native/from_native.dart | 1 + .../handles/native/http_transport_handle.dart | 66 +++++++------------ .../lib/src/{ => handles/native}/init.dart | 14 ++-- .../lib/src/handles/native/realm_core.dart | 6 +- .../lib/src/handles/native/realm_library.dart | 2 +- packages/realm_dart/lib/src/realm_class.dart | 28 ++------ packages/realm_dart/test/app_test.dart | 15 +++-- packages/realm_dart/test/baas_helper.dart | 2 +- .../realm_dart/test/configuration_test.dart | 6 +- packages/realm_dart/test/realm_test.dart | 6 +- .../realm_dart/test/subscription_test.dart | 2 +- packages/realm_dart/test/test.dart | 6 +- packages/realm_dart/test/user_test.dart | 3 +- 16 files changed, 91 insertions(+), 125 deletions(-) rename packages/realm_dart/lib/src/{ => handles/native}/init.dart (93%) diff --git a/packages/realm_dart/lib/src/app.dart b/packages/realm_dart/lib/src/app.dart index 78e2cc82e..a87591d4b 100644 --- a/packages/realm_dart/lib/src/app.dart +++ b/packages/realm_dart/lib/src/app.dart @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:convert'; -import 'dart:io'; import 'dart:isolate'; +import 'package:http/http.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as path; @@ -52,20 +52,20 @@ he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5 -----END CERTIFICATE-----'''; - if (Platform.isWindows) { - try { - final context = SecurityContext(withTrustedRoots: true); - context.setTrustedCertificatesBytes(const AsciiEncoder().convert(isrgRootX1CertPEM)); - return HttpClient(context: context); - } on TlsException catch (e) { - // certificate is already trusted. Nothing to do here - if (e.osError?.message.contains("CERT_ALREADY_IN_HASH_TABLE") != true) { - rethrow; - } - } - } - - return HttpClient(); + // if (Platform.isWindows) { + // try { + // final context = SecurityContext(withTrustedRoots: true); + // context.setTrustedCertificatesBytes(const AsciiEncoder().convert(isrgRootX1CertPEM)); + // return Client(context: context); + // } on TlsException catch (e) { + // // certificate is already trusted. Nothing to do here + // if (e.osError?.message.contains("CERT_ALREADY_IN_HASH_TABLE") != true) { + // rethrow; + // } + // } + // } + + return Client(); }(); /// A class exposing configuration options for an [App] @@ -79,7 +79,7 @@ class AppConfiguration { /// /// This data includes metadata for users and synchronized Realms. If set, you must ensure that the [baseFilePath] /// directory exists. - final Directory baseFilePath; + final String baseFilePath; /// The [baseUrl] is the [Uri] used to reach the MongoDB Atlas. /// @@ -106,26 +106,26 @@ class AppConfiguration { /// Setting this will not change the encryption key for individual Realms, which is set in the [Configuration]. final List? metadataEncryptionKey; - /// The [HttpClient] that will be used for HTTP requests during authentication. + /// The [Client] that will be used for HTTP requests during authentication. /// /// You can use this to override the default http client handler and configure settings like proxies, /// client certificates, and cookies. While these are not required to connect to MongoDB Atlas under /// normal circumstances, they can be useful if client devices are behind corporate firewall or use /// a more complex networking setup. - final HttpClient httpClient; + final Client httpClient; /// Instantiates a new [AppConfiguration] with the specified appId. AppConfiguration( this.appId, { Uri? baseUrl, - Directory? baseFilePath, + String? baseFilePath, this.defaultRequestTimeout = const Duration(seconds: 60), this.metadataEncryptionKey, this.metadataPersistenceMode = MetadataPersistenceMode.plaintext, this.maxConnectionTimeout = const Duration(minutes: 2), - HttpClient? httpClient, + Client? httpClient, }) : baseUrl = baseUrl ?? Uri.parse(realmCore.getDefaultBaseUrl()), - baseFilePath = baseFilePath ?? Directory(path.dirname(Configuration.defaultRealmPath)), + baseFilePath = baseFilePath ?? path.dirname(Configuration.defaultRealmPath), httpClient = httpClient ?? _defaultClient { if (appId == '') { throw RealmException('Supplied appId must be a non-empty value'); @@ -170,7 +170,6 @@ class App { App._(this._handle); static AppHandle _createApp(AppConfiguration configuration) { - configuration.baseFilePath.createSync(recursive: true); return AppHandle.from(configuration); } diff --git a/packages/realm_dart/lib/src/configuration.dart b/packages/realm_dart/lib/src/configuration.dart index 8ec05fb75..ffd299b70 100644 --- a/packages/realm_dart/lib/src/configuration.dart +++ b/packages/realm_dart/lib/src/configuration.dart @@ -2,16 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:async'; -import 'dart:io'; // ignore: no_leading_underscores_for_library_prefixes import 'package:path/path.dart' as _path; import 'app.dart'; import 'handles/realm_core.dart'; -import 'init.dart'; import 'logging.dart'; -import 'realm_class.dart'; +import 'realm_dart.dart'; import 'user.dart'; const encryptionKeySize = 64; @@ -84,11 +82,7 @@ abstract class Configuration { /// On Flutter Linux this is the `/home/username/.local/share/app_name` directory. /// On Dart standalone Windows, macOS and Linux this is the current directory. static String get defaultStoragePath { - if (isFlutterPlatform) { - return realmCore.getAppDirectory(); - } - - return Directory.current.path; + return realmCore.getAppDirectory(); } /// The platform dependent path to the default realm file. diff --git a/packages/realm_dart/lib/src/handles/native/app_handle.dart b/packages/realm_dart/lib/src/handles/native/app_handle.dart index 1c53bbf7a..cf4c4c31d 100644 --- a/packages/realm_dart/lib/src/handles/native/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/app_handle.dart @@ -6,7 +6,7 @@ import 'dart:ffi'; import 'dart:io'; import 'dart:isolate'; -import '../../init.dart'; +import 'init.dart'; import '../../realm_class.dart'; import 'convert.dart'; import 'convert_native.dart'; @@ -34,6 +34,8 @@ class AppHandle extends HandleBase implements intf.AppHandle { _firstTime = false; realmLib.realm_clear_cached_apps(); } + Directory(configuration.baseFilePath).createSync(recursive: true); + final httpTransportHandle = HttpTransportHandle.from(configuration.httpClient); final appConfigHandle = _createAppConfig(configuration, httpTransportHandle); return AppHandle(realmLib.realm_app_create_cached(appConfigHandle.pointer)); @@ -429,7 +431,7 @@ _AppConfigHandle _createAppConfig(AppConfiguration configuration, HttpTransportH realmLib.realm_app_config_set_bundle_id(handle.pointer, realmCore.getBundleId().toCharPtr(arena)); - realmLib.realm_app_config_set_base_file_path(handle.pointer, configuration.baseFilePath.path.toCharPtr(arena)); + realmLib.realm_app_config_set_base_file_path(handle.pointer, configuration.baseFilePath.toCharPtr(arena)); realmLib.realm_app_config_set_metadata_mode(handle.pointer, configuration.metadataPersistenceMode.index); if (configuration.metadataEncryptionKey != null && configuration.metadataPersistenceMode == MetadataPersistenceMode.encrypted) { diff --git a/packages/realm_dart/lib/src/handles/native/from_native.dart b/packages/realm_dart/lib/src/handles/native/from_native.dart index 6e1814c04..609782e36 100644 --- a/packages/realm_dart/lib/src/handles/native/from_native.dart +++ b/packages/realm_dart/lib/src/handles/native/from_native.dart @@ -287,6 +287,7 @@ extension CompleterEx on Completer { enum CustomErrorCode { noError(0), + socketException(997), unknownHttp(998), unknown(999), timeout(1000); diff --git a/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart b/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart index bf4f4fec5..8a316e5b6 100644 --- a/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/http_transport_handle.dart @@ -1,10 +1,13 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 +import 'dart:async'; import 'dart:convert'; import 'dart:ffi'; import 'dart:io'; +import 'package:http/http.dart'; + import '../../logging.dart'; import '../../realm_dart.dart'; import 'convert_native.dart'; @@ -17,7 +20,7 @@ import 'scheduler_handle.dart'; class HttpTransportHandle extends HandleBase { HttpTransportHandle(Pointer pointer) : super(pointer, 24); - factory HttpTransportHandle.from(HttpClient httpClient) { + factory HttpTransportHandle.from(Client httpClient) { final requestCallback = Pointer.fromFunction)>(_requestCallback); final requestCallbackUserdata = realmLib.realm_dart_userdata_async_new(httpClient, requestCallback.cast(), schedulerHandle.pointer); return HttpTransportHandle(realmLib.realm_http_transport_new( @@ -38,9 +41,9 @@ void _requestCallback(Object userData, realm_http_request request, Pointer // We cannot clone request on the native side with realm_clone, // since realm_http_request does not inherit from WrapC. - final client = userData as HttpClient; + final client = userData as Client; - client.connectionTimeout = Duration(milliseconds: request.timeout_ms); + final timeLimit = Duration(milliseconds: request.timeout_ms); final url = Uri.parse(request.url.cast().toRealmDartString()!); @@ -54,16 +57,17 @@ void _requestCallback(Object userData, realm_http_request request, Pointer headers[name] = value; } - _requestCallbackAsync(client, request.method, url, body, headers, requestContext); + _requestCallbackAsync(client, request.method, url, body, headers, timeLimit, requestContext); // The request struct dies here! } Future _requestCallbackAsync( - HttpClient client, + Client client, int requestMethod, Uri url, String? body, Map headers, + Duration timeLimit, Pointer requestContext, ) async { await using((arena) async { @@ -73,32 +77,13 @@ Future _requestCallbackAsync( try { // Build request - late HttpClientRequest request; - - switch (method) { - case HttpMethod.delete: - request = await client.deleteUrl(url); - break; - case HttpMethod.put: - request = await client.putUrl(url); - break; - case HttpMethod.patch: - request = await client.patchUrl(url); - break; - case HttpMethod.post: - request = await client.postUrl(url); - break; - case HttpMethod.get: - request = await client.getUrl(url); - break; - } - + final request = Request(method.name, url); for (final header in headers.entries) { - request.headers.add(header.key, header.value); + request.headers[header.key] = header.value; } if (body != null) { - request.add(utf8.encode(body)); + request.bodyBytes = utf8.encode(body); } Realm.logger.log(LogLevel.debug, "HTTP Transport: Executing ${method.name} $url"); @@ -106,40 +91,37 @@ Future _requestCallbackAsync( final stopwatch = Stopwatch()..start(); // Do the call.. - final response = await request.close(); + final response = await client.send(request).timeout(timeLimit); stopwatch.stop(); Realm.logger.log(LogLevel.debug, "HTTP Transport: Executed ${method.name} $url: ${response.statusCode} in ${stopwatch.elapsedMilliseconds} ms"); - final responseBody = await response.fold>([], (acc, l) => acc..addAll(l)); // gather response + final responseBody = await response.stream.fold>([], (acc, l) => acc..addAll(l)); // gather response // Report back to core responseRef.status_code = response.statusCode; responseRef.body = responseBody.toCharPtr(arena); responseRef.body_size = responseBody.length; - int headerCnt = 0; - response.headers.forEach((name, values) { - headerCnt += values.length; - }); - + int headerCnt = response.headers.length; responseRef.headers = arena(headerCnt); responseRef.num_headers = headerCnt; int index = 0; - response.headers.forEach((name, values) { - for (final value in values) { - final headerRef = (responseRef.headers + index).ref; - headerRef.name = name.toCharPtr(arena); - headerRef.value = value.toCharPtr(arena); - index++; - } + response.headers.forEach((name, value) { + final headerRef = (responseRef.headers + index).ref; + headerRef.name = name.toCharPtr(arena); + headerRef.value = value.toCharPtr(arena); + index++; }); responseRef.custom_status_code = CustomErrorCode.noError.code; + } on TimeoutException catch (timeoutEx) { + Realm.logger.log(LogLevel.warn, "HTTP Transport: TimeoutException executing ${method.name} $url: $timeoutEx"); + responseRef.custom_status_code = CustomErrorCode.timeout.code; } on SocketException catch (socketEx) { Realm.logger.log(LogLevel.warn, "HTTP Transport: SocketException executing ${method.name} $url: $socketEx"); - responseRef.custom_status_code = CustomErrorCode.timeout.code; + responseRef.custom_status_code = CustomErrorCode.socketException.code; } on HttpException catch (httpEx) { Realm.logger.log(LogLevel.warn, "HTTP Transport: HttpException executing ${method.name} $url: $httpEx"); responseRef.custom_status_code = CustomErrorCode.unknownHttp.code; diff --git a/packages/realm_dart/lib/src/init.dart b/packages/realm_dart/lib/src/handles/native/init.dart similarity index 93% rename from packages/realm_dart/lib/src/init.dart rename to packages/realm_dart/lib/src/handles/native/init.dart index 075ca4764..e47734bcd 100644 --- a/packages/realm_dart/lib/src/init.dart +++ b/packages/realm_dart/lib/src/handles/native/init.dart @@ -7,11 +7,13 @@ import 'dart:io'; import 'package:package_config/package_config.dart'; import 'package:path/path.dart' as p; -import '../realm.dart' as realm show isFlutterPlatform; -import 'cli/common/target_os_type.dart'; -import 'cli/metrics/metrics_command.dart'; -import 'cli/metrics/options.dart'; -import 'realm_class.dart'; +import '../../cli/common/target_os_type.dart'; +import '../../cli/metrics/metrics_command.dart'; +import '../../cli/metrics/options.dart'; +import '../../realm_class.dart'; + +import '../../../realm.dart' show isFlutterPlatform; +export '../../../realm.dart' show isFlutterPlatform; const realmBinaryName = 'realm_dart'; final targetOsType = Platform.operatingSystem.asTargetOsType ?? _platformNotSupported(); @@ -50,7 +52,7 @@ String _getLibPathDart(Package realmDartPackage) { _platformNotSupported(); } -bool get isFlutterPlatform => realm.isFlutterPlatform; +//bool get isFlutterPlatform => realm.isFlutterPlatform; String _getLibName(String stem) => switch (targetOsType) { TargetOsType.android => 'lib$stem.so', diff --git a/packages/realm_dart/lib/src/handles/native/realm_core.dart b/packages/realm_dart/lib/src/handles/native/realm_core.dart index ae8c90a28..923448319 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_core.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_core.dart @@ -9,7 +9,7 @@ import 'package:crypto/crypto.dart'; import 'package:path/path.dart' as path; import 'package:pubspec_parse/pubspec_parse.dart'; -import '../../init.dart'; +import 'init.dart'; import '../../realm_class.dart'; import '../../scheduler.dart'; import 'convert_native.dart'; @@ -196,4 +196,8 @@ class RealmCore { return outLimit.value; }); } + + bool checkIfRealmExists(String path) { + return File(path).existsSync(); // TODO: Should this not check that file is an actual realm file? + } } diff --git a/packages/realm_dart/lib/src/handles/native/realm_library.dart b/packages/realm_dart/lib/src/handles/native/realm_library.dart index d4eda7514..a574bc298 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_library.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_library.dart @@ -3,7 +3,7 @@ import 'package:realm_common/realm_common.dart'; -import '../../init.dart'; +import 'init.dart'; import 'ffi.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/realm_class.dart b/packages/realm_dart/lib/src/realm_class.dart index ce4bcfebc..2ef5a13e5 100644 --- a/packages/realm_dart/lib/src/realm_class.dart +++ b/packages/realm_dart/lib/src/realm_class.dart @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:async'; -import 'dart:io'; +import 'dart:isolate'; import 'package:cancellation_token/cancellation_token.dart'; import 'package:collection/collection.dart'; @@ -179,7 +179,7 @@ class Realm { return await CancellableFuture.value(realm, cancellationToken); } - _ensureDirectory(config); +// _ensureDirectory(config); final asyncOpenHandle = AsyncOpenTaskHandle.from(config); return await CancellableFuture.from(() async { @@ -205,17 +205,9 @@ class Realm { } static RealmHandle _openRealm(Configuration config) { - _ensureDirectory(config); return RealmHandle.open(config); } - static void _ensureDirectory(Configuration config) { - var dir = File(config.path).parent; - if (!dir.existsSync()) { - dir.createSync(recursive: true); - } - } - void _populateMetadata() { schema = config.schemaObjects.isNotEmpty ? RealmSchema(config.schemaObjects) : handle.readSchema(); _metadata = RealmMetadata._(schema.map((c) => handle.getObjectMetadata(c))); @@ -230,22 +222,12 @@ class Realm { /// Synchronously checks whether a `Realm` exists at [path] static bool existsSync(String path) { - try { - final fileEntity = File(path); - return fileEntity.existsSync(); - } catch (e) { - throw RealmException("Error while checking if Realm exists at $path. Error: $e"); - } + return realmCore.checkIfRealmExists(path); } /// Checks whether a `Realm` exists at [path]. static Future exists(String path) async { - try { - final fileEntity = File(path); - return await fileEntity.exists(); - } catch (e) { - throw RealmException("Error while checking if Realm exists at $path. Error: $e"); - } + return await Isolate.run(() => realmCore.checkIfRealmExists(path)); } /// Adds a [RealmObject] to the `Realm`. @@ -564,7 +546,7 @@ class Realm { throw RealmException("Can't compact an in-memory Realm"); } - if (!File(config.path).existsSync()) { + if (!Realm.existsSync(config.path)) { print("realm file doesn't exist: ${config.path}"); return false; } diff --git a/packages/realm_dart/test/app_test.dart b/packages/realm_dart/test/app_test.dart index a0c3f04d5..7a780788a 100644 --- a/packages/realm_dart/test/app_test.dart +++ b/packages/realm_dart/test/app_test.dart @@ -6,6 +6,7 @@ import 'dart:io'; import 'dart:isolate'; import 'package:crypto/crypto.dart'; +import 'package:http/http.dart'; import 'package:path/path.dart' as path; import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/handles/realm_core.dart'; @@ -19,15 +20,15 @@ void main() { Configuration.defaultRealmPath = path.join(Configuration.defaultStoragePath, Configuration.defaultRealmName); final defaultAppConfig = AppConfiguration('myapp'); expect(defaultAppConfig.appId, 'myapp'); - expect(defaultAppConfig.baseFilePath.path, Configuration.defaultStoragePath); + expect(defaultAppConfig.baseFilePath, Configuration.defaultStoragePath); expect(defaultAppConfig.baseUrl, Uri.parse('https://services.cloud.mongodb.com')); expect(defaultAppConfig.defaultRequestTimeout, const Duration(minutes: 1)); expect(defaultAppConfig.metadataPersistenceMode, MetadataPersistenceMode.plaintext); - final httpClient = HttpClient(context: SecurityContext(withTrustedRoots: false)); + final httpClient = Client(); final appConfig = AppConfiguration( 'myapp1', - baseFilePath: Directory.systemTemp, + baseFilePath: Directory.systemTemp.path, baseUrl: Uri.parse('https://not_re.al'), defaultRequestTimeout: const Duration(seconds: 2), metadataPersistenceMode: MetadataPersistenceMode.disabled, @@ -35,7 +36,7 @@ void main() { httpClient: httpClient, ); expect(appConfig.appId, 'myapp1'); - expect(appConfig.baseFilePath.path, Directory.systemTemp.path); + expect(appConfig.baseFilePath, Directory.systemTemp.path); expect(appConfig.baseUrl, Uri.parse('https://not_re.al')); expect(appConfig.defaultRequestTimeout, const Duration(seconds: 2)); expect(appConfig.metadataPersistenceMode, MetadataPersistenceMode.disabled); @@ -57,10 +58,10 @@ void main() { }); test('AppConfiguration can be created', () { - final httpClient = HttpClient(context: SecurityContext(withTrustedRoots: false)); + final httpClient = Client(); final appConfig = AppConfiguration( 'myapp1', - baseFilePath: Directory.systemTemp, + baseFilePath: Directory.systemTemp.path, baseUrl: Uri.parse('https://not_re.al'), defaultRequestTimeout: const Duration(seconds: 2), metadataPersistenceMode: MetadataPersistenceMode.encrypted, @@ -70,7 +71,7 @@ void main() { ); expect(appConfig.appId, 'myapp1'); - expect(appConfig.baseFilePath.path, Directory.systemTemp.path); + expect(appConfig.baseFilePath, Directory.systemTemp.path); expect(appConfig.baseUrl, Uri.parse('https://not_re.al')); expect(appConfig.defaultRequestTimeout, const Duration(seconds: 2)); expect(appConfig.metadataPersistenceMode, MetadataPersistenceMode.encrypted); diff --git a/packages/realm_dart/test/baas_helper.dart b/packages/realm_dart/test/baas_helper.dart index 975c8e248..c4e8a2a97 100644 --- a/packages/realm_dart/test/baas_helper.dart +++ b/packages/realm_dart/test/baas_helper.dart @@ -191,7 +191,7 @@ class BaasHelper { return AppConfiguration( app.clientAppId, baseUrl: Uri.parse(customBaseUrl ?? baseUrl), - baseFilePath: temporaryDir, + baseFilePath: temporaryDir.path, maxConnectionTimeout: Duration(minutes: 10), defaultRequestTimeout: Duration(minutes: 7), ); diff --git a/packages/realm_dart/test/configuration_test.dart b/packages/realm_dart/test/configuration_test.dart index 5dbdf98eb..b25ed6ecf 100644 --- a/packages/realm_dart/test/configuration_test.dart +++ b/packages/realm_dart/test/configuration_test.dart @@ -87,7 +87,7 @@ void main() { final appClientId = baasHelper!.getClientAppId(appName: AppName.flexible); final baasUrl = baasHelper!.baseUrl; var appConfig = AppConfiguration(appClientId, baseUrl: Uri.parse(baasUrl)); - expect(appConfig.baseFilePath.path, path.dirname(customDefaultRealmPath)); + expect(appConfig.baseFilePath, path.dirname(customDefaultRealmPath)); var app = App(appConfig); var user = await app.logIn(Credentials.anonymous()); @@ -103,7 +103,7 @@ void main() { Configuration.defaultRealmPath = customDefaultRealmPath; appConfig = AppConfiguration(appClientId, baseUrl: Uri.parse(baasUrl)); - expect(appConfig.baseFilePath.path, path.dirname(customDefaultRealmPath)); + expect(appConfig.baseFilePath, path.dirname(customDefaultRealmPath)); clearCachedApps(); @@ -163,7 +163,7 @@ void main() { var realm = getRealm(config); realm.write(() => realm.add(Car('Tesla'))); realm.close(); - expect(Realm.existsSync(config.path), false); + expect(File(config.path).existsSync(), false); }); test('Configuration inMemory can not be readOnly', () { diff --git a/packages/realm_dart/test/realm_test.dart b/packages/realm_dart/test/realm_test.dart index 3fbc772d0..9b0e01201 100644 --- a/packages/realm_dart/test/realm_test.dart +++ b/packages/realm_dart/test/realm_test.dart @@ -1445,7 +1445,7 @@ void main() { var config = Configuration.local([Product.schema], path: p.join(Configuration.defaultStoragePath, "${generateRandomString(8)}.realm")); final beforeCompactSizeSize = await createRealmForCompact(config); - final compacted = Realm.compact(config); + final compacted = await Realm.compact(config); validateCompact(compacted, config.path, beforeCompactSizeSize); @@ -1486,7 +1486,7 @@ void main() { final beforeCompactSizeSize = await createRealmForCompact(config); - final compacted = Realm.compact(config); + final compacted = await Realm.compact(config); validateCompact(compacted, config.path, beforeCompactSizeSize); @@ -1516,7 +1516,7 @@ void main() { final beforeCompactSize = await createRealmForCompact(config); - final compacted = Realm.compact(config); + final compacted = await Realm.compact(config); validateCompact(compacted, config.path, beforeCompactSize); diff --git a/packages/realm_dart/test/subscription_test.dart b/packages/realm_dart/test/subscription_test.dart index 819fbee6d..bd7802164 100644 --- a/packages/realm_dart/test/subscription_test.dart +++ b/packages/realm_dart/test/subscription_test.dart @@ -473,7 +473,7 @@ void main() { final appConfigurationY = AppConfiguration( appConfigurationX.appId, baseUrl: appConfigurationX.baseUrl, - baseFilePath: temporaryDir, + baseFilePath: temporaryDir.path, ); final appY = App(appConfigurationY); diff --git a/packages/realm_dart/test/test.dart b/packages/realm_dart/test/test.dart index 4c54c6ac2..52d9167a4 100644 --- a/packages/realm_dart/test/test.dart +++ b/packages/realm_dart/test/test.dart @@ -764,13 +764,13 @@ List getSyncSchema() { ]; } -Future runWithRetries(bool Function() tester, {int retryDelay = 100, int attempts = 100}) async { - var success = tester(); +Future runWithRetries(FutureOr Function() tester, {int retryDelay = 100, int attempts = 100}) async { + var success = await tester(); var timeout = retryDelay * attempts; while (!success && attempts > 0) { await Future.delayed(Duration(milliseconds: retryDelay)); - success = tester(); + success = await tester(); attempts--; } diff --git a/packages/realm_dart/test/user_test.dart b/packages/realm_dart/test/user_test.dart index df21c1087..082304074 100644 --- a/packages/realm_dart/test/user_test.dart +++ b/packages/realm_dart/test/user_test.dart @@ -4,9 +4,8 @@ import 'dart:async'; import 'dart:isolate'; -import 'package:test/expect.dart' hide throws; - import 'package:realm_dart/realm.dart'; + import 'test.dart'; void main() { From 355d37ca0ddc6bcc57259d6bcb370ece45132048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 09:47:31 +0200 Subject: [PATCH 08/17] Refactor test to avoid direct deps on dart:io and dart:ffi --- packages/realm/tests/pubspec.yaml | 5 +- .../lib/src/handles/native/realm_handle.dart | 7 +++ packages/realm_dart/pubspec.yaml | 1 + packages/realm_dart/test/app_test.dart | 10 ++-- packages/realm_dart/test/baas_helper.dart | 15 +++--- .../realm_dart/test/client_reset_test.dart | 6 +-- .../realm_dart/test/configuration_test.dart | 24 ++++----- packages/realm_dart/test/realm_map_test.dart | 2 - packages/realm_dart/test/realm_test.dart | 54 +++++++++---------- .../realm_dart/test/subscription_test.dart | 6 +-- packages/realm_dart/test/test.dart | 40 +++----------- .../test/utils/native/platform_util.dart | 50 +++++++++++++++++ .../realm_dart/test/utils/platform_util.dart | 26 +++++++++ .../test/utils/web/platform_util.dart | 11 ++++ 14 files changed, 161 insertions(+), 96 deletions(-) create mode 100644 packages/realm_dart/test/utils/native/platform_util.dart create mode 100644 packages/realm_dart/test/utils/platform_util.dart create mode 100644 packages/realm_dart/test/utils/web/platform_util.dart diff --git a/packages/realm/tests/pubspec.yaml b/packages/realm/tests/pubspec.yaml index fdbe289c0..ed5cb4b25 100644 --- a/packages/realm/tests/pubspec.yaml +++ b/packages/realm/tests/pubspec.yaml @@ -24,10 +24,11 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^3.0.1 - test: any - timezone: ^0.9.0 integration_test: sdk: flutter + test: any + timezone: ^0.9.0 + universal_platform: ^1.1.0 flutter: assets: diff --git a/packages/realm_dart/lib/src/handles/native/realm_handle.dart b/packages/realm_dart/lib/src/handles/native/realm_handle.dart index c759c7ec3..9a5831672 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_handle.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'dart:ffi'; +import 'dart:io'; import 'package:cancellation_token/cancellation_token.dart'; import 'ffi.dart'; @@ -37,7 +38,13 @@ class RealmHandle extends HandleBase implements intf.RealmHandle { RealmHandle.unowned(super.pointer) : super.unowned(); factory RealmHandle.open(Configuration config) { + var dir = File(config.path).parent; + if (!dir.existsSync()) { + dir.createSync(recursive: true); + } + final configHandle = ConfigHandle.from(config); + return RealmHandle(realmLib .realm_open(configHandle.pointer) // .raiseLastErrorIfNull()); diff --git a/packages/realm_dart/pubspec.yaml b/packages/realm_dart/pubspec.yaml index dd5301aae..b4a63abd2 100644 --- a/packages/realm_dart/pubspec.yaml +++ b/packages/realm_dart/pubspec.yaml @@ -37,3 +37,4 @@ dev_dependencies: lints: ^3.0.0 test: ^1.14.3 timezone: ^0.9.0 + universal_platform: ^1.1.0 diff --git a/packages/realm_dart/test/app_test.dart b/packages/realm_dart/test/app_test.dart index 7a780788a..13f758250 100644 --- a/packages/realm_dart/test/app_test.dart +++ b/packages/realm_dart/test/app_test.dart @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:convert'; -import 'dart:io'; import 'dart:isolate'; import 'package:crypto/crypto.dart'; @@ -12,6 +11,7 @@ import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/handles/realm_core.dart'; import 'test.dart'; +import 'utils/platform_util.dart'; void main() { setupTests(); @@ -28,7 +28,7 @@ void main() { final httpClient = Client(); final appConfig = AppConfiguration( 'myapp1', - baseFilePath: Directory.systemTemp.path, + baseFilePath: platformUtil.systemTempPath, baseUrl: Uri.parse('https://not_re.al'), defaultRequestTimeout: const Duration(seconds: 2), metadataPersistenceMode: MetadataPersistenceMode.disabled, @@ -36,7 +36,7 @@ void main() { httpClient: httpClient, ); expect(appConfig.appId, 'myapp1'); - expect(appConfig.baseFilePath, Directory.systemTemp.path); + expect(appConfig.baseFilePath, platformUtil.systemTempPath); expect(appConfig.baseUrl, Uri.parse('https://not_re.al')); expect(appConfig.defaultRequestTimeout, const Duration(seconds: 2)); expect(appConfig.metadataPersistenceMode, MetadataPersistenceMode.disabled); @@ -61,7 +61,7 @@ void main() { final httpClient = Client(); final appConfig = AppConfiguration( 'myapp1', - baseFilePath: Directory.systemTemp.path, + baseFilePath: platformUtil.systemTempPath, baseUrl: Uri.parse('https://not_re.al'), defaultRequestTimeout: const Duration(seconds: 2), metadataPersistenceMode: MetadataPersistenceMode.encrypted, @@ -71,7 +71,7 @@ void main() { ); expect(appConfig.appId, 'myapp1'); - expect(appConfig.baseFilePath, Directory.systemTemp.path); + expect(appConfig.baseFilePath, platformUtil.systemTempPath); expect(appConfig.baseUrl, Uri.parse('https://not_re.al')); expect(appConfig.defaultRequestTimeout, const Duration(seconds: 2)); expect(appConfig.metadataPersistenceMode, MetadataPersistenceMode.encrypted); diff --git a/packages/realm_dart/test/baas_helper.dart b/packages/realm_dart/test/baas_helper.dart index c4e8a2a97..a8810ef99 100644 --- a/packages/realm_dart/test/baas_helper.dart +++ b/packages/realm_dart/test/baas_helper.dart @@ -1,13 +1,12 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'dart:io'; - -import 'package:test/test.dart' as testing; - import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/cli/atlas_apps/baas_client.dart'; import 'package:realm_dart/src/handles/realm_core.dart'; +import 'package:test/test.dart' as testing; + +import 'utils/platform_util.dart'; export 'package:realm_dart/src/cli/atlas_apps/baas_client.dart' show AppName; @@ -37,7 +36,7 @@ enum Env { const Env(this.name, this._dartDefined); String? get dartDefined => _dartDefined.emptyAsNull; - String? get shellDefined => Platform.environment[name]; + String? get shellDefined => platformUtil.environment[name]; String? get value => dartDefined ?? shellDefined; bool get isDefined => value != null; @@ -187,11 +186,11 @@ class BaasHelper { throw app.error!; } - final temporaryDir = await Directory.systemTemp.createTemp('realm_test_'); + final temporaryPath = await platformUtil.createTempPath(); return AppConfiguration( app.clientAppId, baseUrl: Uri.parse(customBaseUrl ?? baseUrl), - baseFilePath: temporaryDir.path, + baseFilePath: temporaryPath, maxConnectionTimeout: Duration(minutes: 10), defaultRequestTimeout: Duration(minutes: 7), ); @@ -234,7 +233,7 @@ class BaasHelper { } print('Failed to trigger client reset: $e'); - await Future.delayed(Duration(seconds: i)); + await Future.delayed(Duration(seconds: i)); } } diff --git a/packages/realm_dart/test/client_reset_test.dart b/packages/realm_dart/test/client_reset_test.dart index 36cc5ba1e..5e76c177a 100644 --- a/packages/realm_dart/test/client_reset_test.dart +++ b/packages/realm_dart/test/client_reset_test.dart @@ -2,9 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:async'; -import 'dart:io'; -import 'package:test/test.dart' hide test, throws; import 'package:realm_dart/realm.dart'; import 'package:realm_dart/src/configuration.dart' show ClientResetHandlerInternal, ClientResyncModeInternal; import 'test.dart'; @@ -95,7 +93,7 @@ void main() { await resetRealmFuture.wait(defaultWaitTimeout, "ManualRecoveryHandler is not reported."); - expect(File(config.path).existsSync(), isFalse); + expect(Realm.existsSync(config.path), isFalse); }); baasTest('Initiate resetRealm after ManualRecoveryHandler callback fails when Realm is opened', (appConfig) async { @@ -121,7 +119,7 @@ void main() { await baasHelper!.triggerClientReset(realm); expect(await resetRealmFuture.timeout(defaultWaitTimeout), !Platform.isWindows); - expect(File(config.path).existsSync(), Platform.isWindows); // posix and windows semantics are different + expect(Realm.existsSync(config.path), Platform.isWindows); // posix and windows semantics are different }); for (Type clientResetHandlerType in [ diff --git a/packages/realm_dart/test/configuration_test.dart b/packages/realm_dart/test/configuration_test.dart index b25ed6ecf..942dba9f1 100644 --- a/packages/realm_dart/test/configuration_test.dart +++ b/packages/realm_dart/test/configuration_test.dart @@ -1,13 +1,13 @@ // Copyright 2021 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'dart:io'; import 'dart:math'; import 'package:path/path.dart' as path; import 'package:realm_dart/realm.dart'; import 'test.dart'; +import 'utils/platform_util.dart'; void main() { setupTests(); @@ -44,7 +44,7 @@ void main() { }); test('Configuration defaultRealmPath can be set for LocalConfiguration', () async { - final customDefaultRealmPath = path.join((await Directory.systemTemp.createTemp()).path, Configuration.defaultRealmName); + final customDefaultRealmPath = path.join(await platformUtil.createTempPath(), Configuration.defaultRealmName); Configuration.defaultRealmPath = customDefaultRealmPath; final config = Configuration.local([Car.schema]); expect(path.dirname(config.path), path.dirname(customDefaultRealmPath)); @@ -53,7 +53,7 @@ void main() { expect(path.dirname(realm.config.path), path.dirname(customDefaultRealmPath)); //set a new defaultRealmPath - final customDefaultRealmPath1 = path.join((await Directory.systemTemp.createTemp()).path, Configuration.defaultRealmName); + final customDefaultRealmPath1 = path.join(await platformUtil.createTempPath(), Configuration.defaultRealmName); Configuration.defaultRealmPath = customDefaultRealmPath1; final config1 = Configuration.local([Car.schema]); final realm1 = getRealm(config1); @@ -81,7 +81,7 @@ void main() { }); baasTest('Configuration defaultRealmPath can be set for FlexibleSyncConfiguration', (_) async { - var customDefaultRealmPath = path.join((await Directory.systemTemp.createTemp()).path, Configuration.defaultRealmName); + var customDefaultRealmPath = path.join(await platformUtil.createTempPath(), Configuration.defaultRealmName); Configuration.defaultRealmPath = customDefaultRealmPath; final appClientId = baasHelper!.getClientAppId(appName: AppName.flexible); @@ -99,7 +99,7 @@ void main() { expect(path.dirname(realm.config.path), startsWith(path.dirname(customDefaultRealmPath))); //set a new defaultRealmPath - customDefaultRealmPath = path.join((await Directory.systemTemp.createTemp()).path, Configuration.defaultRealmName); + customDefaultRealmPath = path.join(await platformUtil.createTempPath(), Configuration.defaultRealmName); Configuration.defaultRealmPath = customDefaultRealmPath; appConfig = AppConfiguration(appClientId, baseUrl: Uri.parse(baasUrl)); @@ -163,7 +163,7 @@ void main() { var realm = getRealm(config); realm.write(() => realm.add(Car('Tesla'))); realm.close(); - expect(File(config.path).existsSync(), false); + expect(Realm.existsSync(config.path), false); }); test('Configuration inMemory can not be readOnly', () { @@ -442,15 +442,15 @@ void main() { } } - for (var shouldCompact in [true, false]) { - test('Configuration.shouldCompact when return $shouldCompact triggers compaction', () { + for (var shouldCompact in [true, false]) { + test('Configuration.shouldCompact when return $shouldCompact triggers compaction', () async { var config = Configuration.local([Person.schema]); final populateRealm = Realm(config); addDummyData(populateRealm); populateRealm.close(); - final oldSize = File(config.path).lengthSync(); + final oldSize = await platformUtil.sizeOnStorage(config); var projectedNewSize = 0; config = Configuration.local([Person.schema], shouldCompactCallback: (totalSize, usedSize) { @@ -459,7 +459,7 @@ void main() { }); final compactedRealm = getRealm(config); - final newSize = File(config.path).lengthSync(); + final newSize = await platformUtil.sizeOnStorage(config); if (shouldCompact) { expect(newSize, lessThan(oldSize)); @@ -522,8 +522,8 @@ void main() { final app = App(appConfig); final user = await app.logIn(Credentials.emailPassword(testUsername, testPassword)); - final dir = await Directory.systemTemp.createTemp(); - final realmPath = path.join(dir.path, 'test.realm'); + final temporaryPath = await platformUtil.createTempPath(); + final realmPath = path.join(temporaryPath, 'test.realm'); final flexibleSyncConfig = Configuration.flexibleSync(user, getSyncSchema(), path: realmPath); final realm = getRealm(flexibleSyncConfig); diff --git a/packages/realm_dart/test/realm_map_test.dart b/packages/realm_dart/test/realm_map_test.dart index 032cc18de..040a4ba3f 100644 --- a/packages/realm_dart/test/realm_map_test.dart +++ b/packages/realm_dart/test/realm_map_test.dart @@ -2,12 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:async'; -import 'dart:io'; import 'dart:typed_data'; import 'package:collection/collection.dart'; import 'package:meta/meta.dart'; -import 'package:test/test.dart' hide test, throws; import 'package:realm_dart/realm.dart'; import 'test.dart'; diff --git a/packages/realm_dart/test/realm_test.dart b/packages/realm_dart/test/realm_test.dart index 9b0e01201..f6ff1cbab 100644 --- a/packages/realm_dart/test/realm_test.dart +++ b/packages/realm_dart/test/realm_test.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:io'; import 'dart:isolate'; import 'package:path/path.dart' as p; @@ -13,6 +12,7 @@ import 'package:timezone/data/latest.dart' as tz; import 'package:timezone/timezone.dart' as tz; import 'test.dart'; +import 'utils/platform_util.dart'; void main() { setupTests(); @@ -108,8 +108,7 @@ void main() { realm.close(); Realm.deleteRealm(config.path); - expect(File(config.path).existsSync(), false); - expect(Directory("${config.path}.management").existsSync(), false); + expect(Realm.existsSync(config.path), false); }); test('Realm deleteRealm throws exception on an open realm', () { @@ -118,8 +117,7 @@ void main() { expect(() => Realm.deleteRealm(config.path), throws()); - expect(File(config.path).existsSync(), true); - expect(Directory("${config.path}.management").existsSync(), true); + expect(Realm.existsSync(config.path), true); }); test('Realm add object', () { @@ -931,21 +929,21 @@ void main() { }); }); - test('Realm - encryption works', () { + test('Realm - encryption works', () async { var config = Configuration.local([Friend.schema], path: p.join(Configuration.defaultStoragePath, "${generateRandomString(8)}.realm")); var realm = getRealm(config); - readFile(String path) { - final bytes = File(path).readAsBytesSync(); + readFile(String path) async { + final bytes = await platformUtil.raw(path); return utf8.decode(bytes, allowMalformed: true); } - var decoded = readFile(realm.config.path); + var decoded = await readFile(realm.config.path); expect(decoded, contains("bestFriend")); config = Configuration.local([Friend.schema], encryptionKey: generateEncryptionKey(), path: p.join(Configuration.defaultStoragePath, "${generateRandomString(8)}.realm")); realm = getRealm(config); - decoded = readFile(realm.config.path); + decoded = await readFile(realm.config.path); expect(decoded, isNot(contains("bestFriend"))); }); @@ -1429,15 +1427,15 @@ void main() { await realm.syncSession.waitForUpload(); } - final beforeSize = await File(config.path).stat().then((value) => value.size); + final beforeSize = platformUtil.sizeOnStorage(config); realm.close(); return beforeSize; } - void validateCompact(bool compacted, String realmPath, int beforeCompactSizeSize) async { + void validateCompact(bool compacted, Configuration config, int beforeCompactSizeSize) async { expect(compacted, true); - final afterCompactSize = await File(realmPath).stat().then((value) => value.size); + final afterCompactSize = await platformUtil.sizeOnStorage(config); expect(beforeCompactSizeSize, greaterThan(afterCompactSize)); } @@ -1445,9 +1443,9 @@ void main() { var config = Configuration.local([Product.schema], path: p.join(Configuration.defaultStoragePath, "${generateRandomString(8)}.realm")); final beforeCompactSizeSize = await createRealmForCompact(config); - final compacted = await Realm.compact(config); + final compacted = Realm.compact(config); - validateCompact(compacted, config.path, beforeCompactSizeSize); + validateCompact(compacted, config, beforeCompactSizeSize); //test the realm can be opened. final realm = getRealm(config); @@ -1474,7 +1472,7 @@ void main() { final compacted = await receivePort.first as bool; - validateCompact(compacted, config.path, beforeCompactSizeSize); + validateCompact(compacted, config, beforeCompactSizeSize); //test the realm can be opened. final realm = getRealm(config); @@ -1486,9 +1484,9 @@ void main() { final beforeCompactSizeSize = await createRealmForCompact(config); - final compacted = await Realm.compact(config); + final compacted = Realm.compact(config); - validateCompact(compacted, config.path, beforeCompactSizeSize); + validateCompact(compacted, config, beforeCompactSizeSize); //test the realm can be opened. final realm = getRealm(config); @@ -1516,9 +1514,9 @@ void main() { final beforeCompactSize = await createRealmForCompact(config); - final compacted = await Realm.compact(config); + final compacted = Realm.compact(config); - validateCompact(compacted, config.path, beforeCompactSize); + validateCompact(compacted, config, beforeCompactSize); // test the realm can be opened. expect(() => getRealm(config), returnsNormally); @@ -1531,7 +1529,7 @@ void main() { final beforeCompactSize = await createRealmForCompact(config); final compacted = await runWithRetries(() => Realm.compact(config)); - validateCompact(compacted, config.path, beforeCompactSize); + validateCompact(compacted, config, beforeCompactSize); // test the realm can be opened. expect(() => getRealm(config), returnsNormally); @@ -1547,7 +1545,7 @@ void main() { final beforeCompactSize = await createRealmForCompact(config); final compacted = await runWithRetries(() => Realm.compact(config)); - validateCompact(compacted, config.path, beforeCompactSize); + validateCompact(compacted, config, beforeCompactSize); // test the realm can be opened. expect(() => getRealm(config), returnsNormally); @@ -1619,7 +1617,7 @@ void main() { originalRealm.writeCopy(configCopy); originalRealm.close(); - expect(File(pathCopy).existsSync(), isTrue); + expect(Realm.existsSync(pathCopy), isTrue); final copiedRealm = getRealm(configCopy); expect(copiedRealm.all().length, itemsCount); copiedRealm.close(); @@ -1674,7 +1672,7 @@ void main() { originalRealm.writeCopy(configCopy); originalRealm.close(); - expect(File(pathCopy).existsSync(), isTrue); + expect(Realm.existsSync(pathCopy), isTrue); final copiedRealm = getRealm(configCopy); expect(copiedRealm.all().length, itemsCount); copiedRealm.close(); @@ -1704,7 +1702,7 @@ void main() { originalRealm.writeCopy(configCopy); originalRealm.close(); - expect(File(configCopy.path).existsSync(), isTrue); + expect(Realm.existsSync(configCopy.path), isTrue); // Check data in copied realm before synchronization final disconnectedConfig = Configuration.disconnectedSync([Product.schema], path: configCopy.path, encryptionKey: destinationEncryptedKey); final disconnectedCopiedRealm = getRealm(disconnectedConfig); @@ -1752,7 +1750,7 @@ void main() { originalRealm.writeCopy(configCopy); originalRealm.close(); - expect(File(pathCopy).existsSync(), isTrue); + expect(Realm.existsSync(pathCopy), isTrue); final copiedRealm = getRealm(configCopy); expect(copiedRealm.all().length, itemsCount); copiedRealm.close(); @@ -1966,8 +1964,8 @@ void openEncryptedRealm(List? encryptionKey, List? decryptionKey, {voi afterEncrypt(realm); } if (encryptionKey == decryptionKey) { - final decriptedRealm = getRealm(config2); - expect(decriptedRealm.isClosed, false); + final decryptedRealm = getRealm(config2); + expect(decryptedRealm.isClosed, false); } else { expect( () => getRealm(config2), diff --git a/packages/realm_dart/test/subscription_test.dart b/packages/realm_dart/test/subscription_test.dart index bd7802164..a24c05ade 100644 --- a/packages/realm_dart/test/subscription_test.dart +++ b/packages/realm_dart/test/subscription_test.dart @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:async'; -import 'dart:io'; import 'dart:math'; import 'dart:typed_data'; @@ -11,6 +10,7 @@ import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:realm_dart/src/subscription.dart'; import 'test.dart'; +import 'utils/platform_util.dart'; void main() { setupTests(); @@ -469,11 +469,11 @@ void main() { final appX = App(appConfigurationX); realmCore.clearCachedApps(); - final temporaryDir = await Directory.systemTemp.createTemp('realm_test_flexible_sync_roundtrip_'); + final temporaryPath = await platformUtil.createTempPath(); final appConfigurationY = AppConfiguration( appConfigurationX.appId, baseUrl: appConfigurationX.baseUrl, - baseFilePath: temporaryDir.path, + baseFilePath: temporaryPath, ); final appY = App(appConfigurationY); diff --git a/packages/realm_dart/test/test.dart b/packages/realm_dart/test/test.dart index 52d9167a4..43dc88d93 100644 --- a/packages/realm_dart/test/test.dart +++ b/packages/realm_dart/test/test.dart @@ -3,8 +3,6 @@ import 'dart:async'; import 'dart:collection'; -import 'dart:ffi'; -import 'dart:io'; import 'dart:math'; import 'dart:typed_data'; @@ -16,8 +14,10 @@ import 'package:realm_dart/src/handles/realm_core.dart'; import 'package:realm_dart/src/logging.dart'; import 'package:realm_dart/src/realm_object.dart'; import 'package:test/test.dart'; +import 'package:universal_platform/universal_platform.dart'; import 'baas_helper.dart'; +import 'utils/platform_util.dart'; export 'package:test/test.dart'; @@ -25,6 +25,8 @@ export 'baas_helper.dart' show AppName; part 'test.realm.dart'; +typedef Platform = UniversalPlatform; + @RealmModel() class _Car { @PrimaryKey() @@ -436,7 +438,7 @@ void setupTests() { } // Enable this to print platform info, including current PID - _printPlatformInfo(); + platformUtil.printPlatformInfo(); }); setUp(() { @@ -465,7 +467,7 @@ void setupTests() { Matcher throws([String? message]) => throwsA(isA().having((dynamic exception) => exception.message, 'message', contains(message ?? ''))); String generateRandomRealmPath() { - final path = _path.join(Directory.systemTemp.createTempSync("realm_test_").path, "${generateRandomString(10)}.realm"); + final path = _path.join(platformUtil.createTempPathSync(), "${generateRandomString(10)}.realm"); return path; } @@ -550,10 +552,9 @@ dynamic freezeDynamic(dynamic object) { return frozen; } -final dummy = File(""); Future tryDeleteRealm(String path) async { //Skip on CI to speed it up. We are creating the realms in $TEMP anyways. - if (Platform.environment.containsKey("REALM_CI")) { + if (platformUtil.environment.containsKey("REALM_CI")) { return; } @@ -561,10 +562,6 @@ Future tryDeleteRealm(String path) async { for (var i = 0; i < 5; i++) { try { Realm.deleteRealm(path); - - //delete lock file - await File('$path.lock').delete().onError((error, stackTrace) => dummy); - return; } catch (e) { Realm.logger.log(LogLevel.info, 'Failed to delete realm at path $path. Trying again in ${duration.inMilliseconds}ms'); @@ -708,23 +705,6 @@ extension DateTimeTest on DateTime { void clearCachedApps() => realmCore.clearCachedApps(); -void _printPlatformInfo() { - final pointerSize = sizeOf() * 8; - final os = Platform.operatingSystem; - String? cpu; - - if (!isFlutterPlatform) { - if (Platform.isWindows) { - cpu = Platform.environment['PROCESSOR_ARCHITECTURE']; - } else { - final info = Process.runSync('uname', ['-m']); - cpu = info.stdout.toString().replaceAll('\n', ''); - } - } - - print('Current PID $pid; OS $os, $pointerSize bit, CPU ${cpu ?? 'unknown'}'); -} - extension StreamEx on Stream> { Stream switchLatest() async* { StreamSubscription? inner; @@ -781,8 +761,4 @@ Future runWithRetries(FutureOr Function() tester, {int retryDelay = return success; } -Future _copyFile(String fromPath, String toPath) async { - await File(fromPath).copy(toPath); -} - -var copyFile = _copyFile; // default, but allow integration_test to override +var copyFile = platformUtil.copy; // default, but allow integration_test to override diff --git a/packages/realm_dart/test/utils/native/platform_util.dart b/packages/realm_dart/test/utils/native/platform_util.dart new file mode 100644 index 000000000..bc0f2fb76 --- /dev/null +++ b/packages/realm_dart/test/utils/native/platform_util.dart @@ -0,0 +1,50 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:realm_dart/realm.dart'; + +import '../platform_util.dart' as intf; + +class PlatformUtil implements intf.PlatformUtil { + const PlatformUtil(); + + @override + String get systemTempPath => Directory.systemTemp.path; + @override + Future createTempPath([String? prefix]) => Directory.systemTemp.createTemp(prefix).then((d) => d.path); + @override + String createTempPathSync([String? prefix]) => Directory.systemTemp.createTempSync(prefix).path; + @override + Future sizeOnStorage(Configuration config) => File(config.path).stat().then((fs) => fs.size); + + @override + void printPlatformInfo() { + final os = Platform.operatingSystem; + String? cpu; + + if (!isFlutterPlatform) { + if (Platform.isWindows) { + cpu = Platform.environment['PROCESSOR_ARCHITECTURE']; + } else { + final info = Process.runSync('uname', ['-m']); + cpu = info.stdout.toString().replaceAll('\n', ''); + } + } + + print('Current PID $pid; OS $os, CPU ${cpu ?? 'unknown'}'); + } + + @override + Future copy(String fromPath, String toPath) async { + await File(fromPath).copy(toPath); + } + + @override + Future raw(String path) => File(path).readAsBytes(); + + @override + Map get environment => Platform.environment; +} diff --git a/packages/realm_dart/test/utils/platform_util.dart b/packages/realm_dart/test/utils/platform_util.dart new file mode 100644 index 000000000..ab1085749 --- /dev/null +++ b/packages/realm_dart/test/utils/platform_util.dart @@ -0,0 +1,26 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'dart:typed_data'; + +import 'package:realm_dart/realm.dart'; + +import 'native/platform_util.dart' if (dart.library.js_interop) 'web/platform_util.dart' as impl; + +abstract interface class PlatformUtil { + const factory PlatformUtil() = impl.PlatformUtil; + + String get systemTempPath; + Future createTempPath(); + String createTempPathSync(); + Future sizeOnStorage(Configuration config); + + void printPlatformInfo(); + + Future copy(String fromPath, String toPath); + Future raw(String path); + + Map get environment; +} + +const platformUtil = PlatformUtil(); diff --git a/packages/realm_dart/test/utils/web/platform_util.dart b/packages/realm_dart/test/utils/web/platform_util.dart new file mode 100644 index 000000000..d414ae5e4 --- /dev/null +++ b/packages/realm_dart/test/utils/web/platform_util.dart @@ -0,0 +1,11 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../platform_util.dart' as intf; + +class PlatformUtil implements intf.PlatformUtil { + const PlatformUtil(); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} From 967fc1beee8f6a54f390697cfef0a97bf97bba81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 10:29:58 +0200 Subject: [PATCH 09/17] Avoid dart:ffi dep on Scheduler --- .../lib/src/handles/native/realm_core.dart | 5 +++-- .../lib/src/handles/native/scheduler_handle.dart | 12 ++++++------ .../realm_dart/lib/src/handles/scheduler_handle.dart | 4 +++- .../lib/src/handles/web/scheduler_handle.dart | 4 +++- packages/realm_dart/lib/src/scheduler.dart | 5 +---- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/realm_dart/lib/src/handles/native/realm_core.dart b/packages/realm_dart/lib/src/handles/native/realm_core.dart index 923448319..9d0ecb3d4 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_core.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_core.dart @@ -16,6 +16,7 @@ import 'convert_native.dart'; import 'error_handling.dart'; import 'ffi.dart'; import 'realm_library.dart'; +import 'scheduler_handle.dart'; final realmCore = RealmCore._(); @@ -159,9 +160,9 @@ class RealmCore { return realmLib.realm_get_library_cpu_arch().cast().toDartString(); } - void loggerAttach() => realmLib.realm_dart_attach_logger(scheduler.nativePort); + void loggerAttach() => realmLib.realm_dart_attach_logger(schedulerHandle.sendPort.nativePort); - void loggerDetach() => realmLib.realm_dart_detach_logger(scheduler.nativePort); + void loggerDetach() => realmLib.realm_dart_detach_logger(schedulerHandle.sendPort.nativePort); void logMessage(LogCategory category, LogLevel logLevel, String message) { return using((arena) { diff --git a/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart index c408943bc..de01a2d0a 100644 --- a/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/scheduler_handle.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:ffi'; +import 'dart:isolate'; import '../../scheduler.dart'; import 'handle_base.dart'; @@ -11,11 +12,12 @@ import 'realm_library.dart'; import '../scheduler_handle.dart' as intf; class SchedulerHandle extends HandleBase implements intf.SchedulerHandle { - SchedulerHandle._(Pointer pointer) : super(pointer, 24); + final SendPort sendPort; + SchedulerHandle._(this.sendPort, Pointer pointer) : super(pointer, 24); - factory SchedulerHandle(int isolateId, int sendPort) { - final schedulerPtr = realmLib.realm_dart_create_scheduler(isolateId, sendPort); - return SchedulerHandle._(schedulerPtr); + factory SchedulerHandle(int isolateId, SendPort sendPort) { + final schedulerPtr = realmLib.realm_dart_create_scheduler(isolateId, sendPort.nativePort); + return SchedulerHandle._(sendPort, schedulerPtr); } @override @@ -26,5 +28,3 @@ class SchedulerHandle extends HandleBase implements intf.Schedu } final schedulerHandle = scheduler.handle as SchedulerHandle; - - diff --git a/packages/realm_dart/lib/src/handles/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/scheduler_handle.dart index 3a3682a7c..4bc340cf2 100644 --- a/packages/realm_dart/lib/src/handles/scheduler_handle.dart +++ b/packages/realm_dart/lib/src/handles/scheduler_handle.dart @@ -1,12 +1,14 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 +import 'dart:isolate'; + import 'handle_base.dart'; import 'native/scheduler_handle.dart' if (dart.library.js_interop) 'web/scheduler_handle.dart' as impl; abstract interface class SchedulerHandle extends HandleBase { - factory SchedulerHandle(int isolateId, int sendPort) = impl.SchedulerHandle; + factory SchedulerHandle(int isolateId, SendPort port) = impl.SchedulerHandle; void invoke(int workQueue); } diff --git a/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart index 3556a0ca8..e5f14a757 100644 --- a/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart @@ -1,10 +1,12 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 +import 'dart:isolate'; + import '../scheduler_handle.dart' as intf; class SchedulerHandle implements intf.SchedulerHandle { - factory SchedulerHandle(int isolateId, int sendPort) => throw UnsupportedError('web not supported'); + factory SchedulerHandle(int isolateId, SendPort sendPort) => throw UnsupportedError('web not supported'); @override noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); diff --git a/packages/realm_dart/lib/src/scheduler.dart b/packages/realm_dart/lib/src/scheduler.dart index aa839df04..f42240b8f 100644 --- a/packages/realm_dart/lib/src/scheduler.dart +++ b/packages/realm_dart/lib/src/scheduler.dart @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import 'dart:async'; -import 'dart:ffi'; import 'dart:isolate'; import 'package:realm_dart/src/logging.dart'; @@ -17,8 +16,6 @@ class Scheduler { late final SchedulerHandle handle; final RawReceivePort _receivePort = RawReceivePort(); - int get nativePort => _receivePort.sendPort.nativePort; - Scheduler._() { _receivePortFinalizer.attach(this, _receivePort, detach: this); // There be dragons here!!! @@ -34,7 +31,7 @@ class Scheduler { // these. _receivePort.handler = Zone.current.bindUnaryCallbackGuarded(_handle); final sendPort = _receivePort.sendPort; - handle = SchedulerHandle(Isolate.current.hashCode, sendPort.nativePort); + handle = SchedulerHandle(Isolate.current.hashCode, sendPort); } void _handle(dynamic message) { From 6105f28428405cad64d969d067b0f36c4064c03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 11:01:01 +0200 Subject: [PATCH 10/17] Split decimal128.dart for web and native --- .../lib/src/handles/decimal128.dart | 78 ++++++++++++++++++- .../lib/src/handles/native/decimal128.dart | 36 ++++++--- .../lib/src/handles/native/to_native.dart | 3 +- .../handles/web/async_open_task_handle.dart | 4 + .../lib/src/handles/web/decimal128.dart | 38 +++++++++ .../lib/src/handles/web/realm_handle.dart | 4 + 6 files changed, 148 insertions(+), 15 deletions(-) create mode 100644 packages/realm_dart/lib/src/handles/web/decimal128.dart diff --git a/packages/realm_dart/lib/src/handles/decimal128.dart b/packages/realm_dart/lib/src/handles/decimal128.dart index 134d18ff5..095096313 100644 --- a/packages/realm_dart/lib/src/handles/decimal128.dart +++ b/packages/realm_dart/lib/src/handles/decimal128.dart @@ -1,5 +1,79 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/decimal128.dart' - if (dart.library.js) 'web/decimal128.dart'; +import 'package:realm_common/realm_common.dart' as common; + +import 'native/decimal128.dart' + if (dart.library.js_interop) 'web/decimal128.dart' as impl; + +abstract interface class Decimal128 implements Comparable, common.Decimal128 { + /// The value 0. + static Decimal128 get zero => impl.Decimal128.zero; + + /// The value 1. + static Decimal128 get one => impl.Decimal128.one; + + /// The value 10. + static Decimal128 get ten => impl.Decimal128.ten; + + /// The value NaN. + static Decimal128 get nan => impl.Decimal128.nan; + + /// The value +Inf. + static Decimal128 get infinity => impl.Decimal128.infinity; + + /// The value -Inf. + static Decimal128 get negativeInfinity => impl.Decimal128.negativeInfinity; + + /// Parses a string into a [Decimal128]. Returns `null` if the string is not a valid [Decimal128]. + static Decimal128? tryParse(String source) => impl.Decimal128.tryParse(source); + + /// Parses a string into a [Decimal128]. Throws a [FormatException] if the string is not a valid [Decimal128]. + factory Decimal128.parse(String source) = impl.Decimal128.parse; + + /// Converts a `int` into a [Decimal128]. + factory Decimal128.fromInt(int value) = impl.Decimal128.fromInt; + + /// Converts a `double` into a [Decimal128]. + factory Decimal128.fromDouble(double value) = impl.Decimal128.fromDouble; + + /// Returns `true` if `this` is NaN. + bool get isNaN; + + /// Adds `this` with `other` and returns a new [Decimal128]. + Decimal128 operator +(Decimal128 other); + + /// Subtracts `other` from `this` and returns a new [Decimal128]. + Decimal128 operator -(Decimal128 other); + + /// Multiplies `this` with `other` and returns a new [Decimal128]. + Decimal128 operator *(Decimal128 other); + + /// Divides `this` by `other` and returns a new [Decimal128]. + Decimal128 operator /(Decimal128 other); + + /// Negates `this` and returns a new [Decimal128]. + Decimal128 operator -(); + + /// Returns the absolute value of `this`. + Decimal128 abs(); + + /// Returns `true` if `this` is less than `other`. + bool operator <(Decimal128 other); + + /// Returns `true` if `this` is less than or equal to `other`. + bool operator <=(Decimal128 other); + + /// Returns `true` if `this` is greater than `other`. + bool operator >(Decimal128 other); + + /// Returns `true` if `this` is greater than or equal to `other`. + bool operator >=(Decimal128 other); + + /// Converts `this` to an `int`. Possibly loosing precision. + int toInt(); + + /// Compares `this` to `other`. + @override + int compareTo(Decimal128 other); +} diff --git a/packages/realm_dart/lib/src/handles/native/decimal128.dart b/packages/realm_dart/lib/src/handles/native/decimal128.dart index ad4df4acd..8c9a15aee 100644 --- a/packages/realm_dart/lib/src/handles/native/decimal128.dart +++ b/packages/realm_dart/lib/src/handles/native/decimal128.dart @@ -5,14 +5,14 @@ import 'dart:convert'; import 'dart:ffi'; import 'ffi.dart'; -import 'package:realm_common/realm_common.dart' as common; - import 'realm_bindings.dart'; import 'realm_library.dart'; import 'to_native.dart'; +import '../decimal128.dart' as intf; + /// A 128-bit decimal floating point number. -class Decimal128 implements Comparable, common.Decimal128 { +class Decimal128 implements intf.Decimal128 { /// The value 0. static final zero = Decimal128.fromInt(0); @@ -62,32 +62,39 @@ class Decimal128 implements Comparable, common.Decimal128 { } /// Returns `true` if `this` is NaN. + @override bool get isNaN => realmLib.realm_dart_decimal128_is_nan(_value); /// Adds `this` with `other` and returns a new [Decimal128]. - Decimal128 operator +(Decimal128 other) { + @override + Decimal128 operator +(covariant Decimal128 other) { return Decimal128._(realmLib.realm_dart_decimal128_add(_value, other._value)); } /// Subtracts `other` from `this` and returns a new [Decimal128]. - Decimal128 operator -(Decimal128 other) { + @override + Decimal128 operator -(covariant Decimal128 other) { return Decimal128._(realmLib.realm_dart_decimal128_subtract(_value, other._value)); } /// Multiplies `this` with `other` and returns a new [Decimal128]. - Decimal128 operator *(Decimal128 other) { + @override + Decimal128 operator *(covariant Decimal128 other) { return Decimal128._(realmLib.realm_dart_decimal128_multiply(_value, other._value)); } /// Divides `this` by `other` and returns a new [Decimal128]. - Decimal128 operator /(Decimal128 other) { + @override + Decimal128 operator /(covariant Decimal128 other) { return Decimal128._(realmLib.realm_dart_decimal128_divide(_value, other._value)); } /// Negates `this` and returns a new [Decimal128]. + @override Decimal128 operator -() => Decimal128._(realmLib.realm_dart_decimal128_negate(_value)); /// Returns the absolute value of `this`. + @override Decimal128 abs() => this < zero ? -this : this; /// Returns `true` if `this` and `other` are equal. @@ -103,22 +110,27 @@ class Decimal128 implements Comparable, common.Decimal128 { } /// Returns `true` if `this` is less than `other`. - bool operator <(Decimal128 other) { + @override + bool operator <(covariant Decimal128 other) { return realmLib.realm_dart_decimal128_less_than(_value, other._value); } /// Returns `true` if `this` is less than or equal to `other`. - bool operator <=(Decimal128 other) => compareTo(other) <= 0; + @override + bool operator <=(covariant Decimal128 other) => compareTo(other) <= 0; /// Returns `true` if `this` is greater than `other`. - bool operator >(Decimal128 other) { + @override + bool operator >(covariant Decimal128 other) { return realmLib.realm_dart_decimal128_greater_than(_value, other._value); } /// Returns `true` if `this` is greater than or equal to `other`. - bool operator >=(Decimal128 other) => compareTo(other) >= 0; + @override + bool operator >=(covariant Decimal128 other) => compareTo(other) >= 0; /// Converts `this` to an `int`. Possibly loosing precision. + @override int toInt() => realmLib.realm_dart_decimal128_to_int64(_value); /// String representation of `this`. @@ -132,7 +144,7 @@ class Decimal128 implements Comparable, common.Decimal128 { /// Compares `this` to `other`. @override - int compareTo(Decimal128 other) => realmLib.realm_dart_decimal128_compare_to(_value, other._value); + int compareTo(covariant Decimal128 other) => realmLib.realm_dart_decimal128_compare_to(_value, other._value); } extension Decimal128Internal on Decimal128 { diff --git a/packages/realm_dart/lib/src/handles/native/to_native.dart b/packages/realm_dart/lib/src/handles/native/to_native.dart index b18b945a9..476a5fbe5 100644 --- a/packages/realm_dart/lib/src/handles/native/to_native.dart +++ b/packages/realm_dart/lib/src/handles/native/to_native.dart @@ -2,7 +2,8 @@ import 'dart:convert'; import 'dart:ffi'; import 'dart:typed_data'; -import '../../realm_dart.dart'; +import 'package:realm_common/realm_common.dart' hide Decimal128; + import '../../realm_object.dart'; import 'decimal128.dart'; import 'realm_bindings.dart'; diff --git a/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart index 12225d979..3a73eedb6 100644 --- a/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart @@ -1,9 +1,13 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 +import 'package:realm_dart/realm.dart'; + import '../async_open_task_handle.dart' as intf; class AsyncOpenTaskHandle implements intf.AsyncOpenTaskHandle { + factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) => throw UnsupportedError('web not supported'); + @override noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); } diff --git a/packages/realm_dart/lib/src/handles/web/decimal128.dart b/packages/realm_dart/lib/src/handles/web/decimal128.dart new file mode 100644 index 000000000..a85abbc63 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/decimal128.dart @@ -0,0 +1,38 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../decimal128.dart' as intf; + +class Decimal128 implements intf.Decimal128 { + static final zero = Decimal128.fromInt(0); + + /// The value 1. + static final one = Decimal128.fromInt(1); + + /// The value 10. + static final ten = Decimal128.fromInt(10); + + /// The value NaN. + static get nan => throw UnimplementedError('web not supported'); + + /// The value +Inf. + static final infinity = one / zero; // +Inf + + /// The value -Inf. + static final negativeInfinity = -infinity; + + /// Parses a string into a [Decimal128]. Returns `null` if the string is not a valid [Decimal128]. + static Decimal128? tryParse(String source) => throw UnimplementedError('web not supported'); + + /// Parses a string into a [Decimal128]. Throws a [FormatException] if the string is not a valid [Decimal128]. + factory Decimal128.parse(String source) => throw UnimplementedError('web not supported'); + + /// Converts a `int` into a [Decimal128]. + factory Decimal128.fromInt(int value) => throw UnimplementedError('web not supported'); + + /// Converts a `double` into a [Decimal128]. + factory Decimal128.fromDouble(double value) => throw UnimplementedError('web not supported'); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} diff --git a/packages/realm_dart/lib/src/handles/web/realm_handle.dart b/packages/realm_dart/lib/src/handles/web/realm_handle.dart index 9521293dd..abdc75fcb 100644 --- a/packages/realm_dart/lib/src/handles/web/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/realm_handle.dart @@ -1,9 +1,13 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 +import 'package:realm_dart/realm.dart'; + import '../realm_handle.dart' as intf; class RealmHandle implements intf.RealmHandle { + factory RealmHandle.open(Configuration config) => throw UnsupportedError('web not supported'); + @override noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); } From 2c56670f603825c31e03d8a05d4a827f886da2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 11:51:27 +0200 Subject: [PATCH 11/17] Split realm_core.dart for web and native --- .../lib/src/handles/native/app_handle.dart | 4 +-- .../lib/src/handles/native/realm_core.dart | 28 ++++++++++++---- .../lib/src/handles/realm_core.dart | 32 +++++++++++++++++-- .../lib/src/handles/web/realm_core.dart | 13 ++++++++ 4 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 packages/realm_dart/lib/src/handles/web/realm_core.dart diff --git a/packages/realm_dart/lib/src/handles/native/app_handle.dart b/packages/realm_dart/lib/src/handles/native/app_handle.dart index cf4c4c31d..010022eeb 100644 --- a/packages/realm_dart/lib/src/handles/native/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/app_handle.dart @@ -6,8 +6,8 @@ import 'dart:ffi'; import 'dart:io'; import 'dart:isolate'; -import 'init.dart'; -import '../../realm_class.dart'; +import 'package:realm_dart/realm.dart'; + import 'convert.dart'; import 'convert_native.dart'; import 'credentials_handle.dart'; diff --git a/packages/realm_dart/lib/src/handles/native/realm_core.dart b/packages/realm_dart/lib/src/handles/native/realm_core.dart index 9d0ecb3d4..e96c1ff15 100644 --- a/packages/realm_dart/lib/src/handles/native/realm_core.dart +++ b/packages/realm_dart/lib/src/handles/native/realm_core.dart @@ -8,17 +8,15 @@ import 'dart:io'; import 'package:crypto/crypto.dart'; import 'package:path/path.dart' as path; import 'package:pubspec_parse/pubspec_parse.dart'; +import 'package:realm_dart/realm.dart'; -import 'init.dart'; -import '../../realm_class.dart'; -import '../../scheduler.dart'; import 'convert_native.dart'; import 'error_handling.dart'; import 'ffi.dart'; import 'realm_library.dart'; import 'scheduler_handle.dart'; -final realmCore = RealmCore._(); +import '../realm_core.dart' as intf; final _pluginLib = () { if (!isFlutterPlatform) { @@ -41,12 +39,16 @@ final _pluginLib = () { return pluginLib; }(); -class RealmCore { - RealmCore._(); +const realmCore = RealmCore(); + +class RealmCore implements intf.RealmCore { + const RealmCore(); // For debugging + @override int get threadId => realmLib.realm_dart_get_thread_id(); + @override void clearCachedApps() { realmLib.realm_clear_cached_apps(); } @@ -56,6 +58,7 @@ class RealmCore { // realmLib.realm_dart_gc(); // } + @override void deleteRealmFiles(String path) { using((arena) { final realmDeleted = arena(); @@ -63,6 +66,7 @@ class RealmCore { }); } + @override List getAllCategoryNames() { return using((arena) { final count = realmLib.realm_get_category_names(0, nullptr); @@ -72,6 +76,7 @@ class RealmCore { }); } + @override String getAppDirectory() { try { if (!isFlutterPlatform || Platform.environment.containsKey('FLUTTER_TEST')) { @@ -103,6 +108,7 @@ class RealmCore { } } + @override String getBundleId() { readBundleId() { try { @@ -136,10 +142,12 @@ class RealmCore { return base64Encode(sha256.convert([...salt, ...utf8.encode(bundleId)]).bytes); } + @override String getDefaultBaseUrl() { return realmLib.realm_app_get_default_base_url().cast().toRealmDartString()!; } + @override String getDeviceName() { if (Platform.isAndroid || Platform.isIOS) { return realmLib.realm_dart_get_device_name().cast().toRealmDartString()!; @@ -148,6 +156,7 @@ class RealmCore { return ""; } + @override String getDeviceVersion() { if (Platform.isAndroid || Platform.isIOS) { return realmLib.realm_dart_get_device_version().cast().toRealmDartString()!; @@ -156,20 +165,25 @@ class RealmCore { return ""; } + @override String getRealmLibraryCpuArchitecture() { return realmLib.realm_get_library_cpu_arch().cast().toDartString(); } + @override void loggerAttach() => realmLib.realm_dart_attach_logger(schedulerHandle.sendPort.nativePort); + @override void loggerDetach() => realmLib.realm_dart_detach_logger(schedulerHandle.sendPort.nativePort); + @override void logMessage(LogCategory category, LogLevel logLevel, String message) { return using((arena) { realmLib.realm_dart_log(logLevel.index, category.toString().toCharPtr(arena), message.toCharPtr(arena)); }); } + @override void setLogLevel(LogLevel level, {required LogCategory category}) { using((arena) { realmLib.realm_set_log_level_category(category.toString().toCharPtr(arena), level.index); @@ -190,6 +204,7 @@ class RealmCore { return realmLib.realm_dart_get_files_path().cast().toRealmDartString()!; } + @override int setAndGetRLimit(int limit) { return using((arena) { final outLimit = arena(); @@ -198,6 +213,7 @@ class RealmCore { }); } + @override bool checkIfRealmExists(String path) { return File(path).existsSync(); // TODO: Should this not check that file is an actual realm file? } diff --git a/packages/realm_dart/lib/src/handles/realm_core.dart b/packages/realm_dart/lib/src/handles/realm_core.dart index efff736de..169db13c3 100644 --- a/packages/realm_dart/lib/src/handles/realm_core.dart +++ b/packages/realm_dart/lib/src/handles/realm_core.dart @@ -1,5 +1,33 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -export 'native/realm_core.dart' - if (dart.library.js_interop) 'web/realm_core.dart'; +import 'package:realm_dart/realm.dart'; + +import 'native/realm_core.dart' if (dart.library.js_interop) 'web/realm_core.dart' as impl; + +abstract interface class RealmCore { + int get threadId; + + void clearCachedApps(); + + String getAppDirectory(); + String getBundleId(); + String getDeviceName(); + String getDeviceVersion(); + String getRealmLibraryCpuArchitecture(); + + String getDefaultBaseUrl(); + + void loggerAttach(); + void loggerDetach(); + List getAllCategoryNames(); + void setLogLevel(LogLevel level, {required LogCategory category}); + void logMessage(LogCategory category, LogLevel logLevel, String message); + + int setAndGetRLimit(int limit); + + bool checkIfRealmExists(String path); + void deleteRealmFiles(String path); +} + +const realmCore = impl.RealmCore(); diff --git a/packages/realm_dart/lib/src/handles/web/realm_core.dart b/packages/realm_dart/lib/src/handles/web/realm_core.dart new file mode 100644 index 000000000..5b270a40d --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/realm_core.dart @@ -0,0 +1,13 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import '../realm_core.dart' as intf; + +const realmCore = RealmCore(); + +class RealmCore implements intf.RealmCore { + const RealmCore(); + + @override + noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +} From c6f73d6d53cb83bfea8406d9454fdcba61141db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 13:24:57 +0200 Subject: [PATCH 12/17] Move int literals with more than 53 bit into platform_util.dart --- packages/realm_dart/test/realm_map_test.dart | 8 ++++---- packages/realm_dart/test/test.dart | 4 ++-- packages/realm_dart/test/utils/native/platform_util.dart | 6 ++++++ packages/realm_dart/test/utils/platform_util.dart | 3 +++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/realm_dart/test/realm_map_test.dart b/packages/realm_dart/test/realm_map_test.dart index 040a4ba3f..9056e370a 100644 --- a/packages/realm_dart/test/realm_map_test.dart +++ b/packages/realm_dart/test/realm_map_test.dart @@ -261,8 +261,8 @@ List> intTestCases() => [ TestCaseData(123456789, initialValues: [('123', -123)]), TestCaseData(123456789, initialValues: [('a', 1), ('b', 1), ('c', 1)]), TestCaseData(123456789, initialValues: [('a', 1), ('b', 2), ('c', 3)]), - TestCaseData(123456789, initialValues: [('a', -0x8000000000000000), ('z', 0x7FFFFFFFFFFFFFFF)]), - TestCaseData(123456789, initialValues: [('a', -0x8000000000000000), ('zero', 0), ('one', 1), ('z', 0x7FFFFFFFFFFFFFFF)]), + TestCaseData(123456789, initialValues: [('a', minInt), ('z', maxInt)]), + TestCaseData(123456789, initialValues: [('a', minInt), ('zero', 0), ('one', 1), ('z', maxInt)]), ]; List> nullableIntTestCases() => [ @@ -272,8 +272,8 @@ List> nullableIntTestCases() => [ TestCaseData(1234, initialValues: [('null', null)]), TestCaseData(1234, initialValues: [('null1', null), ('null2', null), ('null3', null)]), TestCaseData(null, initialValues: [('a', 1), ('b', null), ('c', 3)]), - TestCaseData(1234, initialValues: [('a', -0x8000000000000000), ('m', null), ('z', 0x7FFFFFFFFFFFFFFF)]), - TestCaseData(1234, initialValues: [('a', -0x8000000000000000), ('zero', 0), ('null', null), ('one', 1), ('z', 0x7FFFFFFFFFFFFFFF)]), + TestCaseData(1234, initialValues: [('a', minInt), ('m', null), ('z', maxInt)]), + TestCaseData(1234, initialValues: [('a', minInt), ('zero', 0), ('null', null), ('one', 1), ('z', maxInt)]), ]; List> stringTestValues() => [ diff --git a/packages/realm_dart/test/test.dart b/packages/realm_dart/test/test.dart index 43dc88d93..ff0432f26 100644 --- a/packages/realm_dart/test/test.dart +++ b/packages/realm_dart/test/test.dart @@ -412,8 +412,8 @@ final _openRealms = Queue(); String testUsername = "realm-test@realm.io"; String testPassword = "123456"; -const int maxInt = 9223372036854775807; -const int minInt = -9223372036854775808; +final int maxInt = platformUtil.maxInt; +final int minInt = platformUtil.minInt; const int jsMaxInt = 9007199254740991; const int jsMinInt = -9007199254740991; diff --git a/packages/realm_dart/test/utils/native/platform_util.dart b/packages/realm_dart/test/utils/native/platform_util.dart index bc0f2fb76..393a057f4 100644 --- a/packages/realm_dart/test/utils/native/platform_util.dart +++ b/packages/realm_dart/test/utils/native/platform_util.dart @@ -47,4 +47,10 @@ class PlatformUtil implements intf.PlatformUtil { @override Map get environment => Platform.environment; + + @override + int get maxInt => 0x7FFFFFFFFFFFFFFF; + + @override + int get minInt => -0x8000000000000000; } diff --git a/packages/realm_dart/test/utils/platform_util.dart b/packages/realm_dart/test/utils/platform_util.dart index ab1085749..7e7e89884 100644 --- a/packages/realm_dart/test/utils/platform_util.dart +++ b/packages/realm_dart/test/utils/platform_util.dart @@ -21,6 +21,9 @@ abstract interface class PlatformUtil { Future raw(String path); Map get environment; + + int get maxInt; + int get minInt; } const platformUtil = PlatformUtil(); From 1941736dd0bdee91b0e2440b98fb3038f975fa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 13:26:10 +0200 Subject: [PATCH 13/17] Add compile for web CI job --- .github/workflows/ci.yml | 27 +++++++++++++ packages/realm/tests/web/favicon.png | Bin 0 -> 917 bytes packages/realm/tests/web/icons/Icon-192.png | Bin 0 -> 5292 bytes packages/realm/tests/web/icons/Icon-512.png | Bin 0 -> 8252 bytes .../tests/web/icons/Icon-maskable-192.png | Bin 0 -> 5594 bytes .../tests/web/icons/Icon-maskable-512.png | Bin 0 -> 20998 bytes packages/realm/tests/web/index.html | 38 ++++++++++++++++++ packages/realm/tests/web/manifest.json | 35 ++++++++++++++++ 8 files changed, 100 insertions(+) create mode 100644 packages/realm/tests/web/favicon.png create mode 100644 packages/realm/tests/web/icons/Icon-192.png create mode 100644 packages/realm/tests/web/icons/Icon-512.png create mode 100644 packages/realm/tests/web/icons/Icon-maskable-192.png create mode 100644 packages/realm/tests/web/icons/Icon-maskable-512.png create mode 100644 packages/realm/tests/web/index.html create mode 100644 packages/realm/tests/web/manifest.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4cf172d84..4058963b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -619,3 +619,30 @@ jobs: ** <{{refUrl}}|`{{ref}}` - {{description}}> {{#if description}}<{{diffUrl}}|branch: `{{diffRef}}`>{{/if}} + + web-compile: + name: Compile for web + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + + - name: Setup Melos + run: | + dart pub global activate melos + dart pub global run melos bootstrap + + - name: Compile to wasm + run: flutter build web --wasm -t integration_test/all_tests.dart + working-directory: packages/realm/tests/ + + - name: Compile to js + run: flutter build web -t integration_test/all_tests.dart + working-directory: packages/realm/tests/ diff --git a/packages/realm/tests/web/favicon.png b/packages/realm/tests/web/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..8aaa46ac1ae21512746f852a42ba87e4165dfdd1 GIT binary patch literal 917 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0X7 zltGxWVyS%@P(fs7NJL45ua8x7ey(0(N`6wRUPW#JP&EUCO@$SZnVVXYs8ErclUHn2 zVXFjIVFhG^g!Ppaz)DK8ZIvQ?0~DO|i&7O#^-S~(l1AfjnEK zjFOT9D}DX)@^Za$W4-*MbbUihOG|wNBYh(yU7!lx;>x^|#0uTKVr7USFmqf|i<65o z3raHc^AtelCMM;Vme?vOfh>Xph&xL%(-1c06+^uR^q@XSM&D4+Kp$>4P^%3{)XKjo zGZknv$b36P8?Z_gF{nK@`XI}Z90TzwSQO}0J1!f2c(B=V`5aP@1P1a|PZ!4!3&Gl8 zTYqUsf!gYFyJnXpu0!n&N*SYAX-%d(5gVjrHJWqXQshj@!Zm{!01WsQrH~9=kTxW#6SvuapgMqt>$=j#%eyGrQzr zP{L-3gsMA^$I1&gsBAEL+vxi1*Igl=8#8`5?A-T5=z-sk46WA1IUT)AIZHx1rdUrf zVJrJn<74DDw`j)Ki#gt}mIT-Q`XRa2-jQXQoI%w`nb|XblvzK${ZzlV)m-XcwC(od z71_OEC5Bt9GEXosOXaPTYOia#R4ID2TiU~`zVMl08TV_C%DnU4^+HE>9(CE4D6?Fz oujB08i7adh9xk7*FX66dWH6F5TM;?E2b5PlUHx3vIVCg!0Dx9vYXATM literal 0 HcmV?d00001 diff --git a/packages/realm/tests/web/icons/Icon-192.png b/packages/realm/tests/web/icons/Icon-192.png new file mode 100644 index 0000000000000000000000000000000000000000..b749bfef07473333cf1dd31e9eed89862a5d52aa GIT binary patch literal 5292 zcmZ`-2T+sGz6~)*FVZ`aW+(v>MIm&M-g^@e2u-B-DoB?qO+b1Tq<5uCCv>ESfRum& zp%X;f!~1{tzL__3=gjVJ=j=J>+nMj%ncXj1Q(b|Ckbw{Y0FWpt%4y%$uD=Z*c-x~o zE;IoE;xa#7Ll5nj-e4CuXB&G*IM~D21rCP$*xLXAK8rIMCSHuSu%bL&S3)8YI~vyp@KBu9Ph7R_pvKQ@xv>NQ`dZp(u{Z8K3yOB zn7-AR+d2JkW)KiGx0hosml;+eCXp6+w%@STjFY*CJ?udJ64&{BCbuebcuH;}(($@@ znNlgBA@ZXB)mcl9nbX#F!f_5Z=W>0kh|UVWnf!At4V*LQP%*gPdCXd6P@J4Td;!Ur z<2ZLmwr(NG`u#gDEMP19UcSzRTL@HsK+PnIXbVBT@oHm53DZr?~V(0{rsalAfwgo zEh=GviaqkF;}F_5-yA!1u3!gxaR&Mj)hLuj5Q-N-@Lra{%<4ONja8pycD90&>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nkHT9JU zRA`umgmP9d6=PHmFIgx=0$(sjb>+0CHG)K@cPG{IxaJ&Ueo8)0RWgV9+gO7+Bl1(F z7!BslJ2MP*PWJ;x)QXbR$6jEr5q3 z(3}F@YO_P1NyTdEXRLU6fp?9V2-S=E+YaeLL{Y)W%6`k7$(EW8EZSA*(+;e5@jgD^I zaJQ2|oCM1n!A&-8`;#RDcZyk*+RPkn_r8?Ak@agHiSp*qFNX)&i21HE?yuZ;-C<3C zwJGd1lx5UzViP7sZJ&|LqH*mryb}y|%AOw+v)yc`qM)03qyyrqhX?ub`Cjwx2PrR! z)_z>5*!*$x1=Qa-0uE7jy0z`>|Ni#X+uV|%_81F7)b+nf%iz=`fF4g5UfHS_?PHbr zB;0$bK@=di?f`dS(j{l3-tSCfp~zUuva+=EWxJcRfp(<$@vd(GigM&~vaYZ0c#BTs z3ijkxMl=vw5AS&DcXQ%eeKt!uKvh2l3W?&3=dBHU=Gz?O!40S&&~ei2vg**c$o;i89~6DVns zG>9a*`k5)NI9|?W!@9>rzJ;9EJ=YlJTx1r1BA?H`LWijk(rTax9(OAu;q4_wTj-yj z1%W4GW&K4T=uEGb+E!>W0SD_C0RR91 literal 0 HcmV?d00001 diff --git a/packages/realm/tests/web/icons/Icon-512.png b/packages/realm/tests/web/icons/Icon-512.png new file mode 100644 index 0000000000000000000000000000000000000000..88cfd48dff1169879ba46840804b412fe02fefd6 GIT binary patch literal 8252 zcmd5=2T+s!lYZ%-(h(2@5fr2dC?F^$C=i-}R6$UX8af(!je;W5yC_|HmujSgN*6?W z3knF*TL1$|?oD*=zPbBVex*RUIKsL<(&Rj9%^UD2IK3W?2j>D?eWQgvS-HLymHo9%~|N2Q{~j za?*X-{b9JRowv_*Mh|;*-kPFn>PI;r<#kFaxFqbn?aq|PduQg=2Q;~Qc}#z)_T%x9 zE|0!a70`58wjREmAH38H1)#gof)U3g9FZ^ zF7&-0^Hy{4XHWLoC*hOG(dg~2g6&?-wqcpf{ z&3=o8vw7lMi22jCG9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aUQ9j?ZCtvb^37U$sFpBrkT{7Jpd?HpIvj2!}RIq zH{9~+gErN2+}J`>Jvng2hwM`=PLNkc7pkjblKW|+Fk9rc)G1R>Ww>RC=r-|!m-u7( zc(a$9NG}w#PjWNMS~)o=i~WA&4L(YIW25@AL9+H9!?3Y}sv#MOdY{bb9j>p`{?O(P zIvb`n?_(gP2w3P#&91JX*md+bBEr%xUHMVqfB;(f?OPtMnAZ#rm5q5mh;a2f_si2_ z3oXWB?{NF(JtkAn6F(O{z@b76OIqMC$&oJ_&S|YbFJ*)3qVX_uNf5b8(!vGX19hsG z(OP>RmZp29KH9Ge2kKjKigUmOe^K_!UXP`von)PR8Qz$%=EmOB9xS(ZxE_tnyzo}7 z=6~$~9k0M~v}`w={AeqF?_)9q{m8K#6M{a&(;u;O41j)I$^T?lx5(zlebpY@NT&#N zR+1bB)-1-xj}R8uwqwf=iP1GbxBjneCC%UrSdSxK1vM^i9;bUkS#iRZw2H>rS<2<$ zNT3|sDH>{tXb=zq7XZi*K?#Zsa1h1{h5!Tq_YbKFm_*=A5-<~j63he;4`77!|LBlo zR^~tR3yxcU=gDFbshyF6>o0bdp$qmHS7D}m3;^QZq9kBBU|9$N-~oU?G5;jyFR7>z hN`IR97YZXIo@y!QgFWddJ3|0`sjFx!m))><{BI=FK%f8s literal 0 HcmV?d00001 diff --git a/packages/realm/tests/web/icons/Icon-maskable-192.png b/packages/realm/tests/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000000000000000000000000000000000000..eb9b4d76e525556d5d89141648c724331630325d GIT binary patch literal 5594 zcmdT|`#%%j|KDb2V@0DPm$^(Lx5}lO%Yv(=e*7hl@QqKS50#~#^IQPxBmuh|i9sXnt4ch@VT0F7% zMtrs@KWIOo+QV@lSs66A>2pz6-`9Jk=0vv&u?)^F@HZ)-6HT=B7LF;rdj zskUyBfbojcX#CS>WrIWo9D=DIwcXM8=I5D{SGf$~=gh-$LwY?*)cD%38%sCc?5OsX z-XfkyL-1`VavZ?>(pI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Q7u64;KmFJ#POzdG#np~F&H ze-BUh@g54)dsS%nkBb}+GuUEKU~pHcYIg4vSo$J(J|U36bs0Use+3A&IMcR%6@jv$ z=+QI+@wW@?iu}Hpyzlvj-EYeop{f65GX0O%>w#0t|V z1-svWk`hU~m`|O$kw5?Yn5UhI%9P-<45A(v0ld1n+%Ziq&TVpBcV9n}L9Tus-TI)f zd_(g+nYCDR@+wYNQm1GwxhUN4tGMLCzDzPqY$~`l<47{+l<{FZ$L6(>J)|}!bi<)| zE35dl{a2)&leQ@LlDxLQOfUDS`;+ZQ4ozrleQwaR-K|@9T{#hB5Z^t#8 zC-d_G;B4;F#8A2EBL58s$zF-=SCr`P#z zNCTnHF&|X@q>SkAoYu>&s9v@zCpv9lLSH-UZzfhJh`EZA{X#%nqw@@aW^vPcfQrlPs(qQxmC|4tp^&sHy!H!2FH5eC{M@g;ElWNzlb-+ zxpfc0m4<}L){4|RZ>KReag2j%Ot_UKkgpJN!7Y_y3;Ssz{9 z!K3isRtaFtQII5^6}cm9RZd5nTp9psk&u1C(BY`(_tolBwzV_@0F*m%3G%Y?2utyS zY`xM0iDRT)yTyYukFeGQ&W@ReM+ADG1xu@ruq&^GK35`+2r}b^V!m1(VgH|QhIPDE X>c!)3PgKfL&lX^$Z>Cpu&6)6jvi^Z! literal 0 HcmV?d00001 diff --git a/packages/realm/tests/web/icons/Icon-maskable-512.png b/packages/realm/tests/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000000000000000000000000000000000000..d69c56691fbdb0b7efa65097c7cc1edac12a6d3e GIT binary patch literal 20998 zcmeFZ_gj-)&^4Nb2tlbLMU<{!p(#yjqEe+=0IA_oih%ScH9@5#MNp&}Y#;;(h=A0@ zh7{>lT2MkSQ344eAvrhici!td|HJuyvJm#Y_w1Q9Yu3!26dNlO-oxUDK_C#XnW^Co z5C{VN6#{~B0)K2j7}*1Xq(Nqemv23A-6&=ZpEijkVnSwVGqLv40?n0=p;k3-U5e5+ z+z3>aS`u9DS=!wg8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&%t8MveBuK21uiYj)_a{Fnw0OErMzMN?d$QoPwkhOwcP&p+t>P)4tHlYw-pPN z^oJ=uc$Sl>pv@fZH~ZqxSvdhF@F1s=oZawpr^-#l{IIOGG=T%QXjtwPhIg-F@k@uIlr?J->Ia zpEUQ*=4g|XYn4Gez&aHr*;t$u3oODPmc2Ku)2Og|xjc%w;q!Zz+zY)*3{7V8bK4;& zYV82FZ+8?v)`J|G1w4I0fWdKg|2b#iaazCv;|?(W-q}$o&Y}Q5d@BRk^jL7#{kbCK zSgkyu;=DV+or2)AxCBgq-nj5=@n^`%T#V+xBGEkW4lCqrE)LMv#f;AvD__cQ@Eg3`~x| zW+h9mofSXCq5|M)9|ez(#X?-sxB%Go8};sJ?2abp(Y!lyi>k)|{M*Z$c{e1-K4ky` MPgg&ebxsLQ025IeI{*Lx literal 0 HcmV?d00001 diff --git a/packages/realm/tests/web/index.html b/packages/realm/tests/web/index.html new file mode 100644 index 000000000..4317b0bf5 --- /dev/null +++ b/packages/realm/tests/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + tests + + + + + + diff --git a/packages/realm/tests/web/manifest.json b/packages/realm/tests/web/manifest.json new file mode 100644 index 000000000..b314fa17c --- /dev/null +++ b/packages/realm/tests/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "tests", + "short_name": "tests", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} From 711c924e5782b30c177d9a040ba45d20e093cdf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 15:40:48 +0200 Subject: [PATCH 14/17] Split defaultClient --- packages/realm_dart/lib/src/app.dart | 57 +----------------- .../lib/src/handles/default_client.dart | 8 +++ .../src/handles/native/default_client.dart | 60 +++++++++++++++++++ .../lib/src/handles/web/default_client.dart | 7 +++ 4 files changed, 77 insertions(+), 55 deletions(-) create mode 100644 packages/realm_dart/lib/src/handles/default_client.dart create mode 100644 packages/realm_dart/lib/src/handles/native/default_client.dart create mode 100644 packages/realm_dart/lib/src/handles/web/default_client.dart diff --git a/packages/realm_dart/lib/src/app.dart b/packages/realm_dart/lib/src/app.dart index a87591d4b..91dc6c734 100644 --- a/packages/realm_dart/lib/src/app.dart +++ b/packages/realm_dart/lib/src/app.dart @@ -1,7 +1,6 @@ // Copyright 2022 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -import 'dart:convert'; import 'dart:isolate'; import 'package:http/http.dart'; @@ -11,63 +10,11 @@ import 'package:path/path.dart' as path; import '../realm.dart'; import 'credentials.dart'; import 'handles/app_handle.dart'; +import 'handles/default_client.dart'; import 'handles/realm_core.dart'; import 'logging.dart'; import 'user.dart'; -final _defaultClient = () { - const isrgRootX1CertPEM = // The root certificate used by lets encrypt and hence MongoDB - ''' -subject=CN=ISRG Root X1,O=Internet Security Research Group,C=US -issuer=CN=DST Root CA X3,O=Digital Signature Trust Co. ------BEGIN CERTIFICATE----- -MIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/ -MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT -DkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1ow -TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh -cmNoIEdyb3Vw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b3QteDEubGV0c2VuY3J5cHQu -b3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0LmNvbS9E -U1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFHm0WeZ7tuXkAXOACIjIGlj26Ztu -MA0GCSqGSIb3DQEBCwUAA4IBAQAKcwBslm7/DlLQrt2M51oGrS+o44+/yQoDFVDC -5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW -9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG -WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O -he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC -Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5 ------END CERTIFICATE-----'''; - - // if (Platform.isWindows) { - // try { - // final context = SecurityContext(withTrustedRoots: true); - // context.setTrustedCertificatesBytes(const AsciiEncoder().convert(isrgRootX1CertPEM)); - // return Client(context: context); - // } on TlsException catch (e) { - // // certificate is already trusted. Nothing to do here - // if (e.osError?.message.contains("CERT_ALREADY_IN_HASH_TABLE") != true) { - // rethrow; - // } - // } - // } - - return Client(); -}(); - /// A class exposing configuration options for an [App] /// {@category Application} @immutable @@ -126,7 +73,7 @@ class AppConfiguration { Client? httpClient, }) : baseUrl = baseUrl ?? Uri.parse(realmCore.getDefaultBaseUrl()), baseFilePath = baseFilePath ?? path.dirname(Configuration.defaultRealmPath), - httpClient = httpClient ?? _defaultClient { + httpClient = httpClient ?? defaultClient { if (appId == '') { throw RealmException('Supplied appId must be a non-empty value'); } diff --git a/packages/realm_dart/lib/src/handles/default_client.dart b/packages/realm_dart/lib/src/handles/default_client.dart new file mode 100644 index 000000000..0c93fee29 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/default_client.dart @@ -0,0 +1,8 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:http/http.dart'; + +import 'native/default_client.dart' if (dart.library.js_interop) 'web/default_client.dart' as impl; + +final Client defaultClient = impl.defaultClient(); \ No newline at end of file diff --git a/packages/realm_dart/lib/src/handles/native/default_client.dart b/packages/realm_dart/lib/src/handles/native/default_client.dart new file mode 100644 index 000000000..11da173b0 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/native/default_client.dart @@ -0,0 +1,60 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; + +Client defaultClient() { + const isrgRootX1CertPEM = // The root certificate used by lets encrypt and hence MongoDB + ''' +subject=CN=ISRG Root X1,O=Internet Security Research Group,C=US +issuer=CN=DST Root CA X3,O=Digital Signature Trust Co. +-----BEGIN CERTIFICATE----- +MIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/ +MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT +DkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1ow +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCt6CRz9BQ385ueK1coHIe+3LffOJCMbjzmV6B493XC +ov71am72AE8o295ohmxEk7axY/0UEmu/H9LqMZshftEzPLpI9d1537O4/xLxIZpL +wYqGcWlKZmZsj348cL+tKSIG8+TA5oCu4kuPt5l+lAOf00eXfJlII1PoOK5PCm+D +LtFJV4yAdLbaL9A4j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J7o5XPWioW5WlHAQU7G75K/QosMrAdSW +9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG +WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O +he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC +Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5 +-----END CERTIFICATE-----'''; + + if (Platform.isWindows) { + try { + final context = SecurityContext(withTrustedRoots: true); + context.setTrustedCertificatesBytes(const AsciiEncoder().convert(isrgRootX1CertPEM)); + return IOClient(HttpClient(context: context)); + } on TlsException catch (e) { + // certificate is already trusted. Nothing to do here + if (e.osError?.message.contains("CERT_ALREADY_IN_HASH_TABLE") != true) { + rethrow; + } + } + } + return Client(); +} diff --git a/packages/realm_dart/lib/src/handles/web/default_client.dart b/packages/realm_dart/lib/src/handles/web/default_client.dart new file mode 100644 index 000000000..e4b040cc6 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/default_client.dart @@ -0,0 +1,7 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +import 'package:http/browser_client.dart'; +import 'package:http/http.dart'; + +Client defaultClient() => BrowserClient(); From 27453bcdc67a6cf622abcefd95d67f972c135324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 14:01:07 +0200 Subject: [PATCH 15/17] Update CHANGELOG --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef36fffd0..0948b6a5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,16 @@ ## vNext (TBD) +### Breaking Changes +* To avoid dependency on `dart:io` + - `AppConfiguration.httpClient` is now of type [`Client`](https://api.dart.dev/stable/3.4.2/dart-io/HttpClient-class.html) and + - `AppConfiguration.baseFilePath` is now of type `String` + + (Issue [#1374](https://github.com/realm/realm-dart/issues/1374)) + ### Enhancements * Report the originating error that caused a client reset to occur. (Core 14.9.0) +* Allow the realm package, and code generated by realm_generator to be included when building + for web without breaking compilation. (Issue [#1374](https://github.com/realm/realm-dart/issues/1374)) ### Fixed * `Realm.writeAsync` did not handle async callbacks (`Future Function()`) correctly. (Issue [#1667](https://github.com/realm/realm-dart/issues/1667)) From fd71ad645828ca1f11cfa247bd0e52fc70bc1f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Mon, 3 Jun 2024 15:51:47 +0200 Subject: [PATCH 16/17] Drop some default icons for web tests --- packages/realm/tests/web/favicon.png | Bin 917 -> 0 bytes packages/realm/tests/web/icons/Icon-192.png | Bin 5292 -> 0 bytes packages/realm/tests/web/icons/Icon-512.png | Bin 8252 -> 0 bytes .../realm/tests/web/icons/Icon-maskable-192.png | Bin 5594 -> 0 bytes .../realm/tests/web/icons/Icon-maskable-512.png | Bin 20998 -> 0 bytes 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 packages/realm/tests/web/favicon.png delete mode 100644 packages/realm/tests/web/icons/Icon-192.png delete mode 100644 packages/realm/tests/web/icons/Icon-512.png delete mode 100644 packages/realm/tests/web/icons/Icon-maskable-192.png delete mode 100644 packages/realm/tests/web/icons/Icon-maskable-512.png diff --git a/packages/realm/tests/web/favicon.png b/packages/realm/tests/web/favicon.png deleted file mode 100644 index 8aaa46ac1ae21512746f852a42ba87e4165dfdd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 917 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|I14-?iy0X7 zltGxWVyS%@P(fs7NJL45ua8x7ey(0(N`6wRUPW#JP&EUCO@$SZnVVXYs8ErclUHn2 zVXFjIVFhG^g!Ppaz)DK8ZIvQ?0~DO|i&7O#^-S~(l1AfjnEK zjFOT9D}DX)@^Za$W4-*MbbUihOG|wNBYh(yU7!lx;>x^|#0uTKVr7USFmqf|i<65o z3raHc^AtelCMM;Vme?vOfh>Xph&xL%(-1c06+^uR^q@XSM&D4+Kp$>4P^%3{)XKjo zGZknv$b36P8?Z_gF{nK@`XI}Z90TzwSQO}0J1!f2c(B=V`5aP@1P1a|PZ!4!3&Gl8 zTYqUsf!gYFyJnXpu0!n&N*SYAX-%d(5gVjrHJWqXQshj@!Zm{!01WsQrH~9=kTxW#6SvuapgMqt>$=j#%eyGrQzr zP{L-3gsMA^$I1&gsBAEL+vxi1*Igl=8#8`5?A-T5=z-sk46WA1IUT)AIZHx1rdUrf zVJrJn<74DDw`j)Ki#gt}mIT-Q`XRa2-jQXQoI%w`nb|XblvzK${ZzlV)m-XcwC(od z71_OEC5Bt9GEXosOXaPTYOia#R4ID2TiU~`zVMl08TV_C%DnU4^+HE>9(CE4D6?Fz oujB08i7adh9xk7*FX66dWH6F5TM;?E2b5PlUHx3vIVCg!0Dx9vYXATM diff --git a/packages/realm/tests/web/icons/Icon-192.png b/packages/realm/tests/web/icons/Icon-192.png deleted file mode 100644 index b749bfef07473333cf1dd31e9eed89862a5d52aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5292 zcmZ`-2T+sGz6~)*FVZ`aW+(v>MIm&M-g^@e2u-B-DoB?qO+b1Tq<5uCCv>ESfRum& zp%X;f!~1{tzL__3=gjVJ=j=J>+nMj%ncXj1Q(b|Ckbw{Y0FWpt%4y%$uD=Z*c-x~o zE;IoE;xa#7Ll5nj-e4CuXB&G*IM~D21rCP$*xLXAK8rIMCSHuSu%bL&S3)8YI~vyp@KBu9Ph7R_pvKQ@xv>NQ`dZp(u{Z8K3yOB zn7-AR+d2JkW)KiGx0hosml;+eCXp6+w%@STjFY*CJ?udJ64&{BCbuebcuH;}(($@@ znNlgBA@ZXB)mcl9nbX#F!f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&OU0&{WFH}kKX6uNQC6%oUH z2DZa1s3%Vtk|bglbxep-w)PbFG!J17`<$g8lVhqD2w;Z0zGsh-r zxZ13G$G<48leNqR!DCVt9)@}(zMI5w6Wo=N zpP1*3DI;~h2WDWgcKn*f!+ORD)f$DZFwgKBafEZmeXQMAsq9sxP9A)7zOYnkHT9JU zRA`umgmP9d6=PHmFIgx=0$(sjb>+0CHG)K@cPG{IxaJ&Ueo8)0RWgV9+gO7+Bl1(F z7!BslJ2MP*PWJ;x)QXbR$6jEr5q3 z(3}F@YO_P1NyTdEXRLU6fp?9V2-S=E+YaeLL{Y)W%6`k7$(EW8EZSA*(+;e5@jgD^I zaJQ2|oCM1n!A&-8`;#RDcZyk*+RPkn_r8?Ak@agHiSp*qFNX)&i21HE?yuZ;-C<3C zwJGd1lx5UzViP7sZJ&|LqH*mryb}y|%AOw+v)yc`qM)03qyyrqhX?ub`Cjwx2PrR! z)_z>5*!*$x1=Qa-0uE7jy0z`>|Ni#X+uV|%_81F7)b+nf%iz=`fF4g5UfHS_?PHbr zB;0$bK@=di?f`dS(j{l3-tSCfp~zUuva+=EWxJcRfp(<$@vd(GigM&~vaYZ0c#BTs z3ijkxMl=vw5AS&DcXQ%eeKt!uKvh2l3W?&3=dBHU=Gz?O!40S&&~ei2vg**c$o;i89~6DVns zG>9a*`k5)NI9|?W!@9>rzJ;9EJ=YlJTx1r1BA?H`LWijk(rTax9(OAu;q4_wTj-yj z1%W4GW&K4T=uEGb+E!>W0SD_C0RR91 diff --git a/packages/realm/tests/web/icons/Icon-512.png b/packages/realm/tests/web/icons/Icon-512.png deleted file mode 100644 index 88cfd48dff1169879ba46840804b412fe02fefd6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8252 zcmd5=2T+s!lYZ%-(h(2@5fr2dC?F^$C=i-}R6$UX8af(!je;W5yC_|HmujSgN*6?W z3knF*TL1$|?oD*=zPbBVex*RUIKsL<(&Rj9%^UD2IK3W?2j>D?eWQgvS-HL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z1m}CKigf0 z3L`3Y`{huj`xj9@`$xTZzZc3je?n^yG<8sw$`Y%}9mUsjUR%T!?k^(q)6FH6Af^b6 zlPg~IEwg0y;`t9y;#D+uz!oE4VP&Je!<#q*F?m5L5?J3i@!0J6q#eu z!RRU`-)HeqGi_UJZ(n~|PSNsv+Wgl{P-TvaUQ9j?ZCtvb^37U$sFpBrkT{7Jpd?HpIvj2!}RIq zH{9~+gErN2+}J`>Jvng2hwM`=PLNkc7pkjblKW|+Fk9rc)G1R>Ww>RC=r-|!m-u7( zc(a$9NG}w#PjWNMS~)o=i~WA&4L(YIW25@AL9+H9!?3Y}sv#MOdY{bb9j>p`{?O(P zIvb`n?_(gP2w3P#&91JX*md+bBEr%xUHMVqfB;(f?OPtMnAZ#rm5q5mh;a2f_si2_ z3oXWB?{NF(JtkAn6F(O{z@b76OIqMC$&oJ_&S|YbFJ*)3qVX_uNf5b8(!vGX19hsG z(OP>RmZp29KH9Ge2kKjKigUmOe^K_!UXP`von)PR8Qz$%=EmOB9xS(ZxE_tnyzo}7 z=6~$~9k0M~v}`w={AeqF?_)9q{m8K#6M{a&(;u;O41j)I$^T?lx5(zlebpY@NT&#N zR+1bB)-1-xj}R8uwqwf=iP1GbxBjneCC%UrSdSxK1vM^i9;bUkS#iRZw2H>rS<2<$ zNT3|sDH>{tXb=zq7XZi*K?#Zsa1h1{h5!Tq_YbKFm_*=A5-<~j63he;4`77!|LBlo zR^~tR3yxcU=gDFbshyF6>o0bdp$qmHS7D}m3;^QZq9kBBU|9$N-~oU?G5;jyFR7>z hN`IR97YZXIo@y!QgFWddJ3|0`sjFx!m))><{BI=FK%f8s diff --git a/packages/realm/tests/web/icons/Icon-maskable-192.png b/packages/realm/tests/web/icons/Icon-maskable-192.png deleted file mode 100644 index eb9b4d76e525556d5d89141648c724331630325d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5594 zcmdT|`#%%j|KDb2V@0DPm$^(Lx5}lO%Yv(=e*7hl@QqKS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gQdtPazXz?OcNv4R^oYLJ_BQOd_l172oSK$6!1r@g+B@0ofJ4*{>_AIxfe-#xp>(1 z@Y3Nfd>fmqvjL;?+DmZk*KsfXJf<%~(gcLwEez%>1c6XSboURUh&k=B)MS>6kw9bY z{7vdev7;A}5fy*ZE23DS{J?8at~xwVk`pEwP5^k?XMQ7u64;KmFJ#POzdG#np~F&H ze-BUh@g54)dsS%nkBb}+GuUEKU~pHcYIg4vSo$J(J|U36bs0Use+3A&IMcR%6@jv$ z=+QI+@wW@?iu}Hpyzlvj-EYeop{f65GX0O%>w#0t|V z1-svWk`hU~m`|O$kw5?Yn5UhI%9P-<45A(v0ld1n+%Ziq&TVpBcV9n}L9Tus-TI)f zd_(g+nYCDR@+wYNQm1GwxhUN4tGMLCzDzPqY$~`l<47{+l<{FZ$L6(>J)|}!bi<)| zE35dl{a2)&leQ@LlDxLQOfUDS`;+ZQ4ozrleQwaR-K|@9T{#hB5Z^t#8 zC-d_G;B4;F#8A2EBL58s$zF-=SCr`P#z zNCTnHF&|X@q>SkAoYu>&s9v@zCpv9lLSH-UZzfhJh`EZA{X#%nqw@@aW^vPcfQrlPs(qQxmC|4tp^&sHy!H!2FH5eC{M@g;ElWNzlb-+ zxpfc0m4<}L){4|RZ>KReag2j%Ot_UKkgpJN!7Y_y3;Ssz{9 z!K3isRtaFtQII5^6}cm9RZd5nTp9psk&u1C(BY`(_tolBwzV_@0F*m%3G%Y?2utyS zY`xM0iDRT)yTyYukFeGQ&W@ReM+ADG1xu@ruq&^GK35`+2r}b^V!m1(VgH|QhIPDE X>c!)3PgKfL&lX^$Z>Cpu&6)6jvi^Z! diff --git a/packages/realm/tests/web/icons/Icon-maskable-512.png b/packages/realm/tests/web/icons/Icon-maskable-512.png deleted file mode 100644 index d69c56691fbdb0b7efa65097c7cc1edac12a6d3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20998 zcmeFZ_gj-)&^4Nb2tlbLMU<{!p(#yjqEe+=0IA_oih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zkz3EqG&Ed0Jq1)$|&>4_|NIe=5|n=3?siFV0fI z{As5DLW^gs|B-b4C;Hd(SM-S~GQhzb>HgF2|2Usww0nL^;x@1eaB)=+Clj+$fF@H( z-fqP??~QMT$KI-#m;QC*&6vkp&8699G3)Bq0*kFZXINw=b9OVaed(3(3kS|IZ)CM? zJdnW&%t8MveBuK21uiYj)_a{Fnw0OErMzMN?d$QoPwkhOwcP&p+t>P)4tHlYw-pPN z^oJ=uc$Sl>pv@fZH~ZqxSvdhF@F1s=oZawpr^-#l{IIOGG=T%QXjtwPhIg-F@k@uIlr?J->Ia zpEUQ*=4g|XYn4Gez&aHr*;t$u3oODPmc2Ku)2Og|xjc%w;q!Zz+zY)*3{7V8bK4;& zYV82FZ+8?v)`J|G1w4I0fWdKg|2b#iaazCv;|?(W-q}$o&Y}Q5d@BRk^jL7#{kbCK zSgkyu;=DV+or2)AxCBgq-nj5=@n^`%T#V+xBGEkW4lCqrE)LMv#f;AvD__cQ@Eg3`~x| zW+h9mofSXCq5|M)9|ez(#X?-sxB%Go8};sJ?2abp(Y!lyi>k)|{M*Z$c{e1-K4ky` MPgg&ebxsLQ025IeI{*Lx From 1e8e180c3f63e299c3d7339b5cde352b8a7bcf51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Overg=C3=A5rd=20Nielsen?= Date: Thu, 6 Jun 2024 12:51:00 +0200 Subject: [PATCH 17/17] PR feedback --- CHANGELOG.md | 2 +- packages/realm_dart/lib/realm.dart | 2 +- .../lib/src/handles/native/init.dart | 1 - .../mutable_subscription_set_handle.dart | 4 +++- .../lib/src/handles/web/app_handle.dart | 10 ++++---- .../handles/web/async_open_task_handle.dart | 9 +++---- .../web/collection_changes_handle.dart | 6 ++--- .../src/handles/web/credentials_handle.dart | 24 +++++++++---------- .../lib/src/handles/web/decimal128.dart | 13 +++++----- .../lib/src/handles/web/handle_base.dart | 5 +++- .../lib/src/handles/web/list_handle.dart | 6 ++--- .../src/handles/web/map_changes_handle.dart | 6 ++--- .../lib/src/handles/web/map_handle.dart | 6 ++--- .../web/mutable_subscription_set_handle.dart | 6 ++--- .../web/notification_token_handle.dart | 6 ++--- .../handles/web/object_changes_handle.dart | 6 ++--- .../lib/src/handles/web/object_handle.dart | 6 ++--- .../lib/src/handles/web/realm_core.dart | 3 ++- .../lib/src/handles/web/realm_handle.dart | 8 +++---- .../lib/src/handles/web/results_handle.dart | 6 ++--- .../lib/src/handles/web/scheduler_handle.dart | 10 +++----- .../lib/src/handles/web/schema_handle.dart | 8 +++---- .../lib/src/handles/web/session_handle.dart | 6 ++--- .../lib/src/handles/web/set_handle.dart | 6 ++--- .../src/handles/web/subscription_handle.dart | 6 ++--- .../handles/web/subscription_set_handle.dart | 6 ++--- .../lib/src/handles/web/user_handle.dart | 6 ++--- .../src/handles/web/web_not_supported.dart | 4 ++++ packages/realm_dart/lib/src/realm_class.dart | 1 - packages/realm_dart/lib/src/realm_object.dart | 2 +- packages/realm_dart/lib/src/realm_web.dart | 2 -- packages/realm_dart/lib/src/set.dart | 2 +- packages/realm_dart/test/realm_test.dart | 2 +- .../test/utils/native/platform_util.dart | 2 +- .../realm_dart/test/utils/platform_util.dart | 2 +- 35 files changed, 84 insertions(+), 116 deletions(-) create mode 100644 packages/realm_dart/lib/src/handles/web/web_not_supported.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 0948b6a5a..009d15b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### Breaking Changes * To avoid dependency on `dart:io` - - `AppConfiguration.httpClient` is now of type [`Client`](https://api.dart.dev/stable/3.4.2/dart-io/HttpClient-class.html) and + - `AppConfiguration.httpClient` is now of type [`Client`](https://pub.dev/documentation/http/latest/http/Client-class.html) and - `AppConfiguration.baseFilePath` is now of type `String` (Issue [#1374](https://github.com/realm/realm-dart/issues/1374)) diff --git a/packages/realm_dart/lib/realm.dart b/packages/realm_dart/lib/realm.dart index 70bd5dc37..b6935627e 100644 --- a/packages/realm_dart/lib/realm.dart +++ b/packages/realm_dart/lib/realm.dart @@ -1,6 +1,6 @@ // Copyright 2021 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -//dart.library.cli is available only on dart desktop +// dart.library.cli is available only on dart desktop export 'src/realm_flutter.dart' if (dart.library.cli) 'src/realm_dart.dart'; export 'package:ejson/ejson.dart'; diff --git a/packages/realm_dart/lib/src/handles/native/init.dart b/packages/realm_dart/lib/src/handles/native/init.dart index e47734bcd..f2fe88d0e 100644 --- a/packages/realm_dart/lib/src/handles/native/init.dart +++ b/packages/realm_dart/lib/src/handles/native/init.dart @@ -52,7 +52,6 @@ String _getLibPathDart(Package realmDartPackage) { _platformNotSupported(); } -//bool get isFlutterPlatform => realm.isFlutterPlatform; String _getLibName(String stem) => switch (targetOsType) { TargetOsType.android => 'lib$stem.so', diff --git a/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart index f78264362..70de535df 100644 --- a/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/native/mutable_subscription_set_handle.dart @@ -97,7 +97,9 @@ class MutableSubscriptionSetHandle extends SubscriptionSetHandle implements intf void clear() => realmLib.realm_sync_subscription_set_clear(_mutablePointer).raiseLastErrorIfFalse(); @override - // Workaround for weird compiler bug + // Workaround for weird compiler bug. This should be unnecessary, but if you + // remove this override, you get an error that the method is not implemented. + // I believe this is related to the covariant keyword in the method signature. // ignore: unnecessary_overrides SubscriptionHandle? findByResults(covariant ResultsHandle results) => super.findByResults(results); } diff --git a/packages/realm_dart/lib/src/handles/web/app_handle.dart b/packages/realm_dart/lib/src/handles/web/app_handle.dart index 45556bdeb..9a20302be 100644 --- a/packages/realm_dart/lib/src/handles/web/app_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/app_handle.dart @@ -3,11 +3,9 @@ import '../../../realm.dart'; import '../app_handle.dart' as intf; +import 'handle_base.dart'; -class AppHandle implements intf.AppHandle { - factory AppHandle.from(AppConfiguration configuration) => throw UnsupportedError('web not supported'); - static AppHandle? get(String id, String? baseUrl) => throw UnsupportedError('web not supported'); - - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +class AppHandle extends HandleBase implements intf.AppHandle { + factory AppHandle.from(AppConfiguration configuration) => webNotSupported(); + static AppHandle? get(String id, String? baseUrl) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart b/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart index 3a73eedb6..35d716b51 100644 --- a/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart @@ -4,15 +4,16 @@ import 'package:realm_dart/realm.dart'; import '../async_open_task_handle.dart' as intf; +import 'handle_base.dart'; -class AsyncOpenTaskHandle implements intf.AsyncOpenTaskHandle { - factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) => throw UnsupportedError('web not supported'); +class AsyncOpenTaskHandle extends HandleBase implements intf.AsyncOpenTaskHandle { + factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) => webNotSupported(); @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); + noSuchMethod(Invocation invocation) => webNotSupported(); } abstract class AsyncOpenTaskProgressNotificationTokenHandle implements intf.AsyncOpenTaskProgressNotificationTokenHandle { @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); + noSuchMethod(Invocation invocation) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart b/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart index 7bc265a76..9714b860b 100644 --- a/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../collection_changes_handle.dart' as intf; +import 'handle_base.dart'; -class CollectionChangesHandle implements intf.CollectionChangesHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class CollectionChangesHandle extends HandleBase implements intf.CollectionChangesHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/credentials_handle.dart b/packages/realm_dart/lib/src/handles/web/credentials_handle.dart index 1077e6b4d..e68f5484d 100644 --- a/packages/realm_dart/lib/src/handles/web/credentials_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/credentials_handle.dart @@ -2,26 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 import '../credentials_handle.dart' as intf; +import 'handle_base.dart'; -class CredentialsHandle implements intf.CredentialsHandle { - factory CredentialsHandle.anonymous(bool reuseCredentials) => throw UnsupportedError('web not supported'); +class CredentialsHandle extends HandleBase implements intf.CredentialsHandle { + factory CredentialsHandle.anonymous(bool reuseCredentials) => webNotSupported(); - factory CredentialsHandle.emailPassword(String email, String password) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.emailPassword(String email, String password) => webNotSupported(); - factory CredentialsHandle.jwt(String token) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.jwt(String token) => webNotSupported(); - factory CredentialsHandle.apple(String idToken) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.apple(String idToken) => webNotSupported(); - factory CredentialsHandle.facebook(String accessToken) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.facebook(String accessToken) => webNotSupported(); - factory CredentialsHandle.googleIdToken(String idToken) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.googleIdToken(String idToken) => webNotSupported(); - factory CredentialsHandle.googleAuthCode(String authCode) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.googleAuthCode(String authCode) => webNotSupported(); - factory CredentialsHandle.function(String payload) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.function(String payload) => webNotSupported(); - factory CredentialsHandle.apiKey(String key) => throw UnsupportedError('web not supported'); - - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); + factory CredentialsHandle.apiKey(String key) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/decimal128.dart b/packages/realm_dart/lib/src/handles/web/decimal128.dart index a85abbc63..58240b22b 100644 --- a/packages/realm_dart/lib/src/handles/web/decimal128.dart +++ b/packages/realm_dart/lib/src/handles/web/decimal128.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import '../decimal128.dart' as intf; +import 'web_not_supported.dart'; class Decimal128 implements intf.Decimal128 { static final zero = Decimal128.fromInt(0); @@ -13,7 +14,7 @@ class Decimal128 implements intf.Decimal128 { static final ten = Decimal128.fromInt(10); /// The value NaN. - static get nan => throw UnimplementedError('web not supported'); + static Decimal128 get nan => webNotSupported(); /// The value +Inf. static final infinity = one / zero; // +Inf @@ -22,17 +23,17 @@ class Decimal128 implements intf.Decimal128 { static final negativeInfinity = -infinity; /// Parses a string into a [Decimal128]. Returns `null` if the string is not a valid [Decimal128]. - static Decimal128? tryParse(String source) => throw UnimplementedError('web not supported'); + static Decimal128? tryParse(String source) => webNotSupported(); /// Parses a string into a [Decimal128]. Throws a [FormatException] if the string is not a valid [Decimal128]. - factory Decimal128.parse(String source) => throw UnimplementedError('web not supported'); + factory Decimal128.parse(String source) => webNotSupported(); /// Converts a `int` into a [Decimal128]. - factory Decimal128.fromInt(int value) => throw UnimplementedError('web not supported'); + factory Decimal128.fromInt(int value) => webNotSupported(); /// Converts a `double` into a [Decimal128]. - factory Decimal128.fromDouble(double value) => throw UnimplementedError('web not supported'); + factory Decimal128.fromDouble(double value) => webNotSupported(); @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); + noSuchMethod(Invocation invocation) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/handle_base.dart b/packages/realm_dart/lib/src/handles/web/handle_base.dart index 9d2c26ff0..702f001e2 100644 --- a/packages/realm_dart/lib/src/handles/web/handle_base.dart +++ b/packages/realm_dart/lib/src/handles/web/handle_base.dart @@ -2,8 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 import '../handle_base.dart' as intf; +import 'web_not_supported.dart'; + +export 'web_not_supported.dart'; class HandleBase implements intf.HandleBase { @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); + noSuchMethod(Invocation invocation) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/list_handle.dart b/packages/realm_dart/lib/src/handles/web/list_handle.dart index 9f8180a35..34148b316 100644 --- a/packages/realm_dart/lib/src/handles/web/list_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/list_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../list_handle.dart' as intf; +import 'handle_base.dart'; -class ListHandle implements intf.ListHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class ListHandle extends HandleBase implements intf.ListHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart b/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart index 9e7d0f6ed..32a48f70c 100644 --- a/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/map_changes_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../map_changes_handle.dart' as intf; +import 'handle_base.dart'; -abstract class MapChangesHandle implements intf.MapChangesHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} \ No newline at end of file +class MapChangesHandle extends HandleBase implements intf.MapChangesHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/map_handle.dart b/packages/realm_dart/lib/src/handles/web/map_handle.dart index 28970217a..5660c6166 100644 --- a/packages/realm_dart/lib/src/handles/web/map_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/map_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../map_handle.dart' as intf; +import 'handle_base.dart'; -class MapHandle implements intf.MapHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class MapHandle extends HandleBase implements intf.MapHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart index 69c078502..05e98f401 100644 --- a/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../mutable_subscription_set_handle.dart' as intf; +import 'handle_base.dart'; -class MutableSubscriptionSetHandle implements intf.MutableSubscriptionSetHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class MutableSubscriptionSetHandle extends HandleBase implements intf.MutableSubscriptionSetHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart b/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart index f8d1ef25a..26b1f5e08 100644 --- a/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/notification_token_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../notification_token_handle.dart' as intf; +import 'handle_base.dart'; -class NotificationTokenHandle implements intf.NotificationTokenHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class NotificationTokenHandle extends HandleBase implements intf.NotificationTokenHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart b/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart index 300cb34a4..824b23120 100644 --- a/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/object_changes_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../object_changes_handle.dart' as intf; +import 'handle_base.dart'; -class ObjectChangesHandle implements intf.ObjectChangesHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class ObjectChangesHandle extends HandleBase implements intf.ObjectChangesHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/object_handle.dart b/packages/realm_dart/lib/src/handles/web/object_handle.dart index ba1be46fd..62c0a86fb 100644 --- a/packages/realm_dart/lib/src/handles/web/object_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/object_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../object_handle.dart' as intf; +import 'handle_base.dart'; -class ObjectHandle implements intf.ObjectHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class ObjectHandle extends HandleBase implements intf.ObjectHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/realm_core.dart b/packages/realm_dart/lib/src/handles/web/realm_core.dart index 5b270a40d..41e049cf8 100644 --- a/packages/realm_dart/lib/src/handles/web/realm_core.dart +++ b/packages/realm_dart/lib/src/handles/web/realm_core.dart @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import '../realm_core.dart' as intf; +import 'web_not_supported.dart'; const realmCore = RealmCore(); @@ -9,5 +10,5 @@ class RealmCore implements intf.RealmCore { const RealmCore(); @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); + noSuchMethod(Invocation invocation) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/realm_handle.dart b/packages/realm_dart/lib/src/handles/web/realm_handle.dart index abdc75fcb..205fb7f23 100644 --- a/packages/realm_dart/lib/src/handles/web/realm_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/realm_handle.dart @@ -4,10 +4,8 @@ import 'package:realm_dart/realm.dart'; import '../realm_handle.dart' as intf; +import 'handle_base.dart'; -class RealmHandle implements intf.RealmHandle { - factory RealmHandle.open(Configuration config) => throw UnsupportedError('web not supported'); - - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +class RealmHandle extends HandleBase implements intf.RealmHandle { + factory RealmHandle.open(Configuration config) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/results_handle.dart b/packages/realm_dart/lib/src/handles/web/results_handle.dart index 142779085..694dbfffe 100644 --- a/packages/realm_dart/lib/src/handles/web/results_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/results_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../results_handle.dart' as intf; +import 'handle_base.dart'; -class ResultsHandle implements intf.ResultsHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class ResultsHandle extends HandleBase implements intf.ResultsHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart b/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart index e5f14a757..8ad91238c 100644 --- a/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/scheduler_handle.dart @@ -4,12 +4,8 @@ import 'dart:isolate'; import '../scheduler_handle.dart' as intf; +import 'handle_base.dart'; -class SchedulerHandle implements intf.SchedulerHandle { - factory SchedulerHandle(int isolateId, SendPort sendPort) => throw UnsupportedError('web not supported'); - - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +class SchedulerHandle extends HandleBase implements intf.SchedulerHandle { + factory SchedulerHandle(int isolateId, SendPort sendPort) => webNotSupported(); } - - diff --git a/packages/realm_dart/lib/src/handles/web/schema_handle.dart b/packages/realm_dart/lib/src/handles/web/schema_handle.dart index ace98cf1e..80ae51855 100644 --- a/packages/realm_dart/lib/src/handles/web/schema_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/schema_handle.dart @@ -4,10 +4,8 @@ import 'package:realm_dart/realm.dart'; import '../schema_handle.dart' as intf; +import 'handle_base.dart'; -class SchemaHandle implements intf.SchemaHandle { - factory SchemaHandle.from(Iterable schema) => throw UnsupportedError('web not supported'); - - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); +class SchemaHandle extends HandleBase implements intf.SchemaHandle { + factory SchemaHandle.from(Iterable schema) => webNotSupported(); } diff --git a/packages/realm_dart/lib/src/handles/web/session_handle.dart b/packages/realm_dart/lib/src/handles/web/session_handle.dart index 45f8e3ef4..f6b74bee0 100644 --- a/packages/realm_dart/lib/src/handles/web/session_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/session_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../session_handle.dart' as intf; +import 'handle_base.dart'; -class SessionHandle implements intf.SessionHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class SessionHandle extends HandleBase implements intf.SessionHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/set_handle.dart b/packages/realm_dart/lib/src/handles/web/set_handle.dart index 7eb07ad3f..6cbf95968 100644 --- a/packages/realm_dart/lib/src/handles/web/set_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/set_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../set_handle.dart' as intf; +import 'handle_base.dart'; -class SetHandle implements intf.SetHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class SetHandle extends HandleBase implements intf.SetHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/subscription_handle.dart b/packages/realm_dart/lib/src/handles/web/subscription_handle.dart index dab3f79c5..df3212a92 100644 --- a/packages/realm_dart/lib/src/handles/web/subscription_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/subscription_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../subscription_handle.dart' as intf; +import 'handle_base.dart'; -class SubscriptionHandle implements intf.SubscriptionHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class SubscriptionHandle extends HandleBase implements intf.SubscriptionHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart b/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart index 69d710bd4..20508d1b7 100644 --- a/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../subscription_set_handle.dart' as intf; +import 'handle_base.dart'; -class SubscriptionSetHandle implements intf.SubscriptionSetHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class SubscriptionSetHandle extends HandleBase implements intf.SubscriptionSetHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/user_handle.dart b/packages/realm_dart/lib/src/handles/web/user_handle.dart index baeef586a..a0e0638c0 100644 --- a/packages/realm_dart/lib/src/handles/web/user_handle.dart +++ b/packages/realm_dart/lib/src/handles/web/user_handle.dart @@ -2,8 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 import '../user_handle.dart' as intf; +import 'handle_base.dart'; -class UserHandle implements intf.UserHandle { - @override - noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); -} +class UserHandle extends HandleBase implements intf.UserHandle {} diff --git a/packages/realm_dart/lib/src/handles/web/web_not_supported.dart b/packages/realm_dart/lib/src/handles/web/web_not_supported.dart new file mode 100644 index 000000000..4232bd6f2 --- /dev/null +++ b/packages/realm_dart/lib/src/handles/web/web_not_supported.dart @@ -0,0 +1,4 @@ +// Copyright 2024 MongoDB, Inc. +// SPDX-License-Identifier: Apache-2.0 + +Never webNotSupported() => throw UnsupportedError('web not supported'); diff --git a/packages/realm_dart/lib/src/realm_class.dart b/packages/realm_dart/lib/src/realm_class.dart index 2ef5a13e5..15a91bb95 100644 --- a/packages/realm_dart/lib/src/realm_class.dart +++ b/packages/realm_dart/lib/src/realm_class.dart @@ -179,7 +179,6 @@ class Realm { return await CancellableFuture.value(realm, cancellationToken); } -// _ensureDirectory(config); final asyncOpenHandle = AsyncOpenTaskHandle.from(config); return await CancellableFuture.from(() async { diff --git a/packages/realm_dart/lib/src/realm_object.dart b/packages/realm_dart/lib/src/realm_object.dart index d3e32838e..9e8fa98ce 100644 --- a/packages/realm_dart/lib/src/realm_object.dart +++ b/packages/realm_dart/lib/src/realm_object.dart @@ -648,7 +648,7 @@ extension EmbeddedObjectExtension on EmbeddedObject { extension RealmObjectInternal on RealmObjectBase { void manage(Realm realm, ObjectHandle handle, RealmCoreAccessor accessor, bool update) { if (_handle != null) { - //most certainly a bug hence we throw an Error + // most certainly a bug hence we throw an Error throw ArgumentError("Object is already managed"); } diff --git a/packages/realm_dart/lib/src/realm_web.dart b/packages/realm_dart/lib/src/realm_web.dart index d2b0014df..2cf514f97 100644 --- a/packages/realm_dart/lib/src/realm_web.dart +++ b/packages/realm_dart/lib/src/realm_web.dart @@ -1,8 +1,6 @@ // Copyright 2024 MongoDB, Inc. // SPDX-License-Identifier: Apache-2.0 -//export 'realm_class.dart' hide RealmInternal; - /// @nodoc // is Realm loaded in Flutter or Dart const bool isFlutterPlatform = false; diff --git a/packages/realm_dart/lib/src/set.dart b/packages/realm_dart/lib/src/set.dart index 0d4d3d43b..613350ee3 100644 --- a/packages/realm_dart/lib/src/set.dart +++ b/packages/realm_dart/lib/src/set.dart @@ -141,7 +141,7 @@ class ManagedRealmSet with RealmEntity, SetMixin implement _throwOnRealmValueCollection(value); if (_isManagedRealmObject(value)) { - //It is valid to call `add` with managed objects already in the set. + // It is valid to call `add` with managed objects already in the set. _ensureManagedByThis(value, "add"); } else { // might be updating an existing realm object diff --git a/packages/realm_dart/test/realm_test.dart b/packages/realm_dart/test/realm_test.dart index f6ff1cbab..08f577c15 100644 --- a/packages/realm_dart/test/realm_test.dart +++ b/packages/realm_dart/test/realm_test.dart @@ -933,7 +933,7 @@ void main() { var config = Configuration.local([Friend.schema], path: p.join(Configuration.defaultStoragePath, "${generateRandomString(8)}.realm")); var realm = getRealm(config); readFile(String path) async { - final bytes = await platformUtil.raw(path); + final bytes = await platformUtil.readAsBytes(path); return utf8.decode(bytes, allowMalformed: true); } diff --git a/packages/realm_dart/test/utils/native/platform_util.dart b/packages/realm_dart/test/utils/native/platform_util.dart index 393a057f4..3b82afc65 100644 --- a/packages/realm_dart/test/utils/native/platform_util.dart +++ b/packages/realm_dart/test/utils/native/platform_util.dart @@ -43,7 +43,7 @@ class PlatformUtil implements intf.PlatformUtil { } @override - Future raw(String path) => File(path).readAsBytes(); + Future readAsBytes(String path) => File(path).readAsBytes(); @override Map get environment => Platform.environment; diff --git a/packages/realm_dart/test/utils/platform_util.dart b/packages/realm_dart/test/utils/platform_util.dart index 7e7e89884..350ba846e 100644 --- a/packages/realm_dart/test/utils/platform_util.dart +++ b/packages/realm_dart/test/utils/platform_util.dart @@ -18,7 +18,7 @@ abstract interface class PlatformUtil { void printPlatformInfo(); Future copy(String fromPath, String toPath); - Future raw(String path); + Future readAsBytes(String path); Map get environment;