Merge branch 'jigsaw' into master

This commit is contained in:
Hubert Van De Walle 2020-10-24 00:05:09 +02:00
commit 536c6e7b79
142 changed files with 294 additions and 192 deletions

4
.gitignore vendored
View File

@ -125,8 +125,8 @@ data/
letsencrypt/ letsencrypt/
# generated resources # generated resources
app/src/main/resources/css-manifest.json simplenotes-app/src/main/resources/css-manifest.json
app/src/main/resources/static/styles* simplenotes-app/src/main/resources/static/styles*
# h2 db # h2 db
*.db *.db

View File

@ -4,19 +4,23 @@ WORKDIR /tmp
# Cache dependencies # Cache dependencies
COPY pom.xml . COPY pom.xml .
COPY app/pom.xml app/pom.xml COPY simplenotes-test-resources/pom.xml simplenotes-test-resources/pom.xml
COPY domain/pom.xml domain/pom.xml COPY simplenotes-types/pom.xml simplenotes-types/pom.xml
COPY persistance/pom.xml persistance/pom.xml COPY simplenotes-config/pom.xml simplenotes-config/pom.xml
COPY shared/pom.xml shared/pom.xml COPY simplenotes-persistance/pom.xml simplenotes-persistance/pom.xml
COPY search/pom.xml search/pom.xml COPY simplenotes-search/pom.xml simplenotes-search/pom.xml
COPY simplenotes-domain/pom.xml simplenotes-domain/pom.xml
COPY simplenotes-app/pom.xml simplenotes-app/pom.xml
RUN mvn verify clean --fail-never RUN mvn verify clean --fail-never
COPY app/src app/src COPY simplenotes-test-resources/src simplenotes-test-resources/src
COPY domain/src domain/src COPY simplenotes-types/src simplenotes-types/src
COPY persistance/src persistance/src COPY simplenotes-config/src simplenotes-config/src
COPY shared/src shared/src COPY simplenotes-persistance/src simplenotes-persistance/src
COPY search/src search/src COPY simplenotes-search/src simplenotes-search/src
COPY simplenotes-domain/src simplenotes-domain/src
COPY simplenotes-app/src simplenotes-app/src
RUN mvn -Dstyle.color=always package RUN mvn -Dstyle.color=always package
@ -42,8 +46,8 @@ RUN chown -R $APPLICATION_USER /app
USER $APPLICATION_USER USER $APPLICATION_USER
COPY --from=builder /tmp/app/target/app-*.jar /app/app.jar COPY --from=builder /tmp/simplenotes-app/target/simplenotes-app-*.jar /app/simplenotes.jar
COPY --from=jdkbuilder /myjdk /myjdk COPY --from=jdkbuilder /myjdk /myjdk
WORKDIR /app WORKDIR /app
CMD ["/myjdk/bin/java", "-server", "-XX:+UnlockExperimentalVMOptions", "-Xms64m", "-Xmx256m", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "app.jar"] CMD ["/myjdk/bin/java", "-server", "-XX:+UnlockExperimentalVMOptions", "-Xms64m", "-Xmx256m", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "simplenotes.jar"]

View File

@ -1 +0,0 @@
package be.simplenotes.app

View File

