diff --git a/.sol-migration-run-20260817T110101Z/REPORT.md b/.sol-migration-run-20260817T110101Z/REPORT.md new file mode 100644 index 0000000000..7e3f11a2d0 --- /dev/null +++ b/.sol-migration-run-20260817T110101Z/REPORT.md @@ -0,0 +1,180 @@ +# Sol migration report: TelegramBotAPI + +## Outcome + +- repository: `/home/aleksey/projects/own/TelegramBotAPI` +- cutoff: `2025-08-17` +- starting branch: `36.0.0` +- starting commit: `8bee8982bb904b80f1f563774a73e5a455f4d7c0` +- upstream relation: `36.0.0...origin/36.0.0`, ahead `0`, behind `0` +- starting status: dirty non-master; root status entry=` M codex-master-baseline`; nested checkout status=`## HEAD (no branch)` plus untracked `.codex-gradle/` +- master: local and remote equal at `c7761fd29494e6586a449163a2e48cd7a70a6cef` +- branch gate: failed; dirty non-master checkout cannot be switched or modified +- migration work: not started +- reason: dirty non-master branch is an explicit blocking condition; existing user state was preserved + +## Active/legacy classification + +- result: active +- substantive activity after cutoff: release branches `28.0.1` through `36.0.0` include commits from `2025-09-04` through `2026-08-17`; `master` activity=`2026-07-01`; `init_kdocs` activity=`2026-07-05`; `kdocs` activity=`2026-07-01`; current `36.0.0` activity=`2026-08-17` +- Maven-primary criterion: satisfied by static master configuration; `gradle/templates/mpp_publish.gradle` applies `maven-publish`, seven library modules apply the publication template, and root configuration uses Maven Central/NMCP aggregation +- legacy result: false + +## Branch inventory and classification + +- Git verification: local refs=`279`; remote `origin` refs excluding symbolic `origin/HEAD`=`375`; unique logical branch names=`401` +- helper inventory: `.sol-migration-run-20260817T110101Z/inventory/logical-branches.txt` contains all `401` logical names plus the non-branch pseudo-entry `HEAD`; missing logical names=`0` +- release-style logical names: `311`; classification=`substantive` for every release-style name in the helper inventory because version/release-style names are substantive regardless of diff +- dependency-update-only logical names: `76`; classification=`ignored`; complete branch-to-dependency mapping appears below +- remaining non-release logical names: `14`; classification=`substantive`; complete mapping appears below +- total classified: `311 + 76 + 14 = 401`; equality with verified unique logical count=`true` +- local/remote tip mismatches: `0.24.0`, `0.32.10`, `10.0.1`, `12.0.0`, `12.0.1`, `14.0.0`, `14.0.2`, `15.1.0`, `24.0.0`, `24.0.2`, `26.0.0`, `29.0.0`, `3.2.1`, `3.3.0`, `33.0.0`, `33.2.0`, `4.0.0`, `4.1.3`, `4.2.4`, `5.0.0`, `6.0.2`, `6.0.3`, `8.0.0`, `9.0.0`, `9.1.0`, `9.4.0`, `task/676-rework_of_media_groups`; every version-style mismatch remains substantive by name; both task-branch tips contain substantive media-group work + +### Ignored dependency-update-only branches + +Actual base for every entry below is the branch tip's first parent. Diff review found only the named logical dependency version update; coordinated alias/wrapper changes remain one logical dependency. + +- `gradle-wrapper/6.9` → Gradle wrapper (`6.8.3` → `6.9`) +- `renovate/com.benasher44-uuid-0.x` → `com.benasher44:uuid` +- `renovate/com.jfrog.bintray.gradle-gradle-bintray-plugin-1.x` → Gradle Bintray plugin +- `renovate/com.soywiz.korlibs.klock-klock-1.x` → Korlibs Klock +- `renovate/com.soywiz.korlibs.klock-klock-2.x` → Korlibs Klock +- `renovate/dev.inmo-micro_utils.coroutines-0.x` → MicroUtils family +- `renovate/dev.inmo-micro_utils.crypto-0.x` → MicroUtils family +- `renovate/dev.inmo-micro_utils.serialization.base64-0.x` → MicroUtils family +- `renovate/dev.inmo-micro_utils.serialization.encapsulator-0.x` → MicroUtils family +- `renovate/dev.inmo-micro_utils.serialization.typed_serializer-0.x` → MicroUtils family +- `renovate/dokka` → Dokka +- `renovate/dokka_version` → Dokka +- `renovate/github.release.plugin` → GitHub Release Gradle plugin +- `renovate/github_release_plugin_version` → GitHub Release Gradle plugin +- `renovate/gradle-6.x` → Gradle wrapper +- `renovate/gradle-7.x` → Gradle wrapper +- `renovate/gradle-8.x` → Gradle wrapper +- `renovate/gradle-9.x` → Gradle wrapper +- `renovate/io.ktor-ktor-client-cio-1.x` → Ktor family +- `renovate/io.ktor-ktor-client-core-1.x` → Ktor family +- `renovate/io.ktor-ktor-server-1.x` → Ktor family +- `renovate/io.ktor-ktor-server-host-common-1.x` → Ktor family +- `renovate/klock_version` → Korlibs Klock +- `renovate/korlibs` → Korlibs family +- `renovate/kotlin` → Kotlin family +- `renovate/kotlin-coroutines` → kotlinx.coroutines +- `renovate/kotlin-monorepo` → Kotlin family +- `renovate/kotlin-poet` → KotlinPoet +- `renovate/kotlin-serialization` → kotlinx.serialization +- `renovate/kotlin.coroutines` → kotlinx.coroutines +- `renovate/kotlin.poet` → KotlinPoet +- `renovate/kotlin.serialization` → kotlinx.serialization +- `renovate/kotlin_coroutines_version` → kotlinx.coroutines +- `renovate/kotlin_serialisation_runtime_version` → kotlinx.serialization +- `renovate/kotlin_version` → Kotlin family +- `renovate/kotlinx-coroutines-monorepo` → kotlinx.coroutines +- `renovate/kslog` → KSLog +- `renovate/ksp` → Kotlin Symbol Processing +- `renovate/ksp-monorepo` → Kotlin Symbol Processing +- `renovate/ktor` → Ktor family +- `renovate/ktor-monorepo` → Ktor family +- `renovate/ktor_version` → Ktor family +- `renovate/major-dokka` → Dokka +- `renovate/major-kotlin` → Kotlin family +- `renovate/major-kotlin-monorepo` → Kotlin family +- `renovate/major-kotlin.poet` → KotlinPoet +- `renovate/major-ksp` → Kotlin Symbol Processing +- `renovate/major-ktor-monorepo` → Ktor family +- `renovate/major-ktor_version` → Ktor family +- `renovate/micro_utils_version` → MicroUtils family +- `renovate/microutils` → MicroUtils family +- `renovate/nmcp` → NMCP aggregation plugin +- `renovate/org.jetbrains.dokka-1.x` → Dokka +- `renovate/org.jetbrains.dokka-dokka-gradle-plugin-0.x` → Dokka +- `renovate/org.jetbrains.dokka-dokka-gradle-plugin-1.x` → Dokka +- `renovate/org.jetbrains.dokka-gfm-plugin-1.x` → Dokka +- `renovate/org.jetbrains.dokka-org.jetbrains.dokka.gradle.plugin-0.x` → Dokka +- `renovate/org.jetbrains.dokka-org.jetbrains.dokka.gradle.plugin-1.x` → Dokka +- `renovate/org.jetbrains.kotlin-kotlin-gradle-plugin-1.x` → Kotlin family +- `renovate/org.jetbrains.kotlin-kotlin-serialization-1.x` → Kotlin family +- `renovate/org.jetbrains.kotlin.multiplatform-1.x` → Kotlin family +- `renovate/org.jetbrains.kotlin.multiplatform-org.jetbrains.kotlin.multiplatform.gradle.plugin-1.x` → Kotlin family +- `renovate/org.jetbrains.kotlin.plugin.serialization-1.x` → Kotlin family +- `renovate/org.jetbrains.kotlin.plugin.serialization-org.jetbrains.kotlin.plugin.serialization.gradle.plugin-1.x` → Kotlin family +- `renovate/org.jetbrains.kotlinx-kotlinx-coroutines-core-1.x` → kotlinx.coroutines +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-json-1.x` → kotlinx.serialization JSON +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-properties-1.x` → kotlinx.serialization +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-properties-common-0.x` → kotlinx.serialization +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-properties-js-0.x` → kotlinx.serialization +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-runtime-0.x` → kotlinx.serialization +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-runtime-common-0.x` → kotlinx.serialization +- `renovate/org.jetbrains.kotlinx-kotlinx-serialization-runtime-js-0.x` → kotlinx.serialization +- `renovate/uuid` → `com.benasher44:uuid` +- `renovate/uuid_version` → `com.benasher44:uuid` +- `renovate/validator` → Kotlin binary compatibility validator +- `renovate/versions` → Ben Manes Versions plugin + +### Substantive non-release branches + +- `feature/fsm` → feature history plus README change +- `feature/passport` → passport types and Base64 implementation +- `garbage` → `CHANGELOG.md` change; changelog rule forces substantive classification +- `implement_telegram_passport` → request/response implementation plus `CHANGELOG.md` +- `init_kdocs` → extensive KDoc source changes; activity after cutoff +- `kdocs` → generated documentation deployment; activity after cutoff +- `klassindex` → documentation/build/test implementation changes +- `lib_to_common` → publication implementation changes +- `master` → primary integration branch; activity after cutoff +- `new_branch` → `CHANGELOG.md` plus dependency changes; changelog rule forces substantive classification +- `play_with_dependabot` → comments out `apply from: "publish.gradle"`; behavior change is not a dependency-version update +- `task/28-migration_to_mpp` → multiplatform migration implementation +- `task/676-rework_of_media_groups` → media-group API/core implementation on both unequal local and remote tips +- `tg_channel_imh` → repository image asset history + +## Gradle project/module discovery + +- Gradle execution: skipped because the dirty non-master branch gate failed and unrelated Gradle processes were present; no daemon/process was reused, stopped, or modified +- master static project paths from `settings.gradle`: `:`, `:tgbotapi.core`, `:tgbotapi.ksp`, `:tgbotapi.api`, `:tgbotapi.utils`, `:tgbotapi.behaviour_builder`, `:tgbotapi.behaviour_builder.fsm`, `:tgbotapi`, `:tgbotapi.webapps`, `:docs` +- pre-migration dynamic module list: unavailable because Gradle execution was prohibited by the branch gate +- pre-migration reliable static module list: `[:, :tgbotapi.core, :tgbotapi.ksp, :tgbotapi.api, :tgbotapi.utils, :tgbotapi.behaviour_builder, :tgbotapi.behaviour_builder.fsm, :tgbotapi, :tgbotapi.webapps, :docs]` +- post-migration module list: unavailable because no migration occurred +- pre/post module equality: not evaluated; no equality claim + +## `publishToMavenLocal` and Maven manifests + +- `publishToMavenLocal` existence: static yes for `:tgbotapi.core`, `:tgbotapi.api`, `:tgbotapi.utils`, `:tgbotapi.behaviour_builder`, `:tgbotapi.behaviour_builder.fsm`, `:tgbotapi`, `:tgbotapi.webapps`; each module applies `gradle/templates/mpp_publish.gradle`, which applies `maven-publish` +- static no for `:tgbotapi.ksp` and `:docs`; root `:` does not directly apply `maven-publish` +- dynamic task existence verification: not run because the branch gate failed +- baseline Maven repository: not created +- baseline publication: not run +- baseline manifest: unavailable; no GAV/packaging/artifact/module mapping claim +- post Maven repository: not created +- post publication: not run +- post manifest: unavailable; no GAV/packaging/artifact/module mapping claim +- baseline/post manifest equality: not evaluated; no equality claim + +## Files and changes + +- tracked files changed by migration worker: none +- migration files changed: none +- pre-existing root worktree change preserved: `codex-master-baseline` gitlink reports nested untracked `.codex-gradle/` +- report artifact created: `.sol-migration-run-20260817T110101Z/REPORT.md` +- pre-existing inventory artifact retained: `.sol-migration-run-20260817T110101Z/inventory/logical-branches.txt` +- scope incident: branch-audit command accidentally created `/tmp/tgbot-logical.2283369.txt` outside the assigned repository +- scope remediation: exact accidental file `/tmp/tgbot-logical.2283369.txt` deleted with `apply_patch`; subsequent read-only absence check passed +- repository Gradle/Maven artifact paths created by migration worker: none + +## Commands and validation results + +- Git ref inventory/classification commands: exit `0` +- Git status/branch-gate commands: exit `0`; result=`dirty non-master blocked` +- static master settings/build/publication inspection: exit `0` +- Gradle module discovery: not run +- `kspCommonMainKotlinMetadata`: not run +- `apiDump`: not run +- build/test commands: not run +- `publishToMavenLocal`: not run +- baseline/post artifact equality: not evaluated +- module equality: not evaluated + +## Final status + +- final status: blocked +- reason: checkout started on dirty non-master branch `36.0.0`; explicit branch gate prohibited checkout, Gradle execution, baseline publication, tracked modification, and migration diff --git a/CHANGELOG.md b/CHANGELOG.md index c2c8b8d93c..510a5b006d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ **Breaking changes**: * `RichBlockTableCell.align` now uses the string-serialized `RichBlockTableCellAlign` sealed hierarchy (`Left`, `Center`, or `Right`) instead of `String` +* `RichBlockTableCell.valign` now uses the string-serialized `RichBlockTableCellVAlign` sealed hierarchy (`Top`, `Middle`, or `Bottom`) instead of `String` * `RichBlockTableCell` is now a sealed interface with `Header` and `Regular` implementations; the input table DSL uses `headerCell` and `cell` respectively * `InputRichBlockListItem` is now a sealed interface with `Ordered` and `Unordered` implementations; ordered items require a non-null `value` and typed `LabelType`, while `LabelType.Decimals` is the default; `InputRichBlocksBuilder` now exposes separate `orderedList` and `unorderedList` DSL functions with matching item builders * `ReplyParameters` is now a sealed interface with nested `ReplyParameters.Chat` and `ReplyParameters.Ephemeral` implementations; overloaded `ReplyParameters(...)` companion factories construct both regular-message and ephemeral-message variants @@ -16,6 +17,7 @@ **Migration advice**: Keep `ReplyParameters(...)` for both chat-message and ephemeral-message targets; explicit `ReplyParameters.Ephemeral(...)` subtype construction also remains available; pass `receiverUser`/`ephemeralMessageId` explicitly (or rely on their `null` default) when constructing the 4 group-family message implementations positionally * `Core`: + * (`Rich Messages`) Added the raw-string-serialized `RichBlockTableCellVAlign` hierarchy and migrated table-cell vertical alignment from `String` to `RichBlockTableCellVAlign` * (`Rich Messages`) Added the raw-string-serialized `RichBlockTableCellAlign` hierarchy and migrated table-cell alignment from `String` to `RichBlockTableCellAlign` * (`Rich Messages`) Split `RichBlockTableCell` into header/regular variants with a shared flat surrogate serializer; added `headerCell` to the input table DSL * (`Rich Messages`) Added `h1` through `h6` shortcuts for plain and rich-text headings in `InputRichBlocksBuilder` diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 0567164bb8..178103c57e 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -35863,10 +35863,10 @@ public final class dev/inmo/tgbotapi/types/rich/InputRichBlockTableBuilder { public final class dev/inmo/tgbotapi/types/rich/InputRichBlockTableRowBuilder { public fun ()V public final fun build ()Ljava/util/List; - public final fun cell (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)V - public static synthetic fun cell$default (Ldev/inmo/tgbotapi/types/rich/InputRichBlockTableRowBuilder;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V - public final fun headerCell (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)V - public static synthetic fun headerCell$default (Ldev/inmo/tgbotapi/types/rich/InputRichBlockTableRowBuilder;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V + public final fun cell (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)V + public static synthetic fun cell$default (Ldev/inmo/tgbotapi/types/rich/InputRichBlockTableRowBuilder;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V + public final fun headerCell (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;)V + public static synthetic fun headerCell$default (Ldev/inmo/tgbotapi/types/rich/InputRichBlockTableRowBuilder;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V } public final class dev/inmo/tgbotapi/types/rich/InputRichBlockThinking : dev/inmo/tgbotapi/types/rich/InputRichBlock { @@ -36937,7 +36937,7 @@ public abstract interface class dev/inmo/tgbotapi/types/rich/RichBlockTableCell public abstract fun getColspan ()Ljava/lang/Integer; public abstract fun getRowspan ()Ljava/lang/Integer; public abstract fun getText ()Ldev/inmo/tgbotapi/types/rich/RichText; - public abstract fun getValign ()Ljava/lang/String; + public abstract fun getValign ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign; } public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCell$Companion { @@ -36946,21 +36946,21 @@ public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCell$Companion { public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header : dev/inmo/tgbotapi/types/rich/RichBlockTableCell { public static final field Companion Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header$Companion; - public fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/rich/RichText; public final fun component2 ()Ljava/lang/Integer; public final fun component3 ()Ljava/lang/Integer; public final fun component4 ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign; - public final fun component5 ()Ljava/lang/String; - public final fun copy (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header;Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header; + public final fun component5 ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign; + public final fun copy (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header;Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header; public fun equals (Ljava/lang/Object;)Z public fun getAlign ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign; public fun getColspan ()Ljava/lang/Integer; public fun getRowspan ()Ljava/lang/Integer; public fun getText ()Ldev/inmo/tgbotapi/types/rich/RichText; - public fun getValign ()Ljava/lang/String; + public fun getValign ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -36971,21 +36971,21 @@ public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCell$Header$Compan public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular : dev/inmo/tgbotapi/types/rich/RichBlockTableCell { public static final field Companion Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular$Companion; - public fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/rich/RichText; public final fun component2 ()Ljava/lang/Integer; public final fun component3 ()Ljava/lang/Integer; public final fun component4 ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign; - public final fun component5 ()Ljava/lang/String; - public final fun copy (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular;Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular; + public final fun component5 ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign; + public final fun copy (Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular;Ldev/inmo/tgbotapi/types/rich/RichText;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCell$Regular; public fun equals (Ljava/lang/Object;)Z public fun getAlign ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign; public fun getColspan ()Ljava/lang/Integer; public fun getRowspan ()Ljava/lang/Integer; public fun getText ()Ldev/inmo/tgbotapi/types/rich/RichText; - public fun getValign ()Ljava/lang/String; + public fun getValign ()Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -37048,6 +37048,51 @@ public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCellAlign$Serializ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V } +public abstract interface class dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign { + public static final field Companion Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Companion; + public abstract fun getName ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Bottom : dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Bottom; + public fun equals (Ljava/lang/Object;)Z + public fun getName ()Ljava/lang/String; + public fun hashCode ()I + public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Middle : dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Middle; + public fun equals (Ljava/lang/Object;)Z + public fun getName ()Ljava/lang/String; + public fun hashCode ()I + public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Serializer : kotlinx/serialization/KSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Serializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V +} + +public final class dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Top : dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign$Top; + public fun equals (Ljava/lang/Object;)Z + public fun getName ()Ljava/lang/String; + public fun hashCode ()I + public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; +} + public final class dev/inmo/tgbotapi/types/rich/RichBlockThinking : dev/inmo/tgbotapi/types/rich/RichBlock { public static final field Companion Ldev/inmo/tgbotapi/types/rich/RichBlockThinking$Companion; public static final field TYPE Ljava/lang/String; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDsl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDsl.kt index 0c049b8c24..3ecc57e838 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDsl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDsl.kt @@ -56,7 +56,7 @@ class InputRichBlockTableRowBuilder { fun cell( align: RichBlockTableCellAlign, - valign: String, + valign: RichBlockTableCellVAlign, colspan: Int? = null, rowspan: Int? = null, block: RichTextBuilder.() -> Unit @@ -66,7 +66,7 @@ class InputRichBlockTableRowBuilder { fun headerCell( align: RichBlockTableCellAlign, - valign: String, + valign: RichBlockTableCellVAlign, colspan: Int? = null, rowspan: Int? = null, block: RichTextBuilder.() -> Unit diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockParts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockParts.kt index 17d5610e6e..383ee1726a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockParts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockParts.kt @@ -45,7 +45,7 @@ sealed interface RichBlockTableCell { val colspan: Int? val rowspan: Int? val align: RichBlockTableCellAlign - val valign: String + val valign: RichBlockTableCellVAlign @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Serializer::class) @@ -59,7 +59,7 @@ sealed interface RichBlockTableCell { @SerialName(alignField) override val align: RichBlockTableCellAlign, @SerialName(valignField) - override val valign: String + override val valign: RichBlockTableCellVAlign ) : RichBlockTableCell @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @@ -74,7 +74,7 @@ sealed interface RichBlockTableCell { @SerialName(alignField) override val align: RichBlockTableCellAlign, @SerialName(valignField) - override val valign: String + override val valign: RichBlockTableCellVAlign ) : RichBlockTableCell object Serializer : KSerializer { @@ -92,7 +92,7 @@ sealed interface RichBlockTableCell { @SerialName(alignField) val align: RichBlockTableCellAlign, @SerialName(valignField) - val valign: String + val valign: RichBlockTableCellVAlign ) override val descriptor: SerialDescriptor = Surrogate.serializer().descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign.kt new file mode 100644 index 0000000000..187d738888 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockTableCellVAlign.kt @@ -0,0 +1,52 @@ +package dev.inmo.tgbotapi.types.rich + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationException +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +/** Vertical alignment of a [RichBlockTableCell]. */ +@Serializable(RichBlockTableCellVAlign.Serializer::class) +sealed interface RichBlockTableCellVAlign { + val name: String + + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @Serializable(Serializer::class) + data object Top : RichBlockTableCellVAlign { + override val name: String = "top" + } + + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @Serializable(Serializer::class) + data object Middle : RichBlockTableCellVAlign { + override val name: String = "middle" + } + + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @Serializable(Serializer::class) + data object Bottom : RichBlockTableCellVAlign { + override val name: String = "bottom" + } + + object Serializer : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor( + "RichBlockTableCellVAlign", + PrimitiveKind.STRING + ) + + override fun deserialize(decoder: Decoder): RichBlockTableCellVAlign = when (val name = decoder.decodeString()) { + Top.name -> Top + Middle.name -> Middle + Bottom.name -> Bottom + else -> throw SerializationException("Unknown RichBlockTableCell vertical alignment: $name") + } + + override fun serialize(encoder: Encoder, value: RichBlockTableCellVAlign) { + encoder.encodeString(value.name) + } + } +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlocks.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlocks.kt index bb61ebabb1..7e7bfd265c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlocks.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/rich/RichBlocks.kt @@ -437,7 +437,7 @@ data class RichBlockTable( cell.colspan?.let { append(" colspan=\"$it\"") } cell.rowspan?.let { append(" rowspan=\"$it\"") } append(" align=\"${cell.align.name}\"") - append(" valign=\"${cell.valign}\"") + append(" valign=\"${cell.valign.name}\"") } "<$tag$cellAttributes>${cell.text?.html ?: ""}" } diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDslTest.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDslTest.kt index 5ee157b09b..4bc42e44bc 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDslTest.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichBlocksDslTest.kt @@ -84,12 +84,12 @@ class InputRichBlocksDslTest { val blocks = buildInputRichBlocks { table(isBordered = true, isStriped = false, caption = RichTextPlain("caption")) { row { - headerCell(align = RichBlockTableCellAlign.Left, valign = "top", colspan = 2) { + headerCell(align = RichBlockTableCellAlign.Left, valign = RichBlockTableCellVAlign.Top, colspan = 2) { bold("heading") } } row { - cell(align = RichBlockTableCellAlign.Center, valign = "middle", rowspan = 2) { + cell(align = RichBlockTableCellAlign.Center, valign = RichBlockTableCellVAlign.Middle, rowspan = 2) { plain("value") } } @@ -105,7 +105,7 @@ class InputRichBlocksDslTest { text = RichTextBold(RichTextPlain("heading")), colspan = 2, align = RichBlockTableCellAlign.Left, - valign = "top" + valign = RichBlockTableCellVAlign.Top ) ), listOf( @@ -113,7 +113,7 @@ class InputRichBlocksDslTest { text = RichTextPlain("value"), rowspan = 2, align = RichBlockTableCellAlign.Center, - valign = "middle" + valign = RichBlockTableCellVAlign.Middle ) ) ), diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichMessageSerializationTest.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichMessageSerializationTest.kt index afd9617e14..51111b3d04 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichMessageSerializationTest.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/InputRichMessageSerializationTest.kt @@ -61,7 +61,7 @@ class InputRichMessageSerializationTest { fun encodesTableReusingReceivedCellType() { val table = InputRichBlockTable( cells = listOf( - listOf(RichBlockTableCell.Header(RichTextPlain("h1"), align = RichBlockTableCellAlign.Left, valign = "top")) + listOf(RichBlockTableCell.Header(RichTextPlain("h1"), align = RichBlockTableCellAlign.Left, valign = RichBlockTableCellVAlign.Top)) ) ) val message = InputRichMessageBlocks(blocks = listOf(table)) @@ -69,13 +69,14 @@ class InputRichMessageSerializationTest { val tableJson = json.encodeToJsonElement(InputRichMessage.serializer(), message).jsonObject["blocks"]!!.jsonArray[0].jsonObject val cell = tableJson["cells"]!!.jsonArray[0].jsonArray[0].jsonObject assertEquals("left", cell["align"]?.jsonPrimitive?.content) + assertEquals("top", cell["valign"]?.jsonPrimitive?.content) assertEquals(true, cell["is_header"]?.jsonPrimitive?.boolean) } @Test fun serializesTableCellVariantsWithSharedFlatShape() { - val header: RichBlockTableCell = RichBlockTableCell.Header(RichTextPlain("h"), align = RichBlockTableCellAlign.Left, valign = "top") - val regular: RichBlockTableCell = RichBlockTableCell.Regular(RichTextPlain("v"), align = RichBlockTableCellAlign.Right, valign = "bottom") + val header: RichBlockTableCell = RichBlockTableCell.Header(RichTextPlain("h"), align = RichBlockTableCellAlign.Left, valign = RichBlockTableCellVAlign.Top) + val regular: RichBlockTableCell = RichBlockTableCell.Regular(RichTextPlain("v"), align = RichBlockTableCellAlign.Right, valign = RichBlockTableCellVAlign.Bottom) val headerElement = json.encodeToJsonElement(RichBlockTableCell.Serializer, header).jsonObject val regularElement = json.encodeToJsonElement(RichBlockTableCell.Serializer, regular).jsonObject @@ -108,6 +109,28 @@ class InputRichMessageSerializationTest { } } + @Test + fun serializesEveryTableCellVerticalAlignmentAsItsName() { + val alignments = listOf( + RichBlockTableCellVAlign.Top, + RichBlockTableCellVAlign.Middle, + RichBlockTableCellVAlign.Bottom + ) + + alignments.forEach { alignment -> + val encoded = json.encodeToString(RichBlockTableCellVAlign.Serializer, alignment) + assertEquals("\"${alignment.name}\"", encoded) + assertEquals(alignment, json.decodeFromString(RichBlockTableCellVAlign.Serializer, encoded)) + } + } + + @Test + fun rejectsUnknownTableCellVerticalAlignment() { + assertFailsWith { + json.decodeFromString(RichBlockTableCellVAlign.Serializer, "\"baseline\"") + } + } + @Test fun encodesPhotoBlockMedia() { val photoBlock = InputRichBlockPhoto(TelegramMediaPhoto(FileId("photo_file_id"))) diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockFormattingTest.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockFormattingTest.kt index fb8a155592..a73d36d289 100644 --- a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockFormattingTest.kt +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/rich/RichBlockFormattingTest.kt @@ -108,12 +108,12 @@ class RichBlockFormattingTest { val block = RichBlockTable( listOf( listOf( - RichBlockTableCell.Header(text = RichTextPlain("H1"), align = RichBlockTableCellAlign.Left, valign = "top"), - RichBlockTableCell.Header(text = RichTextPlain("H2"), align = RichBlockTableCellAlign.Center, valign = "top") + RichBlockTableCell.Header(text = RichTextPlain("H1"), align = RichBlockTableCellAlign.Left, valign = RichBlockTableCellVAlign.Top), + RichBlockTableCell.Header(text = RichTextPlain("H2"), align = RichBlockTableCellAlign.Center, valign = RichBlockTableCellVAlign.Top) ), listOf( - RichBlockTableCell.Regular(text = RichTextPlain("a"), align = RichBlockTableCellAlign.Left, valign = "top"), - RichBlockTableCell.Regular(text = RichTextPlain("b"), align = RichBlockTableCellAlign.Center, valign = "top") + RichBlockTableCell.Regular(text = RichTextPlain("a"), align = RichBlockTableCellAlign.Left, valign = RichBlockTableCellVAlign.Top), + RichBlockTableCell.Regular(text = RichTextPlain("b"), align = RichBlockTableCellAlign.Center, valign = RichBlockTableCellVAlign.Top) ) ) )