mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-25 19:48:45 +00:00
Revert "more annotations to god of annotations"
This reverts commit f8a8808508
.
This commit is contained in:
parent
893fd1ac07
commit
90c1731bd1
@ -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"
|
||||
|
@ -1,8 +1,5 @@
|
||||
package dev.inmo.micro_utils.common
|
||||
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
fun <T> Iterable<T>.syncWith(
|
||||
other: Iterable<T>,
|
||||
removed: (List<T>) -> Unit = {},
|
||||
|
@ -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<ByteArrayAllocator> {
|
||||
private val realSerializer = ByteArraySerializer()
|
||||
override val descriptor: SerialDescriptor = realSerializer.descriptor
|
||||
|
@ -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 <T> CoroutineScope.actor(
|
||||
channelCapacity: Int = Channel.UNLIMITED,
|
||||
block: suspend (T) -> Unit
|
||||
|
@ -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 <T> BroadcastFlow(
|
||||
internalChannelSize: Int = Channel.BUFFERED
|
||||
@ -17,7 +15,6 @@ fun <T> BroadcastFlow(
|
||||
)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class BroadcastFlow<T> internal constructor(
|
||||
private val channel: BroadcastChannel<T>,
|
||||
private val flow: Flow<T>
|
||||
|
@ -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<T> internal constructor(
|
||||
parentFlow: Flow<T>,
|
||||
private val stateGetter: () -> T
|
||||
@ -15,7 +13,6 @@ class BroadcastStateFlow<T> internal constructor(
|
||||
get() = stateGetter()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun <T> BroadcastChannel<T>.asStateFlow(value: T, scope: CoroutineScope): StateFlow<T> = asFlow().let {
|
||||
var state: T = value
|
||||
it.onEach { state = it }.launchIn(scope)
|
||||
@ -24,16 +21,13 @@ fun <T> BroadcastChannel<T>.asStateFlow(value: T, scope: CoroutineScope): StateF
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun <T> BroadcastChannel<T?>.asStateFlow(scope: CoroutineScope): StateFlow<T?> = asStateFlow(null, scope)
|
||||
|
||||
@JsExport
|
||||
fun <T> broadcastStateFlow(initial: T, scope: CoroutineScope, channelSize: Int = Channel.BUFFERED) = BroadcastChannel<T>(
|
||||
channelSize
|
||||
).let {
|
||||
it to it.asStateFlow(initial, scope)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun <T> broadcastStateFlow(scope: CoroutineScope, channelSize: Int = Channel.BUFFERED) = broadcastStateFlow<T?>(null, scope, channelSize)
|
||||
|
||||
|
@ -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> T.asDeferred: Deferred<T>
|
||||
get() = CompletableDeferred(this)
|
||||
|
@ -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 <T> doOutsideOfCoroutine(block: () -> T): T = suspendCoroutine {
|
||||
try {
|
||||
it.resume(block())
|
||||
|
@ -2,7 +2,6 @@ package dev.inmo.micro_utils.coroutines
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.supervisorScope
|
||||
import kotlin.js.JsExport
|
||||
|
||||
|
||||
typealias ExceptionHandler<T> = suspend (Throwable) -> T
|
||||
@ -12,7 +11,6 @@ typealias ExceptionHandler<T> = 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 <T> safely(
|
||||
noinline onException: ExceptionHandler<T> = { throw it },
|
||||
noinline block: suspend CoroutineScope.() -> T
|
||||
|
@ -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 <T> HttpClient.createStandardWebsocketFlow(
|
||||
url: String,
|
||||
crossinline checkReconnection: (Throwable?) -> Boolean = { true },
|
||||
@ -62,7 +60,6 @@ inline fun <T> 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 <T> HttpClient.createStandardWebsocketFlow(
|
||||
url: String,
|
||||
crossinline checkReconnection: (Throwable?) -> Boolean = { true },
|
||||
|
@ -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<T> = Pair<SerializationStrategy<T>, T>
|
||||
|
||||
@JsExport
|
||||
suspend fun <ResultType> HttpClient.uniget(
|
||||
url: String,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>
|
||||
@ -20,13 +18,11 @@ suspend fun <ResultType> HttpClient.uniget(
|
||||
}
|
||||
|
||||
|
||||
@JsExport
|
||||
fun <T> SerializationStrategy<T>.encodeUrlQueryValue(value: T) = standardKtorSerialFormat.encodeHex(
|
||||
this,
|
||||
value
|
||||
)
|
||||
|
||||
@JsExport
|
||||
suspend fun <BodyType, ResultType> HttpClient.unipost(
|
||||
url: String,
|
||||
bodyInfo: BodyPair<BodyType>,
|
||||
|
@ -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,
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -1,18 +1,15 @@
|
||||
package dev.inmo.micro_utils.ktor.common
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import kotlin.js.JsExport
|
||||
|
||||
typealias FromToDateTime = Pair<DateTime?, DateTime?>
|
||||
|
||||
@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) },
|
||||
|
@ -1,29 +1,22 @@
|
||||
package dev.inmo.micro_utils.ktor.common
|
||||
|
||||
import kotlin.js.JsExport
|
||||
|
||||
typealias QueryParam = Pair<String, String?>
|
||||
typealias QueryParams = Map<String, String?>
|
||||
|
||||
@JsExport
|
||||
val QueryParams.asUrlQuery: String
|
||||
get() = keys.joinToString("&") { "${it}${get(it) ?.let { value -> "=$value" }}" }
|
||||
|
||||
@JsExport
|
||||
val List<QueryParam>.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<QueryParam>
|
||||
): String = "$this${if (contains("?")) "&" else "?"}${queryParams.asUrlQuery}"
|
||||
|
||||
@JsExport
|
||||
val String.parseUrlQuery: QueryParams
|
||||
get() = split("&").map {
|
||||
it.split("=").let { pair ->
|
||||
|
@ -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 <T> StandardKtorSerialFormat.decodeDefault(
|
||||
deserializationStrategy: DeserializationStrategy<T>,
|
||||
input: StandardKtorSerialInputData
|
||||
): T = decodeFromByteArray(deserializationStrategy, input)
|
||||
|
||||
@JsExport
|
||||
inline fun <T> StandardKtorSerialFormat.encodeDefault(
|
||||
serializationStrategy: SerializationStrategy<T>,
|
||||
data: T
|
||||
): StandardKtorSerialInputData = encodeToByteArray(serializationStrategy, data)
|
||||
|
||||
@JsExport
|
||||
@Deprecated("Will be removed in next major release due to useless")
|
||||
val cbor = Cbor {}
|
||||
|
||||
@JsExport
|
||||
inline fun <T> StandardKtorSerialFormat.decodeHex(
|
||||
deserializationStrategy: DeserializationStrategy<T>,
|
||||
input: String
|
||||
): T = decodeFromHexString(deserializationStrategy, input)
|
||||
|
||||
@JsExport
|
||||
inline fun <T> StandardKtorSerialFormat.encodeHex(
|
||||
serializationStrategy: SerializationStrategy<T>,
|
||||
data: T
|
||||
|
@ -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 <T> Route.includeWebsocketHandling(
|
||||
suburl: String,
|
||||
flow: Flow<T>,
|
||||
|
@ -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<MimeType> = setOf(
|
||||
KnownMimeTypes.XConference.XCooltalk,
|
||||
)
|
||||
|
||||
@JsExport
|
||||
val knownMimeTypesMap by lazy {
|
||||
knownMimeTypes.associateBy { it.raw }
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun findBuiltinMimeType(from: String): MimeType? {
|
||||
return knownMimeTypesMap[from]
|
||||
}
|
||||
|
@ -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<String, MimeType>().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<MimeType> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("mimeType", PrimitiveKind.STRING)
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -1,9 +1,7 @@
|
||||
package dev.inmo.micro_utils.pagination
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
@Serializable
|
||||
data class PaginationResult<T>(
|
||||
override val page: Int,
|
||||
@ -12,10 +10,8 @@ data class PaginationResult<T>(
|
||||
override val size: Int
|
||||
) : Pagination
|
||||
|
||||
@JsExport
|
||||
fun <T> emptyPaginationResult() = PaginationResult<T>(0, 0, emptyList(), 0)
|
||||
|
||||
@JsExport
|
||||
fun <T> List<T>.createPaginationResult(
|
||||
pagination: Pagination,
|
||||
commonObjectsNumber: Long
|
||||
@ -29,7 +25,6 @@ fun <T> List<T>.createPaginationResult(
|
||||
pagination.size
|
||||
)
|
||||
|
||||
@JsExport
|
||||
fun <T> List<T>.createPaginationResult(
|
||||
firstIndex: Int,
|
||||
commonObjectsNumber: Long
|
||||
@ -43,7 +38,6 @@ fun <T> List<T>.createPaginationResult(
|
||||
size
|
||||
)
|
||||
|
||||
@JsExport
|
||||
fun <T> Pair<Long, List<T>>.createPaginationResult(
|
||||
pagination: Pagination
|
||||
) = second.createPaginationResult(pagination, first)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,9 +1,7 @@
|
||||
package dev.inmo.micro_utils.pagination.utils
|
||||
|
||||
import dev.inmo.micro_utils.pagination.*
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
fun <T> Iterable<T>.paginate(with: Pagination): PaginationResult<T> {
|
||||
var i = 0
|
||||
val result = mutableListOf<T>()
|
||||
@ -22,7 +20,6 @@ fun <T> Iterable<T>.paginate(with: Pagination): PaginationResult<T> {
|
||||
return result.createPaginationResult(with, i.toLong())
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun <T> List<T>.paginate(with: Pagination): PaginationResult<T> {
|
||||
return subList(with.firstIndex, with.lastIndex + 1).createPaginationResult(
|
||||
with,
|
||||
@ -30,7 +27,6 @@ fun <T> List<T>.paginate(with: Pagination): PaginationResult<T> {
|
||||
)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun <T> Set<T>.paginate(with: Pagination): PaginationResult<T> {
|
||||
return this.drop(with.firstIndex).take(with.size).createPaginationResult(
|
||||
with,
|
||||
|
@ -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<String, String?>.extractPagination: Pagination
|
||||
get() = SimplePagination(
|
||||
get(paginationPageKey) ?.toIntOrNull() ?: 0,
|
||||
|
@ -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<Key, Value> : Repo {
|
||||
suspend fun get(k: Key, pagination: Pagination, reversed: Boolean = false): PaginationResult<Value>
|
||||
suspend fun keys(pagination: Pagination, reversed: Boolean = false): PaginationResult<Key>
|
||||
@ -17,7 +15,6 @@ interface ReadOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
@Deprecated("Renamed", ReplaceWith("ReadOneToManyKeyValueRepo", "dev.inmo.micro_utils.repos.ReadOneToManyKeyValueRepo"))
|
||||
typealias OneToManyReadKeyValueRepo<Key, Value> = ReadOneToManyKeyValueRepo<Key, Value>
|
||||
|
||||
@JsExport
|
||||
interface WriteOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
val onNewValue: Flow<Pair<Key, Value>>
|
||||
val onValueRemoved: Flow<Pair<Key, Value>>
|
||||
@ -30,5 +27,4 @@ interface WriteOneToManyKeyValueRepo<Key, Value> : Repo {
|
||||
@Deprecated("Renamed", ReplaceWith("WriteOneToManyKeyValueRepo", "dev.inmo.micro_utils.repos.WriteOneToManyKeyValueRepo"))
|
||||
typealias OneToManyWriteKeyValueRepo<Key, Value> = WriteOneToManyKeyValueRepo<Key, Value>
|
||||
|
||||
@JsExport
|
||||
interface OneToManyKeyValueRepo<Key, Value> : ReadOneToManyKeyValueRepo<Key, Value>, WriteOneToManyKeyValueRepo<Key, Value>
|
@ -1,6 +1,3 @@
|
||||
package dev.inmo.micro_utils.repos
|
||||
|
||||
import kotlin.js.JsExport
|
||||
|
||||
@JsExport
|
||||
interface Repo
|
||||
|
@ -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<ObjectType, IdType> : Repo {
|
||||
suspend fun getByPagination(pagination: Pagination): PaginationResult<ObjectType>
|
||||
suspend fun getById(id: IdType): ObjectType?
|
||||
@ -14,14 +12,11 @@ interface ReadStandardCRUDRepo<ObjectType, IdType> : Repo {
|
||||
}
|
||||
|
||||
typealias UpdatedValuePair<IdType, ValueType> = Pair<IdType, ValueType>
|
||||
@JsExport
|
||||
val <IdType> UpdatedValuePair<IdType, *>.id
|
||||
get() = first
|
||||
@JsExport
|
||||
val <ValueType> UpdatedValuePair<*, ValueType>.value
|
||||
get() = second
|
||||
|
||||
@JsExport
|
||||
interface WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> : Repo {
|
||||
val newObjectsFlow: Flow<ObjectType>
|
||||
val updatedObjectsFlow: Flow<ObjectType>
|
||||
@ -33,19 +28,15 @@ interface WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> : Repo {
|
||||
suspend fun deleteById(ids: List<IdType>)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend fun <ObjectType, IdType, InputValueType> WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>.create(
|
||||
vararg values: InputValueType
|
||||
): List<ObjectType> = create(values.toList())
|
||||
@JsExport
|
||||
suspend fun <ObjectType, IdType, InputValueType> WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>.update(
|
||||
vararg values: UpdatedValuePair<IdType, InputValueType>
|
||||
): List<ObjectType> = update(values.toList())
|
||||
@JsExport
|
||||
suspend fun <ObjectType, IdType, InputValueType> WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>.deleteById(
|
||||
vararg ids: IdType
|
||||
) = deleteById(ids.toList())
|
||||
|
||||
@JsExport
|
||||
interface StandardCRUDRepo<ObjectType, IdType, InputValueType> : ReadStandardCRUDRepo<ObjectType, IdType>,
|
||||
WriteStandardCRUDRepo<ObjectType, IdType, InputValueType>
|
@ -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<Key, Value> : Repo {
|
||||
suspend fun get(k: Key): Value?
|
||||
suspend fun values(pagination: Pagination, reversed: Boolean = false): PaginationResult<Value>
|
||||
@ -14,7 +12,6 @@ interface ReadStandardKeyValueRepo<Key, Value> : Repo {
|
||||
suspend fun count(): Long
|
||||
}
|
||||
|
||||
@JsExport
|
||||
interface WriteStandardKeyValueRepo<Key, Value> : Repo {
|
||||
val onNewValue: Flow<Pair<Key, Value>>
|
||||
val onValueRemoved: Flow<Key>
|
||||
@ -23,5 +20,4 @@ interface WriteStandardKeyValueRepo<Key, Value> : Repo {
|
||||
suspend fun unset(k: Key)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
interface StandardKeyValueRepo<Key, Value> : ReadStandardKeyValueRepo<Key, Value>, WriteStandardKeyValueRepo<Key, Value>
|
@ -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 <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doForAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<T>,
|
||||
@ -17,12 +15,10 @@ suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doForAll(
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.doForAll(
|
||||
block: (List<T>) -> Unit
|
||||
) = doForAll({ getByPagination(it) }, block)
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <T, ID, REPO : ReadStandardCRUDRepo<T, ID>> REPO.getAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<T>
|
||||
|
@ -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 <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>,
|
||||
@ -17,12 +15,10 @@ suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REP
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
block: (List<Pair<Key, Value>>) -> Unit
|
||||
) = doForAll({ keys(it, false) }, block)
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadStandardKeyValueRepo<Key, Value>> REPO.getAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>
|
||||
|
@ -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 <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>,
|
||||
@ -27,12 +25,10 @@ suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> RE
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> REPO.doForAll(
|
||||
block: (List<Pair<Key, List<Value>>>) -> Unit
|
||||
) = doForAll({ keys(it, false) }, block)
|
||||
|
||||
@JsExport
|
||||
suspend inline fun <Key, Value, REPO : ReadOneToManyKeyValueRepo<Key, Value>> REPO.getAll(
|
||||
@Suppress("REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE")
|
||||
methodCaller: suspend REPO.(Pagination) -> PaginationResult<Key>
|
||||
|
@ -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<ObjectType, IdType>(
|
||||
private val map: Map<IdType, ObjectType> = emptyMap()
|
||||
) : ReadStandardCRUDRepo<ObjectType, IdType> {
|
||||
@ -25,7 +23,6 @@ class ReadMapCRUDRepo<ObjectType, IdType>(
|
||||
override suspend fun count(): Long = map.size.toLong()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
abstract class WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
private val map: MutableMap<IdType, ObjectType> = mutableMapOf()
|
||||
) : WriteStandardCRUDRepo<ObjectType, IdType, InputValueType> {
|
||||
@ -73,14 +70,12 @@ abstract class WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
|
||||
}
|
||||
|
||||
@JsExport
|
||||
abstract class MapCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
map: MutableMap<IdType, ObjectType>
|
||||
) : StandardCRUDRepo<ObjectType, IdType, InputValueType>,
|
||||
ReadStandardCRUDRepo<ObjectType, IdType> by ReadMapCRUDRepo(map),
|
||||
WriteMapCRUDRepo<ObjectType, IdType, InputValueType>(map)
|
||||
|
||||
@JsExport
|
||||
fun <ObjectType, IdType, InputValueType> MapCRUDRepo(
|
||||
map: MutableMap<IdType, ObjectType>,
|
||||
updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType,
|
||||
@ -95,7 +90,6 @@ fun <ObjectType, IdType, InputValueType> MapCRUDRepo(
|
||||
override suspend fun createObject(newValue: InputValueType): Pair<IdType, ObjectType> = createCallback(newValue)
|
||||
}
|
||||
|
||||
@JsExport
|
||||
fun <ObjectType, IdType, InputValueType> MutableMap<IdType, ObjectType>.asCrudRepo(
|
||||
updateCallback: suspend (newValue: InputValueType, id: IdType, old: ObjectType) -> ObjectType,
|
||||
createCallback: suspend (newValue: InputValueType) -> Pair<IdType, ObjectType>
|
||||
|
@ -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<Key, Value>(
|
||||
private val map: Map<Key, Value> = emptyMap()
|
||||
) : ReadStandardKeyValueRepo<Key, Value> {
|
||||
@ -47,7 +45,6 @@ class ReadMapKeyValueRepo<Key, Value>(
|
||||
override suspend fun count(): Long = map.size.toLong()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class WriteMapKeyValueRepo<Key, Value>(
|
||||
private val map: MutableMap<Key, Value> = mutableMapOf()
|
||||
) : WriteStandardKeyValueRepo<Key, Value> {
|
||||
@ -68,12 +65,10 @@ class WriteMapKeyValueRepo<Key, Value>(
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class MapKeyValueRepo<Key, Value>(
|
||||
private val map: MutableMap<Key, Value> = mutableMapOf()
|
||||
) : StandardKeyValueRepo<Key, Value>,
|
||||
ReadStandardKeyValueRepo<Key, Value> by ReadMapKeyValueRepo(map),
|
||||
WriteStandardKeyValueRepo<Key, Value> by WriteMapKeyValueRepo(map)
|
||||
|
||||
@JsExport
|
||||
fun <K, V> MutableMap<K, V>.asKeyValueRepo(): StandardKeyValueRepo<K, V> = MapKeyValueRepo(this)
|
||||
|
@ -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<Key, Value>(
|
||||
private val map: Map<Key, List<Value>> = emptyMap()
|
||||
) : ReadOneToManyKeyValueRepo<Key, Value> {
|
||||
@ -46,7 +44,6 @@ class MapReadOneToManyKeyValueRepo<Key, Value>(
|
||||
override suspend fun count(): Long = map.size.toLong()
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class MapWriteOneToManyKeyValueRepo<Key, Value>(
|
||||
private val map: MutableMap<Key, MutableList<Value>> = mutableMapOf()
|
||||
) : WriteOneToManyKeyValueRepo<Key, Value> {
|
||||
@ -74,14 +71,12 @@ class MapWriteOneToManyKeyValueRepo<Key, Value>(
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class MapOneToManyKeyValueRepo<Key, Value>(
|
||||
private val map: MutableMap<Key, MutableList<Value>> = mutableMapOf()
|
||||
) : OneToManyKeyValueRepo<Key, Value>,
|
||||
ReadOneToManyKeyValueRepo<Key, Value> by MapReadOneToManyKeyValueRepo(map),
|
||||
WriteOneToManyKeyValueRepo<Key, Value> by MapWriteOneToManyKeyValueRepo(map)
|
||||
|
||||
@JsExport
|
||||
fun <K, V> MutableMap<K, List<V>>.asOneToManyKeyValueRepo(): OneToManyKeyValueRepo<K, V> = MapOneToManyKeyValueRepo(
|
||||
map { (k, v) -> k to v.toMutableList() }.toMap().toMutableMap()
|
||||
)
|
||||
|
@ -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<ObjectType, IdType> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
@ -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<ObjectType, IdType, InputValue> (
|
||||
baseUrl: String,
|
||||
baseSubpart: String,
|
||||
|
@ -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<ObjectType, IdType, InputValue> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
@ -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<Key, Value> (
|
||||
private var baseUrl: String,
|
||||
private var client: HttpClient = HttpClient(),
|
||||
|
@ -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<K, V> (
|
||||
baseUrl: String,
|
||||
baseSubpart: String,
|
||||
|
@ -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<K, V> (
|
||||
private var baseUrl: String,
|
||||
private var client: HttpClient = HttpClient(),
|
||||
|
@ -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<Key, Value>(
|
||||
baseUrl: String,
|
||||
baseSubpart: String,
|
||||
|
@ -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<Key, Value> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
@ -85,4 +83,5 @@ class KtorReadOneToManyKeyValueRepo<Key, Value> (
|
||||
),
|
||||
Long.serializer()
|
||||
)
|
||||
|
||||
}
|
@ -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<Key, Value> (
|
||||
private val baseUrl: String,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
@ -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<K, V> (
|
||||
val key: K,
|
||||
|
@ -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"
|
@ -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"
|
@ -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"
|
Loading…
Reference in New Issue
Block a user