diff --git a/dev-doc/updating-c-library.md b/dev-doc/updating-c-library.md index 5a38a5698..a5e26af08 100644 --- a/dev-doc/updating-c-library.md +++ b/dev-doc/updating-c-library.md @@ -19,17 +19,17 @@ for the binding update script (see below) and for Flutter (`flutter_libs` and `sync_flutter_libs` plugins) on Linux and Windows: ```bash -./tool/set-c-version.sh 4.2.0 +./tool/set-c-version.sh 4.3.0 ``` ```text -* Update ObjectBox database for Flutter Linux/Windows, Dart Native apps to [4.2.0](https://github.com/objectbox/objectbox-c/releases/tag/v4.2.0). +* Update ObjectBox database for Flutter Linux/Windows, Dart Native apps to [4.3.0](https://github.com/objectbox/objectbox-c/releases/tag/v4.3.0). ``` ```text -Update C library [4.1.0 -> 4.2.0] +Update C library [4.2.0 -> 4.3.0] -Includes database 4.2.0-2025-03-04 +Includes database 4.3.0-2025-05-12 ``` ### Android @@ -37,19 +37,19 @@ Includes database 4.2.0-2025-03-04 For the Flutter plugins on Android ([view releases](https://github.com/objectbox/objectbox-java/releases)): ```bash -./tool/set-android-version.sh 4.2.0 +./tool/set-android-version.sh 4.3.0 ``` ```text -* Update ObjectBox database for Flutter Android apps to 4.2.0. +* Update ObjectBox database for Flutter Android apps to 4.3.0. If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make - sure to update to `io.objectbox:objectbox-android-objectbrowser:4.2.0` in `android/app/build.gradle`. + sure to update to `io.objectbox:objectbox-android-objectbrowser:4.3.0` in `android/app/build.gradle`. ``` ```text -Update objectbox-android [4.1.0 -> 4.2.0] +Update Android library [4.2.0 -> 4.3.0] -Includes C API 4.2.0 and database 4.2.0-2025-03-04 +Includes C API 4.3.0 and database 4.3.0-2025-05-12 ``` Note: the embedded C API and ObjectBox version can be looked up @@ -60,18 +60,18 @@ from the relevant objectbox repository release tag (like `java-4.1.0`). For the Flutter plugins on iOS/macOS ([view releases](https://github.com/objectbox/objectbox-swift/releases)) ```bash -./tool/set-swift-version.sh 4.2.0 +./tool/set-swift-version.sh 4.3.0 ``` ```text -* Update ObjectBox database for Flutter iOS/macOS apps to 4.2.0. +* Update ObjectBox database for Flutter iOS/macOS apps to 4.3.0. For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories. ``` ```text -Update ObjectBox Swift [4.1.0 -> 4.2.0] +Update macOS/iOS library [4.2.0 -> 4.3.0] -Includes C API 4.2.0 and database 4.2.0-2025-03-27 +Includes C API 4.3.0 and database 4.3.0-2025-05-12 ``` Note: the embedded C API and ObjectBox version can be looked up @@ -98,5 +98,5 @@ Then manually: - Commit as ```text -Update C-API [4.1.0 -> 4.2.0] +Update C-API [4.2.0 -> 4.3.0] ``` diff --git a/flutter_libs/android/build.gradle b/flutter_libs/android/build.gradle index 788a1a9ad..2d885034f 100644 --- a/flutter_libs/android/build.gradle +++ b/flutter_libs/android/build.gradle @@ -52,6 +52,6 @@ android { // ObjectBox Android library that includes an ObjectBox C library version compatible with // the C API binding of the ObjectBox Dart package. // https://central.sonatype.com/search?q=g:io.objectbox%20objectbox-android - implementation "io.objectbox:objectbox-android:4.2.0" + implementation "io.objectbox:objectbox-android:4.3.0" } } diff --git a/flutter_libs/ios/objectbox_flutter_libs.podspec b/flutter_libs/ios/objectbox_flutter_libs.podspec index a26696e9d..da4ac3cd5 100644 --- a/flutter_libs/ios/objectbox_flutter_libs.podspec +++ b/flutter_libs/ios/objectbox_flutter_libs.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'ObjectBox', '4.2.0' + s.dependency 'ObjectBox', '4.3.0' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } diff --git a/flutter_libs/linux/CMakeLists.txt b/flutter_libs/linux/CMakeLists.txt index cbce9d6c1..9ddab841a 100644 --- a/flutter_libs/linux/CMakeLists.txt +++ b/flutter_libs/linux/CMakeLists.txt @@ -44,7 +44,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) # ---------------------------------------------------------------------- # Download and add objectbox-c prebuilt library. -set(OBJECTBOX_VERSION 4.2.0) +set(OBJECTBOX_VERSION 4.3.0) set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR}) if (${OBJECTBOX_ARCH} MATCHES "x86_64") diff --git a/flutter_libs/macos/objectbox_flutter_libs.podspec b/flutter_libs/macos/objectbox_flutter_libs.podspec index e6ef1d9af..3c95ce32f 100644 --- a/flutter_libs/macos/objectbox_flutter_libs.podspec +++ b/flutter_libs/macos/objectbox_flutter_libs.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'FlutterMacOS' - s.dependency 'ObjectBox', '4.2.0' + s.dependency 'ObjectBox', '4.3.0' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.swift_version = '5.3' diff --git a/flutter_libs/windows/CMakeLists.txt b/flutter_libs/windows/CMakeLists.txt index eed019cbf..bb84e2398 100644 --- a/flutter_libs/windows/CMakeLists.txt +++ b/flutter_libs/windows/CMakeLists.txt @@ -50,7 +50,7 @@ set(objectbox_flutter_libs_bundled_libraries # ---------------------------------------------------------------------- # Download and add objectbox-c prebuilt library. -set(OBJECTBOX_VERSION 4.2.0) +set(OBJECTBOX_VERSION 4.3.0) set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR}) if (${OBJECTBOX_ARCH} MATCHES "AMD64") diff --git a/install.sh b/install.sh index bac35583d..261900e4c 100755 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ set -eu # It's important that the generated dart bindings and the c-api library version match. Dart won't error on C function # signature mismatch, leading to obscure memory bugs. # For how to upgrade the version see dev-doc/updating-c-library.md -cLibVersion=4.2.0 +cLibVersion=4.3.0 os=$(uname) cLibArgs="$*" diff --git a/objectbox/CHANGELOG.md b/objectbox/CHANGELOG.md index 0454c0974..a619a1461 100644 --- a/objectbox/CHANGELOG.md +++ b/objectbox/CHANGELOG.md @@ -1,5 +1,14 @@ ## latest +* Update ObjectBox database for Flutter Linux/Windows, Dart Native apps to [4.3.0](https://github.com/objectbox/objectbox-c/releases/tag/v4.3.0). +* Update ObjectBox database for Flutter Android apps to 4.3.0. + If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make + sure to update to `io.objectbox:objectbox-android-objectbrowser:4.3.0` in `android/app/build.gradle`. +* Update ObjectBox database for Flutter iOS/macOS apps to 4.3.0. + For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories. +* External property types (via [MongoDB connector](https://sync.objectbox.io/mongodb-sync-connector)): + add `jsonToNative` to support sub (embedded/nested) documents/arrays in MongoDB. + ## 4.2.0 (2025-04-15) * Requires at least Dart SDK 3.4 or Flutter SDK 3.22. diff --git a/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle b/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle index 5da6c3569..1f108d141 100644 --- a/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle +++ b/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle @@ -83,5 +83,5 @@ dependencies { // Add the Android library with ObjectBox Admin only for debug builds. // Note: when the objectbox package updates, check if the Android // library below needs to be updated as well. - debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.2.0") + debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.3.0") } diff --git a/objectbox/lib/src/annotations.dart b/objectbox/lib/src/annotations.dart index fee4d5fa8..876fef2a5 100644 --- a/objectbox/lib/src/annotations.dart +++ b/objectbox/lib/src/annotations.dart @@ -593,6 +593,19 @@ enum ExternalPropertyType { /// Representing type: String javaScript, + /// A JSON string that is converted to a native representation in the external + /// system. + /// + /// For example, a JSON object on the ObjectBox side (string) would be + /// converted to an embedded document in MongoDB. + /// + /// It depends on the external system what kind of JSON structures is + /// supported. For MongoDB, this is very flexible and allows (nested) objects, + /// arrays, primitives, etc. + /// + /// Representing type: String + jsonToNative, + /// A vector (array) of Int128 values. int128Vector, diff --git a/objectbox/lib/src/modelinfo/enums.dart b/objectbox/lib/src/modelinfo/enums.dart index d422dcebb..012972d1e 100644 --- a/objectbox/lib/src/modelinfo/enums.dart +++ b/objectbox/lib/src/modelinfo/enums.dart @@ -258,6 +258,8 @@ int externalTypeToOBXExternalType(ExternalPropertyType type) { return OBXExternalPropertyType.Bson; case ExternalPropertyType.javaScript: return OBXExternalPropertyType.JavaScript; + case ExternalPropertyType.jsonToNative: + return OBXExternalPropertyType.JsonToNative; case ExternalPropertyType.int128Vector: return OBXExternalPropertyType.Int128Vector; case ExternalPropertyType.uuidVector: @@ -321,6 +323,13 @@ abstract class OBXExternalPropertyType { /// Representing type: String static const int JavaScript = 111; + /// A JSON string that is converted to a native representation in the external system. + /// For example, a JSON object on the ObjectBox side (string) would be converted to an embedded document in MongoDB. + /// It depends on the external system what kind of JSON structures is supported. + /// For MongoDB, this is very flexible and allows (nested) objects, arrays, primitives, etc. + /// Representing type: String + static const int JsonToNative = 112; + /// A vector (array) of Int128 values static const int Int128Vector = 116; diff --git a/objectbox/lib/src/native/bindings/bindings.dart b/objectbox/lib/src/native/bindings/bindings.dart index 0a6d85924..40a8f600b 100644 --- a/objectbox/lib/src/native/bindings/bindings.dart +++ b/objectbox/lib/src/native/bindings/bindings.dart @@ -96,14 +96,14 @@ ObjectBoxC? _tryObjectBoxLibFile() { // libraries. // Library | C API | Database // ------------------------|-------|----------------- -// objectbox-c | 4.2.0 | 4.2.0-2025-03-04 -// ObjectBox Swift 4.2.0 | 4.2.0 | 4.2.0-2025-03-27 -// objectbox-android 4.2.0 | 4.2.0 | 4.2.0-2025-03-04 +// C library 4.3.0 | 4.3.0 | 4.3.0-2025-05-12 +// Android library 4.3.0 | 4.3.0 | 4.3.0-2025-05-12 +// macOS/iOS library 4.3.0 | 4.3.0 | 4.3.0-2025-05-12 var _obxCminMajor = 4; -var _obxCminMinor = 2; +var _obxCminMinor = 3; var _obxCminPatch = 0; // Require minimum database version guaranteeing actual C API availability. -var _obxDatabaseMinVersion = "4.2.0-2025-03-04"; +var _obxDatabaseMinVersion = "4.3.0-2025-05-12"; bool _isSupportedVersion(ObjectBoxC obxc) { // Require a minimum C API version diff --git a/objectbox/lib/src/native/bindings/objectbox-sync.h b/objectbox/lib/src/native/bindings/objectbox-sync.h index 109bc8a3f..77da691a2 100644 --- a/objectbox/lib/src/native/bindings/objectbox-sync.h +++ b/objectbox/lib/src/native/bindings/objectbox-sync.h @@ -34,7 +34,7 @@ #include "objectbox.h" #if defined(static_assert) || defined(__cplusplus) -static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 2 && OBX_VERSION_PATCH == 0, // NOLINT +static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 3 && OBX_VERSION_PATCH == 0, // NOLINT "Versions of objectbox.h and objectbox-sync.h files do not match, please update"); #endif diff --git a/objectbox/lib/src/native/bindings/objectbox.h b/objectbox/lib/src/native/bindings/objectbox.h index 74ddf39a3..84376440e 100644 --- a/objectbox/lib/src/native/bindings/objectbox.h +++ b/objectbox/lib/src/native/bindings/objectbox.h @@ -52,7 +52,7 @@ extern "C" { /// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using /// obx_version() or obx_version_is_at_least(). #define OBX_VERSION_MAJOR 4 -#define OBX_VERSION_MINOR 2 +#define OBX_VERSION_MINOR 3 #define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase //---------------------------------------------- @@ -669,7 +669,12 @@ typedef enum { /// JavaScript source code /// Representing type: String OBXExternalPropertyType_JavaScript = 111, - // OBXExternalPropertyType_Reserved5 = 112, + /// A JSON string that is converted to a native representation in the external system. + /// For example, a JSON object on the ObjectBox side (string) would be converted to an embedded document in MongoDB. + /// It depends on the external system what kind of JSON structures is supported. + /// For MongoDB, this is very flexible and allows (nested) objects, arrays, primitives, etc. + /// Representing type: String + OBXExternalPropertyType_JsonToNative = 112, // OBXExternalPropertyType_Reserved6 = 113, // OBXExternalPropertyType_Reserved7 = 114, // OBXExternalPropertyType_Reserved8 = 115, diff --git a/objectbox/lib/src/native/bindings/objectbox_c.dart b/objectbox/lib/src/native/bindings/objectbox_c.dart index 2e947f015..db1a845ec 100644 --- a/objectbox/lib/src/native/bindings/objectbox_c.dart +++ b/objectbox/lib/src/native/bindings/objectbox_c.dart @@ -10692,6 +10692,13 @@ abstract class OBXExternalPropertyType { /// Representing type: String static const int JavaScript = 111; + /// A JSON string that is converted to a native representation in the external system. + /// For example, a JSON object on the ObjectBox side (string) would be converted to an embedded document in MongoDB. + /// It depends on the external system what kind of JSON structures is supported. + /// For MongoDB, this is very flexible and allows (nested) objects, arrays, primitives, etc. + /// Representing type: String + static const int JsonToNative = 112; + /// A vector (array) of Int128 values static const int Int128Vector = 116; @@ -11669,7 +11676,7 @@ typedef obx_dart_closer const int OBX_VERSION_MAJOR = 4; -const int OBX_VERSION_MINOR = 2; +const int OBX_VERSION_MINOR = 3; const int OBX_VERSION_PATCH = 0; diff --git a/objectbox_test/test/entity.dart b/objectbox_test/test/entity.dart index 1bfcf3297..2fef9ee1a 100644 --- a/objectbox_test/test/entity.dart +++ b/objectbox_test/test/entity.dart @@ -476,6 +476,7 @@ class HnswObject { @ExternalName(name: 'my-mongo-entity') class EntityWithExternalType { @Id() + @ExternalType(type: ExternalPropertyType.uuid) int id = 0; @Property(type: PropertyType.byteVector) @@ -490,6 +491,9 @@ class EntityWithExternalType { @ExternalName(name: 'my-mongo-rel') final mongoIdEntities = ToMany(); + @ExternalType(type: ExternalPropertyType.jsonToNative) + String? externalJsonToNative; + EntityWithExternalType(this.mongoId, this.mongoUuid); } diff --git a/objectbox_test/test/objectbox-model.json b/objectbox_test/test/objectbox-model.json index ebb6adf65..cbde99aad 100644 --- a/objectbox_test/test/objectbox-model.json +++ b/objectbox_test/test/objectbox-model.json @@ -727,7 +727,7 @@ }, { "id": "16:5931645853908059165", - "lastPropertyId": "3:7670802129899081197", + "lastPropertyId": "4:6250975810854368520", "name": "EntityWithExternalType", "externalName": "my-mongo-entity", "properties": [ @@ -735,6 +735,7 @@ "id": "1:3044824951282217899", "name": "id", "type": 6, + "externalType": 102, "flags": 1 }, { @@ -749,6 +750,12 @@ "type": 27, "externalType": 102, "externalName": "my-mongo-uuid" + }, + { + "id": "4:6250975810854368520", + "name": "externalJsonToNative", + "type": 9, + "externalType": 112 } ], "relations": [ diff --git a/sync_flutter_libs/android/build.gradle b/sync_flutter_libs/android/build.gradle index 39ec10d25..4f3ff7d7f 100644 --- a/sync_flutter_libs/android/build.gradle +++ b/sync_flutter_libs/android/build.gradle @@ -52,6 +52,6 @@ android { // ObjectBox Android library that includes an ObjectBox C library version compatible with // the C API binding of the ObjectBox Dart package. // https://central.sonatype.com/search?q=g:io.objectbox%20objectbox-sync-android - implementation "io.objectbox:objectbox-sync-android:4.2.0" + implementation "io.objectbox:objectbox-sync-android:4.3.0" } } diff --git a/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec b/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec index 3267a9d1a..571176e00 100644 --- a/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec +++ b/sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'ObjectBox', '4.2.0-sync' + s.dependency 'ObjectBox', '4.3.0-sync' # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } diff --git a/sync_flutter_libs/linux/CMakeLists.txt b/sync_flutter_libs/linux/CMakeLists.txt index 246d71b49..57757ae59 100644 --- a/sync_flutter_libs/linux/CMakeLists.txt +++ b/sync_flutter_libs/linux/CMakeLists.txt @@ -44,7 +44,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) # ---------------------------------------------------------------------- # Download and add objectbox-c prebuilt library. -set(OBJECTBOX_VERSION 4.2.0) +set(OBJECTBOX_VERSION 4.3.0) set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR}) if (${OBJECTBOX_ARCH} MATCHES "x86_64") diff --git a/sync_flutter_libs/macos/objectbox_sync_flutter_libs.podspec b/sync_flutter_libs/macos/objectbox_sync_flutter_libs.podspec index eab6f3d23..a0870a53a 100644 --- a/sync_flutter_libs/macos/objectbox_sync_flutter_libs.podspec +++ b/sync_flutter_libs/macos/objectbox_sync_flutter_libs.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'FlutterMacOS' - s.dependency 'ObjectBox', '4.2.0-sync' + s.dependency 'ObjectBox', '4.3.0-sync' s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.swift_version = '5.3' diff --git a/sync_flutter_libs/windows/CMakeLists.txt b/sync_flutter_libs/windows/CMakeLists.txt index 4fcd94c55..f8df47492 100644 --- a/sync_flutter_libs/windows/CMakeLists.txt +++ b/sync_flutter_libs/windows/CMakeLists.txt @@ -50,7 +50,7 @@ set(objectbox_sync_flutter_libs_bundled_libraries # ---------------------------------------------------------------------- # Download and add objectbox-c prebuilt library. -set(OBJECTBOX_VERSION 4.2.0) +set(OBJECTBOX_VERSION 4.3.0) set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR}) if (${OBJECTBOX_ARCH} MATCHES "AMD64") diff --git a/tool/update-c-binding.sh b/tool/update-c-binding.sh index 87789a244..5e49b37e3 100755 --- a/tool/update-c-binding.sh +++ b/tool/update-c-binding.sh @@ -5,7 +5,7 @@ # copies the header files, makes some required modifications # and runs the ffigen binding generator on them. -cLibVersion=4.2.0 +cLibVersion=4.3.0 echo "Downloading C library source files from GitHub..." # Note: the release archives do not contain objectbox-dart.h, so get the full sources.