diff --git a/CHANGELOG.md b/CHANGELOG.md index 439149db38..3bde6454e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,12 @@ x.x.x Release notes (yyyy-MM-dd) * New consistent API for `EmailPasswordAuth` methods, using a single object dictionary rather than positional arguments, to fix inconsistencies and make usage clearer. The existing API is being deprecated (see above). ([#3943](https://github.com/realm/realm-js/issues/3943)) ### Fixed -* ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?) -* None. +* Using `sort`, `distinct`, or `limit` as property name in query expression would cause an `Invalid predicate` error. ([realm/realm-java#7545](https://github.com/realm/realm-java/issues/7545), since v10.0.2) +* Fixed a rare assertion failure or deadlock when a sync session. ([realm/realm-core#4931](https://github.com/realm/realm-core/issues/4931)) +* Fixed a rare segfault which could trigger if a user was being logged out while the access token refresh response comes in. ([realm/realm-core#4944](https://github.com/realm/realm-core/issues/4944), since v10.0.0) +* Fixed a user being left in the logged in state when the user's refresh token expires. ([realm/realm-core#4882](https://github.com/realm/realm-core/issues/4882), since v10.0.0) +* Allow for `EPERM` to be returned from `fallocate()`. This improves support for running on Linux environments with interesting file systems, like AWS Lambda. Thanks to [@ztane](https://github.com/ztane) for reporting and suggesting a fix. ([realm/realm-core#4957](https://github.com/realm/realm-core/issues/4957) and [#1832](https://github.com/realm/realm-js/issues/1832)) +* Sync progress notifiers would not trigger when the downloadable bytes size would equal 0. ([realm/realm-core#4989](https://github.com/realm/realm-core/pull/4989), since v10.3.0-rc.1) ### Compatibility * MongoDB Realm Cloud. @@ -23,10 +27,13 @@ x.x.x Release notes (yyyy-MM-dd) * Adding use of [ccache](https://ccache.dev/) in build scripts, XCode projects and the integration tests GHA workflow. * Dropped using `install-local` in the integration tests, in favour of a more involved Metro configuration. * Add combined type definition for Realm.object and Realm.objectForPrimaryKey so they can be cleanly wrapped. -* -* -* +* Upgraded Realm Core from v11.4.1 to v10.5.2. +* Change Apple/Linux temporary directory to default to the environment's `TMPDIR` if available. This is primarily used by tests. ([realm/realm-core#4921](https://github.com/realm/realm-core/issues/4921)) * Adding colorized compiler diagnostics if using Ninja. +* Upgraded Realm Core from v11.4.1 to v10.6.0. +* Change Apple/Linux temporary directory to default to the environment's `TMPDIR` if available. This is primarily used by tests. ([realm/realm-core#4921](https://github.com/realm/realm-core/issues/4921)) +* Minor speed improvement in property setters. ([#4058](https://github.com/realm/realm-js/pull/4058) and [realm/realm-core#5011](https://github.com/realm/realm-core/pull/5011)) +* Adding use of [ccache](https://ccache.dev/) in build scripts, XCode projects and the integration tests GHA workflow. 10.9.1 Release notes (2021-10-20) ============================================================= diff --git a/dependencies.list b/dependencies.list index c4d30d8ef2..a1a84c651f 100644 --- a/dependencies.list +++ b/dependencies.list @@ -1,6 +1,6 @@ PACKAGE_NAME=realm-js VERSION=10.9.1 -REALM_CORE_VERSION=11.4.1 +REALM_CORE_VERSION=11.6.0 NAPI_VERSION=4 OPENSSL_VERSION=1.1.1g MDBREALM_TEST_SERVER_TAG=2021-06-01 diff --git a/src/js_app.hpp b/src/js_app.hpp index ae63ac6a24..17666d42bd 100644 --- a/src/js_app.hpp +++ b/src/js_app.hpp @@ -181,9 +181,7 @@ void AppClass::constructor(ContextType ctx, ObjectType this_object, Arguments throw std::runtime_error("Expected either a configuration object or an app id string."); } - config.transport_generator = [ctx = Protected(Context::get_global_context(ctx)), eld=NetworkTransport::make_dispatcher()] { - return AppClass::transport_generator(ctx, eld); - }; + config.transport = AppClass::transport_generator(Protected(Context::get_global_context(ctx)), NetworkTransport::make_dispatcher()); config.platform = platform_os; config.platform_version = platform_version; diff --git a/src/js_realm_object.hpp b/src/js_realm_object.hpp index 61ddc7f21b..f12c424844 100644 --- a/src/js_realm_object.hpp +++ b/src/js_realm_object.hpp @@ -188,7 +188,7 @@ bool RealmObjectClass::set_property(ContextType ctx, ObjectType object, const throw TypeErrorException(accessor, realm_object->get_object_schema().name, *prop, value); } - realm_object->set_property_value(accessor, prop->name, value, realm::CreatePolicy::UpdateAll); + realm_object->set_property_value(accessor, *prop, value, realm::CreatePolicy::UpdateAll); return true; } diff --git a/src/js_sync.hpp b/src/js_sync.hpp index 8396dcdc51..8bb4ded169 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -113,7 +113,7 @@ class SessionClass : public ClassDefinition { public: std::string const name = "Session"; using ProgressHandler = void(uint64_t transferred_bytes, uint64_t transferrable_bytes); - using StateHandler = void(SyncSession::PublicState old_state, SyncSession::PublicState new_state); + using StateHandler = void(SyncSession::State old_state, SyncSession::State new_state); using ConnectionHandler = void(SyncSession::ConnectionState new_state, SyncSession::ConnectionState old_state); using DownloadUploadCompletionHandler = void(std::error_code error); @@ -368,7 +368,7 @@ void SessionClass::get_state(ContextType ctx, ObjectType object, ReturnValue return_value.set(invalid); if (auto session = get_internal>(ctx, object)->lock()) { - if (session->state() == SyncSession::PublicState::Inactive) { + if (session->state() == SyncSession::State::Inactive) { return_value.set(inactive); } else { return_value.set(active); @@ -412,14 +412,14 @@ void SessionClass::add_progress_notification(ContextType ctx, ObjectType this if (auto session = get_internal>(ctx, this_object)->lock()) { - std::string direction = Value::validated_to_string(ctx, args[0], "direction"); + std::string direction_str = Value::validated_to_string(ctx, args[0], "direction"); std::string mode = Value::validated_to_string(ctx, args[1], "mode"); - SyncSession::NotifierType notifierType; - if (direction == "download") { - notifierType = SyncSession::NotifierType::download; + SyncSession::ProgressDirection direction; + if (direction_str == "download") { + direction = SyncSession::ProgressDirection::download; } - else if (direction == "upload") { - notifierType = SyncSession::NotifierType::upload; + else if (direction_str == "upload") { + direction = SyncSession::ProgressDirection::upload; } else { throw std::invalid_argument("Invalid argument 'direction'. Only 'download' and 'upload' progress notification directions are supported"); @@ -455,7 +455,7 @@ void SessionClass::add_progress_notification(ContextType ctx, ObjectType this progressFunc = std::move(progress_handler); - auto registrationToken = session->register_progress_notifier(std::move(progressFunc), notifierType, is_streaming); + auto registrationToken = session->register_progress_notifier(std::move(progressFunc), direction, is_streaming); auto syncSession = create_object>(ctx, new WeakSession(session)); PropertyAttributes attributes = ReadOnly | DontEnum | DontDelete; Object::set_property(ctx, callback_function, "_syncSession", syncSession, attributes); @@ -536,7 +536,7 @@ void SessionClass::is_connected(ContextType ctx, ObjectType this_object, Argu auto state = session->state(); auto connection_state = session->connection_state(); if (connection_state == SyncSession::ConnectionState::Connected - && (state == SyncSession::PublicState::Active || state == SyncSession::PublicState::Dying)) { + && (state == SyncSession::State::Active || state == SyncSession::State::Dying)) { return_value.set(true); } } @@ -755,7 +755,7 @@ void SyncClass::set_sync_logger(ContextType ctx, ObjectType this_object, Argu }; auto sync_logger = common::logger::Logger::build_sync_logger(show_logs); - app->sync_manager()->set_logger_factory( *sync_logger ); + app->sync_manager()->set_logger_factory(sync_logger); } template diff --git a/src/logger.hpp b/src/logger.hpp index 3b880a775c..464ba42309 100644 --- a/src/logger.hpp +++ b/src/logger.hpp @@ -112,24 +112,6 @@ class SyncLoggerDelegator : public util::RootLogger { Delegated loggerDelegate; }; -class SyncLoggerDelegatorFactory : public realm::SyncLoggerFactory { - public: - SyncLoggerDelegatorFactory(Delegated logs_fn) : logs_fn{logs_fn} {} - - std::unique_ptr make_logger( - realm::util::Logger::Level level) { - auto logger = std::make_unique(); - - logger->set_level_threshold(level); - logger->delegate(logs_fn); - - return logger; - } - - private: - Delegated logs_fn; -}; - class Logger { private: // Warning: If this grows to big (for example: another method) we should @@ -157,8 +139,13 @@ class Logger { throw std::runtime_error("Bad log level"); } - static SyncLoggerDelegatorFactory* build_sync_logger(Delegated& log_fn) { - return new SyncLoggerDelegatorFactory(log_fn); + static SyncClientConfig::LoggerFactory build_sync_logger(Delegated& log_fn) { + return [&log_fn] (realm::util::Logger::Level level) { + auto logger = std::make_unique(); + logger->set_level_threshold(level); + logger->delegate(log_fn); + return logger; + }; } }; diff --git a/vendor/realm-core b/vendor/realm-core index 23f60515a0..b170db6a47 160000 --- a/vendor/realm-core +++ b/vendor/realm-core @@ -1 +1 @@ -Subproject commit 23f60515a00f076a9e3f2dc672fe1ae07601ee90 +Subproject commit b170db6a47789ff5f2fbc3eeed0220b4b0a3f6b7