diff --git a/README.md b/README.md index a7d9450..5fc223d 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ Extend DGS: Some changes are currently being made: -* `lib.data` +* `bee.persistent` Easier data handling for GraphQL + JPA, [documentation](./lib.data/README.md) -* `lib.result` - Functional kotlin bindings, integration with DGS & more -* `lib.events` +* `bee.functional` + Functional kotlin bindings, integration with DGS, `bee.persistent` & more +* `bee.buzz` Simple event manager based on the mediator pattern, based on C#'s [MediatR library](https://github.com/jbogard/MediatR) diff --git a/lib.events/build.gradle.kts b/bee.buzz/build.gradle.kts similarity index 80% rename from lib.events/build.gradle.kts rename to bee.buzz/build.gradle.kts index 69267b4..cc5cb0f 100644 --- a/lib.events/build.gradle.kts +++ b/bee.buzz/build.gradle.kts @@ -1,8 +1,5 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.spring.boot).apply(false) @@ -14,6 +11,11 @@ group = "com.beeproduced" version = libs.versions.bee.built.get() java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 +tasks.withType().configureEach { + kotlinOptions { + jvmTarget = "17" + } +} repositories { mavenCentral() @@ -45,7 +47,7 @@ java { } dependencies { - implementation("com.beeproduced:result") + implementation("com.beeproduced:bee.functional") implementation(libs.kotlin.stdlib) implementation(libs.spring.boot.starter.web) testImplementation(libs.junit.api) diff --git a/lib.events/gradle.properties b/bee.buzz/gradle.properties similarity index 100% rename from lib.events/gradle.properties rename to bee.buzz/gradle.properties diff --git a/lib.events/gradle/wrapper/gradle-wrapper.jar b/bee.buzz/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from lib.events/gradle/wrapper/gradle-wrapper.jar rename to bee.buzz/gradle/wrapper/gradle-wrapper.jar diff --git a/lib.events/gradle/wrapper/gradle-wrapper.properties b/bee.buzz/gradle/wrapper/gradle-wrapper.properties similarity index 94% rename from lib.events/gradle/wrapper/gradle-wrapper.properties rename to bee.buzz/gradle/wrapper/gradle-wrapper.properties index 62f495d..3fa8f86 100644 --- a/lib.events/gradle/wrapper/gradle-wrapper.properties +++ b/bee.buzz/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/lib.events/gradlew b/bee.buzz/gradlew similarity index 100% rename from lib.events/gradlew rename to bee.buzz/gradlew diff --git a/lib.events/gradlew.bat b/bee.buzz/gradlew.bat similarity index 100% rename from lib.events/gradlew.bat rename to bee.buzz/gradlew.bat diff --git a/lib.events/settings.gradle.kts b/bee.buzz/settings.gradle.kts similarity index 68% rename from lib.events/settings.gradle.kts rename to bee.buzz/settings.gradle.kts index b2a34d3..eb3ee25 100644 --- a/lib.events/settings.gradle.kts +++ b/bee.buzz/settings.gradle.kts @@ -1,4 +1,4 @@ -rootProject.name = "events" +rootProject.name = "bee.buzz" dependencyResolutionManagement { versionCatalogs { @@ -6,4 +6,4 @@ dependencyResolutionManagement { } } -includeBuild("../lib.result") \ No newline at end of file +includeBuild("../bee.functional") \ No newline at end of file diff --git a/lib.events/src/main/kotlin/com/beeproduced/lib/events/Notification.kt b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/Notification.kt similarity index 94% rename from lib.events/src/main/kotlin/com/beeproduced/lib/events/Notification.kt rename to bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/Notification.kt index 7324f5b..b274450 100644 --- a/lib.events/src/main/kotlin/com/beeproduced/lib/events/Notification.kt +++ b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/Notification.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.events +package com.beeproduced.bee.buzz /** * Inspired by https://github.com/jbogard/MediatR/wiki. diff --git a/lib.events/src/main/kotlin/com/beeproduced/lib/events/Request.kt b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/Request.kt similarity index 87% rename from lib.events/src/main/kotlin/com/beeproduced/lib/events/Request.kt rename to bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/Request.kt index 1c38211..77b9f99 100644 --- a/lib.events/src/main/kotlin/com/beeproduced/lib/events/Request.kt +++ b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/Request.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.events +package com.beeproduced.bee.buzz -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.Result /** diff --git a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/EventError.kt b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/EventError.kt similarity index 77% rename from lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/EventError.kt rename to bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/EventError.kt index 2df885d..bef8f6a 100644 --- a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/EventError.kt +++ b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/EventError.kt @@ -1,7 +1,7 @@ -package com.beeproduced.lib.events.manager +package com.beeproduced.bee.buzz.manager -import com.beeproduced.result.errors.InternalAppError -import com.beeproduced.result.errors.ResultError +import com.beeproduced.bee.functional.result.errors.InternalAppError +import com.beeproduced.bee.functional.result.errors.ResultError /** * diff --git a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/EventManager.kt b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/EventManager.kt similarity index 71% rename from lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/EventManager.kt rename to bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/EventManager.kt index dd8d5ae..db8af03 100644 --- a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/EventManager.kt +++ b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/EventManager.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.events.manager +package com.beeproduced.bee.buzz.manager /** * diff --git a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/Mediator.kt b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/Mediator.kt similarity index 68% rename from lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/Mediator.kt rename to bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/Mediator.kt index 98da060..bcf117d 100644 --- a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/Mediator.kt +++ b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/Mediator.kt @@ -1,10 +1,10 @@ -package com.beeproduced.lib.events.manager +package com.beeproduced.bee.buzz.manager -import com.beeproduced.lib.events.Notification -import com.beeproduced.lib.events.NotificationHandler -import com.beeproduced.lib.events.Request -import com.beeproduced.lib.events.RequestHandler -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.buzz.Notification +import com.beeproduced.bee.buzz.NotificationHandler +import com.beeproduced.bee.buzz.Request +import com.beeproduced.bee.buzz.RequestHandler +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.Result /** diff --git a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/Scheduler.kt b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/Scheduler.kt similarity index 85% rename from lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/Scheduler.kt rename to bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/Scheduler.kt index 8517170..f339b28 100644 --- a/lib.events/src/main/kotlin/com/beeproduced/lib/events/manager/Scheduler.kt +++ b/bee.buzz/src/main/kotlin/com/beeproduced/bee/buzz/manager/Scheduler.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.events.manager +package com.beeproduced.bee.buzz.manager import java.util.concurrent.ScheduledFuture import java.util.concurrent.TimeUnit diff --git a/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/autoconfig/BeeBuzzAutoConfiguration.kt b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/autoconfig/BeeBuzzAutoConfiguration.kt new file mode 100644 index 0000000..b531fb3 --- /dev/null +++ b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/autoconfig/BeeBuzzAutoConfiguration.kt @@ -0,0 +1,24 @@ +package com.beeproduced.bee.buzz.autoconfig + +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.buzz.manager.Mediator +import com.beeproduced.bee.buzz.manager.Scheduler +import com.beeproduced.bee.buzz.manager.SimpleEventManager +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration + +/** + * + * + * @author Kacper Urbaniec + * @version 2023-10-23 + */ +@Configuration +@ConditionalOnClass(value = [EventManager::class, Mediator::class, Scheduler::class]) +open class BeeBuzzAutoConfiguration { + @Bean + open fun beeBuzzEventManager() : EventManager { + return SimpleEventManager() + } +} \ No newline at end of file diff --git a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/SimpleEventManager.kt b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/SimpleEventManager.kt similarity index 94% rename from lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/SimpleEventManager.kt rename to bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/SimpleEventManager.kt index a20181b..9fe21c5 100644 --- a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/SimpleEventManager.kt +++ b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/SimpleEventManager.kt @@ -1,12 +1,12 @@ -package com.beeproduced.lib.events.manager +package com.beeproduced.bee.buzz.manager -import com.beeproduced.lib.events.Notification -import com.beeproduced.lib.events.NotificationHandler -import com.beeproduced.lib.events.Request -import com.beeproduced.lib.events.RequestHandler -import com.beeproduced.lib.events.manager.exceptions.NotificationHandlerNotFound -import com.beeproduced.lib.events.manager.exceptions.RequestHandlerNotFound -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.buzz.Notification +import com.beeproduced.bee.buzz.NotificationHandler +import com.beeproduced.bee.buzz.Request +import com.beeproduced.bee.buzz.RequestHandler +import com.beeproduced.bee.buzz.manager.exceptions.NotificationHandlerNotFound +import com.beeproduced.bee.buzz.manager.exceptions.RequestHandlerNotFound +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.Result import org.slf4j.LoggerFactory import org.springframework.util.LinkedMultiValueMap diff --git a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/TestEventManager.kt b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/TestEventManager.kt similarity index 78% rename from lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/TestEventManager.kt rename to bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/TestEventManager.kt index d756a73..b2cf3f9 100644 --- a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/TestEventManager.kt +++ b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/TestEventManager.kt @@ -1,7 +1,7 @@ -package com.beeproduced.lib.events.manager +package com.beeproduced.bee.buzz.manager -import com.beeproduced.lib.events.Request -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.buzz.Request +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.Result open class TestEventManager : SimpleEventManager() { diff --git a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/exceptions/NotificationHandlerNotFound.kt b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/exceptions/NotificationHandlerNotFound.kt similarity index 70% rename from lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/exceptions/NotificationHandlerNotFound.kt rename to bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/exceptions/NotificationHandlerNotFound.kt index 77578bf..96c8aa8 100644 --- a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/exceptions/NotificationHandlerNotFound.kt +++ b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/exceptions/NotificationHandlerNotFound.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.events.manager.exceptions +package com.beeproduced.bee.buzz.manager.exceptions /** * diff --git a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/exceptions/RequestHandlerNotFound.kt b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/exceptions/RequestHandlerNotFound.kt similarity index 69% rename from lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/exceptions/RequestHandlerNotFound.kt rename to bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/exceptions/RequestHandlerNotFound.kt index e8685a8..d73af08 100644 --- a/lib.events/src/simple/kotlin/com/beeproduced/lib/events/manager/exceptions/RequestHandlerNotFound.kt +++ b/bee.buzz/src/simple/kotlin/com/beeproduced/bee/buzz/manager/exceptions/RequestHandlerNotFound.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.events.manager.exceptions +package com.beeproduced.bee.buzz.manager.exceptions /** * diff --git a/bee.buzz/src/simple/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bee.buzz/src/simple/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..41ad4ad --- /dev/null +++ b/bee.buzz/src/simple/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.beeproduced.bee.buzz.autoconfig.BeeBuzzAutoConfiguration \ No newline at end of file diff --git a/bee.fetched.test/build.gradle.kts b/bee.fetched.test/build.gradle.kts index b035832..8e92a2c 100644 --- a/bee.fetched.test/build.gradle.kts +++ b/bee.fetched.test/build.gradle.kts @@ -1,10 +1,5 @@ import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -12,14 +7,15 @@ plugins { alias(libs.plugins.spring.boot) alias(libs.plugins.spring.dependencymanagement) alias(libs.plugins.kotlin.jpa) + // ksp plugin must be placed before kapt + // https://github.com/google/ksp/issues/1445#issuecomment-1763422067 + alias(libs.plugins.ksp) alias(libs.plugins.kotlin.kapt) alias(libs.plugins.dgs.codegen) alias(libs.plugins.kotlin.allopen) alias(libs.plugins.kotlin.noarg) java - alias(libs.plugins.ksp) id("bee.generative") - } allprojects { @@ -60,16 +56,16 @@ repositories { dependencies { // in-house libraries - implementation("com.beeproduced:events") - implementation("com.beeproduced:events") { - capabilities { requireCapability("com.beeproduced:events-simple") } + implementation("com.beeproduced:bee.buzz") + implementation("com.beeproduced:bee.buzz") { + capabilities { requireCapability("com.beeproduced:bee.buzz-simple") } } - implementation("com.beeproduced:result") { - capabilities { requireCapability("com.beeproduced:result-dgs") } + implementation("com.beeproduced:bee.functional") { + capabilities { requireCapability("com.beeproduced:bee.functional-dgs") } } - implementation("com.beeproduced:data") - implementation("com.beeproduced:data") { - capabilities { requireCapability("com.beeproduced:data-dgs") } + implementation("com.beeproduced:bee.persistent") + implementation("com.beeproduced:bee.persistent") { + capabilities { requireCapability("com.beeproduced:bee.persistent-dgs") } } beeGenerative("com.beeproduced:bee.fetched") // external dependencies @@ -156,4 +152,4 @@ tasks.getByName("jar") { tasks.bootRun { jvmArgs = listOf("-Dspring.output.ansi.enabled=ALWAYS") -} +} \ No newline at end of file diff --git a/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar b/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar index 249e583..943f0cb 100644 Binary files a/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar and b/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar differ diff --git a/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties b/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties index 070cb70..744c64d 100644 --- a/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties +++ b/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/bee.fetched.test/gradlew b/bee.fetched.test/gradlew index c53aefa..65dcd68 100644 --- a/bee.fetched.test/gradlew +++ b/bee.fetched.test/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions $var, ${var}, ${var:-default}, ${var+SET}, -# ${var#prefix}, ${var%suffix}, and $( cmd ); -# * compound commands having a testable exit status, especially case; -# * various built-in commands including command, set, and ulimit. +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/bee.fetched.test/gradlew.bat b/bee.fetched.test/gradlew.bat index 107acd3..93e3f59 100644 --- a/bee.fetched.test/gradlew.bat +++ b/bee.fetched.test/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/bee.fetched.test/settings.gradle.kts b/bee.fetched.test/settings.gradle.kts index 1bbd0ec..60557bc 100644 --- a/bee.fetched.test/settings.gradle.kts +++ b/bee.fetched.test/settings.gradle.kts @@ -8,8 +8,8 @@ dependencyResolutionManagement { includeBuild("../bee.generative") includeBuild("../bee.fetched") -includeBuild("../lib.data") -includeBuild("../lib.result") -includeBuild("../lib.events") +includeBuild("../bee.persistent") +includeBuild("../bee.functional") +includeBuild("../bee.buzz") diff --git a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/DgsConfiguration.kt b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/DgsConfiguration.kt index 660d69a..1ad4afb 100644 --- a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/DgsConfiguration.kt +++ b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/DgsConfiguration.kt @@ -1,29 +1,16 @@ package com.beeproduced.example.application.configuration -import com.beeproduced.result.dgs.DgsErrorHandlingConfiguration import com.netflix.graphql.dgs.DgsScalar import graphql.language.StringValue import graphql.schema.Coercing import graphql.schema.CoercingParseLiteralException import graphql.schema.CoercingParseValueException import graphql.schema.CoercingSerializeException -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.EnableAspectJAutoProxy import java.time.Instant import java.time.ZoneId import java.time.ZoneOffset import java.time.format.DateTimeFormatter -/** - * - * - * @author Kacper Urbaniec - * @version 2022-10-10 - */ -@Configuration -@EnableAspectJAutoProxy -class DgsConfiguration : DgsErrorHandlingConfiguration() - /** * Based on: https://netflix.github.io/dgs/scalars/ * diff --git a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/LibrarySetupConfiguration.kt b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/LibrarySetupConfiguration.kt deleted file mode 100644 index df69249..0000000 --- a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/LibrarySetupConfiguration.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.beeproduced.example.application.configuration - -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.lib.events.manager.SimpleEventManager -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.EnableAspectJAutoProxy - -@EnableAspectJAutoProxy -@Configuration -class LibrarySetupConfiguration { - - @Bean - fun eventManager() : EventManager { - return SimpleEventManager() - } -} \ No newline at end of file diff --git a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt index 63a9ff3..4b12da8 100644 --- a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt +++ b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt @@ -7,6 +7,8 @@ import org.springframework.core.env.Environment import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity import org.springframework.security.web.SecurityFilterChain +import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher +import org.springframework.web.servlet.handler.HandlerMappingIntrospector /** * @@ -23,7 +25,8 @@ class SecurityConfig( @Throws(Exception::class) @Bean - fun filterChain(http: HttpSecurity): SecurityFilterChain { + fun filterChain(http: HttpSecurity, introspector: HandlerMappingIntrospector): SecurityFilterChain { + val mvcMatcherBuilder = MvcRequestMatcher.Builder(introspector) // Disable csrf // See: https://github.com/graphql-java-kickstart/graphql-spring-boot/issues/184 http @@ -34,13 +37,13 @@ class SecurityConfig( .authorizeHttpRequests { authorize -> var auth = authorize .requestMatchers( - "/graphql", - "/graphiql", - "/schema.json", - "/subscriptions", - "/actuator/**", - "/graphiql/**", - "/h2-console" + mvcMatcherBuilder.pattern("/graphql"), + mvcMatcherBuilder.pattern("/graphiql"), + mvcMatcherBuilder.pattern("/schema.json"), + mvcMatcherBuilder.pattern("/subscriptions"), + mvcMatcherBuilder.pattern("/actuator/**"), + mvcMatcherBuilder.pattern("/graphiql/**"), + mvcMatcherBuilder.pattern("/h2-console") ) .permitAll() if (env.activeProfiles.contains("dev")) { diff --git a/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt b/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt index a933b37..735ba6b 100644 --- a/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt +++ b/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt @@ -34,7 +34,7 @@ class BeeFetchedTest { fun `query singular id dataloader (foo)`() { val query = GraphQLQueryRequest( FooGraphQLQuery(), - FooProjectionRoot() + projection(::FooProjectionRoot) .waldoId() .waldo().select { waldo() @@ -55,7 +55,7 @@ class BeeFetchedTest { fun `query plural ids dataloader (bar)`() { val query = GraphQLQueryRequest( BarGraphQLQuery(), - BarProjectionRoot() + projection(::BarProjectionRoot) .waldoIds() .waldos().select { waldo() @@ -76,7 +76,7 @@ class BeeFetchedTest { fun `query singular nullable id dataloader (qux)`() { val query = GraphQLQueryRequest( QuxGraphQLQuery(), - QuxProjectionRoot() + projection(::QuxProjectionRoot) .waldoId() .waldo().select { waldo() @@ -97,7 +97,7 @@ class BeeFetchedTest { fun `query plural nullable ids dataloader (quux)`() { val query = GraphQLQueryRequest( QuuxGraphQLQuery(), - QuuxProjectionRoot() + projection(::QuuxProjectionRoot) .waldoIds() .waldos().select { waldo() @@ -118,7 +118,7 @@ class BeeFetchedTest { fun `query singular unrelated id dataloader (corge)`() { val query = GraphQLQueryRequest( CorgeGraphQLQuery(), - CorgeProjectionRoot() + projection(::CorgeProjectionRoot) .corgeToWaldoId() .waldo().select { waldo() @@ -139,7 +139,7 @@ class BeeFetchedTest { fun `query singular id internal type dataloader (grault)`() { val query = GraphQLQueryRequest( GraultGraphQLQuery(), - GraultProjectionRoot() + projection(::GraultProjectionRoot) .waldo().select { waldo() } @@ -159,7 +159,7 @@ class BeeFetchedTest { fun `query singular nullable id internal type dataloader (fred)`() { val query = GraphQLQueryRequest( FredGraphQLQuery(), - FredProjectionRoot() + projection(::FredProjectionRoot) .waldo().select { waldo() } @@ -179,7 +179,7 @@ class BeeFetchedTest { fun `query plural nullable ids internal type dataloader (xyzzy)`() { val query = GraphQLQueryRequest( XyzzyGraphQLQuery(), - XyzzyProjectionRoot() + projection(::XyzzyProjectionRoot) .waldos().select { waldo() } @@ -199,7 +199,7 @@ class BeeFetchedTest { fun `query plural ids internal type dataloader (plugh)`() { val query = GraphQLQueryRequest( PlughGraphQLQuery(), - PlughProjectionRoot() + projection(::PlughProjectionRoot) .waldos().select { waldo() } @@ -219,7 +219,7 @@ class BeeFetchedTest { fun `query not generated dataloader (garply)`() { val query = GraphQLQueryRequest( GarplyGraphQLQuery(), - GarplyProjectionRoot() + projection(::GarplyProjectionRoot) .waldo().select { waldo() } @@ -241,7 +241,7 @@ class BeeFetchedTest { fun `query unsafe singular id dataloader (alpha)`() { val query = GraphQLQueryRequest( AlphaGraphQLQuery(), - AlphaProjectionRoot() + projection(::AlphaProjectionRoot) .zuluId() .zulu().select { zulu() @@ -262,7 +262,7 @@ class BeeFetchedTest { fun `query unsafe plural ids dataloader (bravo)`() { val query = GraphQLQueryRequest( BravoGraphQLQuery(), - BravoProjectionRoot() + projection(::BravoProjectionRoot) .zuluIds() .zulus().select { zulu() @@ -283,7 +283,7 @@ class BeeFetchedTest { fun `query unsafe singular nullable id dataloader (charlie)`() { val query = GraphQLQueryRequest( CharlieGraphQLQuery(), - CharlieProjectionRoot() + projection(::CharlieProjectionRoot) .zuluId() .zulu().select { zulu() @@ -304,7 +304,7 @@ class BeeFetchedTest { fun `query unsafe plural nullable ids dataloader (delta)`() { val query = GraphQLQueryRequest( DeltaGraphQLQuery(), - DeltaProjectionRoot() + projection(::DeltaProjectionRoot) .zuluIds() .zulus().select { zulu() @@ -325,7 +325,7 @@ class BeeFetchedTest { fun `query unsafe singular unrelated id dataloader (echo)`() { val query = GraphQLQueryRequest( EchoGraphQLQuery(), - EchoProjectionRoot() + projection(::EchoProjectionRoot) .echoToZuluId() .zulu().select { zulu() @@ -346,7 +346,7 @@ class BeeFetchedTest { fun `query unsafe singular id internal type dataloader (foxtrot)`() { val query = GraphQLQueryRequest( FoxtrotGraphQLQuery(), - FoxtrotProjectionRoot() + projection(::FoxtrotProjectionRoot) .zulu().select { zulu() } @@ -366,7 +366,7 @@ class BeeFetchedTest { fun `query unsafe singular nullable id internal type dataloader (golf)`() { val query = GraphQLQueryRequest( GolfGraphQLQuery(), - GolfProjectionRoot() + projection(::GolfProjectionRoot) .zulu().select { zulu() } @@ -386,7 +386,7 @@ class BeeFetchedTest { fun `query unsafe plural ids internal type dataloader (hotel)`() { val query = GraphQLQueryRequest( HotelGraphQLQuery(), - HotelProjectionRoot() + projection(::HotelProjectionRoot) .zulus().select { zulu() } @@ -406,7 +406,7 @@ class BeeFetchedTest { fun `query unsafe plural nullable ids internal type dataloader (india)`() { val query = GraphQLQueryRequest( IndiaGraphQLQuery(), - IndiaProjectionRoot() + projection(::IndiaProjectionRoot) .zulus().select { zulu() } @@ -426,7 +426,7 @@ class BeeFetchedTest { fun `query unsafe not generated dataloader (juliet)`() { val query = GraphQLQueryRequest( JulietGraphQLQuery(), - JulietProjectionRoot() + projection(::JulietProjectionRoot) .zulu().select { zulu() } @@ -443,6 +443,12 @@ class BeeFetchedTest { } inline fun > N.select(selection: N.() -> Unit): P { - selection() + this.selection() return this.parent() +} + +// Workaround as Kotlin does not support Java diamond operator +// https://netflix.github.io/dgs/generating-code-from-schema/#client-api-v2 +inline fun > projection(constructor: ()->R): R { + return constructor() } \ No newline at end of file diff --git a/bee.fetched/build.gradle.kts b/bee.fetched/build.gradle.kts index a15637e..f02e33c 100644 --- a/bee.fetched/build.gradle.kts +++ b/bee.fetched/build.gradle.kts @@ -1,10 +1,5 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) java diff --git a/bee.fetched/gradle/wrapper/gradle-wrapper.properties b/bee.fetched/gradle/wrapper/gradle-wrapper.properties index 62f495d..3fa8f86 100644 --- a/bee.fetched/gradle/wrapper/gradle-wrapper.properties +++ b/bee.fetched/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/lib.result/build.gradle.kts b/bee.functional/build.gradle.kts similarity index 81% rename from lib.result/build.gradle.kts rename to bee.functional/build.gradle.kts index 825b573..6956d6b 100644 --- a/lib.result/build.gradle.kts +++ b/bee.functional/build.gradle.kts @@ -1,8 +1,5 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { alias(libs.plugins.kotlin.jvm) java @@ -14,6 +11,11 @@ group = "com.beeproduced" version = libs.versions.bee.built.get() java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 +tasks.withType().configureEach { + kotlinOptions { + jvmTarget = "17" + } +} repositories { mavenCentral() @@ -47,13 +49,13 @@ sourceSets { // configurations["dgsTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get()) // } // } - create("jpa") { + create("persistent") { java { - srcDir("src/jpa/kotlin") + srcDir("src/persistent/kotlin") compileClasspath += main.get().output runtimeClasspath += main.get().output - configurations["jpaImplementation"].extendsFrom(configurations.implementation.get()) - configurations["jpaRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get()) + configurations["persistentImplementation"].extendsFrom(configurations.implementation.get()) + configurations["persistentRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get()) } } } @@ -62,8 +64,8 @@ java { registerFeature("dgs") { usingSourceSet(sourceSets["dgs"]) } - registerFeature("jpa") { - usingSourceSet(sourceSets["jpa"]) + registerFeature("persistent") { + usingSourceSet(sourceSets["persistent"]) } } @@ -77,7 +79,7 @@ dependencies { "dgsImplementation"(platform(libs.dgs.platform)) "dgsImplementation"(libs.dgs.spring.starter) "dgsImplementation"(libs.spring.boot.starter.aop) - "jpaImplementation"(libs.spring.boot.starter.data.jpa) + "persistentImplementation"(libs.spring.boot.starter.data.jpa) } tasks.withType { diff --git a/lib.result/gradle.properties b/bee.functional/gradle.properties similarity index 100% rename from lib.result/gradle.properties rename to bee.functional/gradle.properties diff --git a/lib.result/gradle/wrapper/gradle-wrapper.jar b/bee.functional/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from lib.result/gradle/wrapper/gradle-wrapper.jar rename to bee.functional/gradle/wrapper/gradle-wrapper.jar diff --git a/lib.result/gradle/wrapper/gradle-wrapper.properties b/bee.functional/gradle/wrapper/gradle-wrapper.properties similarity index 94% rename from lib.result/gradle/wrapper/gradle-wrapper.properties rename to bee.functional/gradle/wrapper/gradle-wrapper.properties index 62f495d..3fa8f86 100644 --- a/lib.result/gradle/wrapper/gradle-wrapper.properties +++ b/bee.functional/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/lib.result/gradlew b/bee.functional/gradlew similarity index 100% rename from lib.result/gradlew rename to bee.functional/gradlew diff --git a/lib.result/gradlew.bat b/bee.functional/gradlew.bat similarity index 100% rename from lib.result/gradlew.bat rename to bee.functional/gradlew.bat diff --git a/lib.data/settings.gradle.kts b/bee.functional/settings.gradle.kts similarity index 78% rename from lib.data/settings.gradle.kts rename to bee.functional/settings.gradle.kts index 7ea1abf..542c7db 100644 --- a/lib.data/settings.gradle.kts +++ b/bee.functional/settings.gradle.kts @@ -1,4 +1,4 @@ -rootProject.name = "data" +rootProject.name = "bee.functional" dependencyResolutionManagement { versionCatalogs { diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/aspect/AroundDgsDataAspect.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/aspect/AroundDgsDataAspect.kt similarity index 93% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/aspect/AroundDgsDataAspect.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/aspect/AroundDgsDataAspect.kt index 9f9e7f8..08e9521 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/aspect/AroundDgsDataAspect.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/aspect/AroundDgsDataAspect.kt @@ -1,6 +1,6 @@ -package com.beeproduced.result.dgs.aspect +package com.beeproduced.bee.functional.dgs.aspect -import com.beeproduced.result.dgs.data.fetcher.DataFetcherErrThrower +import com.beeproduced.bee.functional.dgs.fetcher.DataFetcherErrThrower import graphql.execution.DataFetcherResult import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation.Around diff --git a/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/autoconfig/BeeFunctionalDgsAutoConfiguration.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/autoconfig/BeeFunctionalDgsAutoConfiguration.kt new file mode 100644 index 0000000..b8a79cf --- /dev/null +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/autoconfig/BeeFunctionalDgsAutoConfiguration.kt @@ -0,0 +1,15 @@ +package com.beeproduced.bee.functional.dgs.autoconfig + +import com.beeproduced.bee.functional.dgs.config.DgsErrorHandlingConfiguration +import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.EnableAspectJAutoProxy + +/** + * + * + * @author Kacper Urbaniec + * @version 2023-10-23 + */ +@Configuration +@EnableAspectJAutoProxy +open class BeeFunctionalDgsAutoConfiguration : DgsErrorHandlingConfiguration() \ No newline at end of file diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/DgsErrorHandlingConfiguration.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/config/DgsErrorHandlingConfiguration.kt similarity index 68% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/DgsErrorHandlingConfiguration.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/config/DgsErrorHandlingConfiguration.kt index 61b38de..d05c2f8 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/DgsErrorHandlingConfiguration.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/config/DgsErrorHandlingConfiguration.kt @@ -1,8 +1,8 @@ -package com.beeproduced.result.dgs +package com.beeproduced.bee.functional.dgs.config -import com.beeproduced.result.dgs.aspect.AroundDgsDataAspect -import com.beeproduced.result.dgs.aspect.DefaultAroundDgsDataAspect -import com.beeproduced.result.dgs.handler.AspectExceptionHandler +import com.beeproduced.bee.functional.dgs.aspect.AroundDgsDataAspect +import com.beeproduced.bee.functional.dgs.aspect.DefaultAroundDgsDataAspect +import com.beeproduced.bee.functional.dgs.handler.AspectExceptionHandler import graphql.execution.DataFetcherExceptionHandler import org.springframework.context.annotation.Bean import org.springframework.context.annotation.EnableAspectJAutoProxy @@ -26,12 +26,12 @@ abstract class DgsErrorHandlingConfiguration { } @Bean - open fun createDataFetcherExceptionHandler(): DataFetcherExceptionHandler { + open fun beeFunctionalDgsDataFetcherExceptionHandler(): DataFetcherExceptionHandler { return AspectExceptionHandler() } @Bean - open fun createAspect(): AroundDgsDataAspect { + open fun beeFunctionalDgsAspect(): AroundDgsDataAspect { return DefaultAroundDgsDataAspect() } } diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/DataFetcherErrThrower.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/DataFetcherErrThrower.kt similarity index 78% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/DataFetcherErrThrower.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/DataFetcherErrThrower.kt index da3e515..f6e6507 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/DataFetcherErrThrower.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/DataFetcherErrThrower.kt @@ -1,4 +1,4 @@ -package com.beeproduced.result.dgs.data.fetcher +package com.beeproduced.bee.functional.dgs.fetcher import graphql.execution.DataFetcherResult diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/DataFetcherResult.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/DataFetcherResult.kt similarity index 97% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/DataFetcherResult.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/DataFetcherResult.kt index 43bdd1e..c64050b 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/DataFetcherResult.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/DataFetcherResult.kt @@ -1,6 +1,6 @@ @file:Suppress("FunctionName") -package com.beeproduced.result.dgs.data.fetcher +package com.beeproduced.bee.functional.dgs.fetcher import com.netflix.graphql.types.errors.TypedGraphQLError import graphql.execution.DataFetcherResult diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/TypedGraphlQLErrorExtensions.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/TypedGraphlQLErrorExtensions.kt similarity index 93% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/TypedGraphlQLErrorExtensions.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/TypedGraphlQLErrorExtensions.kt index 7547cc2..d40f8e8 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/data/fetcher/TypedGraphlQLErrorExtensions.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/fetcher/TypedGraphlQLErrorExtensions.kt @@ -1,4 +1,4 @@ -package com.beeproduced.result.dgs.data.fetcher +package com.beeproduced.bee.functional.dgs.fetcher import com.netflix.graphql.types.errors.ErrorType import com.netflix.graphql.types.errors.TypedGraphQLError diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/handler/AspectExceptionHandler.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/handler/AspectExceptionHandler.kt similarity index 90% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/handler/AspectExceptionHandler.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/handler/AspectExceptionHandler.kt index cab7681..7b38752 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/dgs/handler/AspectExceptionHandler.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/dgs/handler/AspectExceptionHandler.kt @@ -1,7 +1,7 @@ -package com.beeproduced.result.dgs.handler +package com.beeproduced.bee.functional.dgs.handler -import com.beeproduced.result.dgs.data.fetcher.extendWithHandlerParameters -import com.beeproduced.result.dgs.data.fetcher.DataFetcherErrThrower +import com.beeproduced.bee.functional.dgs.fetcher.extendWithHandlerParameters +import com.beeproduced.bee.functional.dgs.fetcher.DataFetcherErrThrower import com.netflix.graphql.dgs.exceptions.DefaultDataFetcherExceptionHandler import com.netflix.graphql.types.errors.TypedGraphQLError import graphql.execution.DataFetcherExceptionHandler diff --git a/lib.result/src/dgs/kotlin/com/beeproduced/result/extensions/dgs/KotlinResultExtensions.kt b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/KotlinResultDataFetcherExtensions.kt similarity index 76% rename from lib.result/src/dgs/kotlin/com/beeproduced/result/extensions/dgs/KotlinResultExtensions.kt rename to bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/KotlinResultDataFetcherExtensions.kt index 07df892..ec55210 100644 --- a/lib.result/src/dgs/kotlin/com/beeproduced/result/extensions/dgs/KotlinResultExtensions.kt +++ b/bee.functional/src/dgs/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/KotlinResultDataFetcherExtensions.kt @@ -1,9 +1,9 @@ -package com.beeproduced.result.extensions.dgs +package com.beeproduced.bee.functional.extensions.com.github.michaelbull.result -import com.beeproduced.result.dgs.data.fetcher.DataFetcher -import com.beeproduced.result.errors.AppError -import com.beeproduced.result.errors.BadRequestError -import com.beeproduced.result.errors.InternalAppError +import com.beeproduced.bee.functional.dgs.fetcher.DataFetcher +import com.beeproduced.bee.functional.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.BadRequestError +import com.beeproduced.bee.functional.result.errors.InternalAppError import com.github.michaelbull.result.Err import com.github.michaelbull.result.Ok import com.github.michaelbull.result.Result diff --git a/bee.functional/src/dgs/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bee.functional/src/dgs/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..53e59b3 --- /dev/null +++ b/bee.functional/src/dgs/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.beeproduced.bee.functional.dgs.autoconfig.BeeFunctionalDgsAutoConfiguration \ No newline at end of file diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/And.kt b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/And.kt similarity index 82% rename from lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/And.kt rename to bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/And.kt index 1bf6a09..b00d97e 100644 --- a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/And.kt +++ b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/And.kt @@ -1,6 +1,6 @@ -package com.beeproduced.result.extensions.errors +package com.beeproduced.bee.functional.extensions.com.github.michaelbull.result -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.Err import com.github.michaelbull.result.Ok import com.github.michaelbull.result.Result diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/Map.kt b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/Map.kt similarity index 86% rename from lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/Map.kt rename to bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/Map.kt index 98d3519..2638555 100644 --- a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/Map.kt +++ b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/Map.kt @@ -1,4 +1,4 @@ -package com.beeproduced.result.extensions.errors +package com.beeproduced.bee.functional.extensions.com.github.michaelbull.result import com.github.michaelbull.result.Result import com.github.michaelbull.result.Err @@ -6,10 +6,10 @@ import com.github.michaelbull.result.Ok import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind import kotlin.contracts.contract -import com.beeproduced.result.errors.AppError -import com.beeproduced.result.errors.BadRequestError -import com.beeproduced.result.errors.InternalAppError -import com.beeproduced.result.errors.ResultError +import com.beeproduced.bee.functional.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.BadRequestError +import com.beeproduced.bee.functional.result.errors.InternalAppError +import com.beeproduced.bee.functional.result.errors.ResultError /** * diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/functional/MapFunctional.kt b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/MapFunctional.kt similarity index 97% rename from lib.result/src/main/kotlin/com/beeproduced/result/extensions/functional/MapFunctional.kt rename to bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/MapFunctional.kt index 8702789..558f138 100644 --- a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/functional/MapFunctional.kt +++ b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/MapFunctional.kt @@ -1,6 +1,6 @@ -package com.beeproduced.result.extensions.functional +package com.beeproduced.bee.functional.extensions.com.github.michaelbull.result -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.* import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/Unsafe.kt b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/Unsafe.kt similarity index 80% rename from lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/Unsafe.kt rename to bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/Unsafe.kt index bba888a..b364848 100644 --- a/lib.result/src/main/kotlin/com/beeproduced/result/extensions/errors/Unsafe.kt +++ b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/extensions/com/github/michaelbull/result/Unsafe.kt @@ -1,6 +1,6 @@ -package com.beeproduced.result.extensions.errors +package com.beeproduced.bee.functional.extensions.com.github.michaelbull.result -import com.beeproduced.result.errors.InternalAppError +import com.beeproduced.bee.functional.result.errors.InternalAppError import com.github.michaelbull.result.Err import com.github.michaelbull.result.Ok import com.github.michaelbull.result.Result diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/AppResult.kt b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/result/AppResult.kt similarity index 59% rename from lib.result/src/main/kotlin/com/beeproduced/result/AppResult.kt rename to bee.functional/src/main/kotlin/com/beeproduced/bee/functional/result/AppResult.kt index 86730a4..c5fd495 100644 --- a/lib.result/src/main/kotlin/com/beeproduced/result/AppResult.kt +++ b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/result/AppResult.kt @@ -1,6 +1,6 @@ -package com.beeproduced.result +package com.beeproduced.bee.functional.result -import com.beeproduced.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.AppError import com.github.michaelbull.result.Result /** diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/errors/Error.kt b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/result/errors/Error.kt similarity index 98% rename from lib.result/src/main/kotlin/com/beeproduced/result/errors/Error.kt rename to bee.functional/src/main/kotlin/com/beeproduced/bee/functional/result/errors/Error.kt index 7d77fee..69eb978 100644 --- a/lib.result/src/main/kotlin/com/beeproduced/result/errors/Error.kt +++ b/bee.functional/src/main/kotlin/com/beeproduced/bee/functional/result/errors/Error.kt @@ -1,4 +1,4 @@ -package com.beeproduced.result.errors +package com.beeproduced.bee.functional.result.errors /** * Inspired by diff --git a/lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/extensions/TransactionTemplate.kt b/bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/extensions/org/springframework/transaction/support/TransactionTemplate.kt similarity index 87% rename from lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/extensions/TransactionTemplate.kt rename to bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/extensions/org/springframework/transaction/support/TransactionTemplate.kt index d96ff1c..3834a1c 100644 --- a/lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/extensions/TransactionTemplate.kt +++ b/bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/extensions/org/springframework/transaction/support/TransactionTemplate.kt @@ -1,11 +1,12 @@ -package com.beeproduced.result.jpa.extensions +package com.beeproduced.bee.functional.extensions.org.springframework.transaction.support -import com.beeproduced.result.errors.AppError -import com.beeproduced.result.errors.InternalAppError +import com.beeproduced.bee.functional.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.InternalAppError import com.github.michaelbull.result.Err import com.github.michaelbull.result.Result import com.github.michaelbull.result.getOrElse import com.github.michaelbull.result.onFailure +import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.transaction.TransactionStatus import org.springframework.transaction.support.TransactionTemplate @@ -31,7 +32,8 @@ open class TransactionError( skipStackTraceElements, limitStackTraceElements ) -val logger = LoggerFactory.getLogger(TransactionTemplate::class.java) + +val logger: Logger = LoggerFactory.getLogger(TransactionTemplate::class.java) @OptIn(ExperimentalContracts::class) inline fun TransactionTemplate.executeToResult( diff --git a/lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/transactional/TransactionalResult.kt b/bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/persistent/transactional/TransactionalResult.kt similarity index 98% rename from lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/transactional/TransactionalResult.kt rename to bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/persistent/transactional/TransactionalResult.kt index 5f7f612..22330c9 100644 --- a/lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/transactional/TransactionalResult.kt +++ b/bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/persistent/transactional/TransactionalResult.kt @@ -1,4 +1,4 @@ -package com.beeproduced.result.jpa.transactional +package com.beeproduced.bee.functional.persistent.transactional import org.springframework.core.annotation.AliasFor import org.springframework.transaction.TransactionDefinition diff --git a/lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/transactional/TransactionalResultAspect.kt b/bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/persistent/transactional/TransactionalResultAspect.kt similarity index 87% rename from lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/transactional/TransactionalResultAspect.kt rename to bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/persistent/transactional/TransactionalResultAspect.kt index e0be02e..9d83ac2 100644 --- a/lib.result/src/jpa/kotlin/com/beeproduced/result/jpa/transactional/TransactionalResultAspect.kt +++ b/bee.functional/src/persistent/kotlin/com/beeproduced/bee/functional/persistent/transactional/TransactionalResultAspect.kt @@ -1,7 +1,7 @@ -package com.beeproduced.result.jpa.transactional +package com.beeproduced.bee.functional.persistent.transactional -import com.beeproduced.result.errors.AppError -import com.beeproduced.result.errors.InternalAppError +import com.beeproduced.bee.functional.result.errors.AppError +import com.beeproduced.bee.functional.result.errors.InternalAppError import com.github.michaelbull.result.Err import com.github.michaelbull.result.Result import com.github.michaelbull.result.onFailure @@ -25,7 +25,7 @@ class TransactionalResultAspect( private val context: ApplicationContext ) { private val logger = LoggerFactory.getLogger(TransactionalResultAspect::class.java) - @Pointcut("execution(@com.beeproduced.result.jpa.transactional.TransactionalResult com.github.michaelbull.result.Result *(..))") + @Pointcut("execution(@com.beeproduced.bee.functional.persistent.transactional.TransactionalResult com.github.michaelbull.result.Result *(..))") fun transactionalMethodReturningResult() = Unit @Suppress("UNCHECKED_CAST") diff --git a/lib.result/src/test/kotlin/com/beeproduced/result/ErrorTest.kt b/bee.functional/src/test/kotlin/com/beeproduced/bee/functional/ErrorTest.kt similarity index 96% rename from lib.result/src/test/kotlin/com/beeproduced/result/ErrorTest.kt rename to bee.functional/src/test/kotlin/com/beeproduced/bee/functional/ErrorTest.kt index 41792d1..2c98248 100644 --- a/lib.result/src/test/kotlin/com/beeproduced/result/ErrorTest.kt +++ b/bee.functional/src/test/kotlin/com/beeproduced/bee/functional/ErrorTest.kt @@ -1,11 +1,11 @@ -package com.beeproduced.result - -import com.beeproduced.result.errors.BadRequestError -import com.beeproduced.result.errors.ExceptionError -import com.beeproduced.result.errors.InternalAppError -import com.beeproduced.result.errors.ResultError -import com.beeproduced.result.extensions.errors.mapBadRequestError -import com.beeproduced.result.extensions.errors.mapInternalError +package com.beeproduced.bee.functional + +import com.beeproduced.bee.functional.result.errors.BadRequestError +import com.beeproduced.bee.functional.result.errors.ExceptionError +import com.beeproduced.bee.functional.result.errors.InternalAppError +import com.beeproduced.bee.functional.result.errors.ResultError +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.mapBadRequestError +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.mapInternalError import com.github.michaelbull.result.Err import com.github.michaelbull.result.getErrorOrElse import org.junit.jupiter.api.Test diff --git a/lib.result/src/test/kotlin/com/beeproduced/result/MapTest.kt b/bee.functional/src/test/kotlin/com/beeproduced/bee/functional/MapTest.kt similarity index 90% rename from lib.result/src/test/kotlin/com/beeproduced/result/MapTest.kt rename to bee.functional/src/test/kotlin/com/beeproduced/bee/functional/MapTest.kt index bc82010..50f2e06 100644 --- a/lib.result/src/test/kotlin/com/beeproduced/result/MapTest.kt +++ b/bee.functional/src/test/kotlin/com/beeproduced/bee/functional/MapTest.kt @@ -1,7 +1,7 @@ -package com.beeproduced.result +package com.beeproduced.bee.functional -import com.beeproduced.result.extensions.functional.mapWithPair -import com.beeproduced.result.extensions.functional.mapWithTriple +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.mapWithPair +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.mapWithTriple import com.github.michaelbull.result.Ok import com.github.michaelbull.result.getOrThrow import com.github.michaelbull.result.map diff --git a/bee.generative/build.gradle.kts b/bee.generative/build.gradle.kts index ff4db50..541db8b 100644 --- a/bee.generative/build.gradle.kts +++ b/bee.generative/build.gradle.kts @@ -1,18 +1,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) java `java-gradle-plugin` `kotlin-dsl` - // TODO: Fix versioning? - // https://youtrack.jetbrains.com/issue/KT-54238 - id("org.jetbrains.kotlin.plugin.sam.with.receiver") version("1.8.0") } group = "com.beeproduced" diff --git a/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt b/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt index ecc4a00..70fa6f8 100644 --- a/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt +++ b/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt @@ -27,7 +27,7 @@ open class BeeGenerativePluginExtension { } open class BeeDependencies(private val dependencies: DependencyHandler) { - operator fun invoke(dependencyNotation: String): Pair { + operator fun invoke(dependencyNotation: String): Pair { val main = dependencies.add("implementation", dependencyNotation) val processor = dependencies.add("ksp", dependencyNotation, closureOf { val capabilityNotation = if (version != null) { diff --git a/lib.data/.gitignore b/bee.persistent/.gitignore similarity index 100% rename from lib.data/.gitignore rename to bee.persistent/.gitignore diff --git a/lib.data/README.md b/bee.persistent/README.md similarity index 81% rename from lib.data/README.md rename to bee.persistent/README.md index b99c41a..44fb024 100644 --- a/lib.data/README.md +++ b/bee.persistent/README.md @@ -1,17 +1,18 @@
-

