Skip to content

Commit f137741

Browse files
Merge branch '148-database-4.3.0' into 'main'
Update database to 4.3.0, support JsonToNative #148 See merge request objectbox/objectbox-dart!107
2 parents 37180b7 + 2169a68 commit f137741

File tree

23 files changed

+91
-37
lines changed

23 files changed

+91
-37
lines changed

dev-doc/updating-c-library.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,37 @@ for the binding update script (see below) and
1919
for Flutter (`flutter_libs` and `sync_flutter_libs` plugins) on Linux and Windows:
2020

2121
```bash
22-
./tool/set-c-version.sh 4.2.0
22+
./tool/set-c-version.sh 4.3.0
2323
```
2424

2525
```text
26-
* 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).
26+
* 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).
2727
```
2828

2929
```text
30-
Update C library [4.1.0 -> 4.2.0]
30+
Update C library [4.2.0 -> 4.3.0]
3131
32-
Includes database 4.2.0-2025-03-04
32+
Includes database 4.3.0-2025-05-12
3333
```
3434

3535
### Android
3636

3737
For the Flutter plugins on Android ([view releases](https://github.com/objectbox/objectbox-java/releases)):
3838

3939
```bash
40-
./tool/set-android-version.sh 4.2.0
40+
./tool/set-android-version.sh 4.3.0
4141
```
4242

4343
```text
44-
* Update ObjectBox database for Flutter Android apps to 4.2.0.
44+
* Update ObjectBox database for Flutter Android apps to 4.3.0.
4545
If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make
46-
sure to update to `io.objectbox:objectbox-android-objectbrowser:4.2.0` in `android/app/build.gradle`.
46+
sure to update to `io.objectbox:objectbox-android-objectbrowser:4.3.0` in `android/app/build.gradle`.
4747
```
4848

4949
```text
50-
Update objectbox-android [4.1.0 -> 4.2.0]
50+
Update Android library [4.2.0 -> 4.3.0]
5151
52-
Includes C API 4.2.0 and database 4.2.0-2025-03-04
52+
Includes C API 4.3.0 and database 4.3.0-2025-05-12
5353
```
5454

5555
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`).
6060
For the Flutter plugins on iOS/macOS ([view releases](https://github.com/objectbox/objectbox-swift/releases))
6161

6262
```bash
63-
./tool/set-swift-version.sh 4.2.0
63+
./tool/set-swift-version.sh 4.3.0
6464
```
6565

6666
```text
67-
* Update ObjectBox database for Flutter iOS/macOS apps to 4.2.0.
67+
* Update ObjectBox database for Flutter iOS/macOS apps to 4.3.0.
6868
For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories.
6969
```
7070

7171
```text
72-
Update ObjectBox Swift [4.1.0 -> 4.2.0]
72+
Update macOS/iOS library [4.2.0 -> 4.3.0]
7373
74-
Includes C API 4.2.0 and database 4.2.0-2025-03-27
74+
Includes C API 4.3.0 and database 4.3.0-2025-05-12
7575
```
7676

7777
Note: the embedded C API and ObjectBox version can be looked up
@@ -98,5 +98,5 @@ Then manually:
9898
- Commit as
9999

100100
```text
101-
Update C-API [4.1.0 -> 4.2.0]
101+
Update C-API [4.2.0 -> 4.3.0]
102102
```

flutter_libs/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ android {
5252
// ObjectBox Android library that includes an ObjectBox C library version compatible with
5353
// the C API binding of the ObjectBox Dart package.
5454
// https://central.sonatype.com/search?q=g:io.objectbox%20objectbox-android
55-
implementation "io.objectbox:objectbox-android:4.2.0"
55+
implementation "io.objectbox:objectbox-android:4.3.0"
5656
}
5757
}

flutter_libs/ios/objectbox_flutter_libs.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818
s.source_files = 'Classes/**/*'
1919

2020
s.dependency 'Flutter'
21-
s.dependency 'ObjectBox', '4.2.0'
21+
s.dependency 'ObjectBox', '4.3.0'
2222

2323
# Flutter.framework does not contain a i386 slice.
2424
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }

flutter_libs/linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
4444
# ----------------------------------------------------------------------
4545
# Download and add objectbox-c prebuilt library.
4646

47-
set(OBJECTBOX_VERSION 4.2.0)
47+
set(OBJECTBOX_VERSION 4.3.0)
4848

4949
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
5050
if (${OBJECTBOX_ARCH} MATCHES "x86_64")

flutter_libs/macos/objectbox_flutter_libs.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818
s.source_files = 'Classes/**/*'
1919

2020
s.dependency 'FlutterMacOS'
21-
s.dependency 'ObjectBox', '4.2.0'
21+
s.dependency 'ObjectBox', '4.3.0'
2222

2323
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2424
s.swift_version = '5.3'

flutter_libs/windows/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ set(objectbox_flutter_libs_bundled_libraries
5050
# ----------------------------------------------------------------------
5151
# Download and add objectbox-c prebuilt library.
5252

53-
set(OBJECTBOX_VERSION 4.2.0)
53+
set(OBJECTBOX_VERSION 4.3.0)
5454

5555
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
5656
if (${OBJECTBOX_ARCH} MATCHES "AMD64")

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
# It's important that the generated dart bindings and the c-api library version match. Dart won't error on C function
66
# signature mismatch, leading to obscure memory bugs.
77
# For how to upgrade the version see dev-doc/updating-c-library.md
8-
cLibVersion=4.2.0
8+
cLibVersion=4.3.0
99
os=$(uname)
1010
cLibArgs="$*"
1111

objectbox/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
## latest
22

3+
* 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).
4+
* Update ObjectBox database for Flutter Android apps to 4.3.0.
5+
If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make
6+
sure to update to `io.objectbox:objectbox-android-objectbrowser:4.3.0` in `android/app/build.gradle`.
7+
* Update ObjectBox database for Flutter iOS/macOS apps to 4.3.0.
8+
For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories.
9+
* External property types (via [MongoDB connector](https://sync.objectbox.io/mongodb-sync-connector)):
10+
add `jsonToNative` to support sub (embedded/nested) documents/arrays in MongoDB.
11+
312
## 4.2.0 (2025-04-15)
413

514
* Requires at least Dart SDK 3.4 or Flutter SDK 3.22.

objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ dependencies {
8383
// Add the Android library with ObjectBox Admin only for debug builds.
8484
// Note: when the objectbox package updates, check if the Android
8585
// library below needs to be updated as well.
86-
debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.2.0")
86+
debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.3.0")
8787
}

objectbox/lib/src/annotations.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,19 @@ enum ExternalPropertyType {
593593
/// Representing type: String
594594
javaScript,
595595

596+
/// A JSON string that is converted to a native representation in the external
597+
/// system.
598+
///
599+
/// For example, a JSON object on the ObjectBox side (string) would be
600+
/// converted to an embedded document in MongoDB.
601+
///
602+
/// It depends on the external system what kind of JSON structures is
603+
/// supported. For MongoDB, this is very flexible and allows (nested) objects,
604+
/// arrays, primitives, etc.
605+
///
606+
/// Representing type: String
607+
jsonToNative,
608+
596609
/// A vector (array) of Int128 values.
597610
int128Vector,
598611

objectbox/lib/src/modelinfo/enums.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ int externalTypeToOBXExternalType(ExternalPropertyType type) {
258258
return OBXExternalPropertyType.Bson;
259259
case ExternalPropertyType.javaScript:
260260
return OBXExternalPropertyType.JavaScript;
261+
case ExternalPropertyType.jsonToNative:
262+
return OBXExternalPropertyType.JsonToNative;
261263
case ExternalPropertyType.int128Vector:
262264
return OBXExternalPropertyType.Int128Vector;
263265
case ExternalPropertyType.uuidVector:
@@ -321,6 +323,13 @@ abstract class OBXExternalPropertyType {
321323
/// Representing type: String
322324
static const int JavaScript = 111;
323325

326+
/// A JSON string that is converted to a native representation in the external system.
327+
/// For example, a JSON object on the ObjectBox side (string) would be converted to an embedded document in MongoDB.
328+
/// It depends on the external system what kind of JSON structures is supported.
329+
/// For MongoDB, this is very flexible and allows (nested) objects, arrays, primitives, etc.
330+
/// Representing type: String
331+
static const int JsonToNative = 112;
332+
324333
/// A vector (array) of Int128 values
325334
static const int Int128Vector = 116;
326335

objectbox/lib/src/native/bindings/bindings.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ ObjectBoxC? _tryObjectBoxLibFile() {
9696
// libraries.
9797
// Library | C API | Database
9898
// ------------------------|-------|-----------------
99-
// objectbox-c | 4.2.0 | 4.2.0-2025-03-04
100-
// ObjectBox Swift 4.2.0 | 4.2.0 | 4.2.0-2025-03-27
101-
// objectbox-android 4.2.0 | 4.2.0 | 4.2.0-2025-03-04
99+
// C library 4.3.0 | 4.3.0 | 4.3.0-2025-05-12
100+
// Android library 4.3.0 | 4.3.0 | 4.3.0-2025-05-12
101+
// macOS/iOS library 4.3.0 | 4.3.0 | 4.3.0-2025-05-12
102102
var _obxCminMajor = 4;
103-
var _obxCminMinor = 2;
103+
var _obxCminMinor = 3;
104104
var _obxCminPatch = 0;
105105
// Require minimum database version guaranteeing actual C API availability.
106-
var _obxDatabaseMinVersion = "4.2.0-2025-03-04";
106+
var _obxDatabaseMinVersion = "4.3.0-2025-05-12";
107107

108108
bool _isSupportedVersion(ObjectBoxC obxc) {
109109
// Require a minimum C API version

objectbox/lib/src/native/bindings/objectbox-sync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "objectbox.h"
3535

3636
#if defined(static_assert) || defined(__cplusplus)
37-
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 2 && OBX_VERSION_PATCH == 0, // NOLINT
37+
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 3 && OBX_VERSION_PATCH == 0, // NOLINT
3838
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
3939
#endif
4040

objectbox/lib/src/native/bindings/objectbox.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extern "C" {
5252
/// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using
5353
/// obx_version() or obx_version_is_at_least().
5454
#define OBX_VERSION_MAJOR 4
55-
#define OBX_VERSION_MINOR 2
55+
#define OBX_VERSION_MINOR 3
5656
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase
5757

5858
//----------------------------------------------
@@ -669,7 +669,12 @@ typedef enum {
669669
/// JavaScript source code
670670
/// Representing type: String
671671
OBXExternalPropertyType_JavaScript = 111,
672-
// OBXExternalPropertyType_Reserved5 = 112,
672+
/// A JSON string that is converted to a native representation in the external system.
673+
/// For example, a JSON object on the ObjectBox side (string) would be converted to an embedded document in MongoDB.
674+
/// It depends on the external system what kind of JSON structures is supported.
675+
/// For MongoDB, this is very flexible and allows (nested) objects, arrays, primitives, etc.
676+
/// Representing type: String
677+
OBXExternalPropertyType_JsonToNative = 112,
673678
// OBXExternalPropertyType_Reserved6 = 113,
674679
// OBXExternalPropertyType_Reserved7 = 114,
675680
// OBXExternalPropertyType_Reserved8 = 115,

objectbox/lib/src/native/bindings/objectbox_c.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10692,6 +10692,13 @@ abstract class OBXExternalPropertyType {
1069210692
/// Representing type: String
1069310693
static const int JavaScript = 111;
1069410694

10695+
/// A JSON string that is converted to a native representation in the external system.
10696+
/// For example, a JSON object on the ObjectBox side (string) would be converted to an embedded document in MongoDB.
10697+
/// It depends on the external system what kind of JSON structures is supported.
10698+
/// For MongoDB, this is very flexible and allows (nested) objects, arrays, primitives, etc.
10699+
/// Representing type: String
10700+
static const int JsonToNative = 112;
10701+
1069510702
/// A vector (array) of Int128 values
1069610703
static const int Int128Vector = 116;
1069710704

@@ -11669,7 +11676,7 @@ typedef obx_dart_closer
1166911676

1167011677
const int OBX_VERSION_MAJOR = 4;
1167111678

11672-
const int OBX_VERSION_MINOR = 2;
11679+
const int OBX_VERSION_MINOR = 3;
1167311680

1167411681
const int OBX_VERSION_PATCH = 0;
1167511682

objectbox_test/test/entity.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ class HnswObject {
476476
@ExternalName(name: 'my-mongo-entity')
477477
class EntityWithExternalType {
478478
@Id()
479+
@ExternalType(type: ExternalPropertyType.uuid)
479480
int id = 0;
480481

481482
@Property(type: PropertyType.byteVector)
@@ -490,6 +491,9 @@ class EntityWithExternalType {
490491
@ExternalName(name: 'my-mongo-rel')
491492
final mongoIdEntities = ToMany<EntityWithExternalType>();
492493

494+
@ExternalType(type: ExternalPropertyType.jsonToNative)
495+
String? externalJsonToNative;
496+
493497
EntityWithExternalType(this.mongoId, this.mongoUuid);
494498
}
495499

objectbox_test/test/objectbox-model.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,14 +727,15 @@
727727
},
728728
{
729729
"id": "16:5931645853908059165",
730-
"lastPropertyId": "3:7670802129899081197",
730+
"lastPropertyId": "4:6250975810854368520",
731731
"name": "EntityWithExternalType",
732732
"externalName": "my-mongo-entity",
733733
"properties": [
734734
{
735735
"id": "1:3044824951282217899",
736736
"name": "id",
737737
"type": 6,
738+
"externalType": 102,
738739
"flags": 1
739740
},
740741
{
@@ -749,6 +750,12 @@
749750
"type": 27,
750751
"externalType": 102,
751752
"externalName": "my-mongo-uuid"
753+
},
754+
{
755+
"id": "4:6250975810854368520",
756+
"name": "externalJsonToNative",
757+
"type": 9,
758+
"externalType": 112
752759
}
753760
],
754761
"relations": [

sync_flutter_libs/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ android {
5252
// ObjectBox Android library that includes an ObjectBox C library version compatible with
5353
// the C API binding of the ObjectBox Dart package.
5454
// https://central.sonatype.com/search?q=g:io.objectbox%20objectbox-sync-android
55-
implementation "io.objectbox:objectbox-sync-android:4.2.0"
55+
implementation "io.objectbox:objectbox-sync-android:4.3.0"
5656
}
5757
}

sync_flutter_libs/ios/objectbox_sync_flutter_libs.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818
s.source_files = 'Classes/**/*'
1919

2020
s.dependency 'Flutter'
21-
s.dependency 'ObjectBox', '4.2.0-sync'
21+
s.dependency 'ObjectBox', '4.3.0-sync'
2222

2323
# Flutter.framework does not contain a i386 slice.
2424
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }

sync_flutter_libs/linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
4444
# ----------------------------------------------------------------------
4545
# Download and add objectbox-c prebuilt library.
4646

47-
set(OBJECTBOX_VERSION 4.2.0)
47+
set(OBJECTBOX_VERSION 4.3.0)
4848

4949
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
5050
if (${OBJECTBOX_ARCH} MATCHES "x86_64")

sync_flutter_libs/macos/objectbox_sync_flutter_libs.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.source_files = 'Classes/**/*'
1515

1616
s.dependency 'FlutterMacOS'
17-
s.dependency 'ObjectBox', '4.2.0-sync'
17+
s.dependency 'ObjectBox', '4.3.0-sync'
1818

1919
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2020
s.swift_version = '5.3'

sync_flutter_libs/windows/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ set(objectbox_sync_flutter_libs_bundled_libraries
5050
# ----------------------------------------------------------------------
5151
# Download and add objectbox-c prebuilt library.
5252

53-
set(OBJECTBOX_VERSION 4.2.0)
53+
set(OBJECTBOX_VERSION 4.3.0)
5454

5555
set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
5656
if (${OBJECTBOX_ARCH} MATCHES "AMD64")

tool/update-c-binding.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# copies the header files, makes some required modifications
66
# and runs the ffigen binding generator on them.
77

8-
cLibVersion=4.2.0
8+
cLibVersion=4.3.0
99
echo "Downloading C library source files from GitHub..."
1010

1111
# Note: the release archives do not contain objectbox-dart.h, so get the full sources.

0 commit comments

Comments
 (0)