-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
347 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
factory AppHandle.get(String id, String? baseUrl) = impl.AppHandle.get; | ||
|
||
String get id; | ||
|
||
UserHandle? get currentUser; | ||
List<UserHandle> get users; | ||
Future<UserHandle> logIn(CredentialsHandle credentials); | ||
Future<void> removeUser(UserHandle user); | ||
void switchUser(UserHandle user); | ||
Future<void> refreshCustomData(UserHandle user); | ||
|
||
void reconnect(); | ||
String get baseUrl; | ||
Future<void> updateBaseUrl(Uri? baseUrl); | ||
|
||
Future<void> registerUser(String email, String password); | ||
Future<void> confirmUser(String token, String tokenId); | ||
Future<void> resendConfirmation(String email); | ||
|
||
Future<void> completeResetPassword(String password, String token, String tokenId); | ||
Future<void> requestResetPassword(String email); | ||
Future<void> callResetPasswordFunction(String email, String password, String? argsAsJSON); | ||
Future<void> retryCustomConfirmationFunction(String email); | ||
Future<void> deleteUser(UserHandle user); | ||
bool resetRealm(String realmPath); | ||
Future<String> callAppFunction(UserHandle user, String functionName, String? argsAsJSON); | ||
} |
19 changes: 17 additions & 2 deletions
19
packages/realm_dart/lib/src/handles/async_open_task_handle.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 class AsyncOpenTaskHandle extends HandleBase { | ||
factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) = impl.AsyncOpenTaskHandle.from; | ||
|
||
Future<RealmHandle> openAsync(CancellationToken? cancellationToken); | ||
void cancel(); | ||
|
||
AsyncOpenTaskProgressNotificationTokenHandle registerProgressNotifier( | ||
RealmAsyncOpenProgressNotificationsController controller, | ||
); | ||
} | ||
|
||
abstract class AsyncOpenTaskProgressNotificationTokenHandle extends HandleBase {} |
8 changes: 6 additions & 2 deletions
8
packages/realm_dart/lib/src/handles/collection_changes_handle.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,43 @@ | ||
// 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; | ||
|
||
ResultsHandle asResults(); | ||
|
||
int get size; | ||
|
||
void removeAt(int index); | ||
|
||
void move(int from, int to); | ||
void deleteAll(); | ||
int indexOf(Object? value); | ||
void clear(); | ||
|
||
// TODO: avoid taking the [realm] parameter | ||
Object? elementAt(Realm realm, int index); | ||
|
||
ListHandle? resolveIn(RealmHandle frozenRealm); | ||
|
||
// 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); | ||
|
||
ObjectHandle setEmbeddedAt(int index); | ||
|
||
ObjectHandle insertEmbeddedAt(int index); | ||
|
||
ResultsHandle query(String query, List<Object?> args); | ||
|
||
NotificationTokenHandle subscribeForNotifications(NotificationsController controller); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 class MapChangesHandle extends HandleBase { | ||
MapChanges get changes; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 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<Object?> args); | ||
bool remove(String key); | ||
MapHandle? resolveIn(RealmHandle frozenRealm); | ||
NotificationTokenHandle subscribeForNotifications(NotificationsController controller); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.