Skip to content

Commit

Permalink
Upgraded dependencies (Kotlin 2.1.0, KSP 1.0.29, Jooby 3.5.4, Spring …
Browse files Browse the repository at this point in the history
…Boot 3.4.0, Ktor 3.0.1, Vert.x 4.5.11, Micronaut 4.7.1, Koin 4.1.0-Beta1, jackson-module-kotlin 2.18.2, logback 1.5.12, kotlin-wrappers 841, shadow 8.3.5, Chart.js 4.4.6, Electron 33.2.1, Fontawesome 6.7.1, Trix 2.1.8, TomSelect 2.4.1, Gradle 8.11.1)
  • Loading branch information
rjaros committed Dec 1, 2024
1 parent cf1f5c7 commit d1f8953
Show file tree
Hide file tree
Showing 11 changed files with 350 additions and 303 deletions.
477 changes: 236 additions & 241 deletions .kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
implementation("io.github.gradle-nexus:publish-plugin:2.0.0")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
implementation(gradleApi())
Expand Down
38 changes: 19 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
group=io.kvision
versionNumber=8.0.1

systemProp.kotlinVersion=2.0.21
systemProp.kotlinVersion=2.1.0
javaVersion=17
coroutinesVersion=1.9.0
serializationVersion=1.7.3
systemProp.dokkaVersion=1.9.20
systemProp.npmPublishVersion=3.4.2
systemProp.gradlePluginPublishVersion=1.3.0
systemProp.kspVersion=2.0.21-1.0.25
joobyVersion=3.4.2
springBootVersion=3.3.4
springDataRelationalVersion=3.3.4
ktorVersion=2.3.12
systemProp.kspVersion=2.1.0-1.0.29
joobyVersion=3.5.4
springBootVersion=3.4.0
springDataRelationalVersion=3.4.0
ktorVersion=3.0.1
javalinVersion=6.3.0
vertxVersion=4.5.10
micronautVersion=4.6.3
vertxVersion=4.5.11
micronautVersion=4.7.1
guiceVersion=7.0.0
koinVersion=4.0.0
koinVersion=4.1.0-Beta1
jqueryKotlinVersion=1.0.0
navigoKotlinVersion=1.0.0
navigoKotlinNgVersion=0.0.3
diffVersion=0.7.0
jacksonModuleKotlinVersion=2.18.0
logbackVersion=1.5.10
kotlinNodeVersion=22.5.4-pre.818
kotlinReactVersion=18.3.1-pre.818
jacksonModuleKotlinVersion=2.18.2
logbackVersion=1.5.12
kotlinNodeVersion=22.5.5-pre.841
kotlinReactVersion=18.3.1-pre.841
reduxKotlinVersion=0.6.1
reduxKotlinThunkVersion=0.6.0
ballastVersion=4.2.1
testNgVersion=7.10.2
hamcrestVersion=3.0
kotestVersion=5.9.1
shadowVersion=8.3.3
shadowVersion=8.3.5

kvisionAssetsVersion=8.0.13
cssLoaderVersion=7.1.2
Expand All @@ -50,11 +50,11 @@ bootstrapVersion=5.3.3
popperjsCoreVersion=2.11.8
bootstrapIconsVersion=1.11.3
bootstrapFileinputVersion=5.5.4
chartjsVersion=4.4.5
chartjsVersion=4.4.6
tempusDominusVersion=6.9.11
electronVersion=33.0.0
electronVersion=33.2.1
electronRemoteVersion=2.1.2
fontawesomeFreeVersion=6.6.0
fontawesomeFreeVersion=6.7.1
handlebarsVersion=4.7.8
handlebarsLoaderVersion=1.7.3
imaskVersion=7.6.1
Expand All @@ -67,10 +67,10 @@ onsenuiVersion=2.12.8
paceProgressbarVersion=1.0.10
printjsVersion=1.6.0
reactVersion=^18.3.1
trixVersion=2.1.7
trixVersion=2.1.8
tabulatorTablesVersion=6.3.0
toastifyjsVersion=1.12.0
tomSelectVersion=2.3.1
tomSelectVersion=2.4.1

