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..280754a4bd1 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 @@ -9,7 +9,6 @@ import kotlin.js.JsExport typealias ByteArrayAllocator = () -> ByteArray -@JsExport val ByteArray.asAllocator: ByteArrayAllocator get() = { this } 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..d65c13da9a6 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 @@ -3,8 +3,10 @@ package dev.inmo.micro_utils.coroutines import kotlinx.coroutines.channels.* import kotlinx.coroutines.flow.* import kotlin.js.JsExport +import kotlin.js.JsName @JsExport +@JsName("BroadcastFlowFactory") @Suppress("FunctionName") fun BroadcastFlow( internalChannelSize: Int = Channel.BUFFERED 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..4b5061e1624 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 @@ -5,6 +5,7 @@ import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.* import kotlin.js.JsExport +import kotlin.js.JsName @JsExport class BroadcastStateFlow internal constructor( @@ -25,6 +26,7 @@ fun BroadcastChannel.asStateFlow(value: T, scope: CoroutineScope): StateF } @JsExport +@JsName("nullableAsStateFlow") fun BroadcastChannel.asStateFlow(scope: CoroutineScope): StateFlow = asStateFlow(null, scope) @JsExport @@ -35,5 +37,6 @@ fun broadcastStateFlow(initial: T, scope: CoroutineScope, channelSize: Int = } @JsExport +@JsName("nullableBroadcastStateFlow") 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..8ee76b71811 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 @@ -6,7 +6,6 @@ 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..d9972cffab3 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 @@ -12,7 +12,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..50b83c3bea0 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 @@ -9,6 +9,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.channelFlow import kotlinx.serialization.DeserializationStrategy import kotlin.js.JsExport +import kotlin.js.JsName /** * @param checkReconnection This lambda will be called when it is required to reconnect to websocket to establish @@ -63,6 +64,7 @@ inline fun HttpClient.createStandardWebsocketFlow( * connection. Must return true in case if must be reconnected. By default always reconnecting */ @JsExport +@JsName("createStandardWebsocketFlowWithDeserializer") 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..a32dcea460f 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 @@ -9,7 +9,6 @@ import kotlin.js.JsExport typealias BodyPair = Pair, T> -@JsExport suspend fun HttpClient.uniget( url: String, resultDeserializer: DeserializationStrategy @@ -26,7 +25,6 @@ fun SerializationStrategy.encodeUrlQueryValue(value: T) = standardKtorSer 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..ae734ea5e19 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,6 +1,7 @@ package dev.inmo.micro_utils.ktor.common import kotlin.js.JsExport +import kotlin.js.JsName @JsExport fun buildStandardUrl( @@ -12,6 +13,7 @@ fun buildStandardUrl( ) @JsExport +@JsName("buildStandardUrlWithParametersList") fun buildStandardUrl( basePart: String, subpart: String, @@ -21,6 +23,7 @@ fun buildStandardUrl( ) @JsExport +@JsName("buildStandardUrlWithParametersVararg") fun buildStandardUrl( basePart: String, subpart: String, 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..792aed3ead7 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 @@ -4,7 +4,6 @@ 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..2a31acaefcc 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 @@ -5,14 +5,12 @@ 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..09425370bff 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,15 +1,14 @@ package dev.inmo.micro_utils.ktor.common import kotlin.js.JsExport +import kotlin.js.JsName 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" }}" } @@ -19,11 +18,11 @@ fun String.includeQueryParams( ): String = "$this${if(queryParams.isNotEmpty()) "${if (contains("?")) "&" else "?"}${queryParams.asUrlQuery}" else ""}" @JsExport +@JsName("includeQueryParamsWithList") 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/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..d038dce1bc1 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,7 @@ package dev.inmo.micro_utils.pagination import kotlin.js.JsExport +import kotlin.js.JsName import kotlin.math.ceil import kotlin.math.floor @@ -27,7 +28,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,7 +37,6 @@ 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 @@ -52,6 +51,7 @@ fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int { * Calculates pages count for given [datasetSize] */ @JsExport +@JsName("calculatePagesNumberWithInt") fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int = calculatePagesNumber( datasetSize.toLong(), 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..4b3a60f3668 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 @@ -2,6 +2,7 @@ package dev.inmo.micro_utils.pagination import kotlinx.serialization.Serializable import kotlin.js.JsExport +import kotlin.js.JsName @JsExport @Serializable @@ -16,6 +17,7 @@ data class PaginationResult( fun emptyPaginationResult() = PaginationResult(0, 0, emptyList(), 0) @JsExport +@JsName("createPaginationResultWithPagination") fun List.createPaginationResult( pagination: Pagination, commonObjectsNumber: Long @@ -30,6 +32,7 @@ fun List.createPaginationResult( ) @JsExport +@JsName("createPaginationResultWithFirstIndex") fun List.createPaginationResult( firstIndex: Int, commonObjectsNumber: Long @@ -44,6 +47,7 @@ fun List.createPaginationResult( ) @JsExport +@JsName("createPaginationResultWithPair") 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..2f0eb186782 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 @@ -2,6 +2,7 @@ package dev.inmo.micro_utils.pagination import kotlinx.serialization.Serializable import kotlin.js.JsExport +import kotlin.js.JsName const val defaultSmallPageSize = 2 const val defaultMediumPageSize = 5 @@ -32,6 +33,7 @@ data class SimplePagination( ) : Pagination @JsExport +@JsName("PaginationFactory") fun Pagination( page: Int, size: Int 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..cdb5f4a02a9 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 @@ -2,6 +2,7 @@ package dev.inmo.micro_utils.pagination.utils import dev.inmo.micro_utils.pagination.* import kotlin.js.JsExport +import kotlin.js.JsName @JsExport fun Iterable.paginate(with: Pagination): PaginationResult { @@ -23,6 +24,7 @@ fun Iterable.paginate(with: Pagination): PaginationResult { } @JsExport +@JsName("paginateList") fun List.paginate(with: Pagination): PaginationResult { return subList(with.firstIndex, with.lastIndex + 1).createPaginationResult( with, @@ -31,6 +33,7 @@ fun List.paginate(with: Pagination): PaginationResult { } @JsExport +@JsName("paginateSet") 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..f777449759b 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 @@ -7,21 +7,18 @@ 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..c7ce6e66cc8 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 @@ -5,7 +5,6 @@ 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 +16,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 +28,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/StandartCRUDRepo.kt b/repos/common/src/commonMain/kotlin/dev/inmo/micro_utils/repos/StandartCRUDRepo.kt index c8e93f51675..a60dc2edc81 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 @@ -5,7 +5,6 @@ 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 +13,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,15 +29,12 @@ 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()) 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..612edd2541a 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 @@ -5,7 +5,6 @@ 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 +13,6 @@ interface ReadStandardKeyValueRepo : Repo { suspend fun count(): Long } -@JsExport interface WriteStandardKeyValueRepo : Repo { val onNewValue: Flow> val onValueRemoved: Flow @@ -23,5 +21,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..c45eb52244b 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 @@ -4,7 +4,6 @@ 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 +16,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..9c5ee16bc71 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 @@ -4,7 +4,6 @@ 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 +16,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..0b78b5a9d64 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 @@ -4,7 +4,6 @@ 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 +26,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..8488d09a499 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 @@ -4,8 +4,8 @@ import dev.inmo.micro_utils.coroutines.BroadcastFlow import dev.inmo.micro_utils.pagination.* import kotlinx.coroutines.flow.Flow import kotlin.js.JsExport +import kotlin.js.JsName -@JsExport class ReadMapCRUDRepo( private val map: Map = emptyMap() ) : ReadStandardCRUDRepo { @@ -25,7 +25,6 @@ class ReadMapCRUDRepo( override suspend fun count(): Long = map.size.toLong() } -@JsExport abstract class WriteMapCRUDRepo( private val map: MutableMap = mutableMapOf() ) : WriteStandardCRUDRepo { @@ -81,6 +80,7 @@ abstract class MapCRUDRepo( WriteMapCRUDRepo(map) @JsExport +@JsName("MapCRUDRepoFactory") fun MapCRUDRepo( map: MutableMap, updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType, 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..89c571bf788 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 @@ -5,7 +5,6 @@ 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 +46,6 @@ class ReadMapKeyValueRepo( override suspend fun count(): Long = map.size.toLong() } -@JsExport class WriteMapKeyValueRepo( private val map: MutableMap = mutableMapOf() ) : WriteStandardKeyValueRepo { 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..72952f1622b 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 @@ -6,7 +6,6 @@ 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 +45,6 @@ class MapReadOneToManyKeyValueRepo( override suspend fun count(): Long = map.size.toLong() } -@JsExport class MapWriteOneToManyKeyValueRepo( private val map: MutableMap> = mutableMapOf() ) : WriteOneToManyKeyValueRepo { 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..f7f6b3dcc0a 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 @@ -13,7 +13,6 @@ 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/KtorWriteStandardCrudRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/crud/KtorWriteStandardCrudRepo.kt index 717b1d1ece9..5403c066740 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 @@ -13,7 +13,6 @@ 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..0c2d7ea5ed3 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 @@ -13,7 +13,6 @@ 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/KtorWriteStandardKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/key_value/KtorWriteStandardKeyValueRepo.kt index 951f9d30291..0e8ad5ecb4a 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 @@ -13,7 +13,6 @@ 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/KtorReadOneToManyKeyValueRepo.kt b/repos/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/repos/ktor/client/one_to_many/KtorReadOneToManyKeyValueRepo.kt index 92063ec1d8f..7dbe82ad570 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 @@ -13,7 +13,6 @@ 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(), 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..8e167459933 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 @@ -13,7 +13,6 @@ 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(),