lib.data

+

bee.persistent

Easier data handling for GraphQL + JPA

+ ## 💡 Motivation * *Query what you need*: Automatic query translation from e.g. GraphQL * *Idiomatic*: Focus on idiomatic Kotlin (e.g. allow data classes) * *Functional*: Prefer immutable records & minimize side effects -But this comes at a cost by design: `lib.data`'s JPA flavour is more a sophisticated database mapping utility than a fully fletched ORM. +But this comes at a cost by design: `bee.persistent`'s JPA flavour is more a sophisticated database mapping utility than a fully fletched ORM. > Each approach has its advantages and disadvantages; it is therefore not surprising that Object-Relational Mapping is referred to as the [Vietnam of computer science](https://blog.codinghorror.com/object-relational-mapping-is-the-vietnam-of-computer-science/). There is probably no universally good solution, only compromises. @@ -19,13 +20,13 @@ But this comes at a cost by design: `lib.data`'s JPA flavour is more a sophistic ### Define Entities -If one has worked with JPA, the following will be familiar. `lib.data` is a JPA superset which ironically limits functionality by design. +If one has worked with JPA, the following will be familiar. `bee.persistent` is a JPA superset which ironically limits functionality by design. -> No JPA experience? Start with some [fundamentals](https://www.baeldung.com/jpa-entities) before continuing your `lib.data` journey! +> No JPA experience? Start with some [fundamentals](https://www.baeldung.com/jpa-entities) before continuing your `bee.persistent` journey! -In contrast to JPA one can use and is even encouraged to use data classes for entities. Immutability is not a problem for `lib.data` as all changes to entities are flushed at any step or [even directly mapped to database circumventing the persistence context](https://thorben-janssen.com/criteria-updatedelete-easy-way-to/). +In contrast to JPA one can use and is even encouraged to use data classes for entities. Immutability is not a problem for `bee.persistent` as all changes to entities are flushed at any step or [even directly mapped to database circumventing the persistence context](https://thorben-janssen.com/criteria-updatedelete-easy-way-to/). -However, there are some important gotchas that can be tolerated in JPA but not in `lib.data`: +However, there are some important gotchas that can be tolerated in JPA but not in `bee.persistent`: * Use `Set` instead of `List` for collections @@ -60,13 +61,13 @@ However, there are some important gotchas that can be tolerated in JPA but not i > ⚠️ Inheritance support is not verified / tested yet. -Also, all entities must implement the `DataEntity` interface to be compatible with `lib.data`. +Also, all entities must implement the `DataEntity` interface to be compatible with `bee.persistent`. > 🪧 This requirement may be lifted in the future. In view of this, a simple one-to-many association with a composite key can be modelled as follows. -> 🪧 The code is taken from the examples in the folder `lib.data` - `test`. +> 🪧 The code is taken from the examples in the folder `bee.persistent` - `test`. ```kotlin data class WorkId( @@ -139,7 +140,7 @@ data class WorkCollection( ### Create Repositories -`lib.data` uses custom repositories for data access and not standard ones like Spring Data's `CrudRepository`. +`bee.persistent` uses custom repositories for data access and not standard ones like Spring Data's `CrudRepository`. But no worries, they are quite comparable and easy to define. One major difference might be that JPA's entity manager has to be passed explicitly. This was introduced to easily implement support for multiple data sources with independent entity managers. Apart from that, one only has to specify the entity type and its id type as generic parameters. @@ -157,11 +158,11 @@ class WorkCollectionRepository( > ⚠️ Favour `@Component` over the `@Repository` annotation as the latter one can introduce unexpected side effects on non Spring Data repositories. -> ⚠️ Each entity in `lib.data` requires a repository even when it is not explicitly used. Without it, the internal metamodel of `lib.data` will be incomplete, which may lead to unexpected exceptions when the entity is referenced by another, for example by a relationship. +> ⚠️ Each entity in `bee.persistent` requires a repository even when it is not explicitly used. Without it, the internal metamodel of `bee.persistent` will be incomplete, which may lead to unexpected exceptions when the entity is referenced by another, for example by a relationship. ### Create Simple Queries -`lib.data`'s repository API is quite comparable to Spring Data's [`CrudRepository`](https://docs.spring.io/spring-data/data-commons/docs/current/api/org/springframework/data/repository/CrudRepository.html). A notable difference, however, is that there is no universal `save` method for persisting and updating; `lib.data` explicitly provides a `persist` method for entering new entities and an `update` method for the operation of the same name. +`bee.persistent`'s repository API is quite comparable to Spring Data's [`CrudRepository`](https://docs.spring.io/spring-data/data-commons/docs/current/api/org/springframework/data/repository/CrudRepository.html). A notable difference, however, is that there is no universal `save` method for persisting and updating; `bee.persistent` explicitly provides a `persist` method for entering new entities and an `update` method for the operation of the same name. ```kotlin var collectionId: Long = -1 @@ -191,7 +192,7 @@ assertEquals("Update!", workUpdate.txt) #### Fun with Selections or: Query within the Query -In JPA, relation properties marked with `FetchType.LAZY` are returned as proxies. When accessing a field or method of such a proxy, a database query is executed to retrieve the data for that entity. Since `lib.data` strives to minimise side effects, no proxies are returned in such cases, but a `null` value is returned. +In JPA, relation properties marked with `FetchType.LAZY` are returned as proxies. When accessing a field or method of such a proxy, a database query is executed to retrieve the data for that entity. Since `bee.persistent` strives to minimise side effects, no proxies are returned in such cases, but a `null` value is returned. ```kotlin var collectionId: Long = -1 @@ -206,11 +207,11 @@ val collection = collectionRepo.selectById(collectionId) println(collection.works) ``` -To load a lazy relation in `lib.data`, it must be explicitly mentioned in a *data selection*. Each select method takes an additional optional parameter of the `DataSelection` interface, which is a graph listing all the relations to be eagerly loaded for the query. +To load a lazy relation in `bee.persistent`, it must be explicitly mentioned in a *data selection*. Each select method takes an additional optional parameter of the `DataSelection` interface, which is a graph listing all the relations to be eagerly loaded for the query. -> 🪧 `lib.data` internally uses the [Jakarta Persistence Entity Graph](https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#fetching-strategies-dynamic-fetching-entity-graph), specifically a load graph, in combination with the Criteria API to achieve this functionality. Each data selection is converted into a load graph and passed as a query hint. +> 🪧 `bee.persistent` internally uses the [Jakarta Persistence Entity Graph](https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#fetching-strategies-dynamic-fetching-entity-graph), specifically a load graph, in combination with the Criteria API to achieve this functionality. Each data selection is converted into a load graph and passed as a query hint. -On default, all select methods default to `EmptySelection` which loads no relations. `lib.data` also features following `DataSelection` implementations: +On default, all select methods default to `EmptySelection` which loads no relations. `bee.persistent` also features following `DataSelection` implementations: * `SimpleSelection`: Graph of nested sets where relations to be loaded are marked with their property name @@ -242,7 +243,7 @@ println(collection.works) Most JPA implementations such as Hibernate provide Automatic Dirty checking whereby changes to a managed entity are automatically saved to the database when the session is flushed or the transaction is committed. -In `lib.data`, all entities are automatically detached after persistence. One reason for this is that the Criteria API bypasses the persistence context for update or delete operations, leaving managed entities in an inconsistent state. Also, queries to the Criteria API can reuse the entity cache, which can result in missing relationships that were explicitly marked in the load graph converted from a data selection. In summary, this means that in `lib.data` every entity is free of side effects; every operation must be performed explicitly. This should not be an obstacle, as `lib.data` recommends, in the spirit of immutable design, to perform operations with updated copies of an existing entities. +In `bee.persistent`, all entities are automatically detached after persistence. One reason for this is that the Criteria API bypasses the persistence context for update or delete operations, leaving managed entities in an inconsistent state. Also, queries to the Criteria API can reuse the entity cache, which can result in missing relationships that were explicitly marked in the load graph converted from a data selection. In summary, this means that in `bee.persistent` every entity is free of side effects; every operation must be performed explicitly. This should not be an obstacle, as `bee.persistent` recommends, in the spirit of immutable design, to perform operations with updated copies of an existing entities. When working with [kotlin result](https://github.com/michaelbull/kotlin-result) for error handling, one can use `@TransactionalResult` on methods that return `Result` to implicitly wrap method execution in a database transaction. This should be familiar if one has already used [`@Transactionl` from Spring Data](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring); in fact, the `@TransactionalResult` API is based heavily on its Spring counterpart. @@ -258,7 +259,7 @@ However, there is a difference in how exceptions are handled. `@Transactional` o ### Model `m:n` Relations -In `lib.data` relations should be modelled explicitly therefore it is not advised to propagate (cascade) operations to related entities. In JPA one can persist an entity with included relation entities in one step, in `lib.data` each relation is inserted on its own via its own repository. +In `bee.persistent` relations should be modelled explicitly therefore it is not advised to propagate (cascade) operations to related entities. In JPA one can persist an entity with included relation entities in one step, in `bee.persistent` each relation is inserted on its own via its own repository. ```kotlin @Entity @@ -331,7 +332,7 @@ assertEquals(barId, foo1.bars?.first()?.id) ### Advanced Queries -In the previous examples, only simple, predefined operations were shown. It has also been mentioned that `lib.data` is built on top of the Criteria API, but no Criteria Queries have been shown so far. +In the previous examples, only simple, predefined operations were shown. It has also been mentioned that `bee.persistent` is built on top of the Criteria API, but no Criteria Queries have been shown so far. Repository operations that provide extensibility of Criteria Queries contain a parameter `dsl` that represents a lambda. User-defined queries can be inserted into these lambdas. @@ -443,7 +444,7 @@ A skip over can be of type `SkipOverOnce` & `SkipOverAll`. Prefer the latter one ### About `@OneToOne`, `@ManyToOne` and `FetchType.LAZY` -With `lib.data` pre Hibernate 6.X lazy loading for single entities was working as expected. But since migrating to Hibernate 6.X, it seems that this feature is not supported and/or working as intended. +With `bee.persistent` pre Hibernate 6.X lazy loading for single entities was working as expected. But since migrating to Hibernate 6.X, it seems that this feature is not supported and/or working as intended. The [Hibernate 6.1 documentation](https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#fetching-strategies) specifically notes to mark all associations lazy and to use dynamic fetching strategies for eagerness. diff --git a/lib.data/build.gradle.kts b/bee.persistent/build.gradle.kts similarity index 93% rename from lib.data/build.gradle.kts rename to bee.persistent/build.gradle.kts index 642a1c3..8129184 100644 --- a/lib.data/build.gradle.kts +++ b/bee.persistent/build.gradle.kts @@ -1,10 +1,5 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jpa) @@ -16,6 +11,12 @@ plugins { group = "com.beeproduced" version = libs.versions.bee.built.get() java.sourceCompatibility = JavaVersion.VERSION_17 +java.targetCompatibility = JavaVersion.VERSION_17 +tasks.withType().configureEach { + kotlinOptions { + jvmTarget = "17" + } +} repositories { mavenCentral() diff --git a/bee.persistent/gradle/wrapper/gradle-wrapper.jar b/bee.persistent/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..943f0cb Binary files /dev/null and b/bee.persistent/gradle/wrapper/gradle-wrapper.jar differ diff --git a/lib.data/gradle/wrapper/gradle-wrapper.properties b/bee.persistent/gradle/wrapper/gradle-wrapper.properties similarity index 84% rename from lib.data/gradle/wrapper/gradle-wrapper.properties rename to bee.persistent/gradle/wrapper/gradle-wrapper.properties index 070cb70..744c64d 100644 --- a/lib.data/gradle/wrapper/gradle-wrapper.properties +++ b/bee.persistent/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/lib.data/gradlew b/bee.persistent/gradlew similarity index 94% rename from lib.data/gradlew rename to bee.persistent/gradlew index a69d9cb..65dcd68 100644 --- a/lib.data/gradlew +++ b/bee.persistent/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/lib.data/gradlew.bat b/bee.persistent/gradlew.bat similarity index 98% rename from lib.data/gradlew.bat rename to bee.persistent/gradlew.bat index f127cfd..93e3f59 100644 --- a/lib.data/gradlew.bat +++ b/bee.persistent/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/lib.result/settings.gradle.kts b/bee.persistent/settings.gradle.kts similarity index 78% rename from lib.result/settings.gradle.kts rename to bee.persistent/settings.gradle.kts index e5a391f..12b996e 100644 --- a/lib.result/settings.gradle.kts +++ b/bee.persistent/settings.gradle.kts @@ -1,4 +1,4 @@ -rootProject.name = "result" +rootProject.name = "bee.persistent" dependencyResolutionManagement { versionCatalogs { diff --git a/bee.persistent/src/dgs/kotlin/com/beeproduced/bee/persistent/dgs/selection/DgsGraphQLSelection.kt b/bee.persistent/src/dgs/kotlin/com/beeproduced/bee/persistent/dgs/selection/DgsGraphQLSelection.kt new file mode 100644 index 0000000..1277ddb --- /dev/null +++ b/bee.persistent/src/dgs/kotlin/com/beeproduced/bee/persistent/dgs/selection/DgsGraphQLSelection.kt @@ -0,0 +1,21 @@ +package com.beeproduced.bee.persistent.dgs.selection + +import com.beeproduced.bee.persistent.selection.FieldNodeDefinition +import com.beeproduced.bee.persistent.selection.SimpleSelection +import com.beeproduced.bee.persistent.selection.SimpleSelection.Companion.substringBeforeOrNull +import graphql.schema.SelectedField + +fun toDataSelection(node: SelectedField): FieldNodeDefinition { + + val field = node.qualifiedName + val fieldType = node.fullyQualifiedName.substringBeforeOrNull(".") + val immediateFields = node.selectionSet.immediateFields + + val nodeFields = if (immediateFields.isNullOrEmpty()) null + else { + immediateFields.mapTo(HashSet()) { toDataSelection(it) } + } + + return SimpleSelection.TypedFiledNode(field, fieldType, nodeFields) + +} \ No newline at end of file diff --git a/bee.persistent/src/dgs/kotlin/com/beeproduced/bee/persistent/extensions/graphql/schema/DataFetchingExtensions.kt b/bee.persistent/src/dgs/kotlin/com/beeproduced/bee/persistent/extensions/graphql/schema/DataFetchingExtensions.kt new file mode 100644 index 0000000..4eb77e4 --- /dev/null +++ b/bee.persistent/src/dgs/kotlin/com/beeproduced/bee/persistent/extensions/graphql/schema/DataFetchingExtensions.kt @@ -0,0 +1,24 @@ +package com.beeproduced.bee.persistent.extensions.graphql.schema + +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.SimpleSelection +import graphql.schema.DataFetchingEnvironment +import graphql.schema.DataFetchingFieldSelectionSet + +/** + * + * + * @author Kacper Urbaniec + * @version 2023-01-30 + */ + +fun DataFetchingFieldSelectionSet.toDataSelection(): DataSelection { + val fields = immediateFields + .mapTo(HashSet()) { com.beeproduced.bee.persistent.dgs.selection.toDataSelection(it) } + + return SimpleSelection(fields) +} + +fun DataFetchingEnvironment.toDataSelection(): DataSelection { + return selectionSet.toDataSelection() +} \ No newline at end of file diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/context/DataContext.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/context/DataContext.kt similarity index 78% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/context/DataContext.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/context/DataContext.kt index 6522d16..8c7e3d9 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/context/DataContext.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/context/DataContext.kt @@ -1,6 +1,6 @@ -package com.beeproduced.data.jpa.context +package com.beeproduced.bee.persistent.jpa.context -import com.beeproduced.data.selection.DataSelection +import com.beeproduced.bee.persistent.selection.DataSelection /** * diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/entity/DataEntity.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/entity/DataEntity.kt similarity index 68% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/entity/DataEntity.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/entity/DataEntity.kt index 22f86c6..c9a6cbf 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/entity/DataEntity.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/entity/DataEntity.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.entity +package com.beeproduced.bee.persistent.jpa.entity /** * diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/entity/annotations/SelectionName.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/entity/annotations/SelectionName.kt similarity index 90% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/entity/annotations/SelectionName.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/entity/annotations/SelectionName.kt index 0897394..2d7cdf5 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/entity/annotations/SelectionName.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/entity/annotations/SelectionName.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.entity.annotations +package com.beeproduced.bee.persistent.jpa.entity.annotations /** * diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/exceptions/EntityNotFound.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/exceptions/EntityNotFound.kt similarity index 80% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/exceptions/EntityNotFound.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/exceptions/EntityNotFound.kt index a29d11f..05590ad 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/exceptions/EntityNotFound.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/exceptions/EntityNotFound.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.exceptions +package com.beeproduced.bee.persistent.jpa.exceptions /** * diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/exceptions/UnsupportedRelationType.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/exceptions/UnsupportedRelationType.kt similarity index 84% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/exceptions/UnsupportedRelationType.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/exceptions/UnsupportedRelationType.kt index 391f581..4c8168e 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/exceptions/UnsupportedRelationType.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/exceptions/UnsupportedRelationType.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.exceptions +package com.beeproduced.bee.persistent.jpa.exceptions import kotlin.reflect.KType diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/EntityInfo.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/EntityInfo.kt similarity index 98% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/EntityInfo.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/EntityInfo.kt index 3cb6261..2703188 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/EntityInfo.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/EntityInfo.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.meta +package com.beeproduced.bee.persistent.jpa.meta import jakarta.persistence.EmbeddedId import jakarta.persistence.IdClass diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/GeneratedInfo.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/GeneratedInfo.kt similarity index 85% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/GeneratedInfo.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/GeneratedInfo.kt index cf7d249..ecccfb7 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/GeneratedInfo.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/GeneratedInfo.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.meta +package com.beeproduced.bee.persistent.jpa.meta /** * diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MemberInfo.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MemberInfo.kt similarity index 93% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MemberInfo.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MemberInfo.kt index ab7e204..534d418 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MemberInfo.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MemberInfo.kt @@ -1,6 +1,6 @@ -package com.beeproduced.data.jpa.meta +package com.beeproduced.bee.persistent.jpa.meta -import com.beeproduced.data.jpa.exceptions.UnsupportedRelationType +import com.beeproduced.bee.persistent.jpa.exceptions.UnsupportedRelationType import java.lang.reflect.Field import java.util.* import kotlin.reflect.KProperty diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MembersInfo.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MembersInfo.kt similarity index 95% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MembersInfo.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MembersInfo.kt index c5a9831..7c91303 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MembersInfo.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MembersInfo.kt @@ -1,6 +1,6 @@ -package com.beeproduced.data.jpa.meta +package com.beeproduced.bee.persistent.jpa.meta -import com.beeproduced.data.jpa.entity.annotations.SelectionName +import com.beeproduced.bee.persistent.jpa.entity.annotations.SelectionName import jakarta.persistence.* import java.lang.reflect.Field diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MetaModel.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MetaModel.kt similarity index 97% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MetaModel.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MetaModel.kt index 6c1513b..1b7783d 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/meta/MetaModel.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/meta/MetaModel.kt @@ -1,6 +1,6 @@ -package com.beeproduced.data.jpa.meta +package com.beeproduced.bee.persistent.jpa.meta -import com.beeproduced.data.jpa.exceptions.EntityNotFound +import com.beeproduced.bee.persistent.jpa.exceptions.EntityNotFound import org.hibernate.persister.entity.EntityPersister import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/proxy/Unproxy.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/proxy/Unproxy.kt similarity index 97% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/proxy/Unproxy.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/proxy/Unproxy.kt index efe9b22..5c87244 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/proxy/Unproxy.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/proxy/Unproxy.kt @@ -1,9 +1,9 @@ @file:Suppress("NAME_SHADOWING") -package com.beeproduced.data.jpa.proxy +package com.beeproduced.bee.persistent.jpa.proxy -import com.beeproduced.data.jpa.meta.MemberInfo -import com.beeproduced.data.jpa.meta.MetaModel +import com.beeproduced.bee.persistent.jpa.meta.MemberInfo +import com.beeproduced.bee.persistent.jpa.meta.MetaModel import org.hibernate.Hibernate import org.hibernate.metamodel.spi.MetamodelImplementor import org.hibernate.proxy.HibernateProxy diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/BaseDataRepository.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/BaseDataRepository.kt similarity index 94% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/BaseDataRepository.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/BaseDataRepository.kt index 015c08c..063f26e 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/BaseDataRepository.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/BaseDataRepository.kt @@ -1,30 +1,24 @@ -package com.beeproduced.data.jpa.repository - -import com.beeproduced.data.jpa.entity.DataEntity -import com.beeproduced.data.jpa.meta.* -import com.beeproduced.data.jpa.proxy.Unproxy -import com.beeproduced.data.jpa.repository.dsl.DummyCriteriaDeleteQueryDsl -import com.beeproduced.data.jpa.repository.dsl.DummyCriteriaQueryDsl -import com.beeproduced.data.jpa.selection.JpaSelection -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.data.selection.EmptySelection +package com.beeproduced.bee.persistent.jpa.repository + +import com.beeproduced.bee.persistent.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.meta.* +import com.beeproduced.bee.persistent.jpa.proxy.Unproxy +import com.beeproduced.bee.persistent.jpa.repository.dsl.DummyCriteriaDeleteQueryDsl +import com.beeproduced.bee.persistent.jpa.repository.dsl.DummyCriteriaQueryDsl +import com.beeproduced.bee.persistent.jpa.selection.JpaSelection +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.EmptySelection import com.linecorp.kotlinjdsl.QueryFactoryImpl -import com.linecorp.kotlinjdsl.listQuery import com.linecorp.kotlinjdsl.query.creator.CriteriaQueryCreatorImpl import com.linecorp.kotlinjdsl.query.creator.SubqueryCreatorImpl import com.linecorp.kotlinjdsl.query.spec.expression.EntitySpec import com.linecorp.kotlinjdsl.querydsl.CriteriaDeleteQueryDsl import com.linecorp.kotlinjdsl.querydsl.CriteriaQueryDsl -import com.linecorp.kotlinjdsl.selectQuery +import jakarta.persistence.EntityManager +import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl import org.slf4j.Logger import org.slf4j.LoggerFactory import java.lang.reflect.ParameterizedType -import jakarta.persistence.EntityManager -import org.hibernate.Session -import org.hibernate.metamodel.MappingMetamodel -import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl -import org.hibernate.metamodel.spi.MappingMetamodelImplementor -import org.hibernate.metamodel.spi.MetamodelImplementor import kotlin.reflect.KClass /** diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/QueryBuilder.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/QueryBuilder.kt similarity index 97% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/QueryBuilder.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/QueryBuilder.kt index c312c08..65863a0 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/QueryBuilder.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/QueryBuilder.kt @@ -1,8 +1,8 @@ -package com.beeproduced.data.jpa.repository +package com.beeproduced.bee.persistent.jpa.repository -import com.beeproduced.data.jpa.meta.EntityInfo -import com.beeproduced.data.jpa.meta.Fields -import com.beeproduced.data.jpa.meta.Ids +import com.beeproduced.bee.persistent.jpa.meta.EntityInfo +import com.beeproduced.bee.persistent.jpa.meta.Fields +import com.beeproduced.bee.persistent.jpa.meta.Ids import com.linecorp.kotlinjdsl.query.spec.expression.ColumnSpec import com.linecorp.kotlinjdsl.query.spec.expression.EntitySpec import com.linecorp.kotlinjdsl.query.spec.expression.ExpressionSpec diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/dsl/DummyCriteriaDeleteQueryDsl.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/dsl/DummyCriteriaDeleteQueryDsl.kt similarity index 95% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/dsl/DummyCriteriaDeleteQueryDsl.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/dsl/DummyCriteriaDeleteQueryDsl.kt index 358d548..9e25ae4 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/dsl/DummyCriteriaDeleteQueryDsl.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/dsl/DummyCriteriaDeleteQueryDsl.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.repository.dsl +package com.beeproduced.bee.persistent.jpa.repository.dsl import com.linecorp.kotlinjdsl.query.spec.expression.EntitySpec import com.linecorp.kotlinjdsl.query.spec.predicate.PredicateSpec diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/dsl/DummyCriteriaQueryDsl.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/dsl/DummyCriteriaQueryDsl.kt similarity index 97% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/dsl/DummyCriteriaQueryDsl.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/dsl/DummyCriteriaQueryDsl.kt index da45faa..522c83d 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/dsl/DummyCriteriaQueryDsl.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/dsl/DummyCriteriaQueryDsl.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.jpa.repository.dsl +package com.beeproduced.bee.persistent.jpa.repository.dsl import com.linecorp.kotlinjdsl.query.clause.select.MultiSelectClause import com.linecorp.kotlinjdsl.query.clause.select.SingleSelectClause diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/extensions/Pagination.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/extensions/Pagination.kt similarity index 95% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/extensions/Pagination.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/extensions/Pagination.kt index 791db8c..1250d98 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/repository/extensions/Pagination.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/repository/extensions/Pagination.kt @@ -1,9 +1,9 @@ -package com.beeproduced.data.jpa.repository.extensions +package com.beeproduced.bee.persistent.jpa.repository.extensions -import com.beeproduced.data.jpa.entity.DataEntity -import com.beeproduced.data.jpa.repository.BaseDataRepository -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.data.selection.EmptySelection +import com.beeproduced.bee.persistent.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.EmptySelection import com.linecorp.kotlinjdsl.query.spec.expression.ColumnSpec import com.linecorp.kotlinjdsl.query.spec.predicate.GreaterThanValueSpec import com.linecorp.kotlinjdsl.query.spec.predicate.LessThanValueSpec diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/selection/JpaSelection.kt b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/selection/JpaSelection.kt similarity index 95% rename from lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/selection/JpaSelection.kt rename to bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/selection/JpaSelection.kt index a1327f6..aa9d951 100644 --- a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/selection/JpaSelection.kt +++ b/bee.persistent/src/jpa/kotlin/com/beeproduced/bee/persistent/jpa/selection/JpaSelection.kt @@ -1,9 +1,9 @@ -package com.beeproduced.data.jpa.selection +package com.beeproduced.bee.persistent.jpa.selection -import com.beeproduced.data.jpa.meta.MetaModel -import com.beeproduced.data.jpa.meta.Relations -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.data.selection.FullNonRecursiveSelection +import com.beeproduced.bee.persistent.jpa.meta.MetaModel +import com.beeproduced.bee.persistent.jpa.meta.Relations +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.FullNonRecursiveSelection import jakarta.persistence.EntityGraph import jakarta.persistence.EntityManager import jakarta.persistence.Subgraph diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/fieldconverter/StringSetConverter.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/fieldconverter/StringSetConverter.kt similarity index 90% rename from lib.data/src/main/kotlin/com/beeproduced/data/fieldconverter/StringSetConverter.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/fieldconverter/StringSetConverter.kt index e67af72..baa190b 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/fieldconverter/StringSetConverter.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/fieldconverter/StringSetConverter.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.fieldconverter +package com.beeproduced.bee.persistent.fieldconverter import jakarta.persistence.AttributeConverter import jakarta.persistence.Converter diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/selection/DataSelection.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/DataSelection.kt similarity index 67% rename from lib.data/src/main/kotlin/com/beeproduced/data/selection/DataSelection.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/DataSelection.kt index d7988da..5563074 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/selection/DataSelection.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/DataSelection.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.selection +package com.beeproduced.bee.persistent.selection /** * @@ -19,4 +19,12 @@ interface DataSelection { fun merge(vararg selections: SimpleSelection): DataSelection fun merge(selections: Collection): DataSelection + + fun typeSelect(typeName: String): DataSelection? +} + +inline fun DataSelection.typeSelect(): DataSelection? { + val typeName = C::class.simpleName ?: + throw Exception("Given class has no name") + return typeSelect(typeName) } \ No newline at end of file diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/selection/EmptySelection.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/EmptySelection.kt similarity index 84% rename from lib.data/src/main/kotlin/com/beeproduced/data/selection/EmptySelection.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/EmptySelection.kt index b6fd182..8d3afed 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/selection/EmptySelection.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/EmptySelection.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.selection +package com.beeproduced.bee.persistent.selection /** * @@ -21,4 +21,6 @@ class EmptySelection : DataSelection { val selection = SimpleSelection(setOf()) return selection.merge(selections) } + + override fun typeSelect(typeName: String): DataSelection? = null } \ No newline at end of file diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/selection/FieldNodeDefinition.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/FieldNodeDefinition.kt similarity index 69% rename from lib.data/src/main/kotlin/com/beeproduced/data/selection/FieldNodeDefinition.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/FieldNodeDefinition.kt index f58f5f4..99083fa 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/selection/FieldNodeDefinition.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/FieldNodeDefinition.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.selection +package com.beeproduced.bee.persistent.selection /** * @@ -8,5 +8,6 @@ package com.beeproduced.data.selection */ interface FieldNodeDefinition { val field: String + val type: String? val fields: Set? } \ No newline at end of file diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/selection/FullNonRecursiveSelection.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/FullNonRecursiveSelection.kt similarity index 83% rename from lib.data/src/main/kotlin/com/beeproduced/data/selection/FullNonRecursiveSelection.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/FullNonRecursiveSelection.kt index 7cce0bb..5d88bd4 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/selection/FullNonRecursiveSelection.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/FullNonRecursiveSelection.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.selection +package com.beeproduced.bee.persistent.selection /** * @@ -19,4 +19,6 @@ class FullNonRecursiveSelection(skips: Collection = emptyList()) : Dat override fun merge(selections: Collection): DataSelection { return this } + + override fun typeSelect(typeName: String): DataSelection? = this } \ No newline at end of file diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/selection/SimpleSelection.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/SimpleSelection.kt similarity index 85% rename from lib.data/src/main/kotlin/com/beeproduced/data/selection/SimpleSelection.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/SimpleSelection.kt index 5313405..0fc27b1 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/selection/SimpleSelection.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/SimpleSelection.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.selection +package com.beeproduced.bee.persistent.selection import java.io.File import java.nio.file.FileSystems @@ -36,6 +36,11 @@ class SimpleSelection internal constructor( val osFieldGlobPattern = removeLeadingSlash(fieldGlobPattern) return FileSystems.getDefault().getPathMatcher("glob:$osFieldGlobPattern") } + + fun String.substringBeforeOrNull(delimiter: String): String? { + val index = indexOf(delimiter) + return if (index == -1) null else substring(0, index) + } } constructor(fields: Set, skips: Collection = emptyList()) : this( @@ -85,10 +90,19 @@ class SimpleSelection internal constructor( data class FieldNode( override val field: String, override val fields: Set? = null + ) : FieldNodeDefinition { + override val type: String? = null + } + + data class TypedFiledNode( + override val field: String, + override val type: String?, + override val fields: Set? = null ) : FieldNodeDefinition private data class MutableFieldNode( override val field: String, + override val type: String?, override var fields: MutableSet? = null ) : FieldNodeDefinition @@ -141,7 +155,7 @@ class SimpleSelection internal constructor( for (node in immediateFields) { val mutableNode = if (!immediateFieldsTmp.contains(node.field)) { - val mutableNode = MutableFieldNode(node.field) + val mutableNode = MutableFieldNode(node.field, node.type) immediateFieldsTmp[node.field] = mutableNode fieldsTmp[node.field] = mutableNode fieldGlobPathsTmp.add(mutableNode.field) @@ -169,6 +183,19 @@ class SimpleSelection internal constructor( ) } + override fun typeSelect(typeName: String): DataSelection? { + if (typeName.isEmpty()) return null + + val start = mutableSetOf() + for ((_, node) in fields) { + if (node.type != null && node.type == typeName) + start.add(node) + } + + return if (start.isEmpty()) null + else SimpleSelection(start, skipOvers.remainingSkips()) + } + private fun merge( node: FieldNodeDefinition, parent: MutableFieldNode, @@ -180,7 +207,7 @@ class SimpleSelection internal constructor( val mutableFieldNode = if (fieldsTmp.contains(path)) { fieldsTmp.getValue(path) } else { - val currentNode = MutableFieldNode(node.field) + val currentNode = MutableFieldNode(node.field, node.type) fieldsTmp[path] = currentNode currentNode } as MutableFieldNode diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/selection/SkipOver.kt b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/SkipOver.kt similarity index 97% rename from lib.data/src/main/kotlin/com/beeproduced/data/selection/SkipOver.kt rename to bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/SkipOver.kt index 47a378e..e55b493 100644 --- a/lib.data/src/main/kotlin/com/beeproduced/data/selection/SkipOver.kt +++ b/bee.persistent/src/main/kotlin/com/beeproduced/bee/persistent/selection/SkipOver.kt @@ -1,4 +1,4 @@ -package com.beeproduced.data.selection +package com.beeproduced.bee.persistent.selection /** * diff --git a/lib.data/src/main/resources/application.properties b/bee.persistent/src/main/resources/application.properties similarity index 100% rename from lib.data/src/main/resources/application.properties rename to bee.persistent/src/main/resources/application.properties diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/DataSelectionTest.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/DataSelectionTest.kt similarity index 98% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/DataSelectionTest.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/DataSelectionTest.kt index 10990ac..a560fa1 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/DataSelectionTest.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/DataSelectionTest.kt @@ -1,7 +1,7 @@ -package com.beeproduced.lib.data +package com.beeproduced.bee.persistent -import com.beeproduced.data.selection.SimpleSelection -import com.beeproduced.data.selection.SimpleSelection.FieldNode +import com.beeproduced.bee.persistent.selection.SimpleSelection +import com.beeproduced.bee.persistent.selection.SimpleSelection.FieldNode import org.junit.jupiter.api.Test import kotlin.test.* diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/IncubatingTest.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/IncubatingTest.kt similarity index 98% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/IncubatingTest.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/IncubatingTest.kt index 3bee6e1..65f7810 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/IncubatingTest.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/IncubatingTest.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.data +package com.beeproduced.bee.persistent /** * diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/ManyToManyTest.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/ManyToManyTest.kt similarity index 94% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/ManyToManyTest.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/ManyToManyTest.kt index f8e7e48..bbf9c26 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/ManyToManyTest.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/ManyToManyTest.kt @@ -1,12 +1,11 @@ -package com.beeproduced.lib.data - -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.data.selection.EmptySelection -import com.beeproduced.data.selection.FullNonRecursiveSelection -import com.beeproduced.lib.data.config.DummyApplication -import com.beeproduced.lib.data.config.PersistenceConfiguration -import com.beeproduced.lib.data.many.to.many.* -import com.beeproduced.lib.data.one.to.many.* +package com.beeproduced.bee.persistent + +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.EmptySelection +import com.beeproduced.bee.persistent.selection.FullNonRecursiveSelection +import com.beeproduced.bee.persistent.config.DummyApplication +import com.beeproduced.bee.persistent.config.PersistenceConfiguration +import com.beeproduced.bee.persistent.many.to.many.* import com.linecorp.kotlinjdsl.querydsl.expression.column import org.junit.jupiter.api.* import org.junit.jupiter.api.extension.ExtendWith diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/OneToManyTest.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/OneToManyTest.kt similarity index 97% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/OneToManyTest.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/OneToManyTest.kt index b1fa6f1..80aab09 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/OneToManyTest.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/OneToManyTest.kt @@ -1,11 +1,13 @@ -package com.beeproduced.lib.data - -import com.beeproduced.data.selection.EmptySelection -import com.beeproduced.data.selection.FullNonRecursiveSelection -import com.beeproduced.data.selection.SimpleSelection -import com.beeproduced.lib.data.config.DummyApplication -import com.beeproduced.lib.data.config.PersistenceConfiguration -import com.beeproduced.lib.data.one.to.many.* +package com.beeproduced.bee.persistent + +import com.beeproduced.bee.persistent.selection.EmptySelection +import com.beeproduced.bee.persistent.selection.FullNonRecursiveSelection +import com.beeproduced.bee.persistent.selection.SimpleSelection +import com.beeproduced.bee.persistent.config.DummyApplication +import com.beeproduced.bee.persistent.config.PersistenceConfiguration +import com.beeproduced.bee.persistent.one.to.many.* +import com.beeproduced.bee.persistent.one.to.one.* +import com.beeproduced.bee.persistent.many.to.many.* import com.linecorp.kotlinjdsl.querydsl.expression.column import org.junit.jupiter.api.* import org.junit.jupiter.api.Test diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/OneToOneTest.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/OneToOneTest.kt similarity index 90% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/OneToOneTest.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/OneToOneTest.kt index 6f271b1..70f2a50 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/OneToOneTest.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/OneToOneTest.kt @@ -1,16 +1,16 @@ -package com.beeproduced.lib.data - -import com.beeproduced.data.selection.EmptySelection -import com.beeproduced.data.selection.FullNonRecursiveSelection -import com.beeproduced.data.selection.SimpleSelection -import com.beeproduced.data.selection.SimpleSelection.FieldNode -import com.beeproduced.lib.data.config.DummyApplication -import com.beeproduced.lib.data.config.PersistenceConfiguration -import com.beeproduced.lib.data.one.to.many.* -import com.beeproduced.lib.data.one.to.one.Branch -import com.beeproduced.lib.data.one.to.one.BranchRepository -import com.beeproduced.lib.data.one.to.one.Root -import com.beeproduced.lib.data.one.to.one.RootRepository +package com.beeproduced.bee.persistent + +import com.beeproduced.bee.persistent.selection.EmptySelection +import com.beeproduced.bee.persistent.selection.FullNonRecursiveSelection +import com.beeproduced.bee.persistent.selection.SimpleSelection +import com.beeproduced.bee.persistent.selection.SimpleSelection.FieldNode +import com.beeproduced.bee.persistent.config.DummyApplication +import com.beeproduced.bee.persistent.config.PersistenceConfiguration +import com.beeproduced.bee.persistent.one.to.many.* +import com.beeproduced.bee.persistent.one.to.one.Branch +import com.beeproduced.bee.persistent.one.to.one.BranchRepository +import com.beeproduced.bee.persistent.one.to.one.Root +import com.beeproduced.bee.persistent.one.to.one.RootRepository import org.junit.jupiter.api.* import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/PaginationTest.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/PaginationTest.kt similarity index 97% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/PaginationTest.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/PaginationTest.kt index a12fb71..cdb6cd4 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/PaginationTest.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/PaginationTest.kt @@ -1,10 +1,10 @@ -package com.beeproduced.lib.data +package com.beeproduced.bee.persistent -import com.beeproduced.data.selection.EmptySelection -import com.beeproduced.lib.data.config.DummyApplication -import com.beeproduced.lib.data.config.PaginationTestConfiguration -import com.beeproduced.lib.data.pagination.PaginatedFoo -import com.beeproduced.lib.data.pagination.PaginatedFooRepository +import com.beeproduced.bee.persistent.selection.EmptySelection +import com.beeproduced.bee.persistent.config.DummyApplication +import com.beeproduced.bee.persistent.config.PaginationTestConfiguration +import com.beeproduced.bee.persistent.pagination.PaginatedFoo +import com.beeproduced.bee.persistent.pagination.PaginatedFooRepository import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/config/DummyApplication.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/DummyApplication.kt similarity index 86% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/config/DummyApplication.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/DummyApplication.kt index f787924..7431756 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/config/DummyApplication.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/DummyApplication.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.data.config +package com.beeproduced.bee.persistent.config import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.context.properties.EnableConfigurationProperties diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/config/PaginationTestConfiguration.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/PaginationTestConfiguration.kt similarity index 60% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/config/PaginationTestConfiguration.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/PaginationTestConfiguration.kt index d0cb554..325e733 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/config/PaginationTestConfiguration.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/PaginationTestConfiguration.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.data.config +package com.beeproduced.bee.persistent.config import org.springframework.boot.test.context.TestConfiguration import org.springframework.context.annotation.ComponentScan @@ -6,8 +6,8 @@ import org.springframework.context.annotation.ComponentScan @TestConfiguration @ComponentScan( basePackages = [ - "com.beeproduced.lib.data.config", - "com.beeproduced.lib.data.pagination" + "com.beeproduced.bee.persistent.config", + "com.beeproduced.bee.persistent.pagination" ] ) class PaginationTestConfiguration { diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/config/PersistenceConfiguration.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/PersistenceConfiguration.kt similarity index 93% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/config/PersistenceConfiguration.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/PersistenceConfiguration.kt index 9a1cfc4..9a38ef8 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/config/PersistenceConfiguration.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/config/PersistenceConfiguration.kt @@ -1,4 +1,4 @@ -package com.beeproduced.lib.data.config +package com.beeproduced.bee.persistent.config import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Qualifier @@ -17,7 +17,7 @@ import javax.sql.DataSource @Configuration("PersistenceOrder") @EnableJpaRepositories( - basePackages = ["com.beeproduced.lib.data"], + basePackages = ["com.beeproduced.bee.persistent"], entityManagerFactoryRef = "orderEntityManager", transactionManagerRef = "orderTransactionManager" ) @@ -39,7 +39,7 @@ class PersistenceConfiguration { ): LocalContainerEntityManagerFactoryBean { val em = LocalContainerEntityManagerFactoryBean() em.setDataSource(orderDataSource) - em.setPackagesToScan("com.beeproduced.lib.data") + em.setPackagesToScan("com.beeproduced.bee.persistent") val vendorAdapter = HibernateJpaVendorAdapter() em.setJpaVendorAdapter(vendorAdapter) val properties: HashMap = HashMap() diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/many/to/many/Entities.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/many/to/many/Entities.kt similarity index 95% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/many/to/many/Entities.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/many/to/many/Entities.kt index 7f5347d..23a7f64 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/many/to/many/Entities.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/many/to/many/Entities.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.data.many.to.many +package com.beeproduced.bee.persistent.many.to.many -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import java.io.Serializable import jakarta.persistence.* diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/many/to/many/Repositories.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/many/to/many/Repositories.kt similarity index 83% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/many/to/many/Repositories.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/many/to/many/Repositories.kt index 912c901..f132b2c 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/many/to/many/Repositories.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/many/to/many/Repositories.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.data.many.to.many +package com.beeproduced.bee.persistent.many.to.many -import com.beeproduced.data.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Component import jakarta.persistence.EntityManager diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/many/Entities.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/many/Entities.kt similarity index 90% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/many/Entities.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/many/Entities.kt index 7347a74..dcae4f2 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/many/Entities.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/many/Entities.kt @@ -1,10 +1,8 @@ -package com.beeproduced.lib.data.one.to.many +package com.beeproduced.bee.persistent.one.to.many -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import java.io.Serializable import jakarta.persistence.* -import org.hibernate.annotations.LazyToOne -import org.hibernate.annotations.LazyToOneOption /** * diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/many/Repositories.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/many/Repositories.kt similarity index 80% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/many/Repositories.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/many/Repositories.kt index 8d156bf..222167a 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/many/Repositories.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/many/Repositories.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.data.one.to.many +package com.beeproduced.bee.persistent.one.to.many -import com.beeproduced.data.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Component import jakarta.persistence.EntityManager diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/one/Entities.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/one/Entities.kt similarity index 93% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/one/Entities.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/one/Entities.kt index 945492b..611a93d 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/one/Entities.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/one/Entities.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.data.one.to.one +package com.beeproduced.bee.persistent.one.to.one -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import org.hibernate.annotations.LazyToOne import org.hibernate.annotations.LazyToOneOption import jakarta.persistence.* diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/one/Repositories.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/one/Repositories.kt similarity index 79% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/one/Repositories.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/one/Repositories.kt index 9908ed4..c4b8630 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/one/to/one/Repositories.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/one/to/one/Repositories.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.data.one.to.one +package com.beeproduced.bee.persistent.one.to.one -import com.beeproduced.data.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository import org.springframework.beans.factory.annotation.Qualifier import org.springframework.stereotype.Component import jakarta.persistence.* diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/pagination/Entities.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/pagination/Entities.kt similarity index 76% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/pagination/Entities.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/pagination/Entities.kt index a5282c9..539b719 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/pagination/Entities.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/pagination/Entities.kt @@ -1,6 +1,6 @@ -package com.beeproduced.lib.data.pagination +package com.beeproduced.bee.persistent.pagination -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import jakarta.persistence.* import java.time.Instant diff --git a/lib.data/src/test/kotlin/com/beeproduced/lib/data/pagination/Repositories.kt b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/pagination/Repositories.kt similarity index 78% rename from lib.data/src/test/kotlin/com/beeproduced/lib/data/pagination/Repositories.kt rename to bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/pagination/Repositories.kt index bd0bb83..4e99729 100644 --- a/lib.data/src/test/kotlin/com/beeproduced/lib/data/pagination/Repositories.kt +++ b/bee.persistent/src/test/kotlin/com/beeproduced/bee/persistent/pagination/Repositories.kt @@ -1,11 +1,11 @@ -package com.beeproduced.lib.data.pagination +package com.beeproduced.bee.persistent.pagination -import com.beeproduced.data.jpa.repository.BaseDataRepository -import com.beeproduced.data.jpa.repository.extensions.Cursor -import com.beeproduced.data.jpa.repository.extensions.Pagination -import com.beeproduced.data.jpa.repository.extensions.PaginationException -import com.beeproduced.data.jpa.repository.extensions.PaginationResult -import com.beeproduced.data.selection.DataSelection +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.extensions.Cursor +import com.beeproduced.bee.persistent.jpa.repository.extensions.Pagination +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationException +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationResult +import com.beeproduced.bee.persistent.selection.DataSelection import com.linecorp.kotlinjdsl.query.spec.expression.ColumnSpec import com.linecorp.kotlinjdsl.query.spec.expression.EntitySpec import com.linecorp.kotlinjdsl.query.spec.predicate.EqualValueSpec @@ -47,8 +47,8 @@ class PaginatedFooRepository( repository = this, orderBy = ColumnSpec(EntitySpec(PaginatedFoo::class.java), PaginatedFoo::createdOn.name), cursor = Cursor( - decode = ::decodeCursor, - encode = ::encodeCursor + decode = Companion::decodeCursor, + encode = Companion::encodeCursor ), where = { w: String -> EqualValueSpec( diff --git a/lib.data/src/test/resources/application.properties b/bee.persistent/src/test/resources/application.properties similarity index 100% rename from lib.data/src/test/resources/application.properties rename to bee.persistent/src/test/resources/application.properties diff --git a/example/application/build.gradle.kts b/example/application/build.gradle.kts index fbc362d..289f1ea 100644 --- a/example/application/build.gradle.kts +++ b/example/application/build.gradle.kts @@ -1,10 +1,5 @@ import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -12,12 +7,14 @@ plugins { alias(libs.plugins.spring.boot) alias(libs.plugins.spring.dependencymanagement) alias(libs.plugins.kotlin.jpa) + // ksp plugin must be placed before kapt + // https://github.com/google/ksp/issues/1445#issuecomment-1763422067 + alias(libs.plugins.ksp) alias(libs.plugins.kotlin.kapt) alias(libs.plugins.dgs.codegen) alias(libs.plugins.kotlin.allopen) alias(libs.plugins.kotlin.noarg) java - alias(libs.plugins.ksp) id("bee.generative") } @@ -65,16 +62,16 @@ dependencies { implementation(project(":service.organisation.events")) implementation(project(":utils")) // in-house libraries - implementation("com.beeproduced:events") - implementation("com.beeproduced:events") { - capabilities { requireCapability("com.beeproduced:events-simple") } + implementation("com.beeproduced:bee.buzz") + implementation("com.beeproduced:bee.buzz") { + capabilities { requireCapability("com.beeproduced:bee.buzz-simple") } } - implementation("com.beeproduced:result") { - capabilities { requireCapability("com.beeproduced:result-dgs") } + implementation("com.beeproduced:bee.functional") { + capabilities { requireCapability("com.beeproduced:bee.functional-dgs") } } - implementation("com.beeproduced:data") - implementation("com.beeproduced:data") { - capabilities { requireCapability("com.beeproduced:data-dgs") } + implementation("com.beeproduced:bee.persistent") + implementation("com.beeproduced:bee.persistent") { + capabilities { requireCapability("com.beeproduced:bee.persistent-dgs") } } beeGenerative("com.beeproduced:bee.fetched") // external dependencies diff --git a/example/application/gradle/wrapper/gradle-wrapper.jar b/example/application/gradle/wrapper/gradle-wrapper.jar index 249e583..943f0cb 100644 Binary files a/example/application/gradle/wrapper/gradle-wrapper.jar and b/example/application/gradle/wrapper/gradle-wrapper.jar differ diff --git a/example/application/gradle/wrapper/gradle-wrapper.properties b/example/application/gradle/wrapper/gradle-wrapper.properties index 070cb70..744c64d 100644 --- a/example/application/gradle/wrapper/gradle-wrapper.properties +++ b/example/application/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/example/application/gradlew b/example/application/gradlew index c53aefa..65dcd68 100644 --- a/example/application/gradlew +++ b/example/application/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions $var, ${var}, ${var:-default}, ${var+SET}, -# ${var#prefix}, ${var%suffix}, and $( cmd ); -# * compound commands having a testable exit status, especially case; -# * various built-in commands including command, set, and ulimit. +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/example/application/gradlew.bat b/example/application/gradlew.bat index 107acd3..93e3f59 100644 --- a/example/application/gradlew.bat +++ b/example/application/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/example/application/settings.gradle.kts b/example/application/settings.gradle.kts index b53e2aa..bce868e 100644 --- a/example/application/settings.gradle.kts +++ b/example/application/settings.gradle.kts @@ -8,9 +8,9 @@ dependencyResolutionManagement { includeBuild("../../bee.generative") includeBuild("../../bee.fetched") -includeBuild("../../lib.data") -includeBuild("../../lib.result") -includeBuild("../../lib.events") +includeBuild("../../bee.persistent") +includeBuild("../../bee.functional") +includeBuild("../../bee.buzz") // Services include(":service.media") diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/DataGenerator.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/DataGenerator.kt index 60c4c6d..338170e 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/DataGenerator.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/DataGenerator.kt @@ -1,8 +1,8 @@ package com.beeproduced.example.application -import com.beeproduced.data.selection.SimpleSelection -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.result.AppResult +import com.beeproduced.bee.persistent.selection.SimpleSelection +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.functional.result.AppResult import com.beeproduced.service.media.entities.Film import com.beeproduced.service.media.entities.input.CreateFilmInput import com.beeproduced.service.media.events.CreateFilm diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/DgsConfiguration.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/DgsConfiguration.kt index 660d69a..af0f0d1 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/DgsConfiguration.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/DgsConfiguration.kt @@ -1,28 +1,16 @@ package com.beeproduced.example.application.configuration -import com.beeproduced.result.dgs.DgsErrorHandlingConfiguration import com.netflix.graphql.dgs.DgsScalar import graphql.language.StringValue import graphql.schema.Coercing import graphql.schema.CoercingParseLiteralException import graphql.schema.CoercingParseValueException import graphql.schema.CoercingSerializeException -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.EnableAspectJAutoProxy import java.time.Instant import java.time.ZoneId import java.time.ZoneOffset import java.time.format.DateTimeFormatter -/** - * - * - * @author Kacper Urbaniec - * @version 2022-10-10 - */ -@Configuration -@EnableAspectJAutoProxy -class DgsConfiguration : DgsErrorHandlingConfiguration() /** * Based on: https://netflix.github.io/dgs/scalars/ diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/LibrarySetupConfiguration.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/LibrarySetupConfiguration.kt deleted file mode 100644 index df69249..0000000 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/LibrarySetupConfiguration.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.beeproduced.example.application.configuration - -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.lib.events.manager.SimpleEventManager -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.EnableAspectJAutoProxy - -@EnableAspectJAutoProxy -@Configuration -class LibrarySetupConfiguration { - - @Bean - fun eventManager() : EventManager { - return SimpleEventManager() - } -} \ No newline at end of file diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt index 63a9ff3..b087dbb 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt @@ -7,6 +7,8 @@ import org.springframework.core.env.Environment import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity import org.springframework.security.web.SecurityFilterChain +import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher +import org.springframework.web.servlet.handler.HandlerMappingIntrospector /** * @@ -18,12 +20,13 @@ import org.springframework.security.web.SecurityFilterChain @Configuration @EnableWebSecurity class SecurityConfig( - private val env: Environment + private val env: Environment, ) { @Throws(Exception::class) @Bean - fun filterChain(http: HttpSecurity): SecurityFilterChain { + fun filterChain(http: HttpSecurity, introspector: HandlerMappingIntrospector): SecurityFilterChain { + val mvcMatcherBuilder = MvcRequestMatcher.Builder(introspector) // Disable csrf // See: https://github.com/graphql-java-kickstart/graphql-spring-boot/issues/184 http @@ -34,13 +37,13 @@ class SecurityConfig( .authorizeHttpRequests { authorize -> var auth = authorize .requestMatchers( - "/graphql", - "/graphiql", - "/schema.json", - "/subscriptions", - "/actuator/**", - "/graphiql/**", - "/h2-console" + mvcMatcherBuilder.pattern("/graphql"), + mvcMatcherBuilder.pattern("/graphiql"), + mvcMatcherBuilder.pattern("/schema.json"), + mvcMatcherBuilder.pattern("/subscriptions"), + mvcMatcherBuilder.pattern("/actuator/**"), + mvcMatcherBuilder.pattern("/graphiql/**"), + mvcMatcherBuilder.pattern("/h2-console") ) .permitAll() if (env.activeProfiles.contains("dev")) { diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaController.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaController.kt index 2277e49..4c7dce9 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaController.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaController.kt @@ -1,12 +1,12 @@ package com.beeproduced.example.application.media.service -import com.beeproduced.data.dgs.selection.toDataSelection +import com.beeproduced.bee.persistent.extensions.graphql.schema.toDataSelection import com.beeproduced.example.application.graphql.dto.AddFilm import com.beeproduced.example.application.graphql.dto.EditFilm import com.beeproduced.example.application.graphql.dto.Foo import com.beeproduced.example.application.organisation.service.setContext -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.result.extensions.dgs.getDataFetcher +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.getDataFetcher import com.beeproduced.service.media.events.CreateFilm import com.beeproduced.service.media.events.GetRecentlyAddedFilms import com.beeproduced.service.media.events.UpdateFilm diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaMapper.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaMapper.kt index 17162cb..b344e3f 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaMapper.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/media/service/MediaMapper.kt @@ -1,6 +1,6 @@ package com.beeproduced.example.application.media.service -import com.beeproduced.data.jpa.repository.extensions.PaginationResult +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationResult import com.beeproduced.service.media.entities.Film import com.beeproduced.service.media.entities.input.CreateFilmInput import com.beeproduced.service.media.entities.input.FilmPagination diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationController.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationController.kt index be19d3c..7d69172 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationController.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationController.kt @@ -1,8 +1,8 @@ package com.beeproduced.example.application.organisation.service -import com.beeproduced.data.dgs.selection.toDataSelection -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.result.extensions.dgs.getDataFetcher +import com.beeproduced.bee.persistent.extensions.graphql.schema.toDataSelection +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.getDataFetcher import com.beeproduced.service.organisation.events.GetAllCompanies import com.beeproduced.service.organisation.events.GetAllPersons import com.beeproduced.utils.logFor diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationDataLoader.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationDataLoader.kt index 7696f10..089eda7 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationDataLoader.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/organisation/service/OrganisationDataLoader.kt @@ -2,9 +2,9 @@ package com.beeproduced.example.application.organisation.service import com.beeproduced.bee.fetched.annotations.BeeFetched import com.beeproduced.bee.fetched.annotations.FetcherIgnore -import com.beeproduced.data.dgs.selection.toDataSelection -import com.beeproduced.data.selection.EmptySelection -import com.beeproduced.lib.events.manager.EventManager +import com.beeproduced.bee.persistent.extensions.graphql.schema.toDataSelection +import com.beeproduced.bee.persistent.selection.EmptySelection +import com.beeproduced.bee.buzz.manager.EventManager import com.beeproduced.service.organisation.events.GetCompaniesByIds import com.beeproduced.service.organisation.events.GetPersonsByIds import com.beeproduced.utils.logFor diff --git a/example/service.media/build.gradle.kts b/example/service.media/build.gradle.kts index d26a5a8..335bb2e 100644 --- a/example/service.media/build.gradle.kts +++ b/example/service.media/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -30,10 +26,10 @@ dependencies { implementation(project(":service.media.events")) implementation(project(":service.organisation.events")) implementation(project(":utils")) - implementation("com.beeproduced:events") - implementation("com.beeproduced:data") - implementation("com.beeproduced:data") { - capabilities { requireCapability("com.beeproduced:data-dgs") } + implementation("com.beeproduced:bee.buzz") + implementation("com.beeproduced:bee.persistent") + implementation("com.beeproduced:bee.persistent") { + capabilities { requireCapability("com.beeproduced:bee.persistent-dgs") } } implementation(libs.kotlin.stdlib) implementation(libs.spring.boot.starter.web) diff --git a/example/service.media/entities/build.gradle.kts b/example/service.media/entities/build.gradle.kts index 186b14b..e5fc54b 100644 --- a/example/service.media/entities/build.gradle.kts +++ b/example/service.media/entities/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jpa) @@ -25,9 +21,9 @@ dependencies { implementation(project(":utils")) api(libs.jakarta.persistence.api) api(libs.hibernate.core) - api("com.beeproduced:data") - api("com.beeproduced:data") { - capabilities { requireCapability("com.beeproduced:data-jpa") } + api("com.beeproduced:bee.persistent") + api("com.beeproduced:bee.persistent") { + capabilities { requireCapability("com.beeproduced:bee.persistent-jpa") } } } diff --git a/example/service.media/entities/src/main/kotlin/com/beeproduced/service/media/entities/Film.kt b/example/service.media/entities/src/main/kotlin/com/beeproduced/service/media/entities/Film.kt index 6905005..0b1c81f 100644 --- a/example/service.media/entities/src/main/kotlin/com/beeproduced/service/media/entities/Film.kt +++ b/example/service.media/entities/src/main/kotlin/com/beeproduced/service/media/entities/Film.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.media.entities -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import com.beeproduced.service.organisation.entities.CompanyId import com.beeproduced.service.organisation.entities.PersonId import com.beeproduced.utils.UUIDSetConverter diff --git a/example/service.media/events/build.gradle.kts b/example/service.media/events/build.gradle.kts index 231ee73..39671ec 100644 --- a/example/service.media/events/build.gradle.kts +++ b/example/service.media/events/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.serialization) @@ -19,6 +15,6 @@ repositories { dependencies { implementation(libs.kotlin.stdlib) - implementation("com.beeproduced:events") + implementation("com.beeproduced:bee.buzz") api(project(":service.media.entities")) } diff --git a/example/service.media/events/src/main/kotlin/com/beeproduced/service/media/events/Requests.kt b/example/service.media/events/src/main/kotlin/com/beeproduced/service/media/events/Requests.kt index 1f61ce4..0732f6b 100644 --- a/example/service.media/events/src/main/kotlin/com/beeproduced/service/media/events/Requests.kt +++ b/example/service.media/events/src/main/kotlin/com/beeproduced/service/media/events/Requests.kt @@ -1,8 +1,8 @@ package com.beeproduced.service.media.events -import com.beeproduced.data.jpa.repository.extensions.PaginationResult -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.lib.events.Request +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationResult +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.buzz.Request import com.beeproduced.service.media.entities.Film import com.beeproduced.service.media.entities.input.CreateFilmInput import com.beeproduced.service.media.entities.input.FilmPagination diff --git a/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmEvents.kt b/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmEvents.kt index 358435d..72a253f 100644 --- a/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmEvents.kt +++ b/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmEvents.kt @@ -1,9 +1,9 @@ package com.beeproduced.service.media.film.feature -import com.beeproduced.data.jpa.repository.extensions.PaginationResult -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.lib.events.requestHandler -import com.beeproduced.result.AppResult +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationResult +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.buzz.requestHandler +import com.beeproduced.bee.functional.result.AppResult import com.beeproduced.service.media.entities.Film import com.beeproduced.service.media.events.CreateFilm import com.beeproduced.service.media.events.GetAllFilms diff --git a/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmRepository.kt b/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmRepository.kt index 8e91f3f..0277753 100644 --- a/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmRepository.kt +++ b/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmRepository.kt @@ -1,11 +1,11 @@ package com.beeproduced.service.media.film.feature -import com.beeproduced.data.jpa.repository.BaseDataRepository -import com.beeproduced.data.jpa.repository.extensions.Cursor -import com.beeproduced.data.jpa.repository.extensions.Pagination -import com.beeproduced.data.jpa.repository.extensions.PaginationException -import com.beeproduced.data.jpa.repository.extensions.PaginationResult -import com.beeproduced.data.selection.DataSelection +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.extensions.Cursor +import com.beeproduced.bee.persistent.jpa.repository.extensions.Pagination +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationException +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationResult +import com.beeproduced.bee.persistent.selection.DataSelection import com.beeproduced.service.media.entities.Film import com.beeproduced.service.media.entities.FilmId import com.linecorp.kotlinjdsl.query.spec.expression.ColumnSpec diff --git a/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmService.kt b/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmService.kt index 26f31ca..15ddca8 100644 --- a/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmService.kt +++ b/example/service.media/src/main/kotlin/com/beeproduced/service/media/film.feature/FilmService.kt @@ -1,12 +1,12 @@ package com.beeproduced.service.media.film.feature -import com.beeproduced.data.jpa.repository.extensions.PaginationResult -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.result.AppResult -import com.beeproduced.result.errors.BadRequestError -import com.beeproduced.result.extensions.errors.andThenOnSuccess -import com.beeproduced.result.jpa.transactional.TransactionalResult +import com.beeproduced.bee.persistent.jpa.repository.extensions.PaginationResult +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.functional.result.AppResult +import com.beeproduced.bee.functional.result.errors.BadRequestError +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.andThenOnSuccess +import com.beeproduced.bee.functional.persistent.transactional.TransactionalResult import com.beeproduced.service.media.entities.Film import com.beeproduced.service.media.entities.FilmId import com.beeproduced.service.media.entities.input.CreateFilmInput diff --git a/example/service.organisation/build.gradle.kts b/example/service.organisation/build.gradle.kts index 6751395..3fabe2f 100644 --- a/example/service.organisation/build.gradle.kts +++ b/example/service.organisation/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -29,10 +25,10 @@ dependencyManagement { dependencies { implementation(project(":service.organisation.events")) implementation(project(":utils")) - implementation("com.beeproduced:events") - implementation("com.beeproduced:data") - implementation("com.beeproduced:data") { - capabilities { requireCapability("com.beeproduced:data-dgs") } + implementation("com.beeproduced:bee.buzz") + implementation("com.beeproduced:bee.persistent") + implementation("com.beeproduced:bee.persistent") { + capabilities { requireCapability("com.beeproduced:bee.persistent-dgs") } } implementation(libs.kotlin.stdlib) implementation(libs.spring.boot.starter.web) diff --git a/example/service.organisation/entities/build.gradle.kts b/example/service.organisation/entities/build.gradle.kts index d63feef..8d9815b 100644 --- a/example/service.organisation/entities/build.gradle.kts +++ b/example/service.organisation/entities/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jpa) @@ -23,9 +19,9 @@ repositories { dependencies { api(libs.jakarta.persistence.api) api(libs.hibernate.core) - api("com.beeproduced:data") - api("com.beeproduced:data") { - capabilities { requireCapability("com.beeproduced:data-jpa") } + api("com.beeproduced:bee.persistent") + api("com.beeproduced:bee.persistent") { + capabilities { requireCapability("com.beeproduced:bee.persistent-jpa") } } } diff --git a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Address.kt b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Address.kt index ace1c2e..56afcb5 100644 --- a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Address.kt +++ b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Address.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.entities -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import jakarta.persistence.Column import jakarta.persistence.Entity import jakarta.persistence.GeneratedValue diff --git a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Company.kt b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Company.kt index 93e1797..f04f74b 100644 --- a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Company.kt +++ b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Company.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.entities -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import jakarta.persistence.* import java.util.UUID diff --git a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/CompanyMember.kt b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/CompanyMember.kt index 9661974..bbad92b 100644 --- a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/CompanyMember.kt +++ b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/CompanyMember.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.entities -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import jakarta.persistence.* import java.io.Serializable diff --git a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Person.kt b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Person.kt index c5e072d..7ad1a4d 100644 --- a/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Person.kt +++ b/example/service.organisation/entities/src/main/kotlin/com/beeproduced/service/organisation/entities/Person.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.entities -import com.beeproduced.data.jpa.entity.DataEntity +import com.beeproduced.bee.persistent.jpa.entity.DataEntity import jakarta.persistence.* import java.util.UUID diff --git a/example/service.organisation/events/build.gradle.kts b/example/service.organisation/events/build.gradle.kts index 6708ab6..ec8bc65 100644 --- a/example/service.organisation/events/build.gradle.kts +++ b/example/service.organisation/events/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.serialization) @@ -19,6 +15,6 @@ repositories { dependencies { implementation(libs.kotlin.stdlib) - implementation("com.beeproduced:events") + implementation("com.beeproduced:bee.buzz") api(project(":service.organisation.entities")) } diff --git a/example/service.organisation/events/src/main/kotlin/com/beeproduced/service/organisation/events/Requests.kt b/example/service.organisation/events/src/main/kotlin/com/beeproduced/service/organisation/events/Requests.kt index 07e083f..406fbfd 100644 --- a/example/service.organisation/events/src/main/kotlin/com/beeproduced/service/organisation/events/Requests.kt +++ b/example/service.organisation/events/src/main/kotlin/com/beeproduced/service/organisation/events/Requests.kt @@ -1,7 +1,7 @@ package com.beeproduced.service.organisation.events -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.lib.events.Request +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.buzz.Request import com.beeproduced.service.organisation.entities.Company import com.beeproduced.service.organisation.entities.CompanyId import com.beeproduced.service.organisation.entities.Person diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressRepository.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressRepository.kt index 4299016..4b1718e 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressRepository.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressRepository.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.address.feature -import com.beeproduced.data.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository import com.beeproduced.service.organisation.entities.Address import com.beeproduced.service.organisation.entities.AddressId import jakarta.persistence.EntityManager diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressService.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressService.kt index 20dae47..197f15d 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressService.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/address/feature/AddressService.kt @@ -1,7 +1,7 @@ package com.beeproduced.service.organisation.address.feature -import com.beeproduced.result.AppResult -import com.beeproduced.result.jpa.transactional.TransactionalResult +import com.beeproduced.bee.functional.result.AppResult +import com.beeproduced.bee.functional.persistent.transactional.TransactionalResult import com.beeproduced.service.organisation.entities.Address import com.beeproduced.service.organisation.entities.input.CreateAddressInput import com.beeproduced.utils.logFor diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyEvents.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyEvents.kt index a170925..057b260 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyEvents.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyEvents.kt @@ -1,8 +1,8 @@ package com.beeproduced.service.organisation.company.feature -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.lib.events.requestHandler -import com.beeproduced.result.AppResult +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.buzz.requestHandler +import com.beeproduced.bee.functional.result.AppResult import com.beeproduced.service.organisation.entities.Company import com.beeproduced.service.organisation.events.CompaniesExist import com.beeproduced.service.organisation.events.CreateCompany diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyRepository.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyRepository.kt index d155157..a98e4f0 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyRepository.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyRepository.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.company.feature -import com.beeproduced.data.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository import com.beeproduced.service.organisation.entities.Company import com.beeproduced.service.organisation.entities.CompanyId import com.beeproduced.service.organisation.entities.CompanyMember diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyService.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyService.kt index d8c56a3..783f905 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyService.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/company/feature/CompanyService.kt @@ -1,11 +1,11 @@ package com.beeproduced.service.organisation.company.feature -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.data.selection.EmptySelection -import com.beeproduced.result.AppResult -import com.beeproduced.result.errors.BadRequestError -import com.beeproduced.result.extensions.functional.andThenToPair -import com.beeproduced.result.jpa.transactional.TransactionalResult +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.EmptySelection +import com.beeproduced.bee.functional.result.AppResult +import com.beeproduced.bee.functional.result.errors.BadRequestError +import com.beeproduced.bee.functional.extensions.com.github.michaelbull.result.andThenToPair +import com.beeproduced.bee.functional.persistent.transactional.TransactionalResult import com.beeproduced.service.organisation.address.feature.AddressService import com.beeproduced.service.organisation.entities.* import com.beeproduced.service.organisation.entities.input.CreateAddressInput diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonEvents.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonEvents.kt index 3a0b996..9e3e6d4 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonEvents.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonEvents.kt @@ -1,9 +1,8 @@ package com.beeproduced.service.organisation.person.feature -import com.beeproduced.lib.events.manager.EventManager -import com.beeproduced.lib.events.requestHandler -import com.beeproduced.result.AppResult -import com.beeproduced.service.organisation.entities.Company +import com.beeproduced.bee.buzz.manager.EventManager +import com.beeproduced.bee.buzz.requestHandler +import com.beeproduced.bee.functional.result.AppResult import com.beeproduced.service.organisation.entities.Person import com.beeproduced.service.organisation.events.* import com.beeproduced.service.organisation.utils.organisationAdapter diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonRepository.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonRepository.kt index 9a208b4..d543a1e 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonRepository.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonRepository.kt @@ -1,6 +1,6 @@ package com.beeproduced.service.organisation.person.feature -import com.beeproduced.data.jpa.repository.BaseDataRepository +import com.beeproduced.bee.persistent.jpa.repository.BaseDataRepository import com.beeproduced.service.organisation.entities.Person import com.beeproduced.service.organisation.entities.PersonId import jakarta.persistence.EntityManager diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonService.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonService.kt index 1e9391b..e833cc7 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonService.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/person/feature/PersonService.kt @@ -1,9 +1,9 @@ package com.beeproduced.service.organisation.person.feature -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.result.AppResult -import com.beeproduced.result.errors.BadRequestError -import com.beeproduced.result.jpa.transactional.TransactionalResult +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.functional.result.AppResult +import com.beeproduced.bee.functional.result.errors.BadRequestError +import com.beeproduced.bee.functional.persistent.transactional.TransactionalResult import com.beeproduced.service.organisation.address.feature.AddressService import com.beeproduced.service.organisation.entities.Address import com.beeproduced.service.organisation.entities.Person diff --git a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/utils/DataSelection.kt b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/utils/DataSelection.kt index 74495f4..9ff27d8 100644 --- a/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/utils/DataSelection.kt +++ b/example/service.organisation/src/main/kotlin/com/beeproduced/service/organisation/utils/DataSelection.kt @@ -1,7 +1,7 @@ package com.beeproduced.service.organisation.utils -import com.beeproduced.data.selection.DataSelection -import com.beeproduced.data.selection.SkipOverAll +import com.beeproduced.bee.persistent.selection.DataSelection +import com.beeproduced.bee.persistent.selection.SkipOverAll import com.beeproduced.service.organisation.entities.Company import com.beeproduced.service.organisation.entities.CompanyMember import com.beeproduced.service.organisation.entities.Person diff --git a/example/utils/build.gradle.kts b/example/utils/build.gradle.kts index 278fbfc..065c9ed 100644 --- a/example/utils/build.gradle.kts +++ b/example/utils/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -22,9 +18,9 @@ repositories { } dependencies { - api("com.beeproduced:result") - api("com.beeproduced:result") { - capabilities { requireCapability("com.beeproduced:result-jpa") } + api("com.beeproduced:bee.functional") + api("com.beeproduced:bee.functional") { + capabilities { requireCapability("com.beeproduced:bee.functional-persistent") } } api(libs.michael.result) implementation(libs.kotlin.stdlib) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 07e69d6..cf9493d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,29 +1,29 @@ [versions] -bee-built = "0.2.0-SNAPSHOT" -springboot-base = "3.0.2" -springboot-dependencymanagement = "1.1.0" -kotlin-base = "1.8.0" -kotlin-jvm = "1.8.0" -dgs = "6.0.1" -spring-security = "6.0.2" +bee-built = "0.3.0-SNAPSHOT" +springboot-base = "3.1.4" +springboot-dependencymanagement = "1.1.3" +kotlin-base = "1.9.10" +kotlin-jvm = "1.9.10" +dgs = "7.6.0" +spring-security = "6.1.4" mapstruct = "1.5.3.Final" junit = "5.8.1" kotlinter = "3.13.0" -dgs-codegen = "5.6.9" +dgs-codegen = "6.0.2" jackson-module-kotlin = "2.13.4" h2 = "2.1.214" konform = "0.4.0" -michael-result = "1.1.16" +michael-result = "1.1.18" jdsl = "2.2.0.RELEASE" aspectjrt = "1.9.19" jakarta-persistence-api = "3.1.0" -hibernate-core = "6.1.6.Final" +hibernate-core = "6.2.9.Final" caffeine = "3.1.2" springmockk = "4.0.2" datafaker = "1.14.0" jakarta-mail-api = "2.0.1" jakarta-mail = "2.0.1" -ksp-base = "1.8.0-1.0.9" +ksp-base = "1.9.10-1.0.13" [libraries] spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test", version.ref = "springboot-base" } @@ -84,5 +84,5 @@ kotlin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin-bas spring-boot = { id = "org.springframework.boot", version.ref = "springboot-base" } spring-dependencymanagement = { id = "io.spring.dependency-management", version.ref = "springboot-dependencymanagement" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-base" } -dgs-codegen = { id = "com.netflix.dgs.codegen", version = "5.6.9" } +dgs-codegen = { id = "com.netflix.dgs.codegen", version.ref = "dgs-codegen" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp-base"} \ No newline at end of file diff --git a/lib.data/gradle/wrapper/gradle-wrapper.jar b/lib.data/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 249e583..0000000 Binary files a/lib.data/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/lib.data/src/dgs/kotlin/com/beeproduced/data/dgs/root b/lib.data/src/dgs/kotlin/com/beeproduced/data/dgs/root deleted file mode 100644 index e69de29..0000000 diff --git a/lib.data/src/dgs/kotlin/com/beeproduced/data/dgs/selection/DgsGraphQLSelection.kt b/lib.data/src/dgs/kotlin/com/beeproduced/data/dgs/selection/DgsGraphQLSelection.kt deleted file mode 100644 index 9054fb9..0000000 --- a/lib.data/src/dgs/kotlin/com/beeproduced/data/dgs/selection/DgsGraphQLSelection.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.beeproduced.data.dgs.selection - -import com.beeproduced.data.selection.* -import graphql.schema.DataFetchingFieldSelectionSet -import graphql.schema.SelectedField - -/** - * - * - * @author Kacper Urbaniec - * @version 2023-01-30 - */ - -fun DataFetchingFieldSelectionSet.toDataSelection(): DataSelection { - val fields = immediateFields - .mapTo(HashSet()) { toDataSelection(it) } - - return SimpleSelection(fields) -} - -private fun toDataSelection(node: SelectedField): FieldNodeDefinition { - val field = node.qualifiedName - val immediateFields = node.selectionSet.immediateFields - - val nodeFields = if (immediateFields.isNullOrEmpty()) null - else { - immediateFields.mapTo(HashSet()) { toDataSelection(it) } - } - - return SimpleSelection.FieldNode(field, nodeFields) - -} \ No newline at end of file diff --git a/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/root b/lib.data/src/jpa/kotlin/com/beeproduced/data/jpa/root deleted file mode 100644 index e69de29..0000000 diff --git a/lib.data/src/main/kotlin/com/beeproduced/data/root b/lib.data/src/main/kotlin/com/beeproduced/data/root deleted file mode 100644 index e69de29..0000000 diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/AnyError.kt b/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/AnyError.kt deleted file mode 100644 index 7f4d499..0000000 --- a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/AnyError.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.beeproduced.result.errors.deprecated - -/** - * - * - * @author Kacper Urbaniec - * @version 2022-03-10 - */ -@Deprecated("Use new error handling") -class AnyError( - val any: Any, - description: String? = null, - override val source: AppError? = null -) : AppError { - override val description: String = description ?: any.toString() -} diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/AppError.kt b/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/AppError.kt deleted file mode 100644 index f8beb32..0000000 --- a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/AppError.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.beeproduced.result.errors.deprecated - -/** - * - * - * @author Kacper Urbaniec - * @version 2022-01-29 - */ -@Deprecated("Use new error handling") -interface AppError { - val description: String - val source: AppError? - // val exception: Exception? TODO: Discuss if this should be introduced, leads to transparten error handling when using java functions -} diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/ExceptionError.kt b/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/ExceptionError.kt deleted file mode 100644 index b4cf648..0000000 --- a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/ExceptionError.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.beeproduced.result.errors.deprecated - -/** - * - * - * @author Kacper Urbaniec - * @version 2022-01-29 - */ -@Deprecated("Use new error handling") -class ExceptionError( - val exception: Throwable, - description: String? = null, - override val source: AppError? = null -) : AppError { - override val description: String = description ?: exception.stackTraceToString() -} diff --git a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/util/ErrorTestingUtil.kt b/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/util/ErrorTestingUtil.kt deleted file mode 100644 index 90b554f..0000000 --- a/lib.result/src/main/kotlin/com/beeproduced/result/errors/deprecated/util/ErrorTestingUtil.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.beeproduced.result.errors.deprecated.util - -import com.beeproduced.result.errors.deprecated.AppError - -// inline should result in better readability during test -inline fun assertError(expected: AppError, actual: AppError) { - assert(expected::class == actual::class) { "Types do not match, expected: ${expected::class} - actual: ${actual::class}" } - var curExcpected: AppError = expected - var curActual: AppError = actual - while (curExcpected.source != null) { - curExcpected.source?.let { - assert(it::class == actual.source!!::class) { "Embedded types do not match, expected: ${it::class} - actual: ${actual.source!!::class}" } - curExcpected = it - curActual = actual.source!! - } - } -}