systemProp.org.gradle.internal.publish.checksums.insecure=true
org.gradle.jvmargs=-Xmx6g
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
package io.kvision.remote

import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.ktor.server.websocket.*
import io.ktor.util.pipeline.*
import io.ktor.websocket.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ReceiveChannel
Expand All @@ -45,7 +43,7 @@ import java.net.URLDecoder
import java.nio.charset.StandardCharsets
import kotlin.reflect.KClass

typealias RequestHandler = suspend PipelineContext<Unit, ApplicationCall>.(Unit) -> Unit
typealias RequestHandler = suspend RoutingContext.() -> Unit
typealias WebsocketHandler = suspend WebSocketServerSession.() -> Unit
typealias SseHandler = RequestHandler

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
package io.kvision.remote

import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import io.ktor.server.websocket.*
import io.ktor.util.pipeline.*
import io.ktor.websocket.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ReceiveChannel
Expand All @@ -44,7 +42,7 @@ import java.net.URLDecoder
import java.nio.charset.StandardCharsets
import kotlin.reflect.KClass

typealias RequestHandler = suspend PipelineContext<Unit, ApplicationCall>.(Unit) -> Unit
typealias RequestHandler = suspend RoutingContext.() -> Unit
typealias WebsocketHandler = suspend WebSocketServerSession.() -> Unit
typealias SseHandler = RequestHandler

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ package io.kvision.remote
import io.micronaut.context.ApplicationContext
import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.MediaType
import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Delete
Expand All @@ -33,18 +32,13 @@ import io.micronaut.http.annotation.Options
import io.micronaut.http.annotation.PathVariable
import io.micronaut.http.annotation.Post
import io.micronaut.http.annotation.Put
import io.micronaut.http.sse.Event
import io.micronaut.scheduling.TaskExecutors
import io.micronaut.scheduling.annotation.ExecuteOn
import jakarta.annotation.PostConstruct
import jakarta.inject.Inject
import org.reactivestreams.Publisher
import reactor.core.publisher.Flux

/**
* Controller for handling automatic routes.
*/
@Controller("/")
@Controller("/kv")
open class KVController {

@Inject
Expand All @@ -60,50 +54,45 @@ open class KVController {
}
}

@Get("{/path:kv/.*}")
@Get("/{+path}")
suspend fun get(@PathVariable path: String?, request: HttpRequest<*>): HttpResponse<String> =
handle(HttpMethod.GET, path, request)
handle(HttpMethod.GET, "/rpc/$path", request)

@Suppress("UNUSED_PARAMETER")
@Post("{/path:kv/.*}")
@Post("/{+path}")
suspend fun post(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.POST, path, request)
): HttpResponse<String> = handle(HttpMethod.POST, "/rpc/$path", request)

@Suppress("UNUSED_PARAMETER")
@Put("{/path:kv/.*}")
@Put("/{+path}")
suspend fun put(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.PUT, path, request)
): HttpResponse<String> = handle(HttpMethod.PUT, "/rpc/$path", request)

@Suppress("UNUSED_PARAMETER")
@Delete("{/path:kv/.*}")
@Delete("/{+path}")
suspend fun delete(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.DELETE, path, request)
): HttpResponse<String> = handle(HttpMethod.DELETE, "/rpc/$path", request)

@Suppress("UNUSED_PARAMETER")
@Options("{/path:kv/.*}")
@Options("/{+path}")
suspend fun options(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.OPTIONS, path, request)
): HttpResponse<String> = handle(HttpMethod.OPTIONS, "/rpc/$path", request)

@ExecuteOn(TaskExecutors.IO)
@Get("{/path:kvsse/.*}", produces = [MediaType.TEXT_EVENT_STREAM])
fun getSse(@PathVariable path: String?, request: HttpRequest<*>): Publisher<Event<String>> =
handleSse(path, request)

