From e68735d0613657e60b19f10e7cfcbf4c1127b442 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 30 Jul 2024 23:30:11 +0600 Subject: [PATCH] Revert "migrations onto new libraries" This reverts commit 647cd7d7b4ac900664769f0532e81bece1db73a8. --- gradle/libs.versions.toml | 6 ++-- .../ktor/client/OnUploadCallback.kt | 2 +- .../ktor/common/CreateTempFileFromInput.kt | 6 ++-- .../ApplicationCallRespondWithTypeInfo.kt | 5 ++- .../ktor/server/DownloadFileItem.kt | 20 ++++++----- .../ktor/server/NewFlowsWebsocket.kt | 4 +-- .../micro_utils/ktor/server/StartServer.kt | 35 ++++++++----------- .../TemporalFilesRoutingConfigurator.kt | 18 +++------- .../ktor/server/UniloadMultipart.kt | 3 +- .../ApplicationRoutingConfigurator.kt | 9 +++-- .../key/value/KtorWriteKeyValueRepoClient.kt | 2 +- .../values/KtorWriteKeyValuesRepoClient.kt | 2 +- .../ktor/server/crud/KtorCRUDRepoRoutes.kt | 8 ++--- .../server/crud/KtorReadCRUDRepoRoutes.kt | 8 ++--- .../server/crud/KtorWriteCRUDRepoRoutes.kt | 4 +-- .../key/value/KtorKeyValueRepoRoutes.kt | 8 ++--- .../key/value/KtorReadKeyValueRepoRoutes.kt | 10 +++--- .../key/value/KtorWriteKeyValueRepoRoutes.kt | 4 +-- .../key/values/KtorKeyValuesRepoRoutes.kt | 8 ++--- .../key/values/KtorReadKeyValuesRepoRoutes.kt | 10 +++--- .../values/KtorWriteKeyValuesRepoRoutes.kt | 4 +-- 21 files changed, 83 insertions(+), 93 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index df5661c6e63..214fd3c041b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,19 +1,19 @@ [versions] -kt = "2.0.20-RC" +kt = "2.0.0" kt-serialization = "1.7.1" kt-coroutines = "1.8.1" kslog = "1.3.4" -jb-compose = "1.7.0-dev1750" +jb-compose = "1.7.0-dev1742" jb-exposed = "0.51.1" jb-dokka = "1.9.20" korlibs = "5.4.0" uuid = "0.8.4" -ktor = "3.0.0-beta-2" +ktor = "2.3.11" gh-release = "2.5.2" diff --git a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/OnUploadCallback.kt b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/OnUploadCallback.kt index 86c7d065b09..abd79c93b2b 100644 --- a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/OnUploadCallback.kt +++ b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/OnUploadCallback.kt @@ -1,3 +1,3 @@ package dev.inmo.micro_utils.ktor.client -typealias OnUploadCallback = suspend (uploaded: Long, count: Long?) -> Unit +typealias OnUploadCallback = suspend (uploaded: Long, count: Long) -> Unit diff --git a/ktor/common/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/common/CreateTempFileFromInput.kt b/ktor/common/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/common/CreateTempFileFromInput.kt index d49edd0c0d8..5c7b97f888f 100644 --- a/ktor/common/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/common/CreateTempFileFromInput.kt +++ b/ktor/common/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/common/CreateTempFileFromInput.kt @@ -1,8 +1,10 @@ package dev.inmo.micro_utils.ktor.common import io.ktor.utils.io.core.Input -import kotlinx.io.asSink +import io.ktor.utils.io.core.copyTo +import io.ktor.utils.io.streams.asOutput import java.io.File +import java.io.InputStream import java.util.UUID fun Input.downloadToTempFile( @@ -15,7 +17,7 @@ fun Input.downloadToTempFile( folder ).apply { outputStream().use { - this@downloadToTempFile.transferTo(it.asSink()) + copyTo(it.asOutput()) } deleteOnExit() } diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/ApplicationCallRespondWithTypeInfo.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/ApplicationCallRespondWithTypeInfo.kt index 5c1ce621af9..207dde73a63 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/ApplicationCallRespondWithTypeInfo.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/ApplicationCallRespondWithTypeInfo.kt @@ -1,9 +1,8 @@ package dev.inmo.micro_utils.ktor.server import io.ktor.server.application.ApplicationCall -import io.ktor.server.http.* import io.ktor.server.response.responseType -import io.ktor.utils.io.InternalAPI +import io.ktor.util.InternalAPI import io.ktor.util.reflect.TypeInfo @InternalAPI @@ -12,5 +11,5 @@ suspend fun ApplicationCall.respond( typeInfo: TypeInfo ) { response.responseType = typeInfo - respond(message, typeInfo) + response.pipeline.execute(this, message as Any) } diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt index d2f367644db..998fef99797 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/DownloadFileItem.kt @@ -2,19 +2,21 @@ package dev.inmo.micro_utils.ktor.server import com.benasher44.uuid.uuid4 import io.ktor.http.content.PartData -import io.ktor.util.cio.* -import io.ktor.utils.io.* +import io.ktor.utils.io.copyTo +import io.ktor.utils.io.core.copyTo import io.ktor.utils.io.jvm.javaio.copyTo -import kotlinx.io.asSink +import io.ktor.utils.io.streams.asOutput import java.io.File -suspend fun PartData.FileItem.download(target: File) { - provider().copyAndClose( - target.writeChannel() - ) +fun PartData.FileItem.download(target: File) { + provider().use { input -> + target.outputStream().asOutput().use { + input.copyTo(it) + } + } } -suspend fun PartData.FileItem.downloadToTemporalFile(): File { +fun PartData.FileItem.downloadToTemporalFile(): File { val outputFile = File.createTempFile(uuid4().toString(), ".temp").apply { deleteOnExit() } @@ -25,7 +27,7 @@ suspend fun PartData.FileItem.downloadToTemporalFile(): File { fun PartData.BinaryItem.download(target: File) { provider().use { input -> target.outputStream().use { - input.transferTo(it.asSink()) + input.copyTo(it.asOutput()) } } } diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/NewFlowsWebsocket.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/NewFlowsWebsocket.kt index 0240a55fc5e..fa2822c39c1 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/NewFlowsWebsocket.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/NewFlowsWebsocket.kt @@ -5,14 +5,14 @@ import dev.inmo.micro_utils.ktor.common.* import io.ktor.http.URLProtocol import io.ktor.server.application.install import io.ktor.server.application.pluginOrNull -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.application import io.ktor.server.websocket.* import io.ktor.websocket.send import kotlinx.coroutines.flow.Flow import kotlinx.serialization.SerializationStrategy -inline fun Routing.includeWebsocketHandling( +inline fun Route.includeWebsocketHandling( suburl: String, flow: Flow, protocol: URLProtocol? = null, diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/StartServer.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/StartServer.kt index 8ad61980db2..821403521f6 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/StartServer.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/StartServer.kt @@ -1,7 +1,7 @@ package dev.inmo.micro_utils.ktor.server import dev.inmo.micro_utils.ktor.server.configurators.KtorApplicationConfigurator -import io.ktor.server.application.* +import io.ktor.server.application.Application import io.ktor.server.cio.CIO import io.ktor.server.cio.CIOApplicationEngine import io.ktor.server.engine.* @@ -11,22 +11,20 @@ fun , host: String = "localhost", port: Int = Random.nextInt(1024, 65535), - additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, + additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, additionalConfigurationConfigurator: TConfiguration.() -> Unit = {}, - environment: ApplicationEnvironment = applicationEnvironment(), block: Application.() -> Unit -): EmbeddedServer = embeddedServer( +): TEngine = embeddedServer( engine, - environment, - { + applicationEngineEnvironment { + module(block) connector { this.host = host this.port = port - additionalEngineEnvironmentConfigurator() } - additionalConfigurationConfigurator() + additionalEngineEnvironmentConfigurator() }, - module = block + additionalConfigurationConfigurator ) /** @@ -37,17 +35,15 @@ fun Unit = {}, + additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, additionalConfigurationConfigurator: CIOApplicationEngine.Configuration.() -> Unit = {}, - environment: ApplicationEnvironment = applicationEnvironment(), block: Application.() -> Unit -): EmbeddedServer = createKtorServer( +): CIOApplicationEngine = createKtorServer( CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, - environment, block ) @@ -55,17 +51,15 @@ fun , host: String = "localhost", port: Int = Random.nextInt(1024, 65535), - additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, + additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, additionalConfigurationConfigurator: TConfiguration.() -> Unit = {}, - environment: ApplicationEnvironment = applicationEnvironment(), configurators: List -): EmbeddedServer = createKtorServer( +): TEngine = createKtorServer( engine, host, port, additionalEngineEnvironmentConfigurator, - additionalConfigurationConfigurator, - environment, + additionalConfigurationConfigurator ) { configurators.forEach { it.apply { configure() } } } @@ -79,7 +73,6 @@ fun createKtorServer( host: String = "localhost", port: Int = Random.nextInt(1024, 65535), configurators: List, - additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, + additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, additionalConfigurationConfigurator: CIOApplicationEngine.Configuration.() -> Unit = {}, - environment: ApplicationEnvironment = applicationEnvironment(), -): EmbeddedServer = createKtorServer(CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, environment, configurators) +): ApplicationEngine = createKtorServer(CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, configurators) diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/TemporalFilesRoutingConfigurator.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/TemporalFilesRoutingConfigurator.kt index dd3e4048d3d..dd45d06741a 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/TemporalFilesRoutingConfigurator.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/TemporalFilesRoutingConfigurator.kt @@ -14,10 +14,9 @@ import io.ktor.server.application.call import io.ktor.server.request.receiveMultipart import io.ktor.server.response.respond import io.ktor.server.response.respondText -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.post import kotlinx.coroutines.* -import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock @@ -27,10 +26,7 @@ import java.nio.file.attribute.FileTime class TemporalFilesRoutingConfigurator( private val subpath: String = DefaultTemporalFilesSubPath, - private val temporalFilesUtilizer: TemporalFilesUtilizer = TemporalFilesUtilizer, - filesFlowReplay: Int = 0, - filesFlowExtraBufferCapacity: Int = Int.MAX_VALUE, - filesFlowOnBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND + private val temporalFilesUtilizer: TemporalFilesUtilizer = TemporalFilesUtilizer ) : ApplicationRoutingConfigurator.Element { interface TemporalFilesUtilizer { fun start(filesMap: MutableMap, filesMutex: Mutex, onNewFileFlow: Flow): Job @@ -78,14 +74,10 @@ class TemporalFilesRoutingConfigurator( private val temporalFilesMap = mutableMapOf() private val temporalFilesMutex = Mutex() - private val filesFlow = MutableSharedFlow( - replay = filesFlowReplay, - extraBufferCapacity = filesFlowExtraBufferCapacity, - onBufferOverflow = filesFlowOnBufferOverflow - ) + private val filesFlow = MutableSharedFlow() val utilizerJob = temporalFilesUtilizer.start(temporalFilesMap, temporalFilesMutex, filesFlow.asSharedFlow()) - override fun Routing.invoke() { + override fun Route.invoke() { post(subpath) { val multipart = call.receiveMultipart() @@ -119,7 +111,7 @@ class TemporalFilesRoutingConfigurator( temporalFilesMap[fileId] = file } call.respondText(fileId.string) - filesFlow.emit(fileId) + launchSafelyWithoutExceptions { filesFlow.emit(fileId) } } ?: call.respond(HttpStatusCode.BadRequest) } } diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/UniloadMultipart.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/UniloadMultipart.kt index 0bf7828a49b..7898092e54d 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/UniloadMultipart.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/UniloadMultipart.kt @@ -6,7 +6,6 @@ import dev.inmo.micro_utils.ktor.common.downloadToTempFile import io.ktor.http.content.* import io.ktor.server.application.ApplicationCall import io.ktor.server.request.receiveMultipart -import io.ktor.utils.io.* import io.ktor.utils.io.core.* import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.isActive @@ -48,7 +47,7 @@ suspend fun ApplicationCall.uniloadMultipart( onBinaryChannelItem ) { when (it.name) { - "bytes" -> resultInput = it.provider().readBuffer() + "bytes" -> resultInput = it.provider() else -> onCustomFileItem(it) } } diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/configurators/ApplicationRoutingConfigurator.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/configurators/ApplicationRoutingConfigurator.kt index a9d896e23d0..3c008d79b87 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/configurators/ApplicationRoutingConfigurator.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/configurators/ApplicationRoutingConfigurator.kt @@ -2,7 +2,8 @@ package dev.inmo.micro_utils.ktor.server.configurators import dev.inmo.micro_utils.ktor.server.configurators.ApplicationRoutingConfigurator.Element import io.ktor.server.application.* -import io.ktor.server.routing.* +import io.ktor.server.routing.Route +import io.ktor.server.routing.Routing import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable @@ -10,7 +11,7 @@ import kotlinx.serialization.Serializable class ApplicationRoutingConfigurator( private val elements: List<@Contextual Element> ) : KtorApplicationConfigurator { - fun interface Element { operator fun Routing.invoke() } + fun interface Element { operator fun Route.invoke() } private val rootInstaller = Element { elements.forEach { it.apply { invoke() } @@ -18,7 +19,9 @@ class ApplicationRoutingConfigurator( } override fun Application.configure() { - routing { + pluginOrNull(Routing) ?.apply { + rootInstaller.apply { invoke() } + } ?: install(Routing) { rootInstaller.apply { invoke() } } } diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/value/KtorWriteKeyValueRepoClient.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/value/KtorWriteKeyValueRepoClient.kt index 04548c751ba..12de3b5538a 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/value/KtorWriteKeyValueRepoClient.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/value/KtorWriteKeyValueRepoClient.kt @@ -8,7 +8,7 @@ import dev.inmo.micro_utils.repos.ktor.common.key_value.* import io.ktor.client.HttpClient import io.ktor.client.request.post import io.ktor.http.* -import io.ktor.utils.io.InternalAPI +import io.ktor.util.InternalAPI import io.ktor.util.reflect.TypeInfo import io.ktor.util.reflect.typeInfo import kotlinx.coroutines.flow.Flow diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/values/KtorWriteKeyValuesRepoClient.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/values/KtorWriteKeyValuesRepoClient.kt index 50225e60d9d..5fe28f0a7af 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/values/KtorWriteKeyValuesRepoClient.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key/values/KtorWriteKeyValuesRepoClient.kt @@ -8,7 +8,7 @@ import dev.inmo.micro_utils.repos.ktor.common.one_to_many.* import io.ktor.client.HttpClient import io.ktor.client.request.post import io.ktor.http.* -import io.ktor.utils.io.InternalAPI +import io.ktor.util.InternalAPI import io.ktor.util.reflect.TypeInfo import io.ktor.util.reflect.typeInfo import kotlinx.coroutines.flow.Flow diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorCRUDRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorCRUDRepoRoutes.kt index dbc14399fae..f7d950229bd 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorCRUDRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorCRUDRepoRoutes.kt @@ -2,10 +2,10 @@ package dev.inmo.micro_utils.repos.ktor.server.crud import dev.inmo.micro_utils.ktor.common.* import dev.inmo.micro_utils.repos.CRUDRepo -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import kotlinx.serialization.* -inline fun Routing.configureCRUDRepoRoutes( +inline fun Route.configureCRUDRepoRoutes( originalRepo: CRUDRepo, noinline idDeserializer: suspend (String) -> IdType ) { @@ -13,7 +13,7 @@ inline fun Routing.configureCRUDRepoRoutes( +inline fun Route.configureCRUDRepoRoutes( originalRepo: CRUDRepo, idsSerializer: KSerializer, serialFormat: StringFormat @@ -21,7 +21,7 @@ inline fun Routing.configureCRUDRepoRoutes( +inline fun Route.configureCRUDRepoRoutes( originalRepo: CRUDRepo, idsSerializer: KSerializer, serialFormat: BinaryFormat diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorReadCRUDRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorReadCRUDRepoRoutes.kt index 79b3dc87652..7b295deefae 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorReadCRUDRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorReadCRUDRepoRoutes.kt @@ -11,11 +11,11 @@ import dev.inmo.micro_utils.repos.ktor.common.idParameterName import io.ktor.http.HttpStatusCode import io.ktor.server.application.call import io.ktor.server.response.respond -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.get import kotlinx.serialization.* -inline fun Routing.configureReadCRUDRepoRoutes( +inline fun Route.configureReadCRUDRepoRoutes( originalRepo: ReadCRUDRepo, noinline idDeserializer: suspend (String) -> IdType ) { @@ -65,7 +65,7 @@ inline fun Routing.configureReadCRUDRepoRou } } -inline fun Routing.configureReadCRUDRepoRoutes( +inline fun Route.configureReadCRUDRepoRoutes( originalRepo: ReadCRUDRepo, idsSerializer: KSerializer, serialFormat: StringFormat @@ -73,7 +73,7 @@ inline fun Routing.configureReadCRUDRepoRou serialFormat.decodeFromString(idsSerializer, it) } -inline fun Routing.configureReadCRUDRepoRoutes( +inline fun Route.configureReadCRUDRepoRoutes( originalRepo: ReadCRUDRepo, idsSerializer: KSerializer, serialFormat: BinaryFormat diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorWriteCRUDRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorWriteCRUDRepoRoutes.kt index 7d297850f7d..368f928d141 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorWriteCRUDRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud/KtorWriteCRUDRepoRoutes.kt @@ -7,10 +7,10 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.call import io.ktor.server.request.receive import io.ktor.server.response.respond -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.post -inline fun Routing.configureWriteCRUDRepoRoutes( +inline fun Route.configureWriteCRUDRepoRoutes( originalRepo: WriteCRUDRepo ) { includeWebsocketHandling( diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorKeyValueRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorKeyValueRepoRoutes.kt index 59ad0d31660..1ff64d93a00 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorKeyValueRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorKeyValueRepoRoutes.kt @@ -3,10 +3,10 @@ package dev.inmo.micro_utils.repos.ktor.server.key.value import dev.inmo.micro_utils.ktor.common.* import dev.inmo.micro_utils.repos.KeyValueRepo import io.ktor.http.* -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import kotlinx.serialization.* -inline fun Routing.configureKeyValueRepoRoutes ( +inline fun Route.configureKeyValueRepoRoutes ( originalRepo: KeyValueRepo, noinline idDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -15,7 +15,7 @@ inline fun Routing.configureKeyValueRep configureWriteKeyValueRepoRoutes(originalRepo) } -inline fun Routing.configureKeyValueRepoRoutes( +inline fun Route.configureKeyValueRepoRoutes( originalRepo: KeyValueRepo, idsSerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -30,7 +30,7 @@ inline fun Routing.configureKeyValueRep } ) -inline fun Routing.configureKeyValueRepoRoutes( +inline fun Route.configureKeyValueRepoRoutes( originalRepo: KeyValueRepo, idsSerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorReadKeyValueRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorReadKeyValueRepoRoutes.kt index f3e0104806a..418d87cae7e 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorReadKeyValueRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorReadKeyValueRepoRoutes.kt @@ -14,14 +14,14 @@ import dev.inmo.micro_utils.repos.ktor.common.reversedParameterName import io.ktor.http.* import io.ktor.server.application.call import io.ktor.server.response.respond -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.get -import io.ktor.utils.io.InternalAPI +import io.ktor.util.InternalAPI import io.ktor.util.reflect.typeInfo import kotlinx.serialization.* @OptIn(InternalAPI::class) -inline fun Routing.configureReadKeyValueRepoRoutes ( +inline fun Route.configureReadKeyValueRepoRoutes ( originalRepo: ReadKeyValueRepo, noinline idDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -79,7 +79,7 @@ inline fun Routing.configureReadKeyValueRepoRoutes } } -inline fun Routing.configureReadKeyValueRepoRoutes( +inline fun Route.configureReadKeyValueRepoRoutes( originalRepo: ReadKeyValueRepo, idsSerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -94,7 +94,7 @@ inline fun Routing.configureReadKeyValueRepoRoutes( } ) -inline fun Routing.configureReadKeyValueRepoRoutes( +inline fun Route.configureReadKeyValueRepoRoutes( originalRepo: ReadKeyValueRepo, idsSerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorWriteKeyValueRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorWriteKeyValueRepoRoutes.kt index c3bc47e0240..78e39e8ff66 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorWriteKeyValueRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/value/KtorWriteKeyValueRepoRoutes.kt @@ -7,11 +7,11 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.call import io.ktor.server.request.receive import io.ktor.server.response.respond -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.post import io.ktor.util.reflect.typeInfo -inline fun Routing.configureWriteKeyValueRepoRoutes ( +inline fun Route.configureWriteKeyValueRepoRoutes ( originalRepo: WriteKeyValueRepo ) { includeWebsocketHandling( diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorKeyValuesRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorKeyValuesRepoRoutes.kt index 56fe0821c37..541ca5fd7ce 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorKeyValuesRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorKeyValuesRepoRoutes.kt @@ -3,10 +3,10 @@ package dev.inmo.micro_utils.repos.ktor.server.key.values import dev.inmo.micro_utils.ktor.common.* import dev.inmo.micro_utils.repos.* import io.ktor.http.* -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import kotlinx.serialization.* -inline fun Routing.configureKeyValuesRepoRoutes ( +inline fun Route.configureKeyValuesRepoRoutes ( originalRepo: KeyValuesRepo, noinline keyDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -15,7 +15,7 @@ inline fun Routing.configureKeyValuesRe configureWriteKeyValuesRepoRoutes(originalRepo) } -inline fun Routing.configureKeyValuesRepoRoutes( +inline fun Route.configureKeyValuesRepoRoutes( originalRepo: KeyValuesRepo, keySerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -30,7 +30,7 @@ inline fun Routing.configureKeyValuesRe } ) -inline fun Routing.configureKeyValuesRepoRoutes( +inline fun Route.configureKeyValuesRepoRoutes( originalRepo: KeyValuesRepo, keySerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorReadKeyValuesRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorReadKeyValuesRepoRoutes.kt index 82df24d1c53..0953465cd60 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorReadKeyValuesRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorReadKeyValuesRepoRoutes.kt @@ -12,14 +12,14 @@ import dev.inmo.micro_utils.repos.ktor.common.one_to_many.* import io.ktor.http.* import io.ktor.server.application.call import io.ktor.server.response.respond -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.get -import io.ktor.utils.io.InternalAPI +import io.ktor.util.InternalAPI import io.ktor.util.reflect.typeInfo import kotlinx.serialization.* @OptIn(InternalAPI::class) -inline fun Routing.configureReadKeyValuesRepoRoutes ( +inline fun Route.configureReadKeyValuesRepoRoutes ( originalRepo: ReadKeyValuesRepo, noinline keyDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -76,7 +76,7 @@ inline fun Routing.configureReadKeyValuesRepoRoutes } } -inline fun Routing.configureReadKeyValuesRepoRoutes( +inline fun Route.configureReadKeyValuesRepoRoutes( originalRepo: ReadKeyValuesRepo, keySerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -91,7 +91,7 @@ inline fun Routing.configureReadKeyValuesRepoRoutes } ) -inline fun Routing.configureReadKeyValuesRepoRoutes( +inline fun Route.configureReadKeyValuesRepoRoutes( originalRepo: ReadKeyValuesRepo, keySerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, diff --git a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorWriteKeyValuesRepoRoutes.kt b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorWriteKeyValuesRepoRoutes.kt index 73c4d142eb4..3f78ca0a7be 100644 --- a/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorWriteKeyValuesRepoRoutes.kt +++ b/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key/values/KtorWriteKeyValuesRepoRoutes.kt @@ -7,11 +7,11 @@ import io.ktor.http.HttpStatusCode import io.ktor.server.application.call import io.ktor.server.request.receive import io.ktor.server.response.respond -import io.ktor.server.routing.Routing +import io.ktor.server.routing.Route import io.ktor.server.routing.post import io.ktor.util.reflect.typeInfo -inline fun Routing.configureWriteKeyValuesRepoRoutes ( +inline fun Route.configureWriteKeyValuesRepoRoutes ( originalRepo: WriteKeyValuesRepo ) { includeWebsocketHandling(