diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 214fd3c041b..df5661c6e63 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,19 +1,19 @@ [versions] -kt = "2.0.0" +kt = "2.0.20-RC" kt-serialization = "1.7.1" kt-coroutines = "1.8.1" kslog = "1.3.4" -jb-compose = "1.7.0-dev1742" +jb-compose = "1.7.0-dev1750" jb-exposed = "0.51.1" jb-dokka = "1.9.20" korlibs = "5.4.0" uuid = "0.8.4" -ktor = "2.3.11" +ktor = "3.0.0-beta-2" 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 abd79c93b2b..86c7d065b09 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 5c7b97f888f..d49edd0c0d8 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,10 +1,8 @@ package dev.inmo.micro_utils.ktor.common import io.ktor.utils.io.core.Input -import io.ktor.utils.io.core.copyTo -import io.ktor.utils.io.streams.asOutput +import kotlinx.io.asSink import java.io.File -import java.io.InputStream import java.util.UUID fun Input.downloadToTempFile( @@ -17,7 +15,7 @@ fun Input.downloadToTempFile( folder ).apply { outputStream().use { - copyTo(it.asOutput()) + this@downloadToTempFile.transferTo(it.asSink()) } 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 207dde73a63..5c1ce621af9 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,8 +1,9 @@ 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.util.InternalAPI +import io.ktor.utils.io.InternalAPI import io.ktor.util.reflect.TypeInfo @InternalAPI @@ -11,5 +12,5 @@ suspend fun ApplicationCall.respond( typeInfo: TypeInfo ) { response.responseType = typeInfo - response.pipeline.execute(this, message as Any) + respond(message, typeInfo) } 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 998fef99797..d2f367644db 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,21 +2,19 @@ package dev.inmo.micro_utils.ktor.server import com.benasher44.uuid.uuid4 import io.ktor.http.content.PartData -import io.ktor.utils.io.copyTo -import io.ktor.utils.io.core.copyTo +import io.ktor.util.cio.* +import io.ktor.utils.io.* import io.ktor.utils.io.jvm.javaio.copyTo -import io.ktor.utils.io.streams.asOutput +import kotlinx.io.asSink import java.io.File -fun PartData.FileItem.download(target: File) { - provider().use { input -> - target.outputStream().asOutput().use { - input.copyTo(it) - } - } +suspend fun PartData.FileItem.download(target: File) { + provider().copyAndClose( + target.writeChannel() + ) } -fun PartData.FileItem.downloadToTemporalFile(): File { +suspend fun PartData.FileItem.downloadToTemporalFile(): File { val outputFile = File.createTempFile(uuid4().toString(), ".temp").apply { deleteOnExit() } @@ -27,7 +25,7 @@ fun PartData.FileItem.downloadToTemporalFile(): File { fun PartData.BinaryItem.download(target: File) { provider().use { input -> target.outputStream().use { - input.copyTo(it.asOutput()) + input.transferTo(it.asSink()) } } } 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 fa2822c39c1..0240a55fc5e 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.Route +import io.ktor.server.routing.Routing 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 Route.includeWebsocketHandling( +inline fun Routing.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 821403521f6..8ad61980db2 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.Application +import io.ktor.server.application.* import io.ktor.server.cio.CIO import io.ktor.server.cio.CIOApplicationEngine import io.ktor.server.engine.* @@ -11,20 +11,22 @@ fun , host: String = "localhost", port: Int = Random.nextInt(1024, 65535), - additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, + additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, additionalConfigurationConfigurator: TConfiguration.() -> Unit = {}, + environment: ApplicationEnvironment = applicationEnvironment(), block: Application.() -> Unit -): TEngine = embeddedServer( +): EmbeddedServer = embeddedServer( engine, - applicationEngineEnvironment { - module(block) + environment, + { connector { this.host = host this.port = port + additionalEngineEnvironmentConfigurator() } - additionalEngineEnvironmentConfigurator() + additionalConfigurationConfigurator() }, - additionalConfigurationConfigurator + module = block ) /** @@ -35,15 +37,17 @@ fun Unit = {}, + additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, additionalConfigurationConfigurator: CIOApplicationEngine.Configuration.() -> Unit = {}, + environment: ApplicationEnvironment = applicationEnvironment(), block: Application.() -> Unit -): CIOApplicationEngine = createKtorServer( +): EmbeddedServer = createKtorServer( CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, + environment, block ) @@ -51,15 +55,17 @@ fun , host: String = "localhost", port: Int = Random.nextInt(1024, 65535), - additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, + additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, additionalConfigurationConfigurator: TConfiguration.() -> Unit = {}, + environment: ApplicationEnvironment = applicationEnvironment(), configurators: List -): TEngine = createKtorServer( +): EmbeddedServer = createKtorServer( engine, host, port, additionalEngineEnvironmentConfigurator, - additionalConfigurationConfigurator + additionalConfigurationConfigurator, + environment, ) { configurators.forEach { it.apply { configure() } } } @@ -73,6 +79,7 @@ fun createKtorServer( host: String = "localhost", port: Int = Random.nextInt(1024, 65535), configurators: List, - additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {}, + additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {}, additionalConfigurationConfigurator: CIOApplicationEngine.Configuration.() -> Unit = {}, -): ApplicationEngine = createKtorServer(CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, configurators) + environment: ApplicationEnvironment = applicationEnvironment(), +): EmbeddedServer = createKtorServer(CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, environment, 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 dd45d06741a..dd3e4048d3d 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,9 +14,10 @@ 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.Route +import io.ktor.server.routing.Routing 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 @@ -26,7 +27,10 @@ import java.nio.file.attribute.FileTime class TemporalFilesRoutingConfigurator( private val subpath: String = DefaultTemporalFilesSubPath, - private val temporalFilesUtilizer: TemporalFilesUtilizer = TemporalFilesUtilizer + private val temporalFilesUtilizer: TemporalFilesUtilizer = TemporalFilesUtilizer, + filesFlowReplay: Int = 0, + filesFlowExtraBufferCapacity: Int = Int.MAX_VALUE, + filesFlowOnBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND ) : ApplicationRoutingConfigurator.Element { interface TemporalFilesUtilizer { fun start(filesMap: MutableMap, filesMutex: Mutex, onNewFileFlow: Flow): Job @@ -74,10 +78,14 @@ class TemporalFilesRoutingConfigurator( private val temporalFilesMap = mutableMapOf() private val temporalFilesMutex = Mutex() - private val filesFlow = MutableSharedFlow() + private val filesFlow = MutableSharedFlow( + replay = filesFlowReplay, + extraBufferCapacity = filesFlowExtraBufferCapacity, + onBufferOverflow = filesFlowOnBufferOverflow + ) val utilizerJob = temporalFilesUtilizer.start(temporalFilesMap, temporalFilesMutex, filesFlow.asSharedFlow()) - override fun Route.invoke() { + override fun Routing.invoke() { post(subpath) { val multipart = call.receiveMultipart() @@ -111,7 +119,7 @@ class TemporalFilesRoutingConfigurator( temporalFilesMap[fileId] = file } call.respondText(fileId.string) - launchSafelyWithoutExceptions { filesFlow.emit(fileId) } + 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 7898092e54d..0bf7828a49b 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,6 +6,7 @@ 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 @@ -47,7 +48,7 @@ suspend fun ApplicationCall.uniloadMultipart( onBinaryChannelItem ) { when (it.name) { - "bytes" -> resultInput = it.provider() + "bytes" -> resultInput = it.provider().readBuffer() 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 3c008d79b87..a9d896e23d0 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,8 +2,7 @@ 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.Route -import io.ktor.server.routing.Routing +import io.ktor.server.routing.* import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable @@ -11,7 +10,7 @@ import kotlinx.serialization.Serializable class ApplicationRoutingConfigurator( private val elements: List<@Contextual Element> ) : KtorApplicationConfigurator { - fun interface Element { operator fun Route.invoke() } + fun interface Element { operator fun Routing.invoke() } private val rootInstaller = Element { elements.forEach { it.apply { invoke() } @@ -19,9 +18,7 @@ class ApplicationRoutingConfigurator( } override fun Application.configure() { - pluginOrNull(Routing) ?.apply { - rootInstaller.apply { invoke() } - } ?: install(Routing) { + 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 12de3b5538a..04548c751ba 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.util.InternalAPI +import io.ktor.utils.io.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 5fe28f0a7af..50225e60d9d 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.util.InternalAPI +import io.ktor.utils.io.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 f7d950229bd..dbc14399fae 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.Route +import io.ktor.server.routing.Routing import kotlinx.serialization.* -inline fun Route.configureCRUDRepoRoutes( +inline fun Routing.configureCRUDRepoRoutes( originalRepo: CRUDRepo, noinline idDeserializer: suspend (String) -> IdType ) { @@ -13,7 +13,7 @@ inline fun Route.configureCRUDRepoRoutes( +inline fun Routing.configureCRUDRepoRoutes( originalRepo: CRUDRepo, idsSerializer: KSerializer, serialFormat: StringFormat @@ -21,7 +21,7 @@ inline fun Route.configureCRUDRepoRoutes( +inline fun Routing.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 7b295deefae..79b3dc87652 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.Route +import io.ktor.server.routing.Routing import io.ktor.server.routing.get import kotlinx.serialization.* -inline fun Route.configureReadCRUDRepoRoutes( +inline fun Routing.configureReadCRUDRepoRoutes( originalRepo: ReadCRUDRepo, noinline idDeserializer: suspend (String) -> IdType ) { @@ -65,7 +65,7 @@ inline fun Route.configureReadCRUDRepoRoute } } -inline fun Route.configureReadCRUDRepoRoutes( +inline fun Routing.configureReadCRUDRepoRoutes( originalRepo: ReadCRUDRepo, idsSerializer: KSerializer, serialFormat: StringFormat @@ -73,7 +73,7 @@ inline fun Route.configureReadCRUDRepoRoute serialFormat.decodeFromString(idsSerializer, it) } -inline fun Route.configureReadCRUDRepoRoutes( +inline fun Routing.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 368f928d141..7d297850f7d 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.Route +import io.ktor.server.routing.Routing import io.ktor.server.routing.post -inline fun Route.configureWriteCRUDRepoRoutes( +inline fun Routing.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 1ff64d93a00..59ad0d31660 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.Route +import io.ktor.server.routing.Routing import kotlinx.serialization.* -inline fun Route.configureKeyValueRepoRoutes ( +inline fun Routing.configureKeyValueRepoRoutes ( originalRepo: KeyValueRepo, noinline idDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -15,7 +15,7 @@ inline fun Route.configureKeyValueRepoR configureWriteKeyValueRepoRoutes(originalRepo) } -inline fun Route.configureKeyValueRepoRoutes( +inline fun Routing.configureKeyValueRepoRoutes( originalRepo: KeyValueRepo, idsSerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -30,7 +30,7 @@ inline fun Route.configureKeyValueRepoR } ) -inline fun Route.configureKeyValueRepoRoutes( +inline fun Routing.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 418d87cae7e..f3e0104806a 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.Route +import io.ktor.server.routing.Routing import io.ktor.server.routing.get -import io.ktor.util.InternalAPI +import io.ktor.utils.io.InternalAPI import io.ktor.util.reflect.typeInfo import kotlinx.serialization.* @OptIn(InternalAPI::class) -inline fun Route.configureReadKeyValueRepoRoutes ( +inline fun Routing.configureReadKeyValueRepoRoutes ( originalRepo: ReadKeyValueRepo, noinline idDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -79,7 +79,7 @@ inline fun Route.configureReadKeyValueRepoRoutes ( } } -inline fun Route.configureReadKeyValueRepoRoutes( +inline fun Routing.configureReadKeyValueRepoRoutes( originalRepo: ReadKeyValueRepo, idsSerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -94,7 +94,7 @@ inline fun Route.configureReadKeyValueRepoRoutes( } ) -inline fun Route.configureReadKeyValueRepoRoutes( +inline fun Routing.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 78e39e8ff66..c3bc47e0240 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.Route +import io.ktor.server.routing.Routing import io.ktor.server.routing.post import io.ktor.util.reflect.typeInfo -inline fun Route.configureWriteKeyValueRepoRoutes ( +inline fun Routing.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 541ca5fd7ce..56fe0821c37 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.Route +import io.ktor.server.routing.Routing import kotlinx.serialization.* -inline fun Route.configureKeyValuesRepoRoutes ( +inline fun Routing.configureKeyValuesRepoRoutes ( originalRepo: KeyValuesRepo, noinline keyDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -15,7 +15,7 @@ inline fun Route.configureKeyValuesRepo configureWriteKeyValuesRepoRoutes(originalRepo) } -inline fun Route.configureKeyValuesRepoRoutes( +inline fun Routing.configureKeyValuesRepoRoutes( originalRepo: KeyValuesRepo, keySerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -30,7 +30,7 @@ inline fun Route.configureKeyValuesRepo } ) -inline fun Route.configureKeyValuesRepoRoutes( +inline fun Routing.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 0953465cd60..82df24d1c53 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.Route +import io.ktor.server.routing.Routing import io.ktor.server.routing.get -import io.ktor.util.InternalAPI +import io.ktor.utils.io.InternalAPI import io.ktor.util.reflect.typeInfo import kotlinx.serialization.* @OptIn(InternalAPI::class) -inline fun Route.configureReadKeyValuesRepoRoutes ( +inline fun Routing.configureReadKeyValuesRepoRoutes ( originalRepo: ReadKeyValuesRepo, noinline keyDeserializer: suspend (String) -> Key, noinline valueDeserializer: suspend (String) -> Value @@ -76,7 +76,7 @@ inline fun Route.configureReadKeyValuesRepoRoutes ( } } -inline fun Route.configureReadKeyValuesRepoRoutes( +inline fun Routing.configureReadKeyValuesRepoRoutes( originalRepo: ReadKeyValuesRepo, keySerializer: DeserializationStrategy, valueSerializer: DeserializationStrategy, @@ -91,7 +91,7 @@ inline fun Route.configureReadKeyValuesRepoRoutes( } ) -inline fun Route.configureReadKeyValuesRepoRoutes( +inline fun Routing.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 3f78ca0a7be..73c4d142eb4 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.Route +import io.ktor.server.routing.Routing import io.ktor.server.routing.post import io.ktor.util.reflect.typeInfo -inline fun Route.configureWriteKeyValuesRepoRoutes ( +inline fun Routing.configureWriteKeyValuesRepoRoutes ( originalRepo: WriteKeyValuesRepo ) { includeWebsocketHandling(