Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDART-1034: Update realm-core to v14.7.0 #1681

Merged
merged 6 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jobs:
if: startsWith(matrix.build, 'android')
run: echo "ANDROID_NDK=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV

- name: Downgrade XCode for MacOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to move this job to macos-12 for this to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using XCode 14.3.1 instead.

if: matrix.build == 'macos'
run: sudo xcodes select 14.3.1

- name: Build
if: steps.check-cache.outputs.cache-hit != 'true'
run: |
Expand Down
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
## vNext (TBD)

### Enhancements
* None
* Nested collections have full support for automatic client reset. (Core 14.7.0)

### Fixed
* Private fields did not work with default values. (Issue [#1663](https://github.com/realm/realm-dart/issues/1663))

* Having links in a nested collections would leave the file inconsistent if the top object is removed. (Core 14.7.0)

* Accessing App.currentUser from within a notification produced by App.switchUser() (which includes notifications for a newly logged in user) would deadlock. (Core 14.7.0)

* Inserting the same typed link to the same key in a dictionary more than once would incorrectly create multiple backlinks to the object. This did not appear to cause any crashes later, but would have affecting explicit backlink count queries (eg: `...@links.@count`) and possibly notifications. (Core 14.7.0)


### Compatibility
* Realm Studio: 15.0.0 or later.

### Internal
* Using Core x.y.z.
* Using Core 14.7.0.

## 2.2.1 (2024-05-02)

Expand Down
10 changes: 8 additions & 2 deletions packages/realm_dart/test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,19 @@ void main() {
await app.deleteUser(user);
expect(user.state, UserState.removed);

await expectLater(() => loginWithRetry(app, Credentials.emailPassword(username, strongPassword)), throws<AppException>("invalid username/password"));
await expectLater(
() => loginWithRetry(app, Credentials.emailPassword(username, strongPassword)),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', equals('unauthorized'))
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
);
});

baasTest('Call Atlas function that does not exist', (configuration) async {
final app = App(configuration);
final user = await app.logIn(Credentials.anonymous());
await expectLater(user.functions.call('notExisitingFunction'), throws<AppException>("function not found: 'notExisitingFunction'"));
await expectLater(user.functions.call('notExisitingFunction'), throws<AppException>("function not found"));
});

baasTest('Call Atlas function with no arguments', (configuration) async {
Expand Down
34 changes: 28 additions & 6 deletions packages/realm_dart/test/credentials_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ void main() {
await authProvider.registerUser(username, strongPassword);
await authProvider.callResetPasswordFunction(username, newPassword, functionArgs: <dynamic>['success']);
await app.logIn(Credentials.emailPassword(username, newPassword));
await expectLater(() => app.logIn(Credentials.emailPassword(username, strongPassword)), throws<AppException>("invalid username/password"));
await expectLater(
app.logIn(Credentials.emailPassword(username, strongPassword)),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', equals('unauthorized'))
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
);
}, appName: AppName.autoConfirm);

baasTest('Email/Password - call reset password function with no additional arguments', (configuration) async {
Expand All @@ -157,12 +163,16 @@ void main() {
const String newPassword = "!@#!DQXQWD!223eda";
final authProvider = EmailPasswordAuthProvider(app);
await authProvider.registerUser(username, strongPassword);
await expectLater(() async {
await expectLater(
// Calling this function with no additional arguments fails for the test
// because of the specific implementation of resetFunc in the cloud.
// resetFunc returns status 'fail' in case no other status is passed.
return await authProvider.callResetPasswordFunction(username, newPassword);
}, throws<AppException>('failed to reset password for user "$username"'));
authProvider.callResetPasswordFunction(username, newPassword),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', contains('failed to reset password for user "$username"'))
.having((e) => e.statusCode, 'statusCode', 400)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
);
}, appName: AppName.autoConfirm);

/// JWT Payload data
Expand Down Expand Up @@ -298,14 +308,26 @@ void main() {
var token =
"eyJraWQiOiIxIiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.eyJzdWIiOiI2MmYzOTY4ODhhZjg3MjBiMzczZmYwNmEiLCJlbWFpbCI6Indvbmdfc2lnbml0dXJlX2tleUByZWFsbS5pbyIsImlhdCI6MTY2MDE0MjIxNSwiZXhwIjo0ODEzNzQyMjE1LCJhdWQiOiJtb25nb2RiLmNvbSIsImlzcyI6Imh0dHBzOi8vcmVhbG0uaW8ifQ.Af--ZUCL_KC7lAhrD_d1lq91O7qVwu7GqXifwxKojkLCkbjmAER9K2Xa7BPO8xNstFeX8m9uBo4BCD5B6XmngSmyCj5OZWdiG5LTR_uhA3MnpqcV3Vu40K4Yx8XrjPuCL39xVPnEfPKLGz5TjEcMLa8xMPqo51byX0q3mR2eSS4w1A7c5TiTNuQ23_SCO8aK95SyXwuUmU4mH0iR4sHPtf64WyoAXkx8w5twXExzky1_h473CwtAERdMsBhwz1YzFKP0kxU31pg5SRciF5Ly66sK1fSPTMQPuVdS_wKvAYll8_trWnWS83M3_PWs4UxzOdjSpoK0uqhN-_IC38YOGg";
final credentials = Credentials.jwt(token);
await expectLater(() => app.logIn(credentials), throws<AppException>("crypto/rsa: verification error"));
await expectLater(
() => app.logIn(credentials),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', equals('unauthorized'))
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
);
});

baasTest('Facebook credentials - invalid or expired token', (configuration) async {
final app = App(configuration);
final accessToken = 'invalid or expired token';
final credentials = Credentials.facebook(accessToken);
await expectLater(() => app.logIn(credentials), throws<AppException>("error fetching info from OAuth2 provider"));
await expectLater(
app.logIn(credentials),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', equals('unauthorized'))
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))),
);
});

baasTest('Function credentials - wrong payload', (configuration) {
Expand Down
6 changes: 3 additions & 3 deletions packages/realm_dart/test/user_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void main() {
await expectLater(
() => app.logIn(credentials),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', contains('invalid API key'))
.having((e) => e.message, 'message', equals('unauthorized'))
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))));

Expand All @@ -405,7 +405,7 @@ void main() {
await expectLater(
() => app.logIn(credentials),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', contains('invalid API key'))
.having((e) => e.message, 'message', equals('unauthorized'))
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))));
});
Expand Down Expand Up @@ -452,7 +452,7 @@ void main() {
await expectLater(
() async => await app.logIn(credentials),
throwsA(isA<AppException>()
.having((e) => e.message, 'message', 'invalid API key')
.having((e) => e.message, 'message', 'unauthorized')
.having((e) => e.statusCode, 'statusCode', 401)
.having((e) => e.linkToServerLogs, 'linkToServerLogs', contains('logs?co_id='))));
});
Expand Down
Loading