From 90c1731bd1d5aec4d2d8c0974b15ab8978557836 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 16 Oct 2020 19:40:04 +0600 Subject: [PATCH] Revert "more annotations to god of annotations" This reverts commit f8a8808508c0060f0d81ff03d4cf8d0cbcf5cd49. --- build_and_publish.sh | 2 +- .../dev/inmo/micro_utils/common/DiffUtils.kt | 3 --- .../dev/inmo/micro_utils/common/InputAllocator.kt | 3 --- .../dev/inmo/micro_utils/coroutines/Actor.kt | 2 -- .../inmo/micro_utils/coroutines/BroadcastFlow.kt | 3 --- .../micro_utils/coroutines/BroadcastStateFlow.kt | 6 ------ .../inmo/micro_utils/coroutines/DataAsDeferred.kt | 2 -- .../micro_utils/coroutines/DoOutsideOfCoroutine.kt | 2 -- .../inmo/micro_utils/coroutines/HandleSafely.kt | 2 -- .../micro_utils/ktor/client/FlowsWebsockets.kt | 3 --- .../ktor/client/StandardHttpClientGetPost.kt | 4 ---- .../micro_utils/ktor/common/BuildStandardUrl.kt | 5 ----- .../ktor/common/CorrectCloseException.kt | 4 ---- .../micro_utils/ktor/common/CorrectWebsocketUrl.kt | 3 --- .../micro_utils/ktor/common/FromToDateTimeUrl.kt | 3 --- .../micro_utils/ktor/common/QueryParamsBuilder.kt | 7 ------- .../micro_utils/ktor/common/StandardSerializer.kt | 8 -------- .../inmo/micro_utils/ktor/server/FlowsWebsocket.kt | 7 +++++++ .../inmo/micro_utils/mime_types/KnownMimeTypes.kt | 6 ------ .../inmo/micro_utils/mime_types/MimeTypeTools.kt | 4 ---- .../dev/inmo/micro_utils/pagination/Pagination.kt | 7 ------- .../micro_utils/pagination/PaginationResult.kt | 6 ------ .../micro_utils/pagination/SimplePagination.kt | 5 ----- .../inmo/micro_utils/pagination/WalkPagination.kt | 5 ----- .../pagination/utils/IterableExtensions.kt | 4 ---- .../inmo/micro_utils/pagination/PaginationInUrl.kt | 7 ------- .../micro_utils/repos/OneToManyKeyValueRepo.kt | 4 ---- .../kotlin/dev/inmo/micro_utils/repos/Repo.kt | 3 --- .../dev/inmo/micro_utils/repos/StandartCRUDRepo.kt | 9 --------- .../inmo/micro_utils/repos/StandartKeyValueRepo.kt | 4 ---- .../repos/pagination/CRUDPaginationExtensions.kt | 4 ---- .../pagination/KeyValuePaginationExtensions.kt | 4 ---- .../pagination/OneToManyPaginationExtensions.kt | 4 ---- .../dev/inmo/micro_utils/repos/MapCRUDRepo.kt | 6 ------ .../dev/inmo/micro_utils/repos/MapKeyValueRepo.kt | 5 ----- .../micro_utils/repos/MapOneToManyKeyValueRepo.kt | 5 ----- .../ktor/client/crud/KtorReadStandardCrudRepo.kt | 2 -- .../repos/ktor/client/crud/KtorStandardCrudRepo.kt | 2 -- .../ktor/client/crud/KtorWriteStandardCrudRepo.kt | 2 -- .../key_value/KtorReadStandardKeyValueRepo.kt | 2 -- .../client/key_value/KtorStandartKeyValueRepo.kt | 2 -- .../key_value/KtorWriteStandardKeyValueRepo.kt | 2 -- .../one_to_many/KtorOneToManyKeyValueRepo.kt | 2 -- .../one_to_many/KtorReadOneToManyKeyValueRepo.kt | 3 +-- .../one_to_many/KtorWriteOneToManyKeyValueRepo.kt | 2 -- .../repos/ktor/common/crud/CrudReadRoutes.kt | 6 ------ .../repos/ktor/common/crud/CrudWriteRoutes.kt | 9 --------- .../common/key_value/KeyValueParameterNames.kt | 4 ---- .../ktor/common/key_value/KeyValuePostObject.kt | 2 -- .../repos/ktor/common/key_value/KeyValueRoutes.kt | 11 ----------- .../common/one_to_many/OneToManyParametersNames.kt | 5 ----- .../ktor/common/one_to_many/OneToManyRoutes.kt | 14 -------------- 52 files changed, 9 insertions(+), 222 deletions(-) diff --git a/build_and_publish.sh b/build_and_publish.sh index 77c020f3379..231669a1db5 100755 --- a/build_and_publish.sh +++ b/build_and_publish.sh @@ -12,4 +12,4 @@ function assert_success() { export RELEASE_MODE=true project="$1" -assert_success ./gradlew $project:build $project:bintrayUpload +assert_success ./gradlew clean "$project:clean" "$project:build" "$project:publishToMavenLocal" "$project:bintrayUpload" diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt index 0ce020044c4..92e0dca214d 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DiffUtils.kt @@ -1,8 +1,5 @@ package dev.inmo.micro_utils.common -import kotlin.js.JsExport - -@JsExport fun Iterable.syncWith( other: Iterable, removed: (List) -> Unit = {}, diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/InputAllocator.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/InputAllocator.kt index 7e48a9caa9e..2fd48505694 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/InputAllocator.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/InputAllocator.kt @@ -5,15 +5,12 @@ import kotlinx.serialization.builtins.ByteArraySerializer import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -import kotlin.js.JsExport typealias ByteArrayAllocator = () -> ByteArray -@JsExport val ByteArray.asAllocator: ByteArrayAllocator get() = { this } -@JsExport object ByteArrayAllocatorSerializer : KSerializer { private val realSerializer = ByteArraySerializer() override val descriptor: SerialDescriptor = realSerializer.descriptor diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/Actor.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/Actor.kt index d5b1c4589b6..310d67c32f1 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/Actor.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/Actor.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.coroutines import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.launch -import kotlin.js.JsExport -@JsExport fun CoroutineScope.actor( channelCapacity: Int = Channel.UNLIMITED, block: suspend (T) -> Unit diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastFlow.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastFlow.kt index e1fb966144d..d3ff5b0b277 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastFlow.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastFlow.kt @@ -2,9 +2,7 @@ package dev.inmo.micro_utils.coroutines import kotlinx.coroutines.channels.* import kotlinx.coroutines.flow.* -import kotlin.js.JsExport -@JsExport @Suppress("FunctionName") fun BroadcastFlow( internalChannelSize: Int = Channel.BUFFERED @@ -17,7 +15,6 @@ fun BroadcastFlow( ) } -@JsExport class BroadcastFlow internal constructor( private val channel: BroadcastChannel, private val flow: Flow diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt index 3df24b6d12a..f8d54aab376 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/BroadcastStateFlow.kt @@ -4,9 +4,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.* -import kotlin.js.JsExport -@JsExport class BroadcastStateFlow internal constructor( parentFlow: Flow, private val stateGetter: () -> T @@ -15,7 +13,6 @@ class BroadcastStateFlow internal constructor( get() = stateGetter() } -@JsExport fun BroadcastChannel.asStateFlow(value: T, scope: CoroutineScope): StateFlow = asFlow().let { var state: T = value it.onEach { state = it }.launchIn(scope) @@ -24,16 +21,13 @@ fun BroadcastChannel.asStateFlow(value: T, scope: CoroutineScope): StateF } } -@JsExport fun BroadcastChannel.asStateFlow(scope: CoroutineScope): StateFlow = asStateFlow(null, scope) -@JsExport fun broadcastStateFlow(initial: T, scope: CoroutineScope, channelSize: Int = Channel.BUFFERED) = BroadcastChannel( channelSize ).let { it to it.asStateFlow(initial, scope) } -@JsExport fun broadcastStateFlow(scope: CoroutineScope, channelSize: Int = Channel.BUFFERED) = broadcastStateFlow(null, scope, channelSize) diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DataAsDeferred.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DataAsDeferred.kt index d529e3de77a..e196df51555 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DataAsDeferred.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DataAsDeferred.kt @@ -2,8 +2,6 @@ package dev.inmo.micro_utils.coroutines import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlin.js.JsExport -@JsExport val T.asDeferred: Deferred get() = CompletableDeferred(this) diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoOutsideOfCoroutine.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoOutsideOfCoroutine.kt index 5931053cf52..a4a7e2b912b 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoOutsideOfCoroutine.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoOutsideOfCoroutine.kt @@ -1,12 +1,10 @@ package dev.inmo.micro_utils.coroutines import kotlin.coroutines.* -import kotlin.js.JsExport /** * Call this method in case you need to do something in common thread (like reading of file in JVM) */ -@JsExport suspend fun doOutsideOfCoroutine(block: () -> T): T = suspendCoroutine { try { it.resume(block()) diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt index 13738f07d9c..c58ba10c3d3 100644 --- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt +++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt @@ -2,7 +2,6 @@ package dev.inmo.micro_utils.coroutines import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.supervisorScope -import kotlin.js.JsExport typealias ExceptionHandler = suspend (Throwable) -> T @@ -12,7 +11,6 @@ typealias ExceptionHandler = suspend (Throwable) -> T * @param [onException] Will be called when happen exception inside of [block]. By default will throw exception - this * exception will be available for catching */ -@JsExport suspend inline fun safely( noinline onException: ExceptionHandler = { throw it }, noinline block: suspend CoroutineScope.() -> T diff --git a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/FlowsWebsockets.kt b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/FlowsWebsockets.kt index d807fa3815d..5f3512cdc2a 100644 --- a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/FlowsWebsockets.kt +++ b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/FlowsWebsockets.kt @@ -8,13 +8,11 @@ import io.ktor.http.cio.websocket.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.channelFlow import kotlinx.serialization.DeserializationStrategy -import kotlin.js.JsExport /** * @param checkReconnection This lambda will be called when it is required to reconnect to websocket to establish * connection. Must return true in case if must be reconnected. By default always reconnecting */ -@JsExport inline fun HttpClient.createStandardWebsocketFlow( url: String, crossinline checkReconnection: (Throwable?) -> Boolean = { true }, @@ -62,7 +60,6 @@ inline fun HttpClient.createStandardWebsocketFlow( * @param checkReconnection This lambda will be called when it is required to reconnect to websocket to establish * connection. Must return true in case if must be reconnected. By default always reconnecting */ -@JsExport inline fun HttpClient.createStandardWebsocketFlow( url: String, crossinline checkReconnection: (Throwable?) -> Boolean = { true }, diff --git a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/StandardHttpClientGetPost.kt b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/StandardHttpClientGetPost.kt index ce7d5196f20..6981ba21a30 100644 --- a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/StandardHttpClientGetPost.kt +++ b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/StandardHttpClientGetPost.kt @@ -5,11 +5,9 @@ import io.ktor.client.HttpClient import io.ktor.client.request.get import io.ktor.client.request.post import kotlinx.serialization.* -import kotlin.js.JsExport typealias BodyPair = Pair, T> -@JsExport suspend fun HttpClient.uniget( url: String, resultDeserializer: DeserializationStrategy @@ -20,13 +18,11 @@ suspend fun HttpClient.uniget( } -@JsExport fun SerializationStrategy.encodeUrlQueryValue(value: T) = standardKtorSerialFormat.encodeHex( this, value ) -@JsExport suspend fun HttpClient.unipost( url: String, bodyInfo: BodyPair, diff --git a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/BuildStandardUrl.kt b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/BuildStandardUrl.kt index 29db9c2d07e..60b8dc3d99f 100644 --- a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/BuildStandardUrl.kt +++ b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/BuildStandardUrl.kt @@ -1,8 +1,5 @@ package dev.inmo.micro_utils.ktor.common -import kotlin.js.JsExport - -@JsExport fun buildStandardUrl( basePart: String, subpart: String, @@ -11,7 +8,6 @@ fun buildStandardUrl( parameters ) -@JsExport fun buildStandardUrl( basePart: String, subpart: String, @@ -20,7 +16,6 @@ fun buildStandardUrl( parameters ) -@JsExport fun buildStandardUrl( basePart: String, subpart: String, diff --git a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectCloseException.kt b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectCloseException.kt index a9bef863dad..2189e312777 100644 --- a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectCloseException.kt +++ b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectCloseException.kt @@ -1,7 +1,3 @@ package dev.inmo.micro_utils.ktor.common -import kotlin.js.JsExport - -@JsExport -@Deprecated("Will be removed in next major release as useless") object CorrectCloseException : Exception() diff --git a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectWebsocketUrl.kt b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectWebsocketUrl.kt index 0466df14b51..f1cd5d78b0f 100644 --- a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectWebsocketUrl.kt +++ b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/CorrectWebsocketUrl.kt @@ -1,10 +1,7 @@ package dev.inmo.micro_utils.ktor.common -import kotlin.js.JsExport - private val schemaRegex = Regex("^[^:]*://") -@JsExport val String.asCorrectWebSocketUrl: String get() = if (startsWith("ws")) { this diff --git a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/FromToDateTimeUrl.kt b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/FromToDateTimeUrl.kt index dfd1503a8cf..ff015524268 100644 --- a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/FromToDateTimeUrl.kt +++ b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/FromToDateTimeUrl.kt @@ -1,18 +1,15 @@ package dev.inmo.micro_utils.ktor.common import com.soywiz.klock.DateTime -import kotlin.js.JsExport typealias FromToDateTime = Pair -@JsExport val FromToDateTime.asFromToUrlPart: QueryParams get() = mapOf( "from" to first ?.unixMillis ?.toString(), "to" to second ?.unixMillis ?.toString() ) -@JsExport val QueryParams.extractFromToDateTime: FromToDateTime get() = FromToDateTime( get("from") ?.toDoubleOrNull() ?.let { DateTime(it) }, diff --git a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/QueryParamsBuilder.kt b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/QueryParamsBuilder.kt index 4bcfa33492b..0ef45009594 100644 --- a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/QueryParamsBuilder.kt +++ b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/QueryParamsBuilder.kt @@ -1,29 +1,22 @@ package dev.inmo.micro_utils.ktor.common -import kotlin.js.JsExport - typealias QueryParam = Pair typealias QueryParams = Map -@JsExport val QueryParams.asUrlQuery: String get() = keys.joinToString("&") { "${it}${get(it) ?.let { value -> "=$value" }}" } -@JsExport val List.asUrlQuery: String get() = joinToString("&") { (key, value) -> "${key}${value ?.let { _ -> "=$value" }}" } -@JsExport fun String.includeQueryParams( queryParams: QueryParams ): String = "$this${if(queryParams.isNotEmpty()) "${if (contains("?")) "&" else "?"}${queryParams.asUrlQuery}" else ""}" -@JsExport fun String.includeQueryParams( queryParams: List ): String = "$this${if (contains("?")) "&" else "?"}${queryParams.asUrlQuery}" -@JsExport val String.parseUrlQuery: QueryParams get() = split("&").map { it.split("=").let { pair -> diff --git a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/StandardSerializer.kt b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/StandardSerializer.kt index e65678474d9..5d088c9721b 100644 --- a/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/StandardSerializer.kt +++ b/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/common/StandardSerializer.kt @@ -2,36 +2,28 @@ package dev.inmo.micro_utils.ktor.common import kotlinx.serialization.* import kotlinx.serialization.cbor.Cbor -import kotlin.js.JsExport typealias StandardKtorSerialFormat = BinaryFormat typealias StandardKtorSerialInputData = ByteArray -@JsExport val standardKtorSerialFormat: StandardKtorSerialFormat = Cbor { } -@JsExport inline fun StandardKtorSerialFormat.decodeDefault( deserializationStrategy: DeserializationStrategy, input: StandardKtorSerialInputData ): T = decodeFromByteArray(deserializationStrategy, input) -@JsExport inline fun StandardKtorSerialFormat.encodeDefault( serializationStrategy: SerializationStrategy, data: T ): StandardKtorSerialInputData = encodeToByteArray(serializationStrategy, data) -@JsExport -@Deprecated("Will be removed in next major release due to useless") val cbor = Cbor {} -@JsExport inline fun StandardKtorSerialFormat.decodeHex( deserializationStrategy: DeserializationStrategy, input: String ): T = decodeFromHexString(deserializationStrategy, input) -@JsExport inline fun StandardKtorSerialFormat.encodeHex( serializationStrategy: SerializationStrategy, data: T diff --git a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/FlowsWebsocket.kt b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/FlowsWebsocket.kt index 43b8a936193..ed385691437 100644 --- a/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/FlowsWebsocket.kt +++ b/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/ktor/server/FlowsWebsocket.kt @@ -9,6 +9,13 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.serialization.SerializationStrategy +private suspend fun DefaultWebSocketSession.checkReceivedAndCloseIfExists() { + if (incoming.poll() != null) { + close() + throw CorrectCloseException + } +} + fun Route.includeWebsocketHandling( suburl: String, flow: Flow, diff --git a/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/KnownMimeTypes.kt b/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/KnownMimeTypes.kt index 8b23dd398f0..17c13034199 100644 --- a/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/KnownMimeTypes.kt +++ b/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/KnownMimeTypes.kt @@ -1,17 +1,13 @@ package dev.inmo.micro_utils.mime_types import kotlinx.serialization.Serializable -import kotlin.js.JsExport -@JsExport @Serializable(MimeTypeSerializer::class) interface MimeType { val raw: String } -@JsExport data class CustomMimeType(override val raw: String) : MimeType -@JsExport @Serializable(MimeTypeSerializer::class) sealed class KnownMimeTypes(override val raw: String) : MimeType { object Any : MimeType, KnownMimeTypes("*/*") @@ -2148,12 +2144,10 @@ internal val knownMimeTypes: Set = setOf( KnownMimeTypes.XConference.XCooltalk, ) -@JsExport val knownMimeTypesMap by lazy { knownMimeTypes.associateBy { it.raw } } -@JsExport fun findBuiltinMimeType(from: String): MimeType? { return knownMimeTypesMap[from] } diff --git a/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/MimeTypeTools.kt b/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/MimeTypeTools.kt index 9792487ab89..dd285d2f834 100644 --- a/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/MimeTypeTools.kt +++ b/mime_types/src/commonMain/kotlin/dev/inmo/micro_utils/mime_types/MimeTypeTools.kt @@ -5,22 +5,18 @@ import kotlinx.serialization.Serializer import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -import kotlin.js.JsExport private val mimesCache = mutableMapOf().also { knownMimeTypes.forEach { mimeType -> it[mimeType.raw] = mimeType } } -@JsExport fun mimeType(raw: String) = mimesCache.getOrPut(raw) { parseMimeType(raw) } -@JsExport internal fun parseMimeType(raw: String): MimeType = CustomMimeType(raw) @Serializer(MimeType::class) -@JsExport object MimeTypeSerializer : KSerializer { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("mimeType", PrimitiveKind.STRING) diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/Pagination.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/Pagination.kt index e55389d8503..53d8958dc42 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/Pagination.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/Pagination.kt @@ -1,6 +1,5 @@ package dev.inmo.micro_utils.pagination -import kotlin.js.JsExport import kotlin.math.ceil import kotlin.math.floor @@ -10,7 +9,6 @@ import kotlin.math.floor * If you want to request something, you should use [SimplePagination]. If you need to return some result including * pagination - [PaginationResult] */ -@JsExport interface Pagination { /** * Started with 0. @@ -27,7 +25,6 @@ interface Pagination { /** * First number in index of objects. It can be used as offset for databases or other data sources */ -@JsExport val Pagination.firstIndex: Int get() = page * size @@ -37,21 +34,18 @@ val Pagination.firstIndex: Int * [[firstIndex], [lastIndex]]; That means, that for [Pagination] with [Pagination.size] == 10 and [Pagination.page] == 1 * you will retrieve [Pagination.firstIndex] == 10 and [Pagination.lastIndex] == 19. */ -@JsExport val Pagination.lastIndex: Int get() = firstIndex + size - 1 /** * Calculates pages count for given [datasetSize] */ -@JsExport fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int { return ceil(datasetSize.toDouble() / pageSize).toInt() } /** * Calculates pages count for given [datasetSize] */ -@JsExport fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int = calculatePagesNumber( datasetSize.toLong(), @@ -61,7 +55,6 @@ fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int = /** * @return calculated page number which can be correctly used in [PaginationResult] as [PaginationResult.page] value */ -@JsExport fun calculatePage(firstIndex: Int, resultsSize: Int): Int = if (resultsSize > 0) { floor(firstIndex.toFloat() / resultsSize).toInt() } else { diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationResult.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationResult.kt index bf0fc730102..35c3f3939a8 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationResult.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationResult.kt @@ -1,9 +1,7 @@ package dev.inmo.micro_utils.pagination import kotlinx.serialization.Serializable -import kotlin.js.JsExport -@JsExport @Serializable data class PaginationResult( override val page: Int, @@ -12,10 +10,8 @@ data class PaginationResult( override val size: Int ) : Pagination -@JsExport fun emptyPaginationResult() = PaginationResult(0, 0, emptyList(), 0) -@JsExport fun List.createPaginationResult( pagination: Pagination, commonObjectsNumber: Long @@ -29,7 +25,6 @@ fun List.createPaginationResult( pagination.size ) -@JsExport fun List.createPaginationResult( firstIndex: Int, commonObjectsNumber: Long @@ -43,7 +38,6 @@ fun List.createPaginationResult( size ) -@JsExport fun Pair>.createPaginationResult( pagination: Pagination ) = second.createPaginationResult(pagination, first) diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt index 942e9395a72..900bf745794 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/SimplePagination.kt @@ -1,14 +1,12 @@ package dev.inmo.micro_utils.pagination import kotlinx.serialization.Serializable -import kotlin.js.JsExport const val defaultSmallPageSize = 2 const val defaultMediumPageSize = 5 const val defaultLargePageSize = 10 const val defaultExtraLargePageSize = 15 -@JsExport @Suppress("NOTHING_TO_INLINE", "FunctionName") inline fun FirstPagePagination(size: Int = defaultMediumPageSize) = SimplePagination( @@ -16,7 +14,6 @@ inline fun FirstPagePagination(size: Int = defaultMediumPageSize) = size = size ) -@JsExport @Suppress("NOTHING_TO_INLINE") inline fun Pagination.nextPage() = SimplePagination( @@ -24,14 +21,12 @@ inline fun Pagination.nextPage() = size ) -@JsExport @Serializable data class SimplePagination( override val page: Int, override val size: Int ) : Pagination -@JsExport fun Pagination( page: Int, size: Int diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/WalkPagination.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/WalkPagination.kt index d311f22da93..aed3d2716fa 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/WalkPagination.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/WalkPagination.kt @@ -1,8 +1,5 @@ package dev.inmo.micro_utils.pagination -import kotlin.js.JsExport - -@JsExport inline fun doWithPagination( startPagination: Pagination = FirstPagePagination(), requestMaker: (pagination: Pagination) -> Pagination? @@ -13,7 +10,6 @@ inline fun doWithPagination( } } -@JsExport @Suppress("NOTHING_TO_INLINE") inline fun PaginationResult<*>.nextPageIfNotEmpty() = if (results.isNotEmpty()) { SimplePagination( @@ -24,7 +20,6 @@ inline fun PaginationResult<*>.nextPageIfNotEmpty() = if (results.isNotEmpty()) null } -@JsExport @Suppress("NOTHING_TO_INLINE") inline fun PaginationResult<*>.thisPageIfNotEmpty(): Pagination? = if (results.isNotEmpty()) { this diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/IterableExtensions.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/IterableExtensions.kt index db7365cf3f3..4b6a5d97240 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/IterableExtensions.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/IterableExtensions.kt @@ -1,9 +1,7 @@ package dev.inmo.micro_utils.pagination.utils import dev.inmo.micro_utils.pagination.* -import kotlin.js.JsExport -@JsExport fun Iterable.paginate(with: Pagination): PaginationResult { var i = 0 val result = mutableListOf() @@ -22,7 +20,6 @@ fun Iterable.paginate(with: Pagination): PaginationResult { return result.createPaginationResult(with, i.toLong()) } -@JsExport fun List.paginate(with: Pagination): PaginationResult { return subList(with.firstIndex, with.lastIndex + 1).createPaginationResult( with, @@ -30,7 +27,6 @@ fun List.paginate(with: Pagination): PaginationResult { ) } -@JsExport fun Set.paginate(with: Pagination): PaginationResult { return this.drop(with.firstIndex).take(with.size).createPaginationResult( with, diff --git a/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt b/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt index 2dd0904face..5373489bf32 100644 --- a/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt +++ b/pagination/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/PaginationInUrl.kt @@ -1,27 +1,20 @@ package dev.inmo.micro_utils.pagination -import kotlin.js.JsExport - -@JsExport const val paginationPageKey = "ppage" -@JsExport const val paginationSizeKey = "psize" -@JsExport val Pagination.asUrlQueryParts get() = mapOf( paginationPageKey to page.toString(), paginationSizeKey to size.toString() ) -@JsExport val Pagination.asUrlQueryArrayParts get() = arrayOf( paginationPageKey to page.toString(), paginationSizeKey to size.toString() ) -@JsExport val Map.extractPagination: Pagination get() = SimplePagination( get(paginationPageKey) ?.toIntOrNull() ?: 0, diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/OneToManyKeyValueRepo.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/OneToManyKeyValueRepo.kt index 0564db7268e..4c6b71e6b9b 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/OneToManyKeyValueRepo.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/OneToManyKeyValueRepo.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.repos import dev.inmo.micro_utils.pagination.Pagination import dev.inmo.micro_utils.pagination.PaginationResult import kotlinx.coroutines.flow.Flow -import kotlin.js.JsExport -@JsExport interface ReadOneToManyKeyValueRepo : Repo { suspend fun get(k: Key, pagination: Pagination, reversed: Boolean = false): PaginationResult suspend fun keys(pagination: Pagination, reversed: Boolean = false): PaginationResult @@ -17,7 +15,6 @@ interface ReadOneToManyKeyValueRepo : Repo { @Deprecated("Renamed", ReplaceWith("ReadOneToManyKeyValueRepo", "dev.inmo.micro_utils.repos.ReadOneToManyKeyValueRepo")) typealias OneToManyReadKeyValueRepo = ReadOneToManyKeyValueRepo -@JsExport interface WriteOneToManyKeyValueRepo : Repo { val onNewValue: Flow> val onValueRemoved: Flow> @@ -30,5 +27,4 @@ interface WriteOneToManyKeyValueRepo : Repo { @Deprecated("Renamed", ReplaceWith("WriteOneToManyKeyValueRepo", "dev.inmo.micro_utils.repos.WriteOneToManyKeyValueRepo")) typealias OneToManyWriteKeyValueRepo = WriteOneToManyKeyValueRepo -@JsExport interface OneToManyKeyValueRepo : ReadOneToManyKeyValueRepo, WriteOneToManyKeyValueRepo \ No newline at end of file diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/Repo.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/Repo.kt index 1d723ba91a8..b05c462dcbb 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/Repo.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/Repo.kt @@ -1,6 +1,3 @@ package dev.inmo.micro_utils.repos -import kotlin.js.JsExport - -@JsExport interface Repo diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt index c8e93f51675..28ad1ac34c7 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.repos import dev.inmo.micro_utils.pagination.Pagination import dev.inmo.micro_utils.pagination.PaginationResult import kotlinx.coroutines.flow.Flow -import kotlin.js.JsExport -@JsExport interface ReadStandardCRUDRepo : Repo { suspend fun getByPagination(pagination: Pagination): PaginationResult suspend fun getById(id: IdType): ObjectType? @@ -14,14 +12,11 @@ interface ReadStandardCRUDRepo : Repo { } typealias UpdatedValuePair = Pair -@JsExport val UpdatedValuePair.id get() = first -@JsExport val UpdatedValuePair<*, ValueType>.value get() = second -@JsExport interface WriteStandardCRUDRepo : Repo { val newObjectsFlow: Flow val updatedObjectsFlow: Flow @@ -33,19 +28,15 @@ interface WriteStandardCRUDRepo : Repo { suspend fun deleteById(ids: List) } -@JsExport suspend fun WriteStandardCRUDRepo.create( vararg values: InputValueType ): List = create(values.toList()) -@JsExport suspend fun WriteStandardCRUDRepo.update( vararg values: UpdatedValuePair ): List = update(values.toList()) -@JsExport suspend fun WriteStandardCRUDRepo.deleteById( vararg ids: IdType ) = deleteById(ids.toList()) -@JsExport interface StandardCRUDRepo : ReadStandardCRUDRepo, WriteStandardCRUDRepo \ No newline at end of file diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartKeyValueRepo.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartKeyValueRepo.kt index 130d1bda970..a2666571db6 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartKeyValueRepo.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartKeyValueRepo.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.repos import dev.inmo.micro_utils.pagination.Pagination import dev.inmo.micro_utils.pagination.PaginationResult import kotlinx.coroutines.flow.Flow -import kotlin.js.JsExport -@JsExport interface ReadStandardKeyValueRepo : Repo { suspend fun get(k: Key): Value? suspend fun values(pagination: Pagination, reversed: Boolean = false): PaginationResult @@ -14,7 +12,6 @@ interface ReadStandardKeyValueRepo : Repo { suspend fun count(): Long } -@JsExport interface WriteStandardKeyValueRepo : Repo { val onNewValue: Flow> val onValueRemoved: Flow @@ -23,5 +20,4 @@ interface WriteStandardKeyValueRepo : Repo { suspend fun unset(k: Key) } -@JsExport interface StandardKeyValueRepo : ReadStandardKeyValueRepo, WriteStandardKeyValueRepo \ No newline at end of file diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt index 45a63976563..e626262f229 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/CRUDPaginationExtensions.kt @@ -2,9 +2,7 @@ package dev.inmo.micro_utils.repos.pagination import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.repos.ReadStandardCRUDRepo -import kotlin.js.JsExport -@JsExport suspend inline fun > REPO.doForAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") methodCaller: suspend REPO.(Pagination) -> PaginationResult, @@ -17,12 +15,10 @@ suspend inline fun > REPO.doForAll( } } -@JsExport suspend inline fun > REPO.doForAll( block: (List) -> Unit ) = doForAll({ getByPagination(it) }, block) -@JsExport suspend inline fun > REPO.getAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") methodCaller: suspend REPO.(Pagination) -> PaginationResult diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt index 09d5a80f2b8..4442571948c 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/KeyValuePaginationExtensions.kt @@ -2,9 +2,7 @@ package dev.inmo.micro_utils.repos.pagination import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.repos.* -import kotlin.js.JsExport -@JsExport suspend inline fun > REPO.doForAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") methodCaller: suspend REPO.(Pagination) -> PaginationResult, @@ -17,12 +15,10 @@ suspend inline fun > REP } } -@JsExport suspend inline fun > REPO.doForAll( block: (List>) -> Unit ) = doForAll({ keys(it, false) }, block) -@JsExport suspend inline fun > REPO.getAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") methodCaller: suspend REPO.(Pagination) -> PaginationResult diff --git a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt index 52bbfba9974..0c3de2def3c 100644 --- a/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt +++ b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/pagination/OneToManyPaginationExtensions.kt @@ -2,9 +2,7 @@ package dev.inmo.micro_utils.repos.pagination import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.repos.* -import kotlin.js.JsExport -@JsExport suspend inline fun > REPO.doForAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") methodCaller: suspend REPO.(Pagination) -> PaginationResult, @@ -27,12 +25,10 @@ suspend inline fun > RE } } -@JsExport suspend inline fun > REPO.doForAll( block: (List>>) -> Unit ) = doForAll({ keys(it, false) }, block) -@JsExport suspend inline fun > REPO.getAll( @Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE") methodCaller: suspend REPO.(Pagination) -> PaginationResult diff --git a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt index 77ea3788249..a2194f0b96a 100644 --- a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt +++ b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapCRUDRepo.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.repos import dev.inmo.micro_utils.coroutines.BroadcastFlow import dev.inmo.micro_utils.pagination.* import kotlinx.coroutines.flow.Flow -import kotlin.js.JsExport -@JsExport class ReadMapCRUDRepo( private val map: Map = emptyMap() ) : ReadStandardCRUDRepo { @@ -25,7 +23,6 @@ class ReadMapCRUDRepo( override suspend fun count(): Long = map.size.toLong() } -@JsExport abstract class WriteMapCRUDRepo( private val map: MutableMap = mutableMapOf() ) : WriteStandardCRUDRepo { @@ -73,14 +70,12 @@ abstract class WriteMapCRUDRepo( } -@JsExport abstract class MapCRUDRepo( map: MutableMap ) : StandardCRUDRepo, ReadStandardCRUDRepo by ReadMapCRUDRepo(map), WriteMapCRUDRepo(map) -@JsExport fun MapCRUDRepo( map: MutableMap, updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, @@ -95,7 +90,6 @@ fun MapCRUDRepo( override suspend fun createObject(newValue: InputValueType): Pair = createCallback(newValue) } -@JsExport fun MutableMap.asCrudRepo( updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, createCallback: suspend (newValue: InputValueType) -> Pair diff --git a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValueRepo.kt b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValueRepo.kt index 6c4323f26af..506033e6c70 100644 --- a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValueRepo.kt +++ b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapKeyValueRepo.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.repos import dev.inmo.micro_utils.coroutines.BroadcastFlow import dev.inmo.micro_utils.pagination.* import kotlinx.coroutines.flow.Flow -import kotlin.js.JsExport -@JsExport class ReadMapKeyValueRepo( private val map: Map = emptyMap() ) : ReadStandardKeyValueRepo { @@ -47,7 +45,6 @@ class ReadMapKeyValueRepo( override suspend fun count(): Long = map.size.toLong() } -@JsExport class WriteMapKeyValueRepo( private val map: MutableMap = mutableMapOf() ) : WriteStandardKeyValueRepo { @@ -68,12 +65,10 @@ class WriteMapKeyValueRepo( } } -@JsExport class MapKeyValueRepo( private val map: MutableMap = mutableMapOf() ) : StandardKeyValueRepo, ReadStandardKeyValueRepo by ReadMapKeyValueRepo(map), WriteStandardKeyValueRepo by WriteMapKeyValueRepo(map) -@JsExport fun MutableMap.asKeyValueRepo(): StandardKeyValueRepo = MapKeyValueRepo(this) diff --git a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapOneToManyKeyValueRepo.kt b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapOneToManyKeyValueRepo.kt index 9f9b019c946..266f98c3baa 100644 --- a/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapOneToManyKeyValueRepo.kt +++ b/repos/inmemory/src/commonMain/kotlin/dev/inmo/micro_utils/repos/MapOneToManyKeyValueRepo.kt @@ -4,9 +4,7 @@ import dev.inmo.micro_utils.coroutines.BroadcastFlow import dev.inmo.micro_utils.pagination.* import dev.inmo.micro_utils.pagination.utils.paginate import kotlinx.coroutines.flow.Flow -import kotlin.js.JsExport -@JsExport class MapReadOneToManyKeyValueRepo( private val map: Map> = emptyMap() ) : ReadOneToManyKeyValueRepo { @@ -46,7 +44,6 @@ class MapReadOneToManyKeyValueRepo( override suspend fun count(): Long = map.size.toLong() } -@JsExport class MapWriteOneToManyKeyValueRepo( private val map: MutableMap> = mutableMapOf() ) : WriteOneToManyKeyValueRepo { @@ -74,14 +71,12 @@ class MapWriteOneToManyKeyValueRepo( } } -@JsExport class MapOneToManyKeyValueRepo( private val map: MutableMap> = mutableMapOf() ) : OneToManyKeyValueRepo, ReadOneToManyKeyValueRepo by MapReadOneToManyKeyValueRepo(map), WriteOneToManyKeyValueRepo by MapWriteOneToManyKeyValueRepo(map) -@JsExport fun MutableMap>.asOneToManyKeyValueRepo(): OneToManyKeyValueRepo = MapOneToManyKeyValueRepo( map { (k, v) -> k to v.toMutableList() }.toMap().toMutableMap() ) diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorReadStandardCrudRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorReadStandardCrudRepo.kt index 5d5f780ef31..1a3d3a2bf67 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorReadStandardCrudRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorReadStandardCrudRepo.kt @@ -11,9 +11,7 @@ import dev.inmo.micro_utils.repos.ktor.common.crud.* import io.ktor.client.HttpClient import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.serializer -import kotlin.js.JsExport -@JsExport class KtorReadStandardCrudRepo ( private val baseUrl: String, private val client: HttpClient = HttpClient(), diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorStandardCrudRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorStandardCrudRepo.kt index 41121368fe1..97d8a0abbab 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorStandardCrudRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorStandardCrudRepo.kt @@ -3,9 +3,7 @@ package dev.inmo.micro_utils.repos.ktor.client.crud import dev.inmo.micro_utils.repos.* import io.ktor.client.HttpClient import kotlinx.serialization.KSerializer -import kotlin.js.JsExport -@JsExport class KtorStandardCrudRepo ( baseUrl: String, baseSubpart: String, diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorWriteStandardCrudRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorWriteStandardCrudRepo.kt index 717b1d1ece9..960ad239ad1 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorWriteStandardCrudRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorWriteStandardCrudRepo.kt @@ -11,9 +11,7 @@ import io.ktor.client.HttpClient import kotlinx.coroutines.flow.Flow import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.* -import kotlin.js.JsExport -@JsExport class KtorWriteStandardCrudRepo ( private val baseUrl: String, private val client: HttpClient = HttpClient(), diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorReadStandardKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorReadStandardKeyValueRepo.kt index c2886607935..f7c0af2e256 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorReadStandardKeyValueRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorReadStandardKeyValueRepo.kt @@ -11,9 +11,7 @@ import dev.inmo.micro_utils.repos.ktor.common.key_value.* import io.ktor.client.* import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.serializer -import kotlin.js.JsExport -@JsExport class KtorReadStandardKeyValueRepo ( private var baseUrl: String, private var client: HttpClient = HttpClient(), diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorStandartKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorStandartKeyValueRepo.kt index 982cc474709..9c7164ab49f 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorStandartKeyValueRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorStandartKeyValueRepo.kt @@ -5,9 +5,7 @@ import dev.inmo.micro_utils.repos.ReadStandardKeyValueRepo import dev.inmo.micro_utils.repos.WriteStandardKeyValueRepo import io.ktor.client.* import kotlinx.serialization.KSerializer -import kotlin.js.JsExport -@JsExport class KtorStandartKeyValueRepo ( baseUrl: String, baseSubpart: String, diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorWriteStandardKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorWriteStandardKeyValueRepo.kt index 951f9d30291..043f21155db 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorWriteStandardKeyValueRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorWriteStandardKeyValueRepo.kt @@ -11,9 +11,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.PairSerializer import kotlinx.serialization.builtins.serializer -import kotlin.js.JsExport -@JsExport class KtorWriteStandardKeyValueRepo ( private var baseUrl: String, private var client: HttpClient = HttpClient(), diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorOneToManyKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorOneToManyKeyValueRepo.kt index bb299cee216..8dc20ae25ad 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorOneToManyKeyValueRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorOneToManyKeyValueRepo.kt @@ -5,9 +5,7 @@ import dev.inmo.micro_utils.repos.ReadOneToManyKeyValueRepo import dev.inmo.micro_utils.repos.WriteOneToManyKeyValueRepo import io.ktor.client.HttpClient import kotlinx.serialization.KSerializer -import kotlin.js.JsExport -@JsExport class KtorOneToManyKeyValueRepo( baseUrl: String, baseSubpart: String, diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorReadOneToManyKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorReadOneToManyKeyValueRepo.kt index 92063ec1d8f..5dd4e23c9b8 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorReadOneToManyKeyValueRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorReadOneToManyKeyValueRepo.kt @@ -11,9 +11,7 @@ import dev.inmo.micro_utils.repos.ktor.common.one_to_many.* import io.ktor.client.HttpClient import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.serializer -import kotlin.js.JsExport -@JsExport class KtorReadOneToManyKeyValueRepo ( private val baseUrl: String, private val client: HttpClient = HttpClient(), @@ -85,4 +83,5 @@ class KtorReadOneToManyKeyValueRepo ( ), Long.serializer() ) + } \ No newline at end of file diff --git a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorWriteOneToManyKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorWriteOneToManyKeyValueRepo.kt index a78c6be3dd7..3022463da8a 100644 --- a/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorWriteOneToManyKeyValueRepo.kt +++ b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorWriteOneToManyKeyValueRepo.kt @@ -11,9 +11,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.PairSerializer import kotlinx.serialization.builtins.serializer -import kotlin.js.JsExport -@JsExport class KtorWriteOneToManyKeyValueRepo ( private val baseUrl: String, private val client: HttpClient = HttpClient(), diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudReadRoutes.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudReadRoutes.kt index e965c294bfe..00348cc409d 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudReadRoutes.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudReadRoutes.kt @@ -1,12 +1,6 @@ package dev.inmo.micro_utils.repos.ktor.common.crud -import kotlin.js.JsExport - -@JsExport const val getByPaginationRouting = "getByPagination" -@JsExport const val getByIdRouting = "getById" -@JsExport const val containsRouting = "contains" -@JsExport const val countRouting = "count" diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudWriteRoutes.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudWriteRoutes.kt index 898b266554c..f138429fd3a 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudWriteRoutes.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/crud/CrudWriteRoutes.kt @@ -1,19 +1,10 @@ package dev.inmo.micro_utils.repos.ktor.common.crud -import kotlin.js.JsExport - -@JsExport const val newObjectsFlowRouting = "newObjectsFlow" -@JsExport const val updatedObjectsFlowRouting = "updatedObjectsFlow" -@JsExport const val deletedObjectsIdsFlowRouting = "deletedObjectsIdsFlow" -@JsExport const val createRouting = "create" -@JsExport const val updateRouting = "update" -@JsExport const val updateManyRouting = "updateMany" -@JsExport const val deleteByIdRouting = "deleteById" diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueParameterNames.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueParameterNames.kt index 09698736169..d0b168a7bcb 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueParameterNames.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueParameterNames.kt @@ -1,8 +1,4 @@ package dev.inmo.micro_utils.repos.ktor.common.key_value -import kotlin.js.JsExport - -@JsExport const val keyParameterName = "key" -@JsExport const val reversedParameterName = "reversed" \ No newline at end of file diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValuePostObject.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValuePostObject.kt index b8283e05178..77739fc2e87 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValuePostObject.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValuePostObject.kt @@ -1,9 +1,7 @@ package dev.inmo.micro_utils.repos.ktor.common.key_value import kotlinx.serialization.Serializable -import kotlin.js.JsExport -@JsExport @Serializable data class KeyValuePostObject ( val key: K, diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueRoutes.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueRoutes.kt index e56ea12c562..77b32a459ad 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueRoutes.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/key_value/KeyValueRoutes.kt @@ -1,23 +1,12 @@ package dev.inmo.micro_utils.repos.ktor.common.key_value -import kotlin.js.JsExport - -@JsExport const val getRoute = "get" -@JsExport const val valuesRoute = "values" -@JsExport const val keysRoute = "keys" -@JsExport const val containsRoute = "contains" -@JsExport const val countRoute = "count" -@JsExport const val onNewValueRoute = "onNewValue" -@JsExport const val onValueRemovedRoute = "onValueRemoved" -@JsExport const val setRoute = "set" -@JsExport const val unsetRoute = "unset" \ No newline at end of file diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt index 6855cd7442d..c8f8b2ea7eb 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyParametersNames.kt @@ -1,10 +1,5 @@ package dev.inmo.micro_utils.repos.ktor.common.one_to_many -import kotlin.js.JsExport - -@JsExport const val keyParameterName = "key" -@JsExport const val valueParameterName = "value" -@JsExport const val reversedParameterName = "reversed" \ No newline at end of file diff --git a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyRoutes.kt b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyRoutes.kt index 69706d5ae72..637edd9bda1 100644 --- a/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyRoutes.kt +++ b/repos/ktor/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/common/one_to_many/OneToManyRoutes.kt @@ -1,30 +1,16 @@ package dev.inmo.micro_utils.repos.ktor.common.one_to_many -import kotlin.js.JsExport - -@JsExport const val getRoute = "get" -@JsExport const val keysRoute = "keys" -@JsExport const val containsByKeyRoute = "containsByKey" -@JsExport const val containsByKeyValueRoute = "containsByKeyValue" -@JsExport const val countByKeyRoute = "countByKey" -@JsExport const val countRoute = "count" -@JsExport const val onNewValueRoute = "onNewValue" -@JsExport const val onValueRemovedRoute = "onValueRemoved" -@JsExport const val onDataClearedRoute = "onDataCleared" -@JsExport const val addRoute = "add" -@JsExport const val removeRoute = "remove" -@JsExport const val clearRoute = "clear" \ No newline at end of file