v2.1.0
RubyEventStore
-
Remove: Deprecated methods from previous release are gone [#946]
-
Add: Record upcasting as a way to on-the-fly transform previous event versions into newer ones when reading [#836]
Usage:
class Mapper < PipelineMapper
def initialize(upcast_map: {})
super(Pipeline.new(
Transformation::Upcast.new(upcast_map),
))
end
end
RubyEventStore::Client.new(
mapper: Mapper.new(upcast_map: {
'OldEventType' => lambda { |record|
Record.new(
event_type: 'NewEventType',
data: ...,
metadata: record.metadata,
timestamp: record.timestamp,
valid_at: record.valid_at,
event_id: record.event_id
)
}
}),
repository: ...
)
-
Add: Introduce explicit event type resolver [#837]
Previously we'd always expect that a string with event type or anything responding to
to_s
can be passed to APIs expecting event type —of_type
,subscribe
etc. That stays as a default for backward compatibility but can be customized so that:
class SomeEvent < MyEvent
self.event_type = "some.event"
end
client = RubyEventStore::Client.new(
repository: InMemoryRepository.new,
subscriptions: Subscriptions.new(event_type_resolver: ->(klass) { klass.event_type })
)
client.subscribe(lambda { |event| ... }, to: [SomeEvent])
# Previously this needed to be: [SomeEvent.event_type]
RailsEventStore
- Remove: Deprecated methods from previous release are gone [#946]
RailsEventStoreActiveRecord
- Change: Minimal required
activerecord
version specified [afe6bbd]
AggregateRoot
- no changes
RubyEventStore::RSpec
- Remove: Wrapper for old
rails_event_store-rspec
gem name is now gone [#946]
RubyEventStore::Browser
- no changes