cratis_chronicle_contracts

Generated Chronicle gRPC contracts for Elixir.

This package is intentionally non-idiomatic. Its job is to expose generated protobuf and gRPC client modules that an idiomatic Elixir client can build on top of later.

Installation

def deps do
  [
    {:cratis_chronicle_contracts, "~> 0.1.0"}
  ]
end

What Is In The Package

Generating The Elixir Client

From the repository root:

cd Source/Clients/Elixir
bash ./generate-protos.sh

The script:

  1. Copies Source/Kernel/Protobuf into priv/protos
  2. Generates Elixir protobuf and gRPC modules into lib/generated

The generated files are not meant to be edited by hand.

Using Generated Stubs

After generating the Elixir sources, use the generated *.Stub modules under Cratis.Chronicle.Contracts.* with the channel returned by your gRPC connection/channel implementation.

For example, after generation you can call the generated services like this:

{:ok, response} =
  Cratis.Chronicle.Contracts.EventStores.Stub.get_event_stores(
    channel,
    Google.Protobuf.Empty.new()
  )

Publishing

The repository contains a dedicated GitHub Actions workflow for publishing this package to Hex. The publish flow regenerates the Elixir sources from the current proto files before running tests and mix hex.publish --yes.