Releases: RailsEventStore/rails_event_store
v2.8.1
v2.8.0
RubyEventStore
-
Add: Possibility to declare stored type for type serializers of
Mappers::Transformation::PreserveTypes
transformation [832be46]Most of the time serializers in
Mappers::Transformation::PreserveTypes
can rely onClass#name
to deduct the type. However in some edge cases this is not sufficient. For exampleActiveSupport::TimeWithZone
overrides name to present itself asTime
.PreserveTypes.new .register( ActiveSupport::TimeWithZone, serializer: -> (v) { v.iso8601(9) }, deserializer: -> (v) { Time.iso8601(v).in_time_zone }, stored_type: -> (v) { "ActiveSupport::TimeWithZone" } # don't rely on v.class.name for this type )
RailsEventStore
-
Add: Bounded context generator now generates test requires for minitest like it did for rspec [#1189, de4f742]
This helps
rails t
runner and other tools to discover bounded context tests.
RailsEventStoreActiveRecord
-
Fix: Correct order when reading bi-temporal events by
valid_at
timestamp, when it was the same ascreated_at
[fa484a5, #1518]When
created_at
andvalid_at
are the same, we apply an optimization to store only the former timestamp. Reads ordered byvalid_at
(as_of
) did not adjust to this optimization correctly. -
Change: When reading events of particular named stream, don't join to
event_store_events
table when filtering criteria do not require it [8caeb4e, #1517]This is expected to improve performance when reading enormous streams without filtering.
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes
v2.7.0
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
- Change: Add dependency on
ruby_event_store-active_record
gem. Despite additional dependency, everything else stays the same on the surface until next major version.
RubyEventStore::ActiveRecord
This is a new gem, that will be replacing rails_event_store_active_record
in the next major version — that is 3.0. The rails_event_store_active_record
already did not depend on Rails, but it has the name suggesting otherwise. This is what we're gradually changing.
What is more, the ruby_event_store-active_record
ships with a convenient Rake task to generate and perform migrations without Rails. It also gives a possibility to perform database-related tasks provided by ActiveRecord
[#1479]
Usage:
# Rakefile
require "ruby_event_store/active_record/rake_task"
To generate a migration with event store tables, type:
bundle exec rake db:migrations:copy DATA_TYPE=data_type
By default, migrations are created at db/migrate
directory.
Available data types are jsonb
, json
and binary
for PostgreSQL. For MySQL and SQLite the data type can be only set to binary
.
To perform the migration, type:
DATABASE_URL=your_database_url bundle exec rake db:migrate
AggregateRoot
-
Add: Introduced experimental
AggregateRoot::SnapshotRepository
[#1480]repository = AggregateRoot::SnapshotRepository.new(event_store)
It uses an additional stream to store aggregate dumps in marshal format with a configurable interval.
# saves aggregate snapshot on each 50 events repository = AggregateRoot::SnapshotRepository.new(event_store, 50)
Marshal format has its limitations. Dumping an aggregate will not work if its instance variables are bindings, procedure or method objects, instances of class IO, or singleton objects. In such cases, a standard procedure of storing and loading aggregate from its whole events stream will be applied.
To control whether aggregate roots are dumped and restored properly, you can subscribe to
ActiveSupport::Notifications
viaAggregateRoot::InstrumentedRepository
.require 'logger' instrumented_repository = InstrumentedRepository.new(repository, ActiveSupport::Notifications) logger = Logger.new(STDOUT) ActiveSupport::Notifications.subscribe("error_occured.repository.aggregate_root") do |_name, _start, _finish, _id, payload| logger.warn(payload[:exception_object].message) end
Related: https://blog.arkency.com/speed-up-aggregate-roots-loading-with-snapshot-events/
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
-
Fix: compatibility with
Pathname
objects present in$LOAD_PATH
[#1494, 8acc93c]Apparently Rails suggests extending
$LOAD_PATH
withPathname
, e.g.config.autoload_paths << Rails.root.join("extras")
inconfig/application.rb
. Rubocop is also forcing those. We're only looking for bundler-added entries in$LOAD_PATH
which are definitely strings.
v2.6.0
RubyEventStore
-
Change: Friendlier default.
RubyEventStore::InMemoryRepository
is now the default repository forRubyEventStore::Client
[#978] -
Add: Preserve types transform [#1103]
Adds a new transformation
RubyEventStore::Mappers::Transformation::PreserveTypes
. Not used by default,
you need to explicitly define it in your pipeline mapper. It allows to register custom serializer and deserializer
for types used in domain event attributes. Information about types is stored in event's metadata.Usage:
class MyMapper < RubyEventStore::Mappers::PipelineMapper def initialize super( RubyEventStore::Mappers::Pipeline.new( Transformation::PreserveTypes .new .register(Symbol, serializer: ->(v) { v.to_s }, deserializer: ->(v) { v.to_sym }) .register(Time, serializer: ->(v) { v.iso8601(9) }, deserializer: ->(v) { Time.iso8601(v) }) .register(Date, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { Date.iso8601(v) }) .register(DateTime, serializer: ->(v) { v.iso8601(9) }, deserializer: ->(v) { DateTime.iso8601(v) }), Transformation::SymbolizeMetadataKeys.new ) ) end end
-
Add: Instrumented subscriptions [#1109]
RailsEventStore
-
Change: Instrumented subscriptions are now used by default to instrument subscriptions creation [#1109]
-
Change: Transform the job arguments with symbol keys to string keys when using
RailsEventStore::ActiveJobScheduler
. This enables compatibility with Sidekiq 7 used as an engine in ActiveJob and clears warnings generated with Sidekiq < 7 [d602ac2]
RailsEventStoreActiveRecord
- Fix: Unexpected handling of empty array when linking using AR repo. Linking empty list to stream should be a no-op [#1430, #1417]
AggregateRoot
-
Add: Instrument AggregateRoot's apply method with instrumented apply strategy [#1111]
You need to explicitly wrap you apply strategy with
AggregateRoot::InstrumentedApplyStrategy
to use it.
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
-
Change: Browser working from git source [#1187]
Previously you could not use Browser when using
ruby_event_store-browser
from git source. Directly or indirectly, when pointingrails_event_store
togithub: RailsEventStore/rails_event_store
inGemfile
. Now, for particular commits, that are head of pushed changeset, we're building source assets and pushing them to CDN. Browser is aware of being sourced from git repository and switches to CDN source for this particular commit that it is built from. It is quite limited but still an improvement. We're looking for reliable way to build assets for each commit pushed in a changeset, so that limitations are gone. -
Change: Rack 3.0 compatibility [956c3cd]
-
Fix: Browser now displays all streams that an event belongs to [comment]
v2.5.1
v2.5.0
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
- no changes
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
-
Fix: Support Content-Security-Policy for
style-src
— no inline styles in Browser. [#1346] -
Change: Drop
sinatra
dependency. Now onlyrack
is needed to run Browser — whether mounted in Rails, Hanami or as a standalone application. [#1341, #958] -
Deprecate: Passing keyword arguments
environment
,host
orpath
toRubyEventStore::Browser::App.for
is deprecated and scheduled for removal on next major release. These options no longer make sense and Browser can handle well existing use cases without them. [6e0b85e]
v2.4.1
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
-
Fix: Regression when appending empty list of records [f741204]
Normally appending empty list of records should result in a no-operation. When introducing ActiveRecord's bulk insert functionality over external
activerecord-import
, we unintentionally leaked its behaviour for empty collections:ArgumentError: Empty list of attributes passed
This release restores old behaviour and ensures it remains consistent across all shipped event repositories.
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- no changes
v2.4.0
RubyEventStore
-
Add:
RubyEventStore::Client#event_in_stream?
API which returns the position of given event in the stream [#1225] -
Add: Testing against and official support for Ruby 3.1
-
Fix: YAML support under Ruby 3.1 and Psych 4.0 [#1294]
Up until now regular YAML module shipped with Ruby was used as a default serializer. However, with release of Ruby 3.1 this module started to use Psych 4 instead of Psych 3. This, in turn, resulted in a breaking change when non-primitive values were serialized and deserializes, as since version 4 Psych does "safe loading" by default, which disallows deserializing objects such as BigDecimal or Time. As this breaking change also leaks into RES (old events would no longer be correctly deserialized afer upgrading to Ruby 3.1), a proxy serializer is introduced.
-
Remove: Testing against Ruby 2.6 and official support for this EOL release
-
Remove: Drop no longer needed
ruby2_keywords
dependency
RailsEventStore
-
Add:
RailsEventStore::AsyncHandler.with
now also takesevent_store_locator:
keyword argument which overrides event store passed byevent_store:
keyword argument if both are passed [#1239]The
event_store_locator
serves the same purpose except that it takes a callable, which returns a lazy-evaluated event store, instead of taking strictly-evaluated event store instance. Theevent_store:
will be removed in next major release (3.0). -
Add: Testing against and official support for Rails 7.0
-
Add: Testing against and official support for Ruby 3.1
-
Remove: Testing against Rails 5.0, 5.1 and 5.2 and official support for this EOL releases
-
Remove: Testing against Ruby 2.6 and official support for this EOL release
RailsEventStoreActiveRecord
- Add: Testing against and official support for Rails 7.0
- Add: Testing against and official support for Ruby 3.1
- Remove: Testing against Rails 5.0, 5.1 and 5.2 and official support for this EOL releases
- Remove: Testing against Ruby 2.6 and official support for this EOL release
- Remove: Drop no longer needed
activerecord-import
dependency. This functionality is now available natively in ActiveRecord [#1313]
AggregateRoot
- Add: Testing against and official support for Ruby 3.1
- Remove: Testing against Ruby 2.6 and official support for this EOL release
- Remove: Drop no longer needed
ruby2_keywords
dependency
RubyEventStore::RSpec
- Add: Testing against and official support for Ruby 3.1
- Remove: Testing against Ruby 2.6 and official support for this EOL release
RubyEventStore::Browser
v2.0.3
RubyEventStore
- no changes
RailsEventStore
- no changes
RailsEventStoreActiveRecord
- no changes
AggregateRoot
- no changes
RubyEventStore::RSpec
- no changes
RubyEventStore::Browser
- Fix: Release 2.0.2 was released without javascript packages, so whole browser does not work in that release.
v2.0.2
RubyEventStore
- Fix: Remove problematic
mutant.yml
symlink from released gem [#1236]
RailsEventStore
- Fix: Remove problematic
mutant.yml
symlink from released gem [#1236]
RailsEventStoreActiveRecord
- Fix: Remove problematic
mutant.yml
symlink from released gem [#1236]
AggregateRoot
- Fix: Remove problematic
mutant.yml
symlink from released gem [#1236]
RubyEventStore::RSpec
- Fix: Remove problematic
mutant.yml
symlink from released gem [#1236]
RubyEventStore::Browser
- no changes