From bbf351f169a699361ef5fd4fccf919baba400edf Mon Sep 17 00:00:00 2001 From: Chin Yee Wen Date: Thu, 10 Sep 2026 18:04:22 +0800 Subject: [PATCH 1/4] update(BsonJson): add date and boolean support --- .idea/vcs.xml | 2 +- .../main/kotlin/ai/neuon/utility/bson/json/BsonJson.kt | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/json/src/main/kotlin/ai/neuon/utility/bson/json/BsonJson.kt b/json/src/main/kotlin/ai/neuon/utility/bson/json/BsonJson.kt index 1495211..5f71a5f 100644 --- a/json/src/main/kotlin/ai/neuon/utility/bson/json/BsonJson.kt +++ b/json/src/main/kotlin/ai/neuon/utility/bson/json/BsonJson.kt @@ -10,6 +10,8 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +@file:OptIn(ExperimentalTime::class) + package ai.neuon.utility.bson.json import kotlinx.serialization.json.JsonArray @@ -18,6 +20,8 @@ import kotlinx.serialization.json.buildJsonArray import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put import org.bson.BsonArray +import org.bson.BsonBoolean +import org.bson.BsonDateTime import org.bson.BsonDocument import org.bson.BsonDouble import org.bson.BsonInt32 @@ -25,6 +29,8 @@ import org.bson.BsonInt64 import org.bson.BsonNumber import org.bson.BsonObjectId import org.bson.BsonString +import kotlin.time.ExperimentalTime +import kotlin.time.Instant fun BsonArray.toJsonArray(): JsonArray = buildJsonArray { forEach { bson -> @@ -45,8 +51,11 @@ fun BsonDocument.toJsonObject(): JsonObject = buildJsonObject { is BsonDouble -> this.put(key, value.value) is BsonNumber -> this.put(key, value.doubleValue()) is BsonString -> this.put(key, value.value) + is BsonBoolean -> this.put(key, value.value) + is BsonDateTime -> this.put(key, Instant.fromEpochMilliseconds(value.value).toString()) is BsonArray -> this.put(key, value.toJsonArray()) is BsonDocument -> this.put(key, value.toJsonObject()) + else -> {} } } } \ No newline at end of file -- 2.49.1 From 74f7ca2db2e5f7dbaedce92fec9861334acaa2e0 Mon Sep 17 00:00:00 2001 From: Chin Yee Wen Date: Thu, 10 Sep 2026 18:13:40 +0800 Subject: [PATCH 2/4] release -> v0.1.2 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index d4c0622..f309580 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,4 +3,4 @@ plugins { } group = "ai.neuon.utility" -version = "0.1.1" \ No newline at end of file +version = "0.1.2" \ No newline at end of file -- 2.49.1 From 93f2f822d449281da7027d2372c9ea77da96f841 Mon Sep 17 00:00:00 2001 From: Chin Yee Wen Date: Thu, 10 Sep 2026 18:04:22 +0800 Subject: [PATCH 3/4] update(BsonJson): add date and boolean support -- 2.49.1 From 30bbe58e49778ec750d9b9c99c3c97fe9241f03f Mon Sep 17 00:00:00 2001 From: Chin Yee Wen Date: Thu, 10 Sep 2026 18:13:40 +0800 Subject: [PATCH 4/4] release -> v0.1.2 -- 2.49.1