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 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 run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
- name: Build - name: Build
run: ./gradlew dokkaHtml run: ./gradlew build && ./gradlew dokkaHtml
- name: Publish KDocs - name: Publish KDocs
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
with: with:

View File

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

View File

@ -1,3 +1,4 @@
package dev.inmo.micro_utils.crypto 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 expect fun SourceString.hmacSha256(key: String): String

View File

@ -8,6 +8,7 @@ external interface CryptoJs {
@JsNonModule @JsNonModule
external val CryptoJS: CryptoJs 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 { actual fun SourceString.hmacSha256(key: String): String {
return CryptoJS.asDynamic().HmacSHA256(this, key).toString().unsafeCast<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.Mac
import javax.crypto.spec.SecretKeySpec 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 { actual fun SourceString.hmacSha256(key: String): String {
val mac = Mac.getInstance("HmacSHA256") val mac = Mac.getInstance("HmacSHA256")

View File

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

View File

@ -12,6 +12,7 @@ import io.ktor.http.*
import io.ktor.utils.io.core.ByteReadPacket import io.ktor.utils.io.core.ByteReadPacket
import kotlinx.serialization.* import kotlinx.serialization.*
@Deprecated("This class will be removed in next")
typealias BodyPair<T> = Pair<SerializationStrategy<T>, T> typealias BodyPair<T> = Pair<SerializationStrategy<T>, T>
class UnifiedRequester( class UnifiedRequester(
@ -33,7 +34,7 @@ class UnifiedRequester(
suspend fun <BodyType, ResultType> unipost( suspend fun <BodyType, ResultType> unipost(
url: String, url: String,
bodyInfo: BodyPair<BodyType>, bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType> resultDeserializer: DeserializationStrategy<ResultType>
) = client.unipost(url, bodyInfo, resultDeserializer, serialFormat) ) = client.unipost(url, bodyInfo, resultDeserializer, serialFormat)
@ -52,7 +53,7 @@ class UnifiedRequester(
url: String, url: String,
filename: String, filename: String,
inputProvider: InputProvider, inputProvider: InputProvider,
otherData: BodyPair<BodyType>, otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>, resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*", mimetype: String = "*/*",
additionalParametersBuilder: FormBuilder.() -> Unit = {}, additionalParametersBuilder: FormBuilder.() -> Unit = {},
@ -75,7 +76,7 @@ class UnifiedRequester(
suspend fun <BodyType, ResultType> unimultipart( suspend fun <BodyType, ResultType> unimultipart(
url: String, url: String,
mppFile: MPPFile, mppFile: MPPFile,
otherData: BodyPair<BodyType>, otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>, resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*", mimetype: String = "*/*",
additionalParametersBuilder: FormBuilder.() -> Unit = {}, additionalParametersBuilder: FormBuilder.() -> Unit = {},
@ -120,7 +121,7 @@ fun <T> SerializationStrategy<T>.encodeUrlQueryValue(
suspend fun <BodyType, ResultType> HttpClient.unipost( suspend fun <BodyType, ResultType> HttpClient.unipost(
url: String, url: String,
bodyInfo: BodyPair<BodyType>, bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>, resultDeserializer: DeserializationStrategy<ResultType>,
serialFormat: StandardKtorSerialFormat = standardKtorSerialFormat serialFormat: StandardKtorSerialFormat = standardKtorSerialFormat
) = post(url) { ) = post(url) {
@ -162,7 +163,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
suspend fun <BodyType, ResultType> HttpClient.unimultipart( suspend fun <BodyType, ResultType> HttpClient.unimultipart(
url: String, url: String,
filename: String, filename: String,
otherData: BodyPair<BodyType>, otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
inputProvider: InputProvider, inputProvider: InputProvider,
resultDeserializer: DeserializationStrategy<ResultType>, resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*", mimetype: String = "*/*",
@ -220,7 +221,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
suspend fun <BodyType, ResultType> HttpClient.unimultipart( suspend fun <BodyType, ResultType> HttpClient.unimultipart(
url: String, url: String,
mppFile: MPPFile, mppFile: MPPFile,
otherData: BodyPair<BodyType>, otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
resultDeserializer: DeserializationStrategy<ResultType>, resultDeserializer: DeserializationStrategy<ResultType>,
mimetype: String = "*/*", mimetype: String = "*/*",
additionalParametersBuilder: FormBuilder.() -> Unit = {}, 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( override suspend fun create(values: List<InputValue>): List<ObjectType> = unifiedRequester.unipost(
buildStandardUrl(baseUrl, createRouting), buildStandardUrl(baseUrl, createRouting),
BodyPair(listInputSerializer, values), Pair(listInputSerializer, values),
listObjectsSerializer listObjectsSerializer
) )
override suspend fun update(id: IdType, value: InputValue): ObjectType? = unifiedRequester.unipost( override suspend fun update(id: IdType, value: InputValue): ObjectType? = unifiedRequester.unipost(
buildStandardUrl(baseUrl, updateRouting), buildStandardUrl(baseUrl, updateRouting),
BodyPair(inputUpdateSerializer, id to value), Pair(inputUpdateSerializer, id to value),
objectsNullableSerializer objectsNullableSerializer
) )
override suspend fun update(values: List<UpdatedValuePair<IdType, InputValue>>): List<ObjectType> = unifiedRequester.unipost( override suspend fun update(values: List<UpdatedValuePair<IdType, InputValue>>): List<ObjectType> = unifiedRequester.unipost(
buildStandardUrl(baseUrl, updateManyRouting), buildStandardUrl(baseUrl, updateManyRouting),
BodyPair(listInputUpdateSerializer, values), Pair(listInputUpdateSerializer, values),
listObjectsSerializer listObjectsSerializer
) )
override suspend fun deleteById(ids: List<IdType>) = unifiedRequester.unipost( override suspend fun deleteById(ids: List<IdType>) = unifiedRequester.unipost(
buildStandardUrl(baseUrl, deleteByIdRouting), buildStandardUrl(baseUrl, deleteByIdRouting),
BodyPair(listIdsSerializer, ids), Pair(listIdsSerializer, ids),
Unit.serializer() Unit.serializer()
) )
} }

View File

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

View File

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