private suspend fun handle(method: HttpMethod, path: String?, request: HttpRequest<*>): HttpResponse<String> {
private suspend fun handle(method: HttpMethod, path: String, request: HttpRequest<*>): HttpResponse<String> {
val handler = kvManagers.services.asSequence().mapNotNull {
it.routeMapRegistry.findHandler(method, "/$path")
it.routeMapRegistry.findHandler(method, path)
}.firstOrNull() ?: return HttpResponse.notFound()
return handler(
request,
Expand All @@ -112,11 +101,4 @@ open class KVController {
applicationContext
)
}

private fun handleSse(path: String?, request: HttpRequest<*>): Publisher<Event<String>> {
val handler = kvManagers.services.asSequence().mapNotNull {
it.sseRequests["/$path"]
}.firstOrNull() ?: return Flux.empty()
return handler(request, RequestHolder.threadLocalRequest, applicationContext)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 2017-present Robert Jaros
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* 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.
*/
package io.kvision.remote

import io.micronaut.context.ApplicationContext
import io.micronaut.http.HttpRequest
import io.micronaut.http.MediaType
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import io.micronaut.http.annotation.PathVariable
import io.micronaut.http.sse.Event
import io.micronaut.scheduling.TaskExecutors
import io.micronaut.scheduling.annotation.ExecuteOn
import jakarta.annotation.PostConstruct
import jakarta.inject.Inject
import org.reactivestreams.Publisher
import reactor.core.publisher.Flux

/**
* Controller for handling automatic routes.
*/
@Controller("/kvsse")
open class KVSseController {

@Inject
lateinit var kvManagers: KVManagers

@Inject
lateinit var applicationContext: ApplicationContext

@PostConstruct
fun init() {
kvManagers.services.forEach {
it.deSerializer = kotlinxObjectDeSerializer(kvManagers.serializersModules)
}
}

@ExecuteOn(TaskExecutors.IO)
@Get("/{+path}", produces = [MediaType.TEXT_EVENT_STREAM])
fun getSse(@PathVariable path: String?, request: HttpRequest<*>): Publisher<Event<String>> =
handleSse("/rpcsse/$path", request)

private fun handleSse(path: String, request: HttpRequest<*>): Publisher<Event<String>> {
val handler = kvManagers.services.asSequence().mapNotNull {
it.sseRequests[path]
}.firstOrNull() ?: return Flux.empty()
return handler(request, RequestHolder.threadLocalRequest, applicationContext)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ fun Vertx.kvisionInit(
server.webSocketHandler { webSocket ->
serviceManager.webSocketRequests[webSocket.path()]?.let {
it(injector, webSocket)
} ?: webSocket.reject()
}
}
server.webSocketHandshakeHandler { serverWebSocketHandshake ->
serviceManager.webSocketRequests[serverWebSocketHandshake.path()]?.let {
serverWebSocketHandshake.accept()
} ?: serverWebSocketHandshake.reject()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:JsModule("tom-select")
@file:JsNonModule
/*
* Copyright (c) 2017-present Robert Jaros
*
Expand All @@ -24,9 +26,7 @@ package io.kvision.form.select.js

import org.w3c.dom.HTMLElement

@JsModule("tom-select")
@JsNonModule
@JsName("TomSelect")
@JsName("default")
external class TomSelectJs(element: HTMLElement, options: dynamic) {
fun addOption(value: dynamic, user_created: Boolean = definedExternally)
fun addOptions(value: Array<dynamic>, user_created: Boolean = definedExternally)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ abstract class KVisionPlugin @Inject constructor(
*
* The current operating system is taken into account.
*/
@Suppress("DEPRECATION")
private fun Project.nodeJsBinaryProvider(): Provider<String> {
val nodeJsRootExtension = providers.provider {
rootProject.extensions.getByType(NodeJsRootExtension::class)
Expand Down

0 comments on commit d1f8953

Please sign in to comment.