Skip to content

Releases: yousty/event_store_client

v3.2.0

22 Jun 15:36
Compare
Choose a tag to compare

Add ability to override the way how event class is resolved from event type.

Previously the event was resolved from an event type only in the pre-defined way - Object.const_get(event_type). Current release adds an ability to add your own resolver using config.event_class_resolver config option. You should define a Proc that accepts a string and returns a class. Example:

EventStoreClient.configure do |config|
  config.event_class_resolver = proc { |event_type| event_type == 'some-event' ? SomeEvent : AnotherEvent }
end

If config.event_class_resolver returns nil - config.default_event_class class will be picked.

v3.1.0

17 May 13:06
Compare
Choose a tag to compare
  • Make has_option matcher a part of the gem

Breaking changes:

  • Drop ruby 2.7 support. Ruby 3.0.0+ is a requirement now

v3.0.0

06 Jan 10:09
Compare
Choose a tag to compare
  • EventStoreClient::DeserializedEvent now accepts :custom_metadata key. You can pass any value there. Example:
EventStoreClient::DeserializedEvent.new(custom_metadata: { foo: :bar, baz: :oof })

That hash will be directly passed to the EventStore DB in the custom_metadata attribute.

  • Added EventStoreClient::DeserializedEvent#system? method which detects whether an event is a system event. System events have #type which starts from $ sign.

  • Adjusted EventStoreClient::DeserializedEvent#== not to take into account #commit_position and #prepare_position. The reason behind this change is because those values may be different when reading from $all stream and when reading from the specific stream

Breaking changes:

  • EventStoreClient::DeserializedEvent#metadata is now split on #metadata and #custom_metadata. All keys, that were present in #metadata before(upon event deserialization when reading from stream), such as "created_at", "encryption", etc, are now located under #custom_metadata. It means if you were relying on #metadata before to retrieve that info - you should adopt your code to rely on #custom_metadata now. Example:

Before:

event = EventStoreClient::DeserializedEvent.new
EventStoreClient.client.append_to_stream('some-stream', event)
event_from_db = EventStoreClient.client.read('some-stream').last
event_from_db.metadata['created_at'] # => returns string representation of time, e.g. `"2022-12-27 11:40:54 UTC"`

After:

event = EventStoreClient::DeserializedEvent.new
EventStoreClient.client.append_to_stream('some-stream', event)
event_from_db = EventStoreClient.client.read('some-stream').last
event_from_db.metadata # Now contains only "type", "content-type" and "created" keys
event_from_db.custom_metadata['created_at'] # => returns string representation of time, e.g. `"2022-12-27 11:40:54 UTC"`
  • Drop dry-monads gem dependency. Previously all EventStoreClient.client methods were returning either Dry::Monads::Success or Dry::Monads::Failure, and now they return the result which corresponds to the called method. In cases where Dry::Monads::Failure object was returned - it raises the appropriate error now. Example:

Before:

EventStoreClient.client.read('$all') 
# => Dry::Monads::Success([<#EventStoreClient::DeserializedEvent>])
EventStoreClient.client.read('non-existing-stream')
# => Dry::Monads::Failure(:stream_not_found)
EventStoreClient.client.subscribe_to_all(handler: proc { |result| event = result.success; p event })

After:

EventStoreClient.client.read('$all') 
# => [<#EventStoreClient::DeserializedEvent>]
EventStoreClient.client.read('non-existing-stream')
# => raises EventStoreClient::StreamNotFoundError error
EventStoreClient.client.subscribe_to_all(handler: proc { |event| p event })

Please check updated guides in docs/ for more information.

v2.3.0

23 Dec 08:22
Compare
Choose a tag to compare

No changes since v2.3.0-beta2. I am just marking v2.3.0-beta2 as stable.

v2.3.0-beta2

20 Dec 11:52
Compare
Choose a tag to compare

Make EventStoreClient::GRPC::Client#config public

v2.3.0-beta

20 Dec 11:09
Compare
Choose a tag to compare
  • Add a possibility to provide define configurations.
    Example:
EventStoreClient.configure do |config|
  config.eventstore_url = 'esdb://admin:changeit@localhost:2111,localhost:2112,localhost:2113'
end

EventStoreClient.configure(name: :another_config) do |config|
  config.eventstore_url = 'esdb://admin:changeit@localhost:2115/?tls=false'
end

Now you can use it like so:

EventStoreClient.client.read(...) # default(unnamed) config will be used
EventStoreClient.client(config_name: :another_config).read(...) # :another_config config will be used

Breaking changes:

  • To configure a mapper, you have to provide :config keyword argument. If you use default mapper - you don't have to change anything.
    Example:
EventStoreClient.configure do |config|
  config.mapper = EventStoreClient::Mapper::Encrypted.new(some_key_repository, config: config)
end

v2.2.0

05 Dec 19:16
Compare
Choose a tag to compare
  • Add ability to configure channel arguments
    Now you can configure channel arguments. Example:
EventStoreClient.configure do |config|
  config.channel_args = { 'grpc.min_reconnect_backoff_ms' => 200 }
end

More info can be found in configuration docs

v2.1.5

05 Dec 11:22
Compare
Choose a tag to compare
  • All generated code, based of Protos should be scoped to the client's namespace
  • Temporary disable bin/rebuild_protos script

Refs EventStore/EventStore#3671

v2.1.4

29 Nov 14:45
Compare
Choose a tag to compare
  • Fix a bug when using paginated read to read from a projection

v2.1.3

26 Nov 12:24
Compare
Choose a tag to compare
  • Force encoding to ASCII-8BIT in SerializedEvent#to_grpc
  • Serializer::Json.serialize now returns duped string if input argument is a string