Merge pull request #173 from InsanusMokrassar/0.11.11

0.11.11
This commit is contained in:
InsanusMokrassar 2022-06-30 13:41:43 +06:00 committed by GitHub
commit f7dd2b5ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 21 deletions

View File

@ -15,7 +15,7 @@ jobs:
continue-on-error: true
run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
- name: Build
run: ./gradlew dokkaHtml
run: ./gradlew build && ./gradlew dokkaHtml
- name: Publish KDocs
uses: peaceiris/actions-gh-pages@v3
with:

View File

@ -1,5 +1,13 @@
# Changelog
## 0.11.11
* `Crypto`:
* `hmacSha256` has been deprecated
* `Ktor`:
* `Client`:
* `BodyPair` has been deprecated
## 0.11.10
* `Repos`:

View File

@ -1,3 +1,4 @@
package dev.inmo.micro_utils.crypto
@Deprecated("Deprecated due to incorrect of work sometimes and redundancy. Can be replaced by korlibs krypto")
expect fun SourceString.hmacSha256(key: String): String

View File

@ -8,6 +8,7 @@ external interface CryptoJs {
@JsNonModule
external val CryptoJS: CryptoJs
@Deprecated("Deprecated due to incorrect of work sometimes and redundancy. Can be replaced by korlibs krypto")
actual fun SourceString.hmacSha256(key: String): String {
return CryptoJS.asDynamic().HmacSHA256(this, key).toString().unsafeCast<String>()
}

View File

@ -3,6 +3,7 @@ package dev.inmo.micro_utils.crypto
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
@Deprecated("Deprecated due to incorrect of work sometimes and redundancy. Can be replaced by korlibs krypto")
actual fun SourceString.hmacSha256(key: String): String {
val mac = Mac.getInstance("HmacSHA256")

View File

@ -14,5 +14,5 @@ crypto_js_version=4.1.1
# Project data
group=dev.inmo
version=0.11.10
android_code_version=134
version=0.11.11
android_code_version=135

View File

@ -12,6 +12,7 @@ import io.ktor.http.*
import io.ktor.utils.io.core.ByteReadPacket
import kotlinx.serialization.*
@Deprecated("This class will be removed in next")
typealias BodyPair<T> = Pair<SerializationStrategy<T>, T>
class UnifiedRequester(
@ -33,7 +34,7 @@ class UnifiedRequester(
suspend fun <BodyType, ResultType> unipost(
url: String,
bodyInfo: BodyPair<BodyType>,
bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>
) = client.unipost(url, bodyInfo, resultDeserializer, serialFormat)
@ -52,7 +53,7 @@ class UnifiedRequester(
url: String,
filename: String,
inputProvider: InputProvider,
otherData: BodyPair<BodyType>,
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*",
additionalParametersBuilder: FormBuilder.() -> Unit = {},
@ -75,7 +76,7 @@ class UnifiedRequester(
suspend fun <BodyType, ResultType> unimultipart(
url: String,
mppFile: MPPFile,
otherData: BodyPair<BodyType>,
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*",
additionalParametersBuilder: FormBuilder.() -> Unit = {},
@ -120,7 +121,7 @@ fun <T> SerializationStrategy<T>.encodeUrlQueryValue(
suspend fun <BodyType, ResultType> HttpClient.unipost(
url: String,
bodyInfo: BodyPair<BodyType>,
bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>,
serialFormat: StandardKtorSerialFormat = standardKtorSerialFormat
) = post(url) {
@ -162,7 +163,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
url: String,
filename: String,
otherData: BodyPair<BodyType>,
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
inputProvider: InputProvider,
resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*",
@ -220,7 +221,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
url: String,
mppFile: MPPFile,
otherData: BodyPair<BodyType>,
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*",
additionalParametersBuilder: FormBuilder.() -> Unit = {},

View File

@ -56,25 +56,25 @@ class KtorWriteStandardCrudRepo<ObjectType, IdType, InputValue> (
override suspend fun create(values: List<InputValue>): List<ObjectType> = unifiedRequester.unipost(
buildStandardUrl(baseUrl, createRouting),
BodyPair(listInputSerializer, values),
Pair(listInputSerializer, values),
listObjectsSerializer
)
override suspend fun update(id: IdType, value: InputValue): ObjectType? = unifiedRequester.unipost(
buildStandardUrl(baseUrl, updateRouting),
BodyPair(inputUpdateSerializer, id to value),
Pair(inputUpdateSerializer, id to value),
objectsNullableSerializer
)
override suspend fun update(values: List<UpdatedValuePair<IdType, InputValue>>): List<ObjectType> = unifiedRequester.unipost(
buildStandardUrl(baseUrl, updateManyRouting),
BodyPair(listInputUpdateSerializer, values),
Pair(listInputUpdateSerializer, values),
listObjectsSerializer
)
override suspend fun deleteById(ids: List<IdType>) = unifiedRequester.unipost(
buildStandardUrl(baseUrl, deleteByIdRouting),
BodyPair(listIdsSerializer, ids),
Pair(listIdsSerializer, ids),
Unit.serializer()
)
}

View File

@ -45,7 +45,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
baseUrl,
setRoute
),
BodyPair(keyValueMapSerializer, toSet),
Pair(keyValueMapSerializer, toSet),
Unit.serializer()
)
@ -54,7 +54,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
baseUrl,
unsetRoute,
),
BodyPair(keysListSerializer, toUnset),
Pair(keysListSerializer, toUnset),
Unit.serializer()
)
@ -63,7 +63,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
baseUrl,
unsetWithValuesRoute,
),
BodyPair(valuesListSerializer, toUnset),
Pair(valuesListSerializer, toUnset),
Unit.serializer()
)
}

View File

@ -47,7 +47,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
baseUrl,
removeRoute,
),
BodyPair(keyValueMapSerializer, toRemove),
Pair(keyValueMapSerializer, toRemove),
Unit.serializer(),
)
@ -56,7 +56,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
baseUrl,
addRoute,
),
BodyPair(keyValueMapSerializer, toAdd),
Pair(keyValueMapSerializer, toAdd),
Unit.serializer(),
)
override suspend fun clear(k: Key) = unifiedRequester.unipost(
@ -64,7 +64,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
baseUrl,
clearRoute,
),
BodyPair(keySerializer, k),
Pair(keySerializer, k),
Unit.serializer(),
)
@ -73,7 +73,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
baseUrl,
clearWithValueRoute,
),
BodyPair(valueSerializer, v),
Pair(valueSerializer, v),
Unit.serializer(),
)
@ -82,7 +82,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
baseUrl,
setRoute,
),
BodyPair(keyValueMapSerializer, toSet),
Pair(keyValueMapSerializer, toSet),
Unit.serializer(),
)
}