Current section

Files

Jump to
fact mix.exs
Raw

mix.exs

defmodule Fact.MixProject do
  use Mix.Project

  @name "Fact"
  @version "0.4.2"
  @codename "AESop"
  @source_url "https://github.com/evntd/fact"
  @maintainers ["Jake Bruun"]
  @authors ["Jake Bruun"]

  def project do
    [
      aliases: aliases(),
      app: :fact,
      version: @version,
      codename: @codename,
      elixir: "~> 1.14",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      description: description(),
      dialyzer: dialyzer(),
      docs: docs(),
      package: package(),
      name: @name,
      source_url: @source_url,
      test_coverage: test_coverage()
    ]
  end

  def aliases do
    [
      docs: ["docs", &copy_images/1]
    ]
  end

  def application do
    [
      extra_applications: [:logger]
    ]
  end

  def copy_images(_) do
    File.cp!("guides/assets/images/process-model.svg", "doc/assets/process-model.svg")
  end

  defp deps do
    [
      {:jason, "~> 1.4", optional: true},
      {:phoenix_pubsub, "~> 2.2"},
      {:uuid, "~> 2.0", hex: :uuid_erl},

      # Tools
      {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
      {:ex_doc, "~> 0.34", only: :dev, runtime: false}
    ]
  end

  defp description do
    """
    A file system based event store.
    """
  end

  defp docs do
    [
      api_references: true,
      authors: @authors,
      canonical: "https://hexdocs.pm/Fact",
      cover: "guides/assets/images/epub-cover.png",
      extra_section: "GUIDES",
      extras: [
        "LICENSE",
        "guides/components/encryption.md",
        "guides/components/indexers.md",
        "guides/components/merkle-mountain-range.md",
        "guides/components/queries-and-indexes.md",
        "guides/components/record-cache.md",
        "guides/components/seam-architecture.md",
        "guides/components/write-ahead-log.md",
        "guides/introduction/getting-started.md",
        "guides/introduction/process-model.md",
        "guides/introduction/dedication.md": [title: "Dedication"]
      ],
      favicon: "guides/assets/images/turt-16.png",
      groups_for_extras: [
        Introduction: [
          "guides/introduction/getting-started.md",
          "guides/introduction/dedication.md",
          "guides/introduction/process-model.md"
        ],
        Components: [
          "guides/components/encryption.md",
          "guides/components/indexers.md",
          "guides/components/merkle-mountain-range.md",
          "guides/components/queries-and-indexes.md",
          "guides/components/record-cache.md",
          "guides/components/seam-architecture.md",
          "guides/components/write-ahead-log.md"
        ]
      ],
      groups_for_modules: [
        Api: [
          Fact
        ],
        Context: [
          Fact.BootstrapFile,
          Fact.BootstrapFile.Context,
          Fact.BootstrapFile.Decoder,
          Fact.BootstrapFile.Encoder,
          Fact.BootstrapFile.Name,
          Fact.BootstrapFile.Reader,
          Fact.BootstrapFile.Writer,
          Fact.Context,
          Fact.Event,
          Fact.Event.Id,
          Fact.Event.Schema,
          Fact.IndexCheckpointFile,
          Fact.IndexCheckpointFile.Decoder,
          Fact.IndexCheckpointFile.Encoder,
          Fact.IndexCheckpointFile.Name,
          Fact.IndexCheckpointFile.Reader,
          Fact.IndexCheckpointFile.Writer,
          Fact.IndexFile,
          Fact.IndexFile.Decoder,
          Fact.IndexFile.Encoder,
          Fact.IndexFile.Name,
          Fact.IndexFile.Reader,
          Fact.IndexFile.Writer,
          Fact.LedgerFile,
          Fact.LedgerFile.Decoder,
          Fact.LedgerFile.Encoder,
          Fact.LedgerFile.Name,
          Fact.LedgerFile.Reader,
          Fact.LedgerFile.Writer,
          Fact.LockFile,
          Fact.LockFile.Decoder,
          Fact.LockFile.Encoder,
          Fact.LockFile.Name,
          Fact.LockFile.Reader,
          Fact.LockFile.Writer,
          Fact.RecordFile,
          Fact.RecordFile.Decoder,
          Fact.RecordFile.Encoder,
          Fact.RecordFile.Name,
          Fact.RecordFile.Reader,
          Fact.RecordFile.Writer,
          Fact.Storage
        ],
        Core: [
          Fact.BuildInfo,
          Fact.Database,
          Fact.EventLedger,
          Fact.EventReader,
          Fact.EventStreamWriter,
          Fact.Query,
          Fact.QueryItem,
          Fact.RecordCache,
          Fact.WriteAheadLog,
          Fact.WriteAheadLog.Entry
        ],
        Encryption: [
          Fact.Encryption.KEKProvider,
          Fact.Encryption.KEKProvider.Explicit,
          Fact.KeyRing
        ],
        Genesis: [
          Fact.Genesis.Command.CreateDatabase.V1,
          Fact.Genesis.Decider,
          Fact.Genesis.Event.DatabaseCreated.V1,
          Fact.Genesis.TheCreator
        ],
        Integrity: [
          Fact.MerkleMountainRange
        ],
        Indexing: [
          Fact.EventDataIndexer,
          Fact.EventIndexer,
          Fact.EventMetadataIndexer,
          Fact.EventStreamCategoryIndexer,
          Fact.EventStreamIndexer,
          Fact.EventStreamsByCategoryIndexer,
          Fact.EventStreamsIndexer,
          Fact.EventTagsIndexer,
          Fact.EventTypeIndexer
        ],
        Process: [
          Fact.Bootstrapper,
          Fact.DatabaseSupervisor,
          Fact.Lock,
          Fact.Registry,
          Fact.Supervisor
        ],
        "Pub/Sub": [
          Fact.CatchUpSubscription,
          Fact.CatchUpSubscription.All,
          Fact.CatchUpSubscription.Index,
          Fact.CatchUpSubscription.Query,
          Fact.CatchUpSubscription.Stream,
          Fact.EventPublisher
        ],
        Seams: [
          Fact.Seam,
          Fact.Seam.Adapter,
          Fact.Seam.Decoder,
          Fact.Seam.Decoder.Adapter,
          Fact.Seam.Decoder.Binary.V1,
          Fact.Seam.Decoder.Delimited.V1,
          Fact.Seam.Decoder.Integer.V1,
          Fact.Seam.Decoder.Json.V1,
          Fact.Seam.Decoder.Raw.V1,
          Fact.Seam.Decoder.Registry,
          Fact.Seam.Encoder,
          Fact.Seam.Encoder.Adapter,
          Fact.Seam.Encoder.Binary.V1,
          Fact.Seam.Encoder.Delimited.V1,
          Fact.Seam.Encoder.Integer.V1,
          Fact.Seam.Encoder.Json.V1,
          Fact.Seam.Encoder.Raw.V1,
          Fact.Seam.Encoder.Registry,
          Fact.Seam.EventId,
          Fact.Seam.EventId.Adapter,
          Fact.Seam.EventId.Registry,
          Fact.Seam.EventId.Uuid.V4,
          Fact.Seam.EventSchema,
          Fact.Seam.EventSchema.Adapter,
          Fact.Seam.EventSchema.Registry,
          Fact.Seam.EventSchema.Emmett.V1,
          Fact.Seam.EventSchema.Kurrent.V1,
          Fact.Seam.EventSchema.Marten.V1,
          Fact.Seam.EventSchema.Standard.V1,
          Fact.Seam.FileName,
          Fact.Seam.FileName.Adapter,
          Fact.Seam.FileName.ContentAddressable.V1,
          Fact.Seam.FileName.EventId.V1,
          Fact.Seam.FileName.Fixed.V1,
          Fact.Seam.FileName.Hash.V1,
          Fact.Seam.FileName.Raw.V1,
          Fact.Seam.FileName.Registry,
          Fact.Seam.FileReader,
          Fact.Seam.FileReader.Adapter,
          Fact.Seam.FileReader.Encrypted.V1,
          Fact.Seam.FileReader.FixedLength.V1,
          Fact.Seam.FileReader.Full.V1,
          Fact.Seam.FileReader.Registry,
          Fact.Seam.FileWriter,
          Fact.Seam.FileWriter.Adapter,
          Fact.Seam.FileWriter.Encrypted.V1,
          Fact.Seam.FileWriter.Standard.V1,
          Fact.Seam.FileWriter.Registry,
          Fact.Seam.Instance,
          Fact.Seam.Parsers,
          Fact.Seam.Registry,
          Fact.Seam.Storage,
          Fact.Seam.Storage.Adapter,
          Fact.Seam.Storage.Standard.V1,
          Fact.Seam.Storage.Standard.V2,
          Fact.Seam.Storage.Registry
        ]
      ],
      language: "en",
      logo: "guides/assets/images/turt-48.png",
      main: "getting-started",
      nest_modules_by_prefix: [
        Fact.BootstrapFile,
        Fact.Event,
        Fact.Genesis,
        Fact.IndexCheckpointFile,
        Fact.IndexFile,
        Fact.LedgerFile,
        Fact.LockFile,
        Fact.RecordFile,
        Fact.Seam,
        Fact.Seam.Decoder,
        Fact.Seam.Encoder,
        Fact.Seam.EventId,
        Fact.Seam.EventSchema,
        Fact.Seam.FileName,
        Fact.Seam.FileReader,
        Fact.Seam.FileWriter,
        Fact.Seam.Storage
      ]
    ]
  end

  defp dialyzer do
    [
      plt_add_apps: [:ex_unit, :mix, :phoenix_pubsub]
    ]
  end

  defp package do
    [
      maintainers: @maintainers,
      licenses: ["MIT"],
      links: %{
        "GitHub" => @source_url
      }
    ]
  end

  defp test_coverage do
    [
      ignore_modules: [
        Fact.EventIndexer,
        # Seam behaviours and adapters (macro-generated boilerplate, tested via implementations)
        Fact.Seam.Adapter,
        Fact.Seam.Decoder,
        Fact.Seam.Decoder.Adapter,
        Fact.Seam.Encoder,
        Fact.Seam.Encoder.Adapter,
        Fact.Seam.Encoder.Raw.V1,
        Fact.Seam.EventId,
        Fact.Seam.EventId.Adapter,
        Fact.Seam.EventSchema,
        Fact.Seam.EventSchema.Adapter,
        Fact.Seam.FileName,
        Fact.Seam.FileName.Adapter,
        Fact.Seam.FileReader,
        Fact.Seam.FileReader.Adapter,
        Fact.Seam.FileWriter,
        Fact.Seam.FileWriter.Adapter,
        Fact.Seam.Registry,
        Fact.Seam.Storage,
        Fact.Seam.Storage.Adapter,
        # Mix tasks (CLI wrappers)
        Mix.Tasks.Fact.Backup,
        Mix.Tasks.Fact.Restore,
        Mix.Tasks.Fact.Merkle.CreateProof,
        Mix.Tasks.Fact.Merkle.Root,
        Mix.Tasks.Fact.Merkle.Verify,
        Mix.Tasks.Fact.Merkle.VerifyProof,
        # Debug utility
        Fact.CatchUpSubscription.DebugSubscriber,
        # MMR requires CAS-mode database and async PubSub; tested via mix tasks and smoke tests
        Fact.MerkleMountainRange,
        # Index subscription tested indirectly via query subscription
        Fact.CatchUpSubscription.Index,
        # LockFile is adapter boilerplate — lock/unlock tested through Fact.Lock
        Fact.LockFile,
        Fact.LockFile.Decoder,
        Fact.LockFile.Encoder,
        Fact.LockFile.Name,
        Fact.LockFile.Reader,
        Fact.LockFile.Writer
      ],
      summary: [
        threshold: 80
      ]
    ]
  end
end