diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e63dc1..b078be98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,22 @@ ## [Unreleased] ### Added +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security + +## [0.5.2] +### Added +- Yaml plugin +- Partial fix to #53 + + ### Changed ### Deprecated @@ -14,11 +30,14 @@ - Listeners in observable meta are replaced by lists - JS number comparison bug. + ### Security + ## [0.5.0] ### Added - Experimental `listOfSpec` delegate. + ### Changed - **API breaking** Config is deprecated, use `ObservableMeta` instead. - **API breaking** Descriptor no has a member property `defaultValue` instead of `defaultItem()` extension. It caches default value state on the first call. It is done because computing default on each call is too expensive. @@ -29,17 +48,18 @@ - **API breaking** `String.toName()` is replaced by `Name.parse()` - **API breaking** Configurable`config` changed to `meta` + ### Removed - `Config` - Public PluginManager mutability - Tables and tables-exposed moved to the separate project `tables.kt` - BinaryMetaFormat. Use CBOR encoding instead + ### Fixed - Proper json array index treatment. - Proper json index for single-value array. -### Security ## [0.4.0] ### Added - LogManager plugin @@ -47,6 +67,7 @@ - Context `withEnv` and `fetch` methods to manipulate plugins without changing plugins after creation. - Split `ItemDescriptor` into builder and read-only part + ### Changed - Kotlin-logging moved from common to JVM and JS. Replaced by console for native. - Package changed to `space.kscience` @@ -56,18 +77,19 @@ - Added blank builders for children context. - Refactor loggers + ### Deprecated - Direct use of PluginManager + ### Removed - Common dependency on Kotlin-logging - Kotlinx-io fork dependency. Replaced by Ktor-io. + ### Fixed - Scheme properties properly handle children property change. -### Security - ## [0.3.0] ### Added - Yaml meta format based on yaml.kt @@ -76,6 +98,7 @@ - `copy` method to descriptors - Multiplatform yaml meta + ### Changed - `ListValue` and `DoubleArrayValue` implement `Iterable`. - Changed the logic of `Value::isList` to check for type instead of size @@ -90,17 +113,7 @@ - \[Major breaking change\] Full refactor of DataTree/DataSource - \[Major Breaking change\] Replace KClass with KType in data. Remove direct access to constructors with types. -### Deprecated - -### Removed - -### Fixed - -### Security - ## [0.2.0] -### Added - ### Changed - Context content resolution refactor - Kotlin 1.4.10 (build tools 0.6.0) @@ -110,16 +123,17 @@ - Removed io depdendency from `dataforge-output`. Replaced Output by Appendable. - Configurable is no longer MutableItemProvider. All functionality moved to Scheme. + ### Deprecated - Context activation API - TextRenderer + ### Removed - Functional server prototype - `dataforge-output` module + ### Fixed - Global context CoroutineScope resolution -- Library mode compliance - -### Security +- Library mode compliance \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 8c9f0b6e..61588f0a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.5.2-dev-4" + version = "0.5.2" repositories{ mavenCentral() } diff --git a/dataforge-context/api/dataforge-context.api b/dataforge-context/api/dataforge-context.api index 65bcc846..c38ca6e5 100644 --- a/dataforge-context/api/dataforge-context.api +++ b/dataforge-context/api/dataforge-context.api @@ -33,8 +33,8 @@ public final class space/kscience/dataforge/context/ClassLoaderPluginKt { public class space/kscience/dataforge/context/Context : kotlinx/coroutines/CoroutineScope, space/kscience/dataforge/meta/MetaRepr, space/kscience/dataforge/misc/Named, space/kscience/dataforge/provider/Provider { public static final field Companion Lspace/kscience/dataforge/context/Context$Companion; public static final field PROPERTY_TARGET Ljava/lang/String; - public final fun buildContext (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lspace/kscience/dataforge/context/Context; - public static synthetic fun buildContext$default (Lspace/kscience/dataforge/context/Context;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/dataforge/context/Context; + public final fun buildContext (Lspace/kscience/dataforge/names/Name;Lkotlin/jvm/functions/Function1;)Lspace/kscience/dataforge/context/Context; + public static synthetic fun buildContext$default (Lspace/kscience/dataforge/context/Context;Lspace/kscience/dataforge/names/Name;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/dataforge/context/Context; public fun close ()V public fun content (Ljava/lang/String;)Ljava/util/Map; public final fun content (Ljava/lang/String;Z)Ljava/util/Map; @@ -57,7 +57,6 @@ public abstract interface class space/kscience/dataforge/context/ContextAware { public final class space/kscience/dataforge/context/ContextBuilder { public final fun build ()Lspace/kscience/dataforge/context/Context; public final fun getName ()Lspace/kscience/dataforge/names/Name; - public final fun name (Ljava/lang/String;)V public final fun plugin (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V public final fun plugin (Lspace/kscience/dataforge/context/Plugin;)V public final fun plugin (Lspace/kscience/dataforge/context/PluginFactory;Lkotlin/jvm/functions/Function1;)V @@ -67,11 +66,9 @@ public final class space/kscience/dataforge/context/ContextBuilder { public static synthetic fun plugin$default (Lspace/kscience/dataforge/context/ContextBuilder;Lspace/kscience/dataforge/context/PluginFactory;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V public static synthetic fun plugin$default (Lspace/kscience/dataforge/context/ContextBuilder;Lspace/kscience/dataforge/context/PluginTag;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V public final fun properties (Lkotlin/jvm/functions/Function1;)V - public final fun setName (Lspace/kscience/dataforge/names/Name;)V } public final class space/kscience/dataforge/context/ContextBuilderKt { - public static final fun withEnv (Lspace/kscience/dataforge/context/Context;Lkotlin/jvm/functions/Function1;)Lspace/kscience/dataforge/context/Context; } public final class space/kscience/dataforge/context/DefaultLogManager : space/kscience/dataforge/context/AbstractPlugin, space/kscience/dataforge/context/LogManager { diff --git a/dataforge-meta/api/dataforge-meta.api b/dataforge-meta/api/dataforge-meta.api index d1792538..03075958 100644 --- a/dataforge-meta/api/dataforge-meta.api +++ b/dataforge-meta/api/dataforge-meta.api @@ -365,6 +365,8 @@ public class space/kscience/dataforge/meta/Scheme : space/kscience/dataforge/met } public final class space/kscience/dataforge/meta/SchemeKt { + public static final fun copy (Lspace/kscience/dataforge/meta/Scheme;Lspace/kscience/dataforge/meta/SchemeSpec;Lkotlin/jvm/functions/Function1;)Lspace/kscience/dataforge/meta/Scheme; + public static synthetic fun copy$default (Lspace/kscience/dataforge/meta/Scheme;Lspace/kscience/dataforge/meta/SchemeSpec;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/dataforge/meta/Scheme; public static final fun invoke (Lspace/kscience/dataforge/meta/Scheme;Lkotlin/jvm/functions/Function1;)Lspace/kscience/dataforge/meta/Scheme; public static final fun retarget (Lspace/kscience/dataforge/meta/Scheme;Lspace/kscience/dataforge/meta/MutableMeta;)Lspace/kscience/dataforge/meta/Scheme; } @@ -726,6 +728,7 @@ public final class space/kscience/dataforge/names/NameKt { public static final fun getLength (Lspace/kscience/dataforge/names/Name;)I public static final fun isEmpty (Lspace/kscience/dataforge/names/Name;)Z public static final fun lastOrNull (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/dataforge/names/NameToken; + public static final fun parseAsName (Ljava/lang/String;)Lspace/kscience/dataforge/names/Name; public static final fun plus (Lspace/kscience/dataforge/names/Name;Ljava/lang/String;)Lspace/kscience/dataforge/names/Name; public static final fun plus (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/dataforge/names/Name; public static final fun plus (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/names/NameToken;)Lspace/kscience/dataforge/names/Name; diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt index e1661e53..d39a6dbf 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/MutableMeta.kt @@ -296,9 +296,7 @@ private class MutableMetaImpl( override fun attach(name: Name, node: ObservableMutableMeta) { when (name.length) { 0 -> error("Can't set a meta with empty name") - 1 -> { - replaceItem(name.first(), get(name), node) - } + 1 -> replaceItem(name.first(), get(name), node) else -> get(name.cutLast())?.attach(name.lastOrNull()!!.asName(), node) } } diff --git a/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MutableMetaTest.kt b/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MutableMetaTest.kt index 534d907e..0d47db99 100644 --- a/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MutableMetaTest.kt +++ b/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MutableMetaTest.kt @@ -2,10 +2,11 @@ package space.kscience.dataforge.meta import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertFails class MutableMetaTest{ @Test - fun testRemove(){ + fun remove(){ val meta = MutableMeta { "aNode" put { "innerNode" put { @@ -19,4 +20,13 @@ class MutableMetaTest{ meta.remove("aNode.c") assertEquals(meta["aNode.c"], null) } + + @Test + fun recursiveMeta(){ + val meta = MutableMeta { + "a" put 2 + } + + assertFails { meta["child.a"] = meta} + } } \ No newline at end of file