@ -2,8 +2,8 @@
"name": "css", "name": "css",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"css": "NODE_ENV=dev MANIFEST=../app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../app/src/main/resources/static/styles.css", "css": "NODE_ENV=dev MANIFEST=../simplenotes-app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../simplenotes-app/src/main/resources/static/styles.css",
"css-purge": "NODE_ENV=production MANIFEST=../app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../app/src/main/resources/static/styles.css" "css-purge": "NODE_ENV=production MANIFEST=../simplenotes-app/src/main/resources/css-manifest.json postcss build src/styles.pcss --output ../simplenotes-app/src/main/resources/static/styles.css"
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^9.8.6", "autoprefixer": "^9.8.6",

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
purge: { purge: {
content: [ content: [
'../app/src/main/kotlin/views/**/*.kt' '../simplenotes-app/src/main/kotlin/be/simplenotes/app/views/**/*.kt'
] ]
}, },
theme: { theme: {

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
rm app/src/main/resources/css-manifest.json rm simplenotes-app/src/main/resources/css-manifest.json
rm app/src/main/resources/static/styles* rm simplenotes-app/src/main/resources/static/styles*
yarn --cwd css run css-purge \ yarn --cwd css run css-purge \
&& docker build -t hubv/simplenotes:latest . \ && docker build -t hubv/simplenotes:latest . \

View File

@ -1,5 +0,0 @@
package be.simplenotes.domain
/**
* Empty file @see [root-package-declaration](https://discuss.kotlinlang.org/t/root-package-declaration-to-reduce-folder-clutter/2247/4)
*/

View File

@ -1 +0,0 @@
package be.simplenotes.persistance

16
pom.xml
View File

@ -4,15 +4,17 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>parent</artifactId> <artifactId>simplenotes-parent</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<modules> <modules>
<module>persistance</module> <module>simplenotes-persistance</module>
<module>app</module> <module>simplenotes-app</module>
<module>domain</module> <module>simplenotes-domain</module>
<module>shared</module> <module>simplenotes-search</module>
<module>search</module> <module>simplenotes-types</module>
<module>simplenotes-config</module>
<module>simplenotes-test-resources</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
@ -179,7 +181,7 @@
<dependency> <dependency>
<groupId>io.arrow-kt</groupId> <groupId>io.arrow-kt</groupId>
<artifactId>arrow-core</artifactId> <artifactId>arrow-core</artifactId>
<version>0.10.5</version> <version>0.11.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>

View File

@ -1 +0,0 @@
package be.simplenotes.shared

View File

@ -2,13 +2,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>simplenotes-parent</artifactId>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>app</artifactId> <artifactId>simplenotes-app</artifactId>
<properties> <properties>
<http4k.version>3.268.0</http4k.version> <http4k.version>3.268.0</http4k.version>
@ -17,38 +17,54 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>persistance</artifactId> <artifactId>simplenotes-persistance</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>search</artifactId> <artifactId>simplenotes-search</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>domain</artifactId> <artifactId>simplenotes-domain</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>shared</artifactId> <artifactId>simplenotes-config</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.http4k</groupId> <groupId>org.http4k</groupId>
<artifactId>http4k-core</artifactId> <artifactId>http4k-core</artifactId>
</dependency> </dependency>
<!--
<dependency> <dependency>
<groupId>org.http4k</groupId> <groupId>org.http4k</groupId>
<artifactId>http4k-server-jetty</artifactId> <artifactId>http4k-server-jetty</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
-->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.4.32.v20200930</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.4.32.v20200930</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlinx</groupId> <groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-html-jvm</artifactId> <artifactId>kotlinx-html-jvm</artifactId>
@ -81,7 +97,7 @@
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>shared</artifactId> <artifactId>simplenotes-test-resources</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>

View File

@ -1,8 +1,8 @@
package be.simplenotes.app package be.simplenotes.app
import be.simplenotes.shared.config.DataSourceConfig import be.simplenotes.config.DataSourceConfig
import be.simplenotes.shared.config.JwtConfig import be.simplenotes.config.JwtConfig
import be.simplenotes.shared.config.ServerConfig import be.simplenotes.config.ServerConfig
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit

View File

@ -2,7 +2,7 @@ package be.simplenotes.app
import org.http4k.server.Http4kServer import org.http4k.server.Http4kServer
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import be.simplenotes.shared.config.ServerConfig as SimpleNotesServerConfig import be.simplenotes.config.ServerConfig as SimpleNotesServerConfig
class Server( class Server(
private val config: SimpleNotesServerConfig, private val config: SimpleNotesServerConfig,

View File

@ -2,8 +2,8 @@ package be.simplenotes.app.api
import be.simplenotes.app.extensions.auto import be.simplenotes.app.extensions.auto
import be.simplenotes.app.utils.parseSearchTerms import be.simplenotes.app.utils.parseSearchTerms
import be.simplenotes.domain.model.PersistedNote import be.simplenotes.types.PersistedNote
import be.simplenotes.domain.model.PersistedNoteMetadata import be.simplenotes.types.PersistedNoteMetadata
import be.simplenotes.domain.security.JwtPayload import be.simplenotes.domain.security.JwtPayload
import be.simplenotes.domain.usecases.NoteService import be.simplenotes.domain.usecases.NoteService
import kotlinx.serialization.Contextual import kotlinx.serialization.Contextual

View File

@ -10,7 +10,7 @@ import be.simplenotes.domain.usecases.users.login.*
import be.simplenotes.domain.usecases.users.register.InvalidRegisterForm import be.simplenotes.domain.usecases.users.register.InvalidRegisterForm
import be.simplenotes.domain.usecases.users.register.RegisterForm import be.simplenotes.domain.usecases.users.register.RegisterForm
import be.simplenotes.domain.usecases.users.register.UserExists import be.simplenotes.domain.usecases.users.register.UserExists
import be.simplenotes.shared.config.JwtConfig import be.simplenotes.config.JwtConfig
import org.http4k.core.Method.GET import org.http4k.core.Method.GET
import org.http4k.core.Request import org.http4k.core.Request
import org.http4k.core.Response import org.http4k.core.Response

View File

@ -0,0 +1,40 @@
package be.simplenotes.app.jetty
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.server.ServerConnector
import org.eclipse.jetty.servlet.ServletContextHandler
import org.eclipse.jetty.servlet.ServletContextHandler.SESSIONS
import org.eclipse.jetty.servlet.ServletHolder
import org.http4k.core.HttpHandler
import org.http4k.server.Http4kServer
import org.http4k.server.ServerConfig
import org.http4k.servlet.asServlet
class Jetty(private val port: Int, private val server: Server) : ServerConfig {
constructor(port: Int = 8000) : this(port, http(port))
constructor(port: Int, vararg inConnectors: ConnectorBuilder) : this(port, Server().apply {
inConnectors.forEach { addConnector(it(this)) }
})
override fun toServer(httpHandler: HttpHandler): Http4kServer {
server.insertHandler(httpHandler.toJettyHandler())
return object : Http4kServer {
override fun start(): Http4kServer = apply {
server.start()
}
override fun stop(): Http4kServer = apply { server.stop() }
override fun port(): Int = if (port > 0) port else server.uri.port
}
}
}
fun HttpHandler.toJettyHandler() = ServletContextHandler(SESSIONS).apply {
addServlet(ServletHolder(this@toJettyHandler.asServlet()), "/*")
}
typealias ConnectorBuilder = (Server) -> ServerConnector
fun http(httpPort: Int): ConnectorBuilder = { server: Server -> ServerConnector(server).apply { port = httpPort } }

View File

@ -5,17 +5,17 @@ import be.simplenotes.app.filters.AuthFilter
import be.simplenotes.app.filters.AuthType import be.simplenotes.app.filters.AuthType
import be.simplenotes.app.filters.ErrorFilter import be.simplenotes.app.filters.ErrorFilter
import be.simplenotes.app.filters.TransactionFilter import be.simplenotes.app.filters.TransactionFilter
import be.simplenotes.app.jetty.ConnectorBuilder
import be.simplenotes.app.jetty.Jetty
import be.simplenotes.app.routes.Router import be.simplenotes.app.routes.Router
import be.simplenotes.app.utils.StaticFileResolver import be.simplenotes.app.utils.StaticFileResolver
import be.simplenotes.app.utils.StaticFileResolverImpl import be.simplenotes.app.utils.StaticFileResolverImpl
import be.simplenotes.app.views.ErrorView import be.simplenotes.app.views.ErrorView
import be.simplenotes.shared.config.ServerConfig import be.simplenotes.config.ServerConfig
import org.eclipse.jetty.server.ServerConnector import org.eclipse.jetty.server.ServerConnector
import org.http4k.core.Filter import org.http4k.core.Filter
import org.http4k.core.RequestContexts import org.http4k.core.RequestContexts
import org.http4k.routing.RoutingHttpHandler import org.http4k.routing.RoutingHttpHandler
import org.http4k.server.ConnectorBuilder
import org.http4k.server.Jetty
import org.http4k.server.asServer import org.http4k.server.asServer
import org.koin.core.qualifier.named import org.koin.core.qualifier.named
import org.koin.core.qualifier.qualifier import org.koin.core.qualifier.qualifier

View File

@ -1,6 +1,6 @@
package be.simplenotes.app.utils package be.simplenotes.app.utils
import be.simplenotes.domain.usecases.search.SearchTerms import be.simplenotes.search.SearchTerms
private fun innerRegex(name: String) = private fun innerRegex(name: String) =
"""$name:['"](.*?)['"]""".toRegex() """$name:['"](.*?)['"]""".toRegex()

View File

@ -2,8 +2,8 @@ package be.simplenotes.app.views
import be.simplenotes.app.utils.StaticFileResolver import be.simplenotes.app.utils.StaticFileResolver
import be.simplenotes.app.views.components.* import be.simplenotes.app.views.components.*
import be.simplenotes.domain.model.PersistedNote import be.simplenotes.types.PersistedNote
import be.simplenotes.domain.model.PersistedNoteMetadata import be.simplenotes.types.PersistedNoteMetadata
import be.simplenotes.domain.security.JwtPayload import be.simplenotes.domain.security.JwtPayload
import io.konform.validation.ValidationError import io.konform.validation.ValidationError
import kotlinx.html.* import kotlinx.html.*

View File

@ -1,7 +1,7 @@
package be.simplenotes.app.views.components package be.simplenotes.app.views.components
import be.simplenotes.app.utils.toTimeAgo import be.simplenotes.app.utils.toTimeAgo
import be.simplenotes.domain.model.PersistedNoteMetadata import be.simplenotes.types.PersistedNoteMetadata
import kotlinx.html.* import kotlinx.html.*
import kotlinx.html.ButtonType.submit import kotlinx.html.ButtonType.submit
import kotlinx.html.FormMethod.post import kotlinx.html.FormMethod.post

View File

@ -1,7 +1,7 @@
package be.simplenotes.app.views.components package be.simplenotes.app.views.components
import be.simplenotes.app.utils.toTimeAgo import be.simplenotes.app.utils.toTimeAgo
import be.simplenotes.domain.model.PersistedNoteMetadata import be.simplenotes.types.PersistedNoteMetadata
import kotlinx.html.* import kotlinx.html.*
import kotlinx.html.ThScope.col import kotlinx.html.ThScope.col

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -3,7 +3,7 @@ package be.simplenotes.app.filters
import be.simplenotes.domain.security.JwtPayload import be.simplenotes.domain.security.JwtPayload
import be.simplenotes.domain.security.JwtPayloadExtractor import be.simplenotes.domain.security.JwtPayloadExtractor
import be.simplenotes.domain.security.SimpleJwt import be.simplenotes.domain.security.SimpleJwt
import be.simplenotes.shared.config.JwtConfig import be.simplenotes.config.JwtConfig
import com.natpryce.hamkrest.assertion.assertThat import com.natpryce.hamkrest.assertion.assertThat
import org.http4k.core.* import org.http4k.core.*
import org.http4k.core.Method.GET import org.http4k.core.Method.GET

View File

@ -1,6 +1,6 @@
package be.simplenotes.app.utils package be.simplenotes.app.utils
import be.simplenotes.domain.usecases.search.SearchTerms import be.simplenotes.search.SearchTerms
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource import org.junit.jupiter.params.provider.MethodSource

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>simplenotes-parent</artifactId>
<groupId>be.simplenotes</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>simplenotes-config</artifactId>
</project>

View File

@ -1,4 +1,4 @@
package be.simplenotes.shared.config package be.simplenotes.config
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit

View File

@ -2,36 +2,38 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>parent</artifactId> <artifactId>simplenotes-parent</artifactId>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>domain</artifactId> <artifactId>simplenotes-domain</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>shared</artifactId> <artifactId>simplenotes-config</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>be.simplenotes</groupId> <groupId>be.simplenotes</groupId>
<artifactId>shared</artifactId> <artifactId>simplenotes-test-resources</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>test-jar</type> <type>test-jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>io.arrow-kt</groupId>
<artifactId>arrow-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.koin</groupId> <groupId>org.koin</groupId>
<artifactId>koin-core</artifactId> <artifactId>koin-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.arrow-kt</groupId>
<artifactId>arrow-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.natpryce</groupId> <groupId>com.natpryce</groupId>
<artifactId>hamkrest</artifactId> <artifactId>hamkrest</artifactId>
@ -83,15 +85,29 @@
<artifactId>owasp-java-html-sanitizer</artifactId> <artifactId>owasp-java-html-sanitizer</artifactId>
<version>20200713.1</version> <version>20200713.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-serialization-json-jvm</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId> <artifactId>commons-compress</artifactId>
<version>1.20</version> <version>1.20</version>
</dependency> </dependency>
<dependency>
<groupId>be.simplenotes</groupId>
<artifactId>simplenotes-types</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>be.simplenotes</groupId>
<artifactId>simplenotes-persistance</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>be.simplenotes</groupId>
<artifactId>simplenotes-search</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -2,7 +2,7 @@ package be.simplenotes.domain.security
import org.owasp.html.HtmlPolicyBuilder import org.owasp.html.HtmlPolicyBuilder
object HtmlSanitizer { internal object HtmlSanitizer {
private val htmlPolicy = HtmlPolicyBuilder() private val htmlPolicy = HtmlPolicyBuilder()
.allowElements("a") .allowElements("a")
.allowCommonBlockElements() .allowCommonBlockElements()

View File

@ -1,6 +1,6 @@
package be.simplenotes.domain.security package be.simplenotes.domain.security
import be.simplenotes.domain.model.PersistedUser import be.simplenotes.types.PersistedUser
import com.auth0.jwt.exceptions.JWTVerificationException import com.auth0.jwt.exceptions.JWTVerificationException
data class JwtPayload(val userId: Int, val username: String) { data class JwtPayload(val userId: Int, val username: String) {

View File

@ -1,6 +1,6 @@
package be.simplenotes.domain.security package be.simplenotes.domain.security
import be.simplenotes.shared.config.JwtConfig import be.simplenotes.config.JwtConfig
import com.auth0.jwt.JWT import com.auth0.jwt.JWT
import com.auth0.jwt.JWTVerifier import com.auth0.jwt.JWTVerifier
import com.auth0.jwt.algorithms.Algorithm import com.auth0.jwt.algorithms.Algorithm

View File

@ -2,16 +2,16 @@ package be.simplenotes.domain.usecases
import arrow.core.Either import arrow.core.Either
import arrow.core.extensions.fx import arrow.core.extensions.fx
import be.simplenotes.domain.model.Note import be.simplenotes.types.Note
import be.simplenotes.domain.model.PersistedNote import be.simplenotes.types.PersistedNote
import be.simplenotes.domain.model.PersistedNoteMetadata import be.simplenotes.types.PersistedNoteMetadata
import be.simplenotes.domain.security.HtmlSanitizer import be.simplenotes.domain.security.HtmlSanitizer
import be.simplenotes.domain.usecases.markdown.MarkdownConverter import be.simplenotes.domain.usecases.markdown.MarkdownConverter
import be.simplenotes.domain.usecases.markdown.MarkdownParsingError import be.simplenotes.domain.usecases.markdown.MarkdownParsingError
import be.simplenotes.domain.usecases.repositories.NoteRepository import be.simplenotes.persistance.repositories.NoteRepository
import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.persistance.repositories.UserRepository
import be.simplenotes.domain.usecases.search.NoteSearcher import be.simplenotes.search.NoteSearcher
import be.simplenotes.domain.usecases.search.SearchTerms import be.simplenotes.search.SearchTerms
import java.util.* import java.util.*
class NoteService( class NoteService(

View File

@ -1,7 +1,7 @@
package be.simplenotes.domain.usecases.export package be.simplenotes.domain.usecases.export
import be.simplenotes.domain.model.ExportedNote import be.simplenotes.types.ExportedNote
import be.simplenotes.domain.usecases.repositories.NoteRepository import be.simplenotes.persistance.repositories.NoteRepository
import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry import org.apache.commons.compress.archivers.zip.ZipArchiveEntry

View File

@ -4,7 +4,7 @@ import arrow.core.Either
import arrow.core.extensions.fx import arrow.core.extensions.fx
import arrow.core.left import arrow.core.left
import arrow.core.right import arrow.core.right
import be.simplenotes.domain.model.NoteMetadata import be.simplenotes.types.NoteMetadata
import be.simplenotes.domain.validation.NoteValidations import be.simplenotes.domain.validation.NoteValidations
import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension
import com.vladsch.flexmark.html.HtmlRenderer import com.vladsch.flexmark.html.HtmlRenderer

View File

@ -4,9 +4,9 @@ import arrow.core.Either
import arrow.core.extensions.fx import arrow.core.extensions.fx
import arrow.core.rightIfNotNull import arrow.core.rightIfNotNull
import be.simplenotes.domain.security.PasswordHash import be.simplenotes.domain.security.PasswordHash
import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.persistance.repositories.UserRepository
import be.simplenotes.domain.usecases.search.NoteSearcher
import be.simplenotes.domain.validation.UserValidations import be.simplenotes.domain.validation.UserValidations
import be.simplenotes.search.NoteSearcher
internal class DeleteUseCaseImpl( internal class DeleteUseCaseImpl(
private val userRepository: UserRepository, private val userRepository: UserRepository,

View File

@ -7,8 +7,8 @@ import arrow.core.rightIfNotNull
import be.simplenotes.domain.security.JwtPayload import be.simplenotes.domain.security.JwtPayload
import be.simplenotes.domain.security.PasswordHash import be.simplenotes.domain.security.PasswordHash
import be.simplenotes.domain.security.SimpleJwt import be.simplenotes.domain.security.SimpleJwt
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.domain.validation.UserValidations import be.simplenotes.domain.validation.UserValidations
import be.simplenotes.persistance.repositories.UserRepository
internal class LoginUseCaseImpl( internal class LoginUseCaseImpl(
private val userRepository: UserRepository, private val userRepository: UserRepository,

View File

@ -3,10 +3,10 @@ package be.simplenotes.domain.usecases.users.register
import arrow.core.Either import arrow.core.Either
import arrow.core.filterOrElse import arrow.core.filterOrElse
import arrow.core.leftIfNull import arrow.core.leftIfNull
import be.simplenotes.domain.model.PersistedUser import be.simplenotes.types.PersistedUser
import be.simplenotes.domain.security.PasswordHash import be.simplenotes.domain.security.PasswordHash
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.domain.validation.UserValidations import be.simplenotes.domain.validation.UserValidations
import be.simplenotes.persistance.repositories.UserRepository
internal class RegisterUseCaseImpl( internal class RegisterUseCaseImpl(
private val userRepository: UserRepository, private val userRepository: UserRepository,

View File

@ -1,7 +1,7 @@
package be.simplenotes.domain.usecases.users.register package be.simplenotes.domain.usecases.users.register
import arrow.core.Either import arrow.core.Either
import be.simplenotes.domain.model.PersistedUser import be.simplenotes.types.PersistedUser
import be.simplenotes.domain.usecases.users.login.LoginForm import be.simplenotes.domain.usecases.users.login.LoginForm
import io.konform.validation.ValidationErrors import io.konform.validation.ValidationErrors

View File

@ -1,7 +1,7 @@
package be.simplenotes.domain.validation package be.simplenotes.domain.validation
import arrow.core.* import arrow.core.*
import be.simplenotes.domain.model.NoteMetadata import be.simplenotes.types.NoteMetadata
import be.simplenotes.domain.usecases.markdown.ValidationError import be.simplenotes.domain.usecases.markdown.ValidationError
import io.konform.validation.Validation import io.konform.validation.Validation
import io.konform.validation.jsonschema.maxItems import io.konform.validation.jsonschema.maxItems

View File

@ -3,7 +3,7 @@ package be.simplenotes.domain.validation
import arrow.core.Either import arrow.core.Either
import arrow.core.left import arrow.core.left
import arrow.core.right import arrow.core.right
import be.simplenotes.domain.model.User import be.simplenotes.types.User
import be.simplenotes.domain.usecases.users.delete.DeleteError import be.simplenotes.domain.usecases.users.delete.DeleteError
import be.simplenotes.domain.usecases.users.delete.DeleteForm import be.simplenotes.domain.usecases.users.delete.DeleteForm
import be.simplenotes.domain.usecases.users.login.InvalidLoginForm import be.simplenotes.domain.usecases.users.login.InvalidLoginForm

View File

@ -1,7 +1,7 @@
package be.simplenotes.domain.security package be.simplenotes.domain.security
import be.simplenotes.domain.usecases.users.login.Token import be.simplenotes.domain.usecases.users.login.Token
import be.simplenotes.shared.config.JwtConfig import be.simplenotes.config.JwtConfig
import com.auth0.jwt.JWT import com.auth0.jwt.JWT
import com.auth0.jwt.algorithms.Algorithm import com.auth0.jwt.algorithms.Algorithm
import com.natpryce.hamkrest.absent import com.natpryce.hamkrest.absent

View File

@ -1,4 +1,4 @@
package be.simplenotes.shared.testutils.assertions package be.simplenotes.domain.testutils
import arrow.core.Either import arrow.core.Either
import com.natpryce.hamkrest.MatchResult import com.natpryce.hamkrest.MatchResult

View File

@ -1,12 +1,12 @@
package be.simplenotes.domain.usecases.users.login package be.simplenotes.domain.usecases.users.login
import be.simplenotes.domain.model.PersistedUser import be.simplenotes.types.PersistedUser
import be.simplenotes.domain.security.BcryptPasswordHash import be.simplenotes.domain.security.BcryptPasswordHash
import be.simplenotes.domain.security.SimpleJwt import be.simplenotes.domain.security.SimpleJwt
import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.persistance.repositories.UserRepository
import be.simplenotes.shared.config.JwtConfig import be.simplenotes.config.JwtConfig
import be.simplenotes.shared.testutils.assertions.isLeftOfType import be.simplenotes.domain.testutils.isLeftOfType
import be.simplenotes.shared.testutils.assertions.isRight import be.simplenotes.domain.testutils.isRight
import com.natpryce.hamkrest.assertion.assertThat import com.natpryce.hamkrest.assertion.assertThat
import io.mockk.* import io.mockk.*
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach

View File

@ -1,10 +1,10 @@
package be.simplenotes.domain.usecases.users.register package be.simplenotes.domain.usecases.users.register
import be.simplenotes.domain.model.PersistedUser import be.simplenotes.types.PersistedUser
import be.simplenotes.domain.security.BcryptPasswordHash import be.simplenotes.domain.security.BcryptPasswordHash
import be.simplenotes.domain.usecases.repositories.UserRepository import be.simplenotes.domain.testutils.isLeftOfType
import be.simplenotes.shared.testutils.assertions.isLeftOfType import be.simplenotes.domain.testutils.isRight
import be.simplenotes.shared.testutils.assertions.isRight import be.simplenotes.persistance.repositories.UserRepository
import com.natpryce.hamkrest.assertion.assertThat import com.natpryce.hamkrest.assertion.assertThat
import com.natpryce.hamkrest.equalTo import com.natpryce.hamkrest.equalTo
import io.mockk.* import io.mockk.*

View File

@ -1,10 +1,10 @@
package be.simplenotes.domain.validation package be.simplenotes.domain.validation
import be.simplenotes.domain.testutils.isLeftOfType
import be.simplenotes.domain.testutils.isRight
import be.simplenotes.domain.usecases.users.login.InvalidLoginForm import be.simplenotes.domain.usecases.users.login.InvalidLoginForm
import be.simplenotes.domain.usecases.users.login.LoginForm import be.simplenotes.domain.usecases.users.login.LoginForm
import be.simplenotes.domain.usecases.users.register.RegisterForm import be.simplenotes.domain.usecases.users.register.RegisterForm
import be.simplenotes.shared.testutils.assertions.isLeftOfType
import be.simplenotes.shared.testutils.assertions.isRight
import com.natpryce.hamkrest.assertion.assertThat import com.natpryce.hamkrest.assertion.assertThat
import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Nested
import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.ParameterizedTest

Some files were not shown because too many files have changed in this diff Show More