diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81640619..488d507e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,20 +15,20 @@ on: tags: [v*] env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build and Test strategy: matrix: os: [ubuntu-latest] - scala: [3.3.0] + scala: [3] java: [temurin@8, temurin@17] project: [rootJS, rootJVM, rootNative] exclude: @@ -37,23 +37,20 @@ jobs: - project: rootNative java: temurin@17 runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' - name: Install Nix uses: cachix/install-nix-action@v17 @@ -89,11 +86,11 @@ jobs: - name: Make target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: mkdir -p modules/skunk-upickle/.native/target modules/backend/.native/target modules/munit/.js/target modules/skunk-upickle/.js/target target modules/skunk-circe/.jvm/target modules/postgres/.js/target modules/skunk/.native/target unidocs/target .js/target modules/skunk-circe/.native/target modules/core/.native/target site/target modules/backend/.jvm/target modules/skunk/.jvm/target modules/skunk-jsoniter/.native/target modules/skunk-jsoniter/.jvm/target modules/postgres/.jvm/target modules/core/.js/target examples/.js/target modules/skunk-circe/.js/target modules/doobie/.jvm/target modules/postgres/.native/target modules/doobie-circe/.jvm/target modules/core/.jvm/target .jvm/target .native/target modules/doobie-jsoniter/.jvm/target examples/.jvm/target modules/backend-tests/js/target modules/backend-tests/jvm/target modules/skunk-jsoniter/.js/target modules/doobie-upickle/.jvm/target modules/skunk-upickle/.jvm/target modules/skunk/.js/target modules/munit/.jvm/target modules/backend-tests/native/target mdoc-plantuml/target modules/backend/.js/target modules/munit/.native/target project/target + run: mkdir -p modules/skunk-upickle/.native/target modules/backend/.native/target modules/munit/.js/target modules/skunk-upickle/.js/target modules/skunk-circe/.jvm/target modules/postgres/.js/target modules/skunk/.native/target unidocs/target modules/skunk-circe/.native/target modules/core/.native/target modules/backend/.jvm/target modules/skunk/.jvm/target modules/skunk-jsoniter/.native/target modules/skunk-jsoniter/.jvm/target modules/postgres/.jvm/target modules/core/.js/target modules/skunk-circe/.js/target modules/doobie/.jvm/target modules/postgres/.native/target modules/doobie-circe/.jvm/target modules/core/.jvm/target modules/doobie-jsoniter/.jvm/target modules/skunk-jsoniter/.js/target modules/doobie-upickle/.jvm/target modules/skunk-upickle/.jvm/target modules/skunk/.js/target modules/munit/.jvm/target modules/backend/.js/target modules/munit/.native/target project/target - name: Compress target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') - run: tar cf targets.tar modules/skunk-upickle/.native/target modules/backend/.native/target modules/munit/.js/target modules/skunk-upickle/.js/target target modules/skunk-circe/.jvm/target modules/postgres/.js/target modules/skunk/.native/target unidocs/target .js/target modules/skunk-circe/.native/target modules/core/.native/target site/target modules/backend/.jvm/target modules/skunk/.jvm/target modules/skunk-jsoniter/.native/target modules/skunk-jsoniter/.jvm/target modules/postgres/.jvm/target modules/core/.js/target examples/.js/target modules/skunk-circe/.js/target modules/doobie/.jvm/target modules/postgres/.native/target modules/doobie-circe/.jvm/target modules/core/.jvm/target .jvm/target .native/target modules/doobie-jsoniter/.jvm/target examples/.jvm/target modules/backend-tests/js/target modules/backend-tests/jvm/target modules/skunk-jsoniter/.js/target modules/doobie-upickle/.jvm/target modules/skunk-upickle/.jvm/target modules/skunk/.js/target modules/munit/.jvm/target modules/backend-tests/native/target mdoc-plantuml/target modules/backend/.js/target modules/munit/.native/target project/target + run: tar cf targets.tar modules/skunk-upickle/.native/target modules/backend/.native/target modules/munit/.js/target modules/skunk-upickle/.js/target modules/skunk-circe/.jvm/target modules/postgres/.js/target modules/skunk/.native/target unidocs/target modules/skunk-circe/.native/target modules/core/.native/target modules/backend/.jvm/target modules/skunk/.jvm/target modules/skunk-jsoniter/.native/target modules/skunk-jsoniter/.jvm/target modules/postgres/.jvm/target modules/core/.js/target modules/skunk-circe/.js/target modules/doobie/.jvm/target modules/postgres/.native/target modules/doobie-circe/.jvm/target modules/core/.jvm/target modules/doobie-jsoniter/.jvm/target modules/skunk-jsoniter/.js/target modules/doobie-upickle/.jvm/target modules/skunk-upickle/.jvm/target modules/skunk/.js/target modules/munit/.jvm/target modules/backend/.js/target modules/munit/.native/target project/target - name: Upload target directories if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') @@ -113,69 +110,106 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' - name: Install Nix uses: cachix/install-nix-action@v17 - - name: Download target directories (3.3.0, rootJS) + - name: Download target directories (3, rootJS) uses: actions/download-artifact@v3 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.0-rootJS + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS - - name: Inflate target directories (3.3.0, rootJS) + - name: Inflate target directories (3, rootJS) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.3.0, rootJVM) + - name: Download target directories (3, rootJVM) uses: actions/download-artifact@v3 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.0-rootJVM + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM - - name: Inflate target directories (3.3.0, rootJVM) + - name: Inflate target directories (3, rootJVM) run: | tar xf targets.tar rm targets.tar - - name: Download target directories (3.3.0, rootNative) + - name: Download target directories (3, rootNative) uses: actions/download-artifact@v3 with: - name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.0-rootNative + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative - - name: Inflate target directories (3.3.0, rootNative) + - name: Inflate target directories (3, rootNative) run: | tar xf targets.tar rm targets.tar - name: Import signing key if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' - run: echo $PGP_SECRET | base64 -di | gpg --import + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -d -i - | gpg --import - name: Import signing key and strip passphrase if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} run: | - echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg + echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) - name: Publish + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} run: 'nix develop .#${{ matrix.java }} -c sbt tlCiRelease' + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' + + - name: Install Nix + uses: cachix/install-nix-action@v17 + + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + modules-ignore: edomata_3 docs_3 examples_sjs1_3 edomata_3 edomata_3 examples_3 edomata-backend-tests_sjs1_3 edomata-backend-tests_3 edomata-backend-tests_native0.4_3 mdocplantuml_3 + configs-ignore: test scala-tool scala-doc-tool test-internal + post-build: name: post build needs: [build] @@ -192,25 +226,21 @@ jobs: strategy: matrix: os: [ubuntu-latest] - java: [temurin@8] + java: [temurin@17] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: 'nix develop .#${{ matrix.java }} -c sbt +update' - name: Install Nix uses: cachix/install-nix-action@v17 @@ -220,7 +250,7 @@ jobs: - name: Publish site if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: peaceiris/actions-gh-pages@v3.9.0 + uses: peaceiris/actions-gh-pages@v3.9.3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site/target/docs/site diff --git a/build.sbt b/build.sbt index da9ccc90..2af915df 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,4 @@ import Dependencies._ -import laika.io.config.SiteConfig -import laika.rewrite.link.ApiLinks -import laika.rewrite.link.LinkConfig import sbt.ThisBuild import sbtcrossproject.CrossProject @@ -80,30 +77,7 @@ lazy val mdocPlantuml = project lazy val docs = project .in(file("site")) - .enablePlugins(TypelevelSitePlugin) - .settings( - tlSiteHeliumConfig := SiteConfigs(mdocVariables.value), - tlSiteRelatedProjects := Seq( - TypelevelProject.Cats, - TypelevelProject.CatsEffect, - TypelevelProject.Fs2, - TypelevelProject.Discipline - ), - laikaConfig := LaikaConfig.defaults - .withConfigValue( - LinkConfig(apiLinks = - Seq( - ApiLinks( - tlSiteApiUrl.value - .map(_.toString()) - .getOrElse("/edomata/api/"), - "edomata" - ) - ) - ) - ), - laikaIncludeAPI := true - ) + .enablePlugins(EdomataSitePlugin) .dependsOn( core.jvm, postgres.jvm, diff --git a/ci.sbt b/ci.sbt index 52420054..c7676c3b 100644 --- a/ci.sbt +++ b/ci.sbt @@ -3,6 +3,7 @@ val LTSJava = JavaSpec.temurin("17") inThisBuild( List( + tlSiteJavaVersion := LTSJava, githubWorkflowJavaVersions := Seq(PrimaryJava, LTSJava), githubWorkflowBuildPreamble ++= dockerComposeUp, githubWorkflowJobSetup ~= { diff --git a/examples/src/main/scala/Example1.scala b/examples/src/main/scala/Example1.scala index 8d1e960b..938cee11 100644 --- a/examples/src/main/scala/Example1.scala +++ b/examples/src/main/scala/Example1.scala @@ -102,7 +102,6 @@ object Application extends IOApp.Simple { val application = database.flatMap(backendRes).use { backend => val service = backend.compile(app) - val srv2 = backend.compile(CounterService()) service( CommandMessage("abc", Instant.now, "a", "receive") diff --git a/flake.nix b/flake.nix index 245b9fe8..4cd51f47 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ }; }; in { - devShell = mkShell pkgs.jdk8; + devShell = mkShell pkgs.jdk17; devShells = { "temurin@8" = mkShell pkgs.temurin-bin-8; diff --git a/mdoc-plantuml/src/main/scala/PlantumlModifier.scala b/mdoc-plantuml/src/main/scala/PlantumlModifier.scala index e56a3728..55446aff 100644 --- a/mdoc-plantuml/src/main/scala/PlantumlModifier.scala +++ b/mdoc-plantuml/src/main/scala/PlantumlModifier.scala @@ -18,8 +18,6 @@ package ir.hnaderi.mdocPlantuml import mdoc.Reporter import mdoc.StringModifier -import net.sourceforge.plantuml.FileFormat -import net.sourceforge.plantuml.FileFormatOption import net.sourceforge.plantuml.SourceStringReader import scala.meta.inputs.Input diff --git a/modules/backend-tests/js/src/main/scala/StorageSuite.scala b/modules/backend-tests/js/src/main/scala/StorageSuite.scala index c5b70389..7b87311c 100644 --- a/modules/backend-tests/js/src/main/scala/StorageSuite.scala +++ b/modules/backend-tests/js/src/main/scala/StorageSuite.scala @@ -18,7 +18,6 @@ package tests import cats.effect.IO import cats.effect.kernel.Resource -import edomata.backend.* import munit.CatsEffectSuite import munit.Location diff --git a/modules/backend-tests/jvm/src/main/scala/StorageSuite.scala b/modules/backend-tests/jvm/src/main/scala/StorageSuite.scala index 1b3fa4e8..adaecc04 100644 --- a/modules/backend-tests/jvm/src/main/scala/StorageSuite.scala +++ b/modules/backend-tests/jvm/src/main/scala/StorageSuite.scala @@ -18,7 +18,6 @@ package tests import cats.effect.IO import cats.effect.kernel.Resource -import edomata.backend.* import munit.CatsEffectSuite import munit.Location diff --git a/modules/backend-tests/native/src/main/scala/StorageSuite.scala b/modules/backend-tests/native/src/main/scala/StorageSuite.scala index 1b3fa4e8..adaecc04 100644 --- a/modules/backend-tests/native/src/main/scala/StorageSuite.scala +++ b/modules/backend-tests/native/src/main/scala/StorageSuite.scala @@ -18,7 +18,6 @@ package tests import cats.effect.IO import cats.effect.kernel.Resource -import edomata.backend.* import munit.CatsEffectSuite import munit.Location diff --git a/modules/backend-tests/shared/src/main/scala/CqrsSuite.scala b/modules/backend-tests/shared/src/main/scala/CqrsSuite.scala index f68d6186..5aa82630 100644 --- a/modules/backend-tests/shared/src/main/scala/CqrsSuite.scala +++ b/modules/backend-tests/shared/src/main/scala/CqrsSuite.scala @@ -18,7 +18,6 @@ package tests import cats.effect.IO import cats.effect.kernel.Resource -import cats.effect.std.UUIDGen import cats.implicits.* import edomata.backend.BackendError import edomata.backend.cqrs.* diff --git a/modules/backend-tests/shared/src/main/scala/PersistenceSuite.scala b/modules/backend-tests/shared/src/main/scala/PersistenceSuite.scala index 664b2647..39d06982 100644 --- a/modules/backend-tests/shared/src/main/scala/PersistenceSuite.scala +++ b/modules/backend-tests/shared/src/main/scala/PersistenceSuite.scala @@ -25,7 +25,6 @@ import edomata.backend.BackendError import edomata.core.CommandMessage import edomata.core.Edomaton import edomata.core.ResponseD -import munit.CatsEffectSuite import tests.TestDomain.given_ModelTC_State_Event_Rejection import java.time.Instant diff --git a/modules/backend/src/main/scala/Backend.scala b/modules/backend/src/main/scala/Backend.scala index 103f5946..b8590d64 100644 --- a/modules/backend/src/main/scala/Backend.scala +++ b/modules/backend/src/main/scala/Backend.scala @@ -16,12 +16,8 @@ package edomata.backend -import cats.effect.kernel.Async -import cats.effect.kernel.Resource import edomata.core.* -import scala.concurrent.duration.* - object Backend { def builder[C, S, E, R, N]( domain: Domain[C, S, E, R, N] diff --git a/modules/backend/src/main/scala/CommandStore.scala b/modules/backend/src/main/scala/CommandStore.scala index 53760c1f..c18f3c88 100644 --- a/modules/backend/src/main/scala/CommandStore.scala +++ b/modules/backend/src/main/scala/CommandStore.scala @@ -17,7 +17,6 @@ package edomata.backend import cats.Monad -import cats.effect.Concurrent import cats.effect.kernel.Async import cats.effect.kernel.Ref import cats.implicits.* diff --git a/modules/backend/src/main/scala/LRUCache.scala b/modules/backend/src/main/scala/LRUCache.scala index c4ac6ae7..06f747af 100644 --- a/modules/backend/src/main/scala/LRUCache.scala +++ b/modules/backend/src/main/scala/LRUCache.scala @@ -16,7 +16,6 @@ package edomata.backend -import cats.effect.Concurrent import cats.effect.Resource import cats.effect.Sync import cats.effect.kernel.Async diff --git a/modules/backend/src/main/scala/Outbox.scala b/modules/backend/src/main/scala/Outbox.scala index befde3e0..cecd7a3b 100644 --- a/modules/backend/src/main/scala/Outbox.scala +++ b/modules/backend/src/main/scala/Outbox.scala @@ -21,7 +21,6 @@ import edomata.core.* import fs2.Stream import java.time.OffsetDateTime -import java.util.UUID trait OutboxReader[F[_], N] { def read: Stream[F, OutboxItem[N]] diff --git a/modules/backend/src/main/scala/OutboxConsumer.scala b/modules/backend/src/main/scala/OutboxConsumer.scala index 4ec2a20e..91195927 100644 --- a/modules/backend/src/main/scala/OutboxConsumer.scala +++ b/modules/backend/src/main/scala/OutboxConsumer.scala @@ -19,7 +19,6 @@ package edomata.backend import cats.Monad import cats.data.NonEmptyChain import cats.implicits.* -import edomata.backend.OutboxItem import fs2.Stream import fs2.Stream.* diff --git a/modules/backend/src/main/scala/cqrs/Backend.scala b/modules/backend/src/main/scala/cqrs/Backend.scala index 39df8961..c3759aa6 100644 --- a/modules/backend/src/main/scala/cqrs/Backend.scala +++ b/modules/backend/src/main/scala/cqrs/Backend.scala @@ -17,13 +17,9 @@ package edomata.backend package cqrs -import cats.Applicative -import cats.Monad -import cats.data.NonEmptyChain import cats.effect.kernel.Async import cats.effect.kernel.Resource import cats.effect.std.Random -import cats.implicits.* import edomata.core.* import scala.concurrent.duration.* diff --git a/modules/backend/src/main/scala/cqrs/Storage.scala b/modules/backend/src/main/scala/cqrs/Storage.scala index e151c2e3..88ad6306 100644 --- a/modules/backend/src/main/scala/cqrs/Storage.scala +++ b/modules/backend/src/main/scala/cqrs/Storage.scala @@ -17,7 +17,6 @@ package edomata.backend package cqrs -import cats.data.NonEmptyChain import cats.effect.kernel.Resource import edomata.core.StateModelTC diff --git a/modules/backend/src/main/scala/eventsourcing/CommandHandler.scala b/modules/backend/src/main/scala/eventsourcing/CommandHandler.scala index fd4d76ea..c66cb3ad 100644 --- a/modules/backend/src/main/scala/eventsourcing/CommandHandler.scala +++ b/modules/backend/src/main/scala/eventsourcing/CommandHandler.scala @@ -21,7 +21,6 @@ import cats.Monad import cats.data.EitherNec import cats.data.NonEmptyChain import cats.effect.Temporal -import cats.effect.implicits.* import cats.implicits.* import edomata.core.* diff --git a/modules/backend/src/main/scala/eventsourcing/JournalReader.scala b/modules/backend/src/main/scala/eventsourcing/JournalReader.scala index 3b57bcf0..71e51ee2 100644 --- a/modules/backend/src/main/scala/eventsourcing/JournalReader.scala +++ b/modules/backend/src/main/scala/eventsourcing/JournalReader.scala @@ -17,13 +17,8 @@ package edomata.backend package eventsourcing -import cats.data.NonEmptyChain -import edomata.core.* import fs2.Stream -import java.time.OffsetDateTime -import java.util.UUID - trait JournalReader[F[_], E] { def readStream(streamId: StreamId): Stream[F, EventMessage[E]] def readStreamAfter( diff --git a/modules/backend/src/main/scala/eventsourcing/RepositoryReader.scala b/modules/backend/src/main/scala/eventsourcing/RepositoryReader.scala index 5ee9c614..831e5318 100644 --- a/modules/backend/src/main/scala/eventsourcing/RepositoryReader.scala +++ b/modules/backend/src/main/scala/eventsourcing/RepositoryReader.scala @@ -24,9 +24,6 @@ import edomata.core.* import fs2.Pipe import fs2.Stream -import java.time.OffsetDateTime -import java.util.UUID - type CommandState[S, E, R] = AggregateState[S, E, R] | CommandState.Redundant.type diff --git a/modules/backend/src/main/scala/eventsourcing/Snapshot.scala b/modules/backend/src/main/scala/eventsourcing/Snapshot.scala index 7fd3caee..ce015a69 100644 --- a/modules/backend/src/main/scala/eventsourcing/Snapshot.scala +++ b/modules/backend/src/main/scala/eventsourcing/Snapshot.scala @@ -81,7 +81,7 @@ object SnapshotStore { lc <- Resource.eval( LRUCache[F, StreamId, AggregateState.Valid[S]](size) ) - pss = PersistedSnapshotStoreImpl(lc, store, q, maxBuffer, maxWait) + pss = PersistedSnapshotStoreImpl(lc, store, q) flush = lc.byUsage.use( Stream .fromIterator(_, size min 1000) @@ -115,9 +115,7 @@ type SnapshotItem[S] = private[backend] final class PersistedSnapshotStoreImpl[F[_], S]( cache: LRUCache[F, StreamId, AggregateState.Valid[S]], p: SnapshotPersistence[F, S], - q: Queue[F, SnapshotItem[S]], - maxBuffer: Int, - maxWait: FiniteDuration + q: Queue[F, SnapshotItem[S]] )(using F: Temporal[F]) extends SnapshotStore[F, S] { def get(id: StreamId): F[Option[AggregateState.Valid[S]]] = diff --git a/modules/backend/src/test/scala/FakeOutboxReader.scala b/modules/backend/src/test/scala/FakeOutboxReader.scala index b017e1e0..c941d5a8 100644 --- a/modules/backend/src/test/scala/FakeOutboxReader.scala +++ b/modules/backend/src/test/scala/FakeOutboxReader.scala @@ -16,11 +16,8 @@ package edomata.backend -import cats.data.Chain -import cats.data.NonEmptyChain import cats.effect.IO import cats.effect.kernel.Ref -import edomata.core.* import fs2.Stream import FakeOutboxReader.* diff --git a/modules/backend/src/test/scala/InMemoryCommandStoreSuite.scala b/modules/backend/src/test/scala/InMemoryCommandStoreSuite.scala index 740a6b3f..8cf870ba 100644 --- a/modules/backend/src/test/scala/InMemoryCommandStoreSuite.scala +++ b/modules/backend/src/test/scala/InMemoryCommandStoreSuite.scala @@ -16,15 +16,11 @@ package edomata.backend -import cats.data.Chain -import cats.data.NonEmptyChain import cats.effect.IO -import cats.implicits.* import edomata.core.* import munit.CatsEffectSuite import java.time.Instant -import scala.collection.immutable.HashSet import InMemoryCommandStoreSuite.* diff --git a/modules/backend/src/test/scala/OutboxConsumerSuite.scala b/modules/backend/src/test/scala/OutboxConsumerSuite.scala index 69ed4a78..2ab18d27 100644 --- a/modules/backend/src/test/scala/OutboxConsumerSuite.scala +++ b/modules/backend/src/test/scala/OutboxConsumerSuite.scala @@ -16,14 +16,12 @@ package edomata.backend -import cats.data.NonEmptyChain import cats.effect.IO import cats.implicits.* import edomata.core.MessageMetadata import fs2.Stream import fs2.Stream.* import munit.CatsEffectSuite -import munit.FunSuite import java.time.OffsetDateTime diff --git a/modules/backend/src/test/scala/cqrs/CommandHandlerSuite.scala b/modules/backend/src/test/scala/cqrs/CommandHandlerSuite.scala index a3a72a41..3db5eea3 100644 --- a/modules/backend/src/test/scala/cqrs/CommandHandlerSuite.scala +++ b/modules/backend/src/test/scala/cqrs/CommandHandlerSuite.scala @@ -27,13 +27,11 @@ import munit.CatsEffectSuite import java.time.Instant import java.time.OffsetDateTime -import java.util.UUID import scala.concurrent.duration.* import CommandHandlerSuite.* import SUT.given_StateModelTC_State import FakeRepository.Interaction -import cats.effect.std.Random.apply import cats.effect.std.Random import edomata.backend.BackendError import edomata.backend.CommandState.Redundant diff --git a/modules/backend/src/test/scala/cqrs/FakeRepository.scala b/modules/backend/src/test/scala/cqrs/FakeRepository.scala index f199679f..d7ddb411 100644 --- a/modules/backend/src/test/scala/cqrs/FakeRepository.scala +++ b/modules/backend/src/test/scala/cqrs/FakeRepository.scala @@ -19,11 +19,9 @@ package edomata.backend.cqrs import cats.data.* import cats.effect.IO import cats.effect.kernel.Ref -import cats.implicits.* import edomata.backend.cqrs.FakeRepository.* import edomata.backend.{SeqNr, StreamId} import edomata.core.* -import edomata.syntax.all.* import munit.CatsEffectAssertions.* final class FakeRepository[State, Event]( diff --git a/modules/backend/src/test/scala/cqrs/NotificationsSuite.scala b/modules/backend/src/test/scala/cqrs/NotificationsSuite.scala index 8389c984..bc1985bc 100644 --- a/modules/backend/src/test/scala/cqrs/NotificationsSuite.scala +++ b/modules/backend/src/test/scala/cqrs/NotificationsSuite.scala @@ -19,7 +19,6 @@ package cqrs import cats.effect.IO import cats.effect.testkit.TestControl -import cats.implicits.* import fs2.Chunk import fs2.Stream import munit.CatsEffectSuite diff --git a/modules/backend/src/test/scala/eventsourcing/CommandHandlerSuite.scala b/modules/backend/src/test/scala/eventsourcing/CommandHandlerSuite.scala index 733941db..cc65f389 100644 --- a/modules/backend/src/test/scala/eventsourcing/CommandHandlerSuite.scala +++ b/modules/backend/src/test/scala/eventsourcing/CommandHandlerSuite.scala @@ -29,7 +29,6 @@ import munit.CatsEffectSuite import java.time.Instant import java.time.OffsetDateTime -import java.util.UUID import scala.concurrent.duration.* import CommandHandlerSuite.* diff --git a/modules/backend/src/test/scala/eventsourcing/Doubles.scala b/modules/backend/src/test/scala/eventsourcing/Doubles.scala index da79900c..fa6e53ec 100644 --- a/modules/backend/src/test/scala/eventsourcing/Doubles.scala +++ b/modules/backend/src/test/scala/eventsourcing/Doubles.scala @@ -21,7 +21,6 @@ import cats.data.Chain import cats.data.NonEmptyChain import cats.effect.IO import cats.effect.kernel.Ref -import cats.implicits.* import edomata.backend.eventsourcing.AggregateState.Valid import edomata.core.* import fs2.Chunk diff --git a/modules/backend/src/test/scala/eventsourcing/NotificationsSuite.scala b/modules/backend/src/test/scala/eventsourcing/NotificationsSuite.scala index 95b27af6..785de1ab 100644 --- a/modules/backend/src/test/scala/eventsourcing/NotificationsSuite.scala +++ b/modules/backend/src/test/scala/eventsourcing/NotificationsSuite.scala @@ -19,7 +19,6 @@ package eventsourcing import cats.effect.IO import cats.effect.testkit.TestControl -import cats.implicits.* import fs2.Chunk import fs2.Stream import munit.CatsEffectSuite diff --git a/modules/backend/src/test/scala/eventsourcing/PersistedSnapshotStoreSuite.scala b/modules/backend/src/test/scala/eventsourcing/PersistedSnapshotStoreSuite.scala index 3b8f017f..1efe82e3 100644 --- a/modules/backend/src/test/scala/eventsourcing/PersistedSnapshotStoreSuite.scala +++ b/modules/backend/src/test/scala/eventsourcing/PersistedSnapshotStoreSuite.scala @@ -18,7 +18,6 @@ package edomata.backend package eventsourcing import cats.effect.IO -import cats.effect.kernel.Resource import cats.effect.testkit.TestControl import cats.implicits.* import munit.CatsEffectSuite diff --git a/modules/core/src/main/scala/Decision.scala b/modules/core/src/main/scala/Decision.scala index d90496c6..4f7781d1 100644 --- a/modules/core/src/main/scala/Decision.scala +++ b/modules/core/src/main/scala/Decision.scala @@ -17,7 +17,6 @@ package edomata.core import cats.Applicative -import cats.Bifunctor import cats.Eval import cats.MonadError import cats.Traverse diff --git a/modules/core/src/main/scala/DomainCompiler.scala b/modules/core/src/main/scala/DomainCompiler.scala index 088a7574..42a21ef7 100644 --- a/modules/core/src/main/scala/DomainCompiler.scala +++ b/modules/core/src/main/scala/DomainCompiler.scala @@ -23,8 +23,6 @@ import cats.data.EitherNec import cats.data.NonEmptyChain import cats.implicits.* -import java.time.OffsetDateTime -import java.time.ZoneOffset import scala.util.NotGiven type DomainService[F[_], C, R] = C => F[EitherNec[R, Unit]] diff --git a/modules/core/src/main/scala/RaiseError.scala b/modules/core/src/main/scala/RaiseError.scala index cf96a00d..51512ec7 100644 --- a/modules/core/src/main/scala/RaiseError.scala +++ b/modules/core/src/main/scala/RaiseError.scala @@ -18,7 +18,6 @@ package edomata.core import cats.data.NonEmptyChainImpl.Type import cats.data.* -import cats.implicits.* trait RaiseError[F[+_], R] { def fold[O, A](v: F[O])(err: NonEmptyChain[R] => A, value: O => A): A diff --git a/modules/core/src/main/scala/RequestContext.scala b/modules/core/src/main/scala/RequestContext.scala index 09dd3292..ef90252c 100644 --- a/modules/core/src/main/scala/RequestContext.scala +++ b/modules/core/src/main/scala/RequestContext.scala @@ -16,7 +16,6 @@ package edomata.core -import cats.data.NonEmptyChain import cats.implicits.* import java.time.Instant diff --git a/modules/core/src/main/scala/ResponseD.scala b/modules/core/src/main/scala/ResponseD.scala index 0c215ed8..53a60bed 100644 --- a/modules/core/src/main/scala/ResponseD.scala +++ b/modules/core/src/main/scala/ResponseD.scala @@ -18,7 +18,6 @@ package edomata.core import cats.* import cats.data.* -import cats.implicits.* /** Representation of programs that decide and emit notifications * diff --git a/modules/core/src/main/scala/ResponseE.scala b/modules/core/src/main/scala/ResponseE.scala index 3efe94b7..68eeb72b 100644 --- a/modules/core/src/main/scala/ResponseE.scala +++ b/modules/core/src/main/scala/ResponseE.scala @@ -19,9 +19,6 @@ package edomata.core import cats.* import cats.data.* import cats.implicits.* -import cats.kernel.Eq - -import scala.annotation.tailrec /** Representation of programs that decide and emit notifications * diff --git a/modules/core/src/test/scala/Helpers.scala b/modules/core/src/test/scala/Helpers.scala index 59cc9193..92dac2d5 100644 --- a/modules/core/src/test/scala/Helpers.scala +++ b/modules/core/src/test/scala/Helpers.scala @@ -17,12 +17,10 @@ package tests import cats.Functor -import cats.Monad import cats.data.NonEmptyChain import cats.implicits.* import org.scalacheck.Arbitrary import org.scalacheck.Gen -import org.scalacheck.Prop.forAll private[tests] def necOf[T](g: Gen[T]): Gen[NonEmptyChain[T]] = Gen diff --git a/modules/core/src/test/scala/action/ActionSuite.scala b/modules/core/src/test/scala/action/ActionSuite.scala index 02d8a380..149c786f 100644 --- a/modules/core/src/test/scala/action/ActionSuite.scala +++ b/modules/core/src/test/scala/action/ActionSuite.scala @@ -132,7 +132,6 @@ class ActionSuite extends DisciplineSuite { val c = a >> b val ares = a.run.value - val bres = b.run.value val cres = c.run.value assertEquals(cres.result, ares.result) // just for doc diff --git a/modules/core/src/test/scala/decision/DecisionSuite.scala b/modules/core/src/test/scala/decision/DecisionSuite.scala index 04219c8e..8a15c557 100644 --- a/modules/core/src/test/scala/decision/DecisionSuite.scala +++ b/modules/core/src/test/scala/decision/DecisionSuite.scala @@ -17,12 +17,10 @@ package tests package decision -import cats.Monad import cats.data.* import cats.implicits.* import cats.kernel.laws.discipline.EqTests import cats.kernel.laws.discipline.SerializableTests -import cats.laws.discipline.FunctorTests import cats.laws.discipline.MonadErrorTests import cats.laws.discipline.TraverseTests import cats.laws.discipline.arbitrary.catsLawsCogenForNonEmptyChain diff --git a/modules/core/src/test/scala/decision/Generators.scala b/modules/core/src/test/scala/decision/Generators.scala index 83432f9f..9a8e25ed 100644 --- a/modules/core/src/test/scala/decision/Generators.scala +++ b/modules/core/src/test/scala/decision/Generators.scala @@ -17,7 +17,6 @@ package tests package decision -import cats.data.NonEmptyChain import org.scalacheck.Arbitrary import org.scalacheck.Gen import edomata.core.Decision diff --git a/modules/core/src/test/scala/decisiont/DecisionTSuite.scala b/modules/core/src/test/scala/decisiont/DecisionTSuite.scala index 55af07d1..e09b926c 100644 --- a/modules/core/src/test/scala/decisiont/DecisionTSuite.scala +++ b/modules/core/src/test/scala/decisiont/DecisionTSuite.scala @@ -19,7 +19,6 @@ package decisiont import cats.Applicative import cats.Eval -import cats.data.NonEmptyChain import cats.implicits.* import cats.kernel.laws.discipline.EqTests import cats.laws.discipline.MonadTests diff --git a/modules/core/src/test/scala/edomaton/EdomatonSuite.scala b/modules/core/src/test/scala/edomaton/EdomatonSuite.scala index 544f42de..13e7281a 100644 --- a/modules/core/src/test/scala/edomaton/EdomatonSuite.scala +++ b/modules/core/src/test/scala/edomaton/EdomatonSuite.scala @@ -22,12 +22,10 @@ import cats.data.* import cats.implicits.* import cats.kernel.laws.discipline.EqTests import cats.laws.discipline.* -import cats.laws.discipline.arbitrary.* import cats.laws.discipline.eq.* import munit.* import org.scalacheck.Arbitrary import org.scalacheck.Gen -import org.scalacheck.Prop.forAll import edomata.core.* import tests.decision.Generators diff --git a/modules/core/src/test/scala/responset/ResponseDecisionSuite.scala b/modules/core/src/test/scala/responset/ResponseDecisionSuite.scala index e3dfd1a2..02d15093 100644 --- a/modules/core/src/test/scala/responset/ResponseDecisionSuite.scala +++ b/modules/core/src/test/scala/responset/ResponseDecisionSuite.scala @@ -16,18 +16,11 @@ package tests.responset -import cats.Monad import cats.data.* import cats.implicits.* -import cats.kernel.laws.discipline.EqTests -import cats.laws.discipline.MonadTests import cats.laws.discipline.TraverseTests import cats.laws.discipline.arbitrary.catsLawsArbitraryForNonEmptyChain -import cats.laws.discipline.arbitrary.catsLawsCogenForNonEmptyChain -import munit.* import org.scalacheck.Arbitrary -import org.scalacheck.Gen -import org.scalacheck.Prop.forAll import edomata.core.* import tests.decision.Generators.* diff --git a/modules/core/src/test/scala/responset/ResponseTLaws.scala b/modules/core/src/test/scala/responset/ResponseTLaws.scala index b8e21049..dabcc1b6 100644 --- a/modules/core/src/test/scala/responset/ResponseTLaws.scala +++ b/modules/core/src/test/scala/responset/ResponseTLaws.scala @@ -22,8 +22,6 @@ import cats.data.* import cats.implicits.* import cats.kernel.laws.discipline.EqTests import cats.laws.discipline.MonadTests -import cats.laws.discipline.arbitrary.catsLawsArbitraryForNonEmptyChain -import cats.laws.discipline.arbitrary.catsLawsCogenForNonEmptyChain import munit.* import org.scalacheck.Arbitrary import org.scalacheck.Gen diff --git a/modules/core/src/test/scala/stomaton/StomatonSuite.scala b/modules/core/src/test/scala/stomaton/StomatonSuite.scala index 3c2f6795..2d81c482 100644 --- a/modules/core/src/test/scala/stomaton/StomatonSuite.scala +++ b/modules/core/src/test/scala/stomaton/StomatonSuite.scala @@ -17,11 +17,8 @@ package tests package stomaton -import cats.Eval -import cats.Monad import cats.data.NonEmptyChain import cats.implicits.* -import cats.kernel.Eq import cats.kernel.laws.discipline.EqTests import cats.laws.discipline.* import cats.laws.discipline.arbitrary.* @@ -29,7 +26,6 @@ import cats.laws.discipline.eq.* import munit.* import org.scalacheck.Arbitrary import org.scalacheck.Gen -import org.scalacheck.Prop.forAll import edomata.core.* type Rejection = String diff --git a/modules/doobie-circe/src/main/scala/CirceCodec.scala b/modules/doobie-circe/src/main/scala/CirceCodec.scala index 47cf3d11..ec361385 100644 --- a/modules/doobie-circe/src/main/scala/CirceCodec.scala +++ b/modules/doobie-circe/src/main/scala/CirceCodec.scala @@ -16,11 +16,9 @@ package edomata.doobie -import _root_.doobie.* import cats.implicits.* import io.circe.Decoder import io.circe.Encoder -import io.circe.Json import io.circe.parser.decode import io.circe.syntax.* diff --git a/modules/doobie-jsoniter/src/main/scala/JsoniterCodec.scala b/modules/doobie-jsoniter/src/main/scala/JsoniterCodec.scala index 2ed9f951..93f8d3b8 100644 --- a/modules/doobie-jsoniter/src/main/scala/JsoniterCodec.scala +++ b/modules/doobie-jsoniter/src/main/scala/JsoniterCodec.scala @@ -16,7 +16,6 @@ package edomata.doobie -import _root_.doobie.* import cats.implicits.* import com.github.plokhotnyuk.jsoniter_scala.core.* import BackendCodec.* diff --git a/modules/doobie/src/main/scala/BackendCodec.scala b/modules/doobie/src/main/scala/BackendCodec.scala index c37bf523..2ac952a1 100644 --- a/modules/doobie/src/main/scala/BackendCodec.scala +++ b/modules/doobie/src/main/scala/BackendCodec.scala @@ -20,7 +20,6 @@ import _root_.doobie.* import cats.Show import cats.data.NonEmptyList import cats.implicits.* -import edomata.backend.* import org.postgresql.util.PGobject import scala.annotation.implicitNotFound diff --git a/modules/doobie/src/main/scala/DoobieCQRSRepository.scala b/modules/doobie/src/main/scala/DoobieCQRSRepository.scala index 698d1ab1..e9461508 100644 --- a/modules/doobie/src/main/scala/DoobieCQRSRepository.scala +++ b/modules/doobie/src/main/scala/DoobieCQRSRepository.scala @@ -20,14 +20,12 @@ import _root_.doobie.postgres.sqlstate import cats.data.* import cats.effect.kernel.Clock import cats.effect.kernel.Concurrent -import cats.effect.kernel.Resource import cats.implicits.* import doobie.* import doobie.implicits.* import doobie.util.transactor.Transactor import edomata.backend.BackendError import edomata.backend.CommandState.Redundant -import edomata.backend.PGNamespace import edomata.backend.SeqNr import edomata.backend.StreamId import edomata.backend.cqrs.* diff --git a/modules/doobie/src/main/scala/DoobieJournalReader.scala b/modules/doobie/src/main/scala/DoobieJournalReader.scala index 798a51a6..c66b5f77 100644 --- a/modules/doobie/src/main/scala/DoobieJournalReader.scala +++ b/modules/doobie/src/main/scala/DoobieJournalReader.scala @@ -19,14 +19,9 @@ package edomata.doobie import _root_.doobie.Transactor import _root_.doobie.implicits.* import cats.effect.Concurrent -import cats.implicits.* import edomata.backend.* -import edomata.core.* import fs2.Stream -import java.time.OffsetDateTime -import java.time.ZoneOffset - private final class DoobieJournalReader[F[_]: Concurrent, E]( trx: Transactor[F], qs: Queries.Journal[E] diff --git a/modules/doobie/src/main/scala/DoobieOutboxReader.scala b/modules/doobie/src/main/scala/DoobieOutboxReader.scala index 00a5eb40..453b2bad 100644 --- a/modules/doobie/src/main/scala/DoobieOutboxReader.scala +++ b/modules/doobie/src/main/scala/DoobieOutboxReader.scala @@ -23,10 +23,8 @@ import cats.effect.Concurrent import cats.effect.kernel.Clock import cats.implicits.* import edomata.backend.* -import edomata.core.* import fs2.Stream -import java.time.OffsetDateTime import java.time.ZoneOffset private final class DoobieOutboxReader[F[_]: Concurrent: Clock, N]( diff --git a/modules/doobie/src/main/scala/DoobieRepository.scala b/modules/doobie/src/main/scala/DoobieRepository.scala index 34a175d1..96ed25cd 100644 --- a/modules/doobie/src/main/scala/DoobieRepository.scala +++ b/modules/doobie/src/main/scala/DoobieRepository.scala @@ -21,17 +21,14 @@ import _root_.doobie.implicits.* import _root_.doobie.postgres.sqlstate import cats.data.Chain import cats.data.NonEmptyChain -import cats.effect.Concurrent import cats.effect.kernel.Clock import cats.effect.kernel.Sync import cats.implicits.* import edomata.backend.* import edomata.core.* -import fs2.Stream import java.time.OffsetDateTime import java.time.ZoneOffset -import java.util.UUID import cats.effect.std.UUIDGen private final class DoobieRepository[F[_], S, E, R, N]( diff --git a/modules/doobie/src/main/scala/DoobieSnapshotPersistence.scala b/modules/doobie/src/main/scala/DoobieSnapshotPersistence.scala index d6d76751..2e6d4740 100644 --- a/modules/doobie/src/main/scala/DoobieSnapshotPersistence.scala +++ b/modules/doobie/src/main/scala/DoobieSnapshotPersistence.scala @@ -23,12 +23,7 @@ import cats.implicits.* import edomata.backend.PGNamespace import edomata.backend.StreamId import edomata.backend.eventsourcing.* -import edomata.core.* import fs2.Chunk -import fs2.Stream - -import java.time.OffsetDateTime -import java.time.ZoneOffset private final class DoobieSnapshotPersistence[F[_]: Concurrent, S]( trx: Transactor[F], diff --git a/modules/postgres/src/main/scala/PGNamespace.scala b/modules/postgres/src/main/scala/PGNamespace.scala index 2ebfd478..81b1bf36 100644 --- a/modules/postgres/src/main/scala/PGNamespace.scala +++ b/modules/postgres/src/main/scala/PGNamespace.scala @@ -21,7 +21,6 @@ import scala.util.matching.Regex opaque type PGNamespace <: String = String object PGNamespace { - import scala.compiletime import scala.quoted.* private def toNs(ns: Expr[String])(using ctx: Quotes): Expr[PGNamespace] = { diff --git a/modules/skunk-jsoniter/src/main/scala/JsoniterCodec.scala b/modules/skunk-jsoniter/src/main/scala/JsoniterCodec.scala index 9da9defb..4ce85073 100644 --- a/modules/skunk-jsoniter/src/main/scala/JsoniterCodec.scala +++ b/modules/skunk-jsoniter/src/main/scala/JsoniterCodec.scala @@ -16,7 +16,6 @@ package edomata.skunk -import _root_.skunk.* import cats.implicits.* import com.github.plokhotnyuk.jsoniter_scala.core.* import BackendCodec.* diff --git a/modules/skunk/src/main/scala/BackendCodec.scala b/modules/skunk/src/main/scala/BackendCodec.scala index 118db7a7..1d55f3b9 100644 --- a/modules/skunk/src/main/scala/BackendCodec.scala +++ b/modules/skunk/src/main/scala/BackendCodec.scala @@ -19,7 +19,6 @@ package edomata.skunk import _root_.skunk.Codec import _root_.skunk.codec.binary.bytea import _root_.skunk.data.Type -import edomata.backend.* import scala.annotation.implicitNotFound diff --git a/modules/skunk/src/main/scala/Queries.scala b/modules/skunk/src/main/scala/Queries.scala index ce3a6440..2677753d 100644 --- a/modules/skunk/src/main/scala/Queries.scala +++ b/modules/skunk/src/main/scala/Queries.scala @@ -19,7 +19,6 @@ package edomata.skunk import _root_.skunk.* import _root_.skunk.codec.all.* import _root_.skunk.implicits.* -import cats.data.NonEmptyList import edomata.backend.* import edomata.backend.eventsourcing.AggregateState import edomata.core.CommandMessage diff --git a/modules/skunk/src/main/scala/SkunkCQRSDriver.scala b/modules/skunk/src/main/scala/SkunkCQRSDriver.scala index 0e5dd0f1..e4a5be4a 100644 --- a/modules/skunk/src/main/scala/SkunkCQRSDriver.scala +++ b/modules/skunk/src/main/scala/SkunkCQRSDriver.scala @@ -17,7 +17,6 @@ package edomata.skunk import _root_.skunk.Session -import cats.data.NonEmptyChain import cats.effect.kernel.Async import cats.effect.kernel.Resource import cats.implicits.* diff --git a/modules/skunk/src/main/scala/SkunkCQRSRepository.scala b/modules/skunk/src/main/scala/SkunkCQRSRepository.scala index 1e51cdab..65bd1063 100644 --- a/modules/skunk/src/main/scala/SkunkCQRSRepository.scala +++ b/modules/skunk/src/main/scala/SkunkCQRSRepository.scala @@ -19,7 +19,6 @@ package edomata.skunk import _root_.skunk.* import cats.data.* import cats.effect.Concurrent -import cats.effect.implicits.* import cats.effect.kernel.Clock import cats.effect.kernel.Resource import cats.implicits.* @@ -29,14 +28,7 @@ import edomata.backend.SeqNr import edomata.backend.StreamId import edomata.backend.cqrs.* import edomata.core.* -import fs2.Stream -import skunk.* import skunk.data.Completion -import skunk.implicits.* - -import java.time.OffsetDateTime -import java.time.ZoneOffset -import scala.concurrent.duration.* private final class SkunkCQRSRepository[F[_]: Clock, S, N]( pool: Resource[F, Session[F]], diff --git a/modules/skunk/src/main/scala/SkunkJournalReader.scala b/modules/skunk/src/main/scala/SkunkJournalReader.scala index 71ad4bc4..6d42ea5e 100644 --- a/modules/skunk/src/main/scala/SkunkJournalReader.scala +++ b/modules/skunk/src/main/scala/SkunkJournalReader.scala @@ -17,23 +17,11 @@ package edomata.skunk import _root_.skunk.* -import cats.data.EitherNec -import cats.data.NonEmptyChain import cats.effect.Concurrent -import cats.effect.implicits.* -import cats.effect.kernel.Async -import cats.effect.kernel.Clock import cats.effect.kernel.Resource -import cats.effect.kernel.Temporal -import cats.implicits.* import edomata.backend.* -import edomata.core.* import fs2.Stream -import java.time.OffsetDateTime -import java.time.ZoneOffset -import scala.concurrent.duration.* - private final class SkunkJournalReader[F[_]: Concurrent, E]( pool: Resource[F, Session[F]], q: Queries.Journal[E] diff --git a/modules/skunk/src/main/scala/SkunkOutboxReader.scala b/modules/skunk/src/main/scala/SkunkOutboxReader.scala index accc4e95..b39a2645 100644 --- a/modules/skunk/src/main/scala/SkunkOutboxReader.scala +++ b/modules/skunk/src/main/scala/SkunkOutboxReader.scala @@ -17,23 +17,14 @@ package edomata.skunk import _root_.skunk.* -import cats.data.EitherNec import cats.data.NonEmptyChain import cats.effect.Concurrent -import cats.effect.implicits.* -import cats.effect.kernel.Async import cats.effect.kernel.Clock import cats.effect.kernel.Resource -import cats.effect.kernel.Temporal import cats.implicits.* import edomata.backend.* -import edomata.core.* import fs2.Stream -import java.time.OffsetDateTime -import java.time.ZoneOffset -import scala.concurrent.duration.* - private final class SkunkOutboxReader[F[_]: Concurrent: Clock, N]( pool: Resource[F, Session[F]], q: Queries.Outbox[N] diff --git a/modules/skunk/src/main/scala/SkunkRepository.scala b/modules/skunk/src/main/scala/SkunkRepository.scala index 1403bb21..7c6d182f 100644 --- a/modules/skunk/src/main/scala/SkunkRepository.scala +++ b/modules/skunk/src/main/scala/SkunkRepository.scala @@ -17,21 +17,15 @@ package edomata.skunk import _root_.skunk.* -import _root_.skunk.data.Completion import cats.data.Chain import cats.data.NonEmptyChain -import cats.effect.Concurrent -import cats.effect.kernel.Clock import cats.effect.kernel.Resource import cats.effect.kernel.Sync +import cats.effect.std.UUIDGen import cats.implicits.* import edomata.backend.* import edomata.core.* -import java.time.ZoneOffset -import java.util.UUID -import cats.effect.std.UUIDGen - private final class SkunkRepository[F[_], S, E, R, N]( pool: Resource[F, Session[F]], journal: Queries.Journal[E], @@ -39,7 +33,7 @@ private final class SkunkRepository[F[_], S, E, R, N]( cmds: Queries.Commands, repository: RepositoryReader[F, S, E, R], updates: NotificationsPublisher[F] -)(using F: Sync[F], clock: Clock[F]) +)(using F: Sync[F]) extends Repository[F, S, E, R, N] { private val trx = pool.flatTap(_.transaction) diff --git a/modules/skunk/src/main/scala/SkunkSnapshotPersistence.scala b/modules/skunk/src/main/scala/SkunkSnapshotPersistence.scala index 48cd9893..b0e7c282 100644 --- a/modules/skunk/src/main/scala/SkunkSnapshotPersistence.scala +++ b/modules/skunk/src/main/scala/SkunkSnapshotPersistence.scala @@ -23,7 +23,6 @@ import cats.implicits.* import edomata.backend.PGNamespace import edomata.backend.StreamId import edomata.backend.eventsourcing.* -import edomata.core.* import fs2.Chunk private final class SkunkSnapshotPersistence[F[_]: Concurrent, S]( diff --git a/modules/skunk/src/test/scala/SkunkCompatibilitySuite.scala b/modules/skunk/src/test/scala/SkunkCompatibilitySuite.scala index f56e16b7..978c791b 100644 --- a/modules/skunk/src/test/scala/SkunkCompatibilitySuite.scala +++ b/modules/skunk/src/test/scala/SkunkCompatibilitySuite.scala @@ -21,9 +21,7 @@ import cats.effect.IO import cats.effect.kernel.Resource import cats.implicits.* import edomata.backend.* -import edomata.core.DomainModel import edomata.skunk.* -import edomata.syntax.all.* import natchez.Trace.Implicits.noop import scodec.bits.ByteVector diff --git a/project/EdomataSitePlugin.scala b/project/EdomataSitePlugin.scala new file mode 100644 index 00000000..1283f293 --- /dev/null +++ b/project/EdomataSitePlugin.scala @@ -0,0 +1,149 @@ +import laika.config.ApiLinks +import laika.config.LinkConfig +import laika.ast.Path.Root +import laika.ast._ +import laika.config.LaikaKeys +import laika.helium.Helium +import laika.helium.config._ +import laika.sbt.LaikaConfig +import laika.sbt.LaikaPlugin.autoImport._ +import org.typelevel.sbt.TypelevelSitePlugin.autoImport._ +import laika.theme._ +import sbt.AutoPlugin +import sbt.Plugins +import org.typelevel.sbt.TypelevelSitePlugin +import org.typelevel.sbt.TypelevelVersioningPlugin.autoImport.tlLatestVersion +import sbt._ +import sbt.Keys.version +import cats.data.NonEmptyList +import laika.format.Markdown +import laika.config.SyntaxHighlighting + +object EdomataSitePlugin extends AutoPlugin { + override def requires: Plugins = TypelevelSitePlugin + + private def tl(repo: String) = + TextLink.external(s"https://typelevel.org/$repo/", repo) + + private val relatedProjectLinks = ThemeNavigationSection( + "Related projects", + tl("cats"), + tl("cats-effect"), + TextLink.external("https://fs2.io/", "fs2"), + TextLink.external("https://github.com/typelevel/discipline/", "discipline") + ) + + override def projectSettings: Seq[Def.Setting[_]] = Seq( + tlSiteHelium := build( + version = version.value, + latestVersion = tlLatestVersion.value + ), + laikaConfig := LaikaConfig.defaults + .withConfigValue( + LinkConfig.empty.addApiLinks( + ApiLinks( + tlSiteApiUrl.value + .map(_.toString()) + .getOrElse("/edomata/api/") + ).withPackagePrefix("edomata") + ) + ), + laikaIncludeAPI := true, + laikaExtensions := Seq(Markdown.GitHubFlavor, SyntaxHighlighting) + ) + + private def build(version: String, latestVersion: Option[String]): Helium = + Helium.defaults.site + .mainNavigation(appendLinks = Seq(relatedProjectLinks)) + .site + .metadata( + title = Some("Edomata"), + authors = Seq("Hossein Naderi"), + language = Some("en") + ) + .site + .favIcons( + Favicon.internal(Root / "icon.png", "32x32") + ) + .site + .landingPage( + logo = Some( + Image.internal( + Root / "icon.png", + width = Some(Length(50, LengthUnit.percent)) + ) + ), + title = Some("Edomata"), + subtitle = + Some("Event-driven automatons for Scala, Scala.js and scala native"), + latestReleases = Seq( + ReleaseInfo( + "Latest develop Release", + version + ), + ReleaseInfo("Latest Stable Release", latestVersion.getOrElse("N/A")) + ), + license = Some("Apache 2.0"), + documentationLinks = Seq( + TextLink.internal(Root / "introduction.md", "Introduction"), + TextLink + .internal(Root / "tutorials" / "0_getting_started.md", "Tutorials"), + TextLink.internal(Root / "principles" / "index.md", "Principles"), + TextLink.external( + "https://github.com/hnaderi/edomata-example", + "Example project" + ) + ), + teasers = Seq( + Teaser( + "Purely functional", + "Fully referentially transparent, no exceptions or runtime reflection and integration with cats-effect for polymorphic effect handling." + ), + Teaser( + "Modular/Polymorphic", + "You can decide on your ecosystem, usage, libraries, patterns ..." + ), + Teaser( + "Lightweight", + "Provides simple, composable tools that encourage good design for complex event-driven systems" + ), + Teaser( + "Extensible", + "Everything can be extended easily, if included components or defaults are not suitable for you" + ), + Teaser( + "DDD/Eventsourcing/CQRS", + "enables modeling true eventsourced systems to ensure you can reason about your system" + ), + Teaser( + "Principled", + "Based on simple and battle tested old ideas on how to design and build distributed systems" + ), + Teaser( + "Simple", + "You can easily understand what's going on and don't need a phd in Akka clusterology!" + ), + Teaser( + "Cross platform support", + "Supports all scala platforms, so you can use your application on the server, in the browser or compile to a native binary!" + ) + ) + ) + .site + .topNavigationBar( + homeLink = ImageLink + .internal( + Root / "introduction.md", + Image.internal(Root / "icon.png") + ), + navLinks = Seq( + IconLink + .external("https://github.com/hnaderi/edomata/", HeliumIcon.github), + IconLink + .external("https://edomata.ir/", HeliumIcon.home) + ) + ) + .site + .baseURL("https://edomata.ir/") + +} diff --git a/project/SiteConfig.scala b/project/SiteConfig.scala deleted file mode 100644 index d307d28e..00000000 --- a/project/SiteConfig.scala +++ /dev/null @@ -1,99 +0,0 @@ -import laika.ast.Path.Root -import laika.ast._ -import laika.config.ConfigBuilder -import laika.config.LaikaKeys -import laika.helium.Helium -import laika.helium.config._ -import laika.sbt.LaikaConfig -import laika.theme._ - -object SiteConfigs { - def apply(vars: Map[String, String]): Helium = Helium.defaults.site - .metadata( - title = Some("Edomata"), - authors = Seq("Hossein Naderi"), - language = Some("en") - ) - .site - .favIcons( - Favicon.internal(Root / "icon.png", "32x32") - ) - .site - .landingPage( - logo = Some( - Image.internal( - Root / "icon.png", - width = Some(Length(50, LengthUnit.percent)) - ) - ), - title = Some("Edomata"), - subtitle = - Some("Event-driven automatons for Scala, Scala.js and scala native"), - latestReleases = Seq( - ReleaseInfo( - "Latest develop Release", - vars.getOrElse("SNAPSHOT_VERSION", "N/A") - ), - ReleaseInfo("Latest Stable Release", vars.getOrElse("VERSION", "N/A")) - ), - license = Some("Apache 2.0"), - documentationLinks = Seq( - TextLink.internal(Root / "introduction.md", "Introduction"), - TextLink - .internal(Root / "tutorials" / "0_getting_started.md", "Tutorials"), - TextLink.internal(Root / "principles" / "index.md", "Principles"), - TextLink.external( - "https://github.com/hnaderi/edomata-example", - "Example project" - ) - ), - teasers = Seq( - Teaser( - "Purely functional", - "Fully referentially transparent, no exceptions or runtime reflection and integration with cats-effect for polymorphic effect handling." - ), - Teaser( - "Modular/Polymorphic", - "You can decide on your ecosystem, usage, libraries, patterns ..." - ), - Teaser( - "Lightweight", - "Provides simple, composable tools that encourage good design for complex event-driven systems" - ), - Teaser( - "Extensible", - "Everything can be extended easily, if included components or defaults are not suitable for you" - ), - Teaser( - "DDD/Eventsourcing/CQRS", - "enables modeling true eventsourced systems to ensure you can reason about your system" - ), - Teaser( - "Principled", - "Based on simple and battle tested old ideas on how to design and build distributed systems" - ), - Teaser( - "Simple", - "You can easily understand what's going on and don't need a phd in Akka clusterology!" - ), - Teaser( - "Cross platform support", - "Supports all scala platforms, so you can use your application on the server, in the browser or compile to a native binary!" - ) - ) - ) - .site - .topNavigationBar( - homeLink = ImageLink - .internal(Root / "introduction.md", Image.internal(Root / "icon.png")), - navLinks = Seq( - IconLink - .external("https://github.com/hnaderi/edomata/", HeliumIcon.github), - IconLink - .external("https://edomata.ir/", HeliumIcon.home) - ) - ) - .site - .baseURL("https://edomata.ir/") - -} diff --git a/project/plugins.sbt b/project/plugins.sbt index cc19f356..dda82070 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,9 +3,9 @@ addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") -addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22") -addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.4.22") -addSbtPlugin("org.typelevel" % "sbt-typelevel-github-actions" % "0.4.22") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.2") +addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.2") +addSbtPlugin("org.typelevel" % "sbt-typelevel-github-actions" % "0.6.2") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.1") addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")