├── .github
└── workflows
│ ├── aggregate_root_coverage.yml
│ ├── aggregate_root_mutate.yml
│ ├── aggregate_root_test.yml
│ ├── dres_client_test.yml
│ ├── dres_rails_test.yml
│ ├── minitest-ruby_event_store_coverage.yml
│ ├── minitest-ruby_event_store_mutate.yml
│ ├── minitest-ruby_event_store_test.yml
│ ├── rails_event_store_coverage.yml
│ ├── rails_event_store_mutate.yml
│ ├── rails_event_store_test.yml
│ ├── ruby_event_store-active_record_coverage.yml
│ ├── ruby_event_store-active_record_mutate.yml
│ ├── ruby_event_store-active_record_test.yml
│ ├── ruby_event_store-browser_assets.yml
│ ├── ruby_event_store-browser_coverage.yml
│ ├── ruby_event_store-browser_mutate.yml
│ ├── ruby_event_store-browser_test.yml
│ ├── ruby_event_store-flipper_coverage.yml
│ ├── ruby_event_store-flipper_mutate.yml
│ ├── ruby_event_store-flipper_test.yml
│ ├── ruby_event_store-newrelic_coverage.yml
│ ├── ruby_event_store-newrelic_mutate.yml
│ ├── ruby_event_store-newrelic_test.yml
│ ├── ruby_event_store-outbox_coverage.yml
│ ├── ruby_event_store-outbox_mutate.yml
│ ├── ruby_event_store-outbox_test.yml
│ ├── ruby_event_store-profiler_coverage.yml
│ ├── ruby_event_store-profiler_mutate.yml
│ ├── ruby_event_store-profiler_test.yml
│ ├── ruby_event_store-protobuf_coverage.yml
│ ├── ruby_event_store-protobuf_mutate.yml
│ ├── ruby_event_store-protobuf_test.yml
│ ├── ruby_event_store-rom_coverage.yml
│ ├── ruby_event_store-rom_mutate.yml
│ ├── ruby_event_store-rom_test.yml
│ ├── ruby_event_store-rspec_coverage.yml
│ ├── ruby_event_store-rspec_mutate.yml
│ ├── ruby_event_store-rspec_test.yml
│ ├── ruby_event_store-sequel_coverage.yml
│ ├── ruby_event_store-sequel_mutate.yml
│ ├── ruby_event_store-sequel_test.yml
│ ├── ruby_event_store-sidekiq_scheduler_coverage.yml
│ ├── ruby_event_store-sidekiq_scheduler_mutate.yml
│ ├── ruby_event_store-sidekiq_scheduler_test.yml
│ ├── ruby_event_store-transformations_coverage.yml
│ ├── ruby_event_store-transformations_mutate.yml
│ ├── ruby_event_store-transformations_test.yml
│ ├── ruby_event_store_coverage.yml
│ ├── ruby_event_store_mutate.yml
│ └── ruby_event_store_test.yml
├── .gitignore
├── .streerc
├── APP_TEMPLATE
├── CONTRIBUTING.md
├── LICENSE
├── Makefile
├── README.md
├── RELEASE.md
├── RES_VERSION
├── aggregate_root
├── .mutant.yml
├── Gemfile
├── Gemfile.lock
├── Gemfile.rails_7_2
├── Gemfile.rails_7_2.lock
├── Makefile
├── README.md
├── aggregate_root.gemspec
├── bin
│ ├── mutant
│ └── rspec
├── lib
│ ├── aggregate_root.rb
│ └── aggregate_root
│ │ ├── configuration.rb
│ │ ├── default_apply_strategy.rb
│ │ ├── instrumented_apply_strategy.rb
│ │ ├── instrumented_repository.rb
│ │ ├── repository.rb
│ │ ├── snapshot_repository.rb
│ │ ├── transform.rb
│ │ └── version.rb
└── spec
│ ├── aggregate_root_marshalling_spec.rb
│ ├── aggregate_root_spec.rb
│ ├── instrumented_apply_strategy_spec.rb
│ ├── instrumented_repository_spec.rb
│ ├── no_warnings_spec.rb
│ ├── repository_spec.rb
│ ├── snapshot_repository_spec.rb
│ ├── spec_helper.rb
│ └── transform_spec.rb
├── contrib
├── Makefile
├── README.md
├── dres_client
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Makefile
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── dres_client.gemspec
│ ├── lib
│ │ ├── dres_client.rb
│ │ └── dres_client
│ │ │ └── version.rb
│ └── spec
│ │ ├── dres_client_spec.rb
│ │ ├── shared
│ │ ├── body1.json
│ │ ├── body2.json
│ │ └── body3.json
│ │ └── spec_helper.rb
├── dres_rails
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Makefile
│ ├── app
│ │ ├── controllers
│ │ │ └── dres_rails
│ │ │ │ └── application_controller.rb
│ │ └── models
│ │ │ └── dres_rails
│ │ │ ├── job.rb
│ │ │ └── queue.rb
│ ├── bin
│ │ ├── mutant
│ │ ├── rails
│ │ ├── rspec
│ │ └── setup
│ ├── config
│ │ └── routes.rb
│ ├── db
│ │ └── migrate
│ │ │ ├── 20180802140810_create_dres_rails_queues.rb
│ │ │ └── 20180809123523_create_queue_jobs_table.rb
│ ├── dres_rails.gemspec
│ ├── lib
│ │ ├── dres_rails.rb
│ │ ├── dres_rails
│ │ │ ├── engine.rb
│ │ │ └── identity.rb
│ │ ├── generators
│ │ │ └── dres_rails
│ │ │ │ ├── install
│ │ │ │ ├── USAGE
│ │ │ │ └── install_generator.rb
│ │ │ │ └── upgrade
│ │ │ │ ├── USAGE
│ │ │ │ └── upgrade_generator.rb
│ │ └── tasks
│ │ │ └── dres_rails_tasks.rake
│ └── spec
│ │ ├── dummy
│ │ ├── Rakefile
│ │ ├── app
│ │ │ ├── assets
│ │ │ │ ├── config
│ │ │ │ │ └── manifest.js
│ │ │ │ ├── images
│ │ │ │ │ └── .keep
│ │ │ │ ├── javascripts
│ │ │ │ │ ├── application.js
│ │ │ │ │ ├── cable.js
│ │ │ │ │ └── channels
│ │ │ │ │ │ └── .keep
│ │ │ │ └── stylesheets
│ │ │ │ │ └── application.css
│ │ │ ├── channels
│ │ │ │ └── application_cable
│ │ │ │ │ ├── channel.rb
│ │ │ │ │ └── connection.rb
│ │ │ ├── controllers
│ │ │ │ ├── application_controller.rb
│ │ │ │ └── concerns
│ │ │ │ │ └── .keep
│ │ │ ├── helpers
│ │ │ │ └── application_helper.rb
│ │ │ ├── jobs
│ │ │ │ └── application_job.rb
│ │ │ ├── mailers
│ │ │ │ └── application_mailer.rb
│ │ │ ├── models
│ │ │ │ ├── application_record.rb
│ │ │ │ └── concerns
│ │ │ │ │ └── .keep
│ │ │ └── views
│ │ │ │ └── layouts
│ │ │ │ ├── application.html.erb
│ │ │ │ ├── mailer.html.erb
│ │ │ │ └── mailer.text.erb
│ │ ├── bin
│ │ │ ├── bundle
│ │ │ ├── rails
│ │ │ ├── rake
│ │ │ ├── setup
│ │ │ ├── update
│ │ │ └── yarn
│ │ ├── config.ru
│ │ ├── config
│ │ │ ├── application.rb
│ │ │ ├── boot.rb
│ │ │ ├── cable.yml
│ │ │ ├── database.yml
│ │ │ ├── environment.rb
│ │ │ ├── environments
│ │ │ │ ├── development.rb
│ │ │ │ ├── production.rb
│ │ │ │ └── test.rb
│ │ │ ├── initializers
│ │ │ │ ├── application_controller_renderer.rb
│ │ │ │ ├── assets.rb
│ │ │ │ ├── backtrace_silencers.rb
│ │ │ │ ├── cookies_serializer.rb
│ │ │ │ ├── filter_parameter_logging.rb
│ │ │ │ ├── inflections.rb
│ │ │ │ ├── mime_types.rb
│ │ │ │ └── wrap_parameters.rb
│ │ │ ├── locales
│ │ │ │ └── en.yml
│ │ │ ├── puma.rb
│ │ │ ├── routes.rb
│ │ │ ├── secrets.yml
│ │ │ └── spring.rb
│ │ ├── db
│ │ │ ├── migrate
│ │ │ │ ├── 20180802142436_create_dres_rails_queues.dres_rails.rb
│ │ │ │ └── 20180809123950_create_queue_jobs_table.dres_rails.rb
│ │ │ └── schema.rb
│ │ ├── lib
│ │ │ └── assets
│ │ │ │ └── .keep
│ │ ├── package.json
│ │ └── public
│ │ │ ├── 404.html
│ │ │ ├── 422.html
│ │ │ ├── 500.html
│ │ │ ├── apple-touch-icon-precomposed.png
│ │ │ ├── apple-touch-icon.png
│ │ │ └── favicon.ico
│ │ ├── features
│ │ └── expose_spec.rb
│ │ ├── models
│ │ └── queue_spec.rb
│ │ ├── rails_helper.rb
│ │ ├── shared
│ │ ├── body2.json
│ │ └── body3.json
│ │ └── spec_helper.rb
├── minitest-ruby_event_store
│ ├── .mutant.yml
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── lib
│ │ └── minitest
│ │ │ ├── ruby_event_store.rb
│ │ │ └── ruby_event_store
│ │ │ ├── assertions.rb
│ │ │ └── version.rb
│ ├── minitest-ruby_event_store.gemspec
│ └── test
│ │ ├── minitest
│ │ └── ruby_event_store_test.rb
│ │ └── test_helper.rb
├── ruby_event_store-flipper
│ ├── .mutant.yml
│ ├── CHANGELOG.md
│ ├── Gemfile
│ ├── Gemfile.activesupport_7_1
│ ├── Gemfile.activesupport_7_1.lock
│ ├── Gemfile.activesupport_7_2
│ ├── Gemfile.activesupport_7_2.lock
│ ├── Gemfile.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── lib
│ │ ├── generators
│ │ │ └── ruby_event_store
│ │ │ │ └── flipper
│ │ │ │ ├── events_generator.rb
│ │ │ │ └── templates
│ │ │ │ └── events.rb
│ │ └── ruby_event_store
│ │ │ ├── flipper.rb
│ │ │ └── flipper
│ │ │ ├── events.rb
│ │ │ └── version.rb
│ ├── ruby_event_store-flipper.gemspec
│ └── spec
│ │ ├── flipper_spec.rb
│ │ ├── ruby_event_store
│ │ └── flipper_spec.rb
│ │ └── spec_helper.rb
├── ruby_event_store-newrelic
│ ├── .mutant.yml
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── lib
│ │ └── ruby_event_store
│ │ │ ├── newrelic.rb
│ │ │ └── newrelic
│ │ │ └── version.rb
│ ├── ruby_event_store-newrelic.gemspec
│ └── spec
│ │ ├── ruby_event_store
│ │ └── newrelic_spec.rb
│ │ └── spec_helper.rb
├── ruby_event_store-outbox
│ ├── .mutant.yml
│ ├── CHANGELOG.md
│ ├── Dockerfile
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_1
│ ├── Gemfile.rails_7_1.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Gemfile.sidekiq_6_5
│ ├── Gemfile.sidekiq_6_5.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ ├── res_outbox
│ │ └── rspec
│ ├── lib
│ │ ├── generators
│ │ │ └── ruby_event_store
│ │ │ │ └── outbox
│ │ │ │ ├── migration_generator.rb
│ │ │ │ └── templates
│ │ │ │ └── create_event_store_outbox_template.erb
│ │ └── ruby_event_store
│ │ │ ├── outbox.rb
│ │ │ └── outbox
│ │ │ ├── batch_result.rb
│ │ │ ├── cleanup_strategies.rb
│ │ │ ├── cleanup_strategies
│ │ │ ├── clean_old_enqueued.rb
│ │ │ └── none.rb
│ │ │ ├── cli.rb
│ │ │ ├── configuration.rb
│ │ │ ├── consumer.rb
│ │ │ ├── fetch_specification.rb
│ │ │ ├── metrics.rb
│ │ │ ├── metrics
│ │ │ ├── influx.rb
│ │ │ ├── null.rb
│ │ │ └── test.rb
│ │ │ ├── repository.rb
│ │ │ ├── runner.rb
│ │ │ ├── sidekiq5_format.rb
│ │ │ ├── sidekiq_processor.rb
│ │ │ ├── sidekiq_producer.rb
│ │ │ ├── sidekiq_scheduler.rb
│ │ │ ├── tempo.rb
│ │ │ └── version.rb
│ ├── ruby_event_store-outbox.gemspec
│ └── spec
│ │ ├── batch_result_spec.rb
│ │ ├── cli_spec.rb
│ │ ├── consumer_spec.rb
│ │ ├── metrics
│ │ ├── factory_spec.rb
│ │ ├── influx_spec.rb
│ │ └── null_spec.rb
│ │ ├── migration_test_spec.rb
│ │ ├── repository_spec.rb
│ │ ├── runner_spec.rb
│ │ ├── sidekiq_correctness_spec.rb
│ │ ├── sidekiq_scheduler_spec.rb
│ │ ├── spec_helper.rb
│ │ ├── support
│ │ ├── db.rb
│ │ └── sidekiq.rb
│ │ └── tempo_spec.rb
├── ruby_event_store-profiler
│ ├── .mutant.yml
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── examples
│ │ └── demo
│ ├── lib
│ │ └── ruby_event_store
│ │ │ ├── profiler.rb
│ │ │ └── profiler
│ │ │ └── version.rb
│ ├── ruby_event_store-profiler.gemspec
│ └── spec
│ │ ├── profiler_spec.rb
│ │ └── spec_helper.rb
├── ruby_event_store-protobuf
│ ├── .mutant.yml
│ ├── CHANGELOG.md
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_1
│ ├── Gemfile.rails_7_1.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── lib
│ │ └── ruby_event_store
│ │ │ ├── protobuf.rb
│ │ │ └── protobuf
│ │ │ ├── mappers
│ │ │ ├── protobuf.rb
│ │ │ └── transformation
│ │ │ │ ├── proto_event.rb
│ │ │ │ ├── protobuf_encoder.rb
│ │ │ │ └── protobuf_nested_struct_metadata.rb
│ │ │ └── version.rb
│ ├── ruby_event_store-protobuf.gemspec
│ └── spec
│ │ ├── aggregate_root_spec.rb
│ │ ├── client_spec.rb
│ │ ├── link_by_metadata_spec.rb
│ │ ├── mappers
│ │ ├── events.proto
│ │ ├── events_pb.rb
│ │ ├── protobuf_spec.rb
│ │ └── transformation
│ │ │ ├── proto_event_spec.rb
│ │ │ ├── protobuf_encoder_spec.rb
│ │ │ └── protobuf_nested_struct_metadata_spec.rb
│ │ ├── no_warnings_spec.rb
│ │ ├── protobuf_integration_spec.rb
│ │ └── spec_helper.rb
├── ruby_event_store-rom
│ ├── .mutant.yml
│ ├── CHANGELOG.md
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── README.md
│ ├── Rakefile
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── db
│ │ └── migrate
│ │ │ └── 20210806000000_create_ruby_event_store_tables.rb
│ ├── lib
│ │ ├── ruby_event_store-rom.rb
│ │ └── ruby_event_store
│ │ │ ├── rom.rb
│ │ │ └── rom
│ │ │ ├── changesets
│ │ │ ├── create_events.rb
│ │ │ ├── create_stream_entries.rb
│ │ │ └── update_events.rb
│ │ │ ├── event_repository.rb
│ │ │ ├── index_violation_detector.rb
│ │ │ ├── mappers
│ │ │ ├── event_to_serialized_record.rb
│ │ │ └── stream_entry_to_serialized_record.rb
│ │ │ ├── rake_task.rb
│ │ │ ├── relations
│ │ │ ├── events.rb
│ │ │ └── stream_entries.rb
│ │ │ ├── repositories
│ │ │ ├── events.rb
│ │ │ └── stream_entries.rb
│ │ │ ├── tasks
│ │ │ └── migration_tasks.rake
│ │ │ ├── types.rb
│ │ │ ├── unit_of_work.rb
│ │ │ └── version.rb
│ ├── ruby_event_store-rom.gemspec
│ ├── spec
│ │ ├── rom
│ │ │ ├── event_repository_spec.rb
│ │ │ ├── no_warnings_spec.rb
│ │ │ └── rom_spec.rb
│ │ └── spec_helper.rb
│ └── tmp
│ │ └── .gitkeep
├── ruby_event_store-sequel
│ ├── .mutant.yml
│ ├── CHANGELOG.md
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── lib
│ │ └── ruby_event_store
│ │ │ ├── generators
│ │ │ └── templates
│ │ │ │ ├── 1_create_ruby_event_store_tables.rb
│ │ │ │ ├── mysql
│ │ │ │ └── 1_create_ruby_event_store_tables.rb
│ │ │ │ └── postgres
│ │ │ │ └── 1_create_ruby_event_store_tables.rb
│ │ │ ├── sequel.rb
│ │ │ └── sequel
│ │ │ ├── event_repository.rb
│ │ │ ├── index_violation_detector.rb
│ │ │ └── version.rb
│ ├── ruby_event_store-sequel.gemspec
│ └── spec
│ │ ├── event_repository_spec.rb
│ │ └── spec_helper.rb
├── ruby_event_store-sidekiq_scheduler
│ ├── .mutant.yml
│ ├── CHANGELOG.md
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Gemfile.sidekiq_6_5
│ ├── Gemfile.sidekiq_6_5.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ │ ├── mutant
│ │ └── rspec
│ ├── lib
│ │ └── ruby_event_store
│ │ │ ├── sidekiq_scheduler.rb
│ │ │ └── sidekiq_scheduler
│ │ │ └── version.rb
│ ├── ruby_event_store-sidekiq_scheduler.gemspec
│ └── spec
│ │ ├── async_handler_helpers_spec.rb
│ │ ├── no_warnings_spec.rb
│ │ ├── sidekiq_scheduler_spec.rb
│ │ └── spec_helper.rb
└── ruby_event_store-transformations
│ ├── .mutant.yml
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Gemfile.rails_7_2
│ ├── Gemfile.rails_7_2.lock
│ ├── Makefile
│ ├── README.md
│ ├── bin
│ ├── mutant
│ └── rspec
│ ├── lib
│ └── ruby_event_store
│ │ ├── transformations.rb
│ │ └── transformations
│ │ ├── identity_map.rb
│ │ ├── version.rb
│ │ └── with_indifferent_access.rb
│ ├── ruby_event_store-transformations.gemspec
│ └── spec
│ ├── identity_map_spec.rb
│ ├── no_warnings_spec.rb
│ ├── spec_helper.rb
│ └── with_indifferent_access_spec.rb
├── netlify.toml
├── rails_event_store
├── .mutant.yml
├── Gemfile
├── Gemfile.lock
├── Gemfile.rails_7_1
├── Gemfile.rails_7_1.lock
├── Gemfile.rails_7_2
├── Gemfile.rails_7_2.lock
├── Makefile
├── README.md
├── bin
│ ├── mutant
│ └── rspec
├── lib
│ ├── generators
│ │ ├── rails_event_store
│ │ │ ├── bounded_context_generator.rb
│ │ │ ├── rspec_generator.rb
│ │ │ └── test_unit_generator.rb
│ │ └── templates
│ │ │ ├── bc_spec.erb
│ │ │ ├── module.erb
│ │ │ ├── require_bc_spec.erb
│ │ │ ├── require_bc_test.erb
│ │ │ ├── spec_helper.erb
│ │ │ └── test_helper.erb
│ ├── rails_event_store.rb
│ └── rails_event_store
│ │ ├── active_job_id_only_scheduler.rb
│ │ ├── active_job_scheduler.rb
│ │ ├── after_commit_async_dispatcher.rb
│ │ ├── all.rb
│ │ ├── async_handler_helpers.rb
│ │ ├── browser.rb
│ │ ├── client.rb
│ │ ├── json_client.rb
│ │ ├── link_by_metadata.rb
│ │ ├── middleware.rb
│ │ ├── railtie.rb
│ │ └── version.rb
├── rails_event_store.gemspec
└── spec
│ ├── active_job_id_only_scheduler_spec.rb
│ ├── active_job_scheduler_spec.rb
│ ├── after_commit_async_dispatcher_spec.rb
│ ├── async_handler_helpers_spec.rb
│ ├── browser_integration_spec.rb
│ ├── client_spec.rb
│ ├── deprecation_spec.rb
│ ├── dummy_7_1
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Rakefile
│ ├── bin
│ │ └── rails
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── credentials.yml.enc
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── application_controller_renderer.rb
│ │ │ ├── backtrace_silencers.rb
│ │ │ ├── content_security_policy.rb
│ │ │ ├── cookies_serializer.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ ├── mime_types.rb
│ │ │ ├── permissions_policy.rb
│ │ │ └── wrap_parameters.rb
│ │ ├── locales
│ │ │ └── en.yml
│ │ ├── master.key
│ │ ├── routes.rb
│ │ └── spring.rb
│ └── test
│ │ └── test_helper.rb
│ ├── dummy_7_2
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Rakefile
│ ├── bin
│ │ └── rails
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── credentials.yml.enc
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── content_security_policy.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ ├── inflections.rb
│ │ │ └── permissions_policy.rb
│ │ ├── locales
│ │ │ └── en.yml
│ │ ├── master.key
│ │ ├── puma.rb
│ │ └── routes.rb
│ └── test
│ │ └── test_helper.rb
│ ├── dummy_8_0
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── Rakefile
│ ├── bin
│ │ └── rails
│ ├── config
│ │ ├── application.rb
│ │ ├── boot.rb
│ │ ├── credentials.yml.enc
│ │ ├── environment.rb
│ │ ├── environments
│ │ │ ├── development.rb
│ │ │ ├── production.rb
│ │ │ └── test.rb
│ │ ├── initializers
│ │ │ ├── content_security_policy.rb
│ │ │ ├── filter_parameter_logging.rb
│ │ │ └── inflections.rb
│ │ ├── locales
│ │ │ └── en.yml
│ │ ├── master.key
│ │ ├── puma.rb
│ │ └── routes.rb
│ └── test
│ │ └── test_helper.rb
│ ├── example_invoicing_app.rb
│ ├── full_story_spec.rb
│ ├── generators_spec.rb
│ ├── json_client_spec.rb
│ ├── link_by_metadata_spec.rb
│ ├── middleware_integration_spec.rb
│ ├── middleware_spec.rb
│ ├── migration_spec.rb
│ ├── no_warnings_spec.rb
│ ├── rails_event_id_index_migration_generator_spec.rb
│ ├── rails_foreign_key_on_event_id_migration_generator_spec.rb
│ ├── rails_migration_generator_spec.rb
│ ├── spec_helper.rb
│ └── support
│ ├── fake_configuration.rb
│ └── test_application.rb
├── railseventstore.org
├── Makefile
├── README.md
├── babel.config.js
├── docs
│ ├── advanced-topics
│ │ ├── bi-temporal.md
│ │ ├── command-bus.md
│ │ ├── custom-repository.md
│ │ ├── event-serialization-formats.md
│ │ ├── gdpr.md
│ │ ├── instrumentation.md
│ │ ├── mappers.md
│ │ ├── mapping-handlers-to-events.md
│ │ ├── migrating-existing-events.md
│ │ ├── protobuf.html.md
│ │ ├── transactions.md
│ │ └── without-rails.md
│ ├── common-usage-patterns
│ │ └── publishing_unique_events.md
│ ├── contributing
│ │ └── maintenance_policy.md
│ ├── core-concepts
│ │ ├── browser.md
│ │ ├── client-errors.md
│ │ ├── correlation-causation.md
│ │ ├── delete.md
│ │ ├── event-sourcing.md
│ │ ├── expected-version.md
│ │ ├── internals.mdx
│ │ ├── link.md
│ │ ├── projections.md
│ │ ├── publish.md
│ │ ├── pubsub.md
│ │ ├── read.md
│ │ ├── request-metadata.md
│ │ ├── rspec.md
│ │ └── subscribe.md
│ ├── custom_components_2_0.html.md
│ ├── getting-started
│ │ ├── api.md
│ │ ├── install.mdx
│ │ └── introduction.md
│ ├── minitest.html.md
│ ├── publish-sequence-diagram.mmd
│ ├── read-sequence-diagram.mmd
│ └── subscribe-sequence-diagram.mmd
├── docusaurus.config.js
├── package-lock.json
├── package.json
├── plugins
│ └── tailwind-config.cjs
├── sidebars.json
├── source
│ ├── billetto.html.erb
│ └── images
│ │ ├── anenta.png
│ │ ├── billetto-chart.png
│ │ └── jobvalley.svg
├── src
│ ├── components
│ │ ├── Asciinema.js
│ │ ├── HomepageCompanies
│ │ │ └── index.js
│ │ └── HomepageFeatures
│ │ │ └── index.js
│ ├── css
│ │ └── custom.css
│ ├── helpers
│ │ └── getYoutubeId.js
│ ├── pages
│ │ ├── billetto.js
│ │ ├── community.js
│ │ ├── contributing.js
│ │ ├── data
│ │ │ ├── apps.json
│ │ │ ├── articles.json
│ │ │ ├── gems_v1.json
│ │ │ ├── gems_v2.json
│ │ │ └── videos.json
│ │ ├── index.js
│ │ └── support.js
│ └── theme
│ │ └── DocItem
│ │ └── Content
│ │ └── index.js
├── static
│ ├── .nojekyll
│ ├── images
│ │ ├── .keep
│ │ ├── acatus_logo.svg
│ │ ├── anenta.png
│ │ ├── arkency.svg
│ │ ├── assist_logo.png
│ │ ├── bi_temporal_event_sourcing_when_things_go_smoothly.jpg
│ │ ├── bi_temporal_valid_at_event_sourcing.jpg
│ │ ├── billetto-chart.png
│ │ ├── billetto_logo.svg
│ │ ├── favicons
│ │ │ ├── res-rubies-120x120.png
│ │ │ ├── res-rubies-152x152.png
│ │ │ ├── res-rubies-160x160.png
│ │ │ ├── res-rubies-167x167.png
│ │ │ ├── res-rubies-16x16.png
│ │ │ ├── res-rubies-180x180.png
│ │ │ ├── res-rubies-192x192.png
│ │ │ ├── res-rubies-270x270.png
│ │ │ ├── res-rubies-310x310.png
│ │ │ ├── res-rubies-32x32.png
│ │ │ ├── res-rubies-70x70.png
│ │ │ └── res-rubies-96x96.png
│ │ ├── gat-logo.svg
│ │ ├── jobvalley.svg
│ │ ├── localhost_3000_res_.png
│ │ ├── monterail.svg
│ │ ├── trezy.svg
│ │ ├── yago.svg
│ │ ├── zencargo_logo.png
│ │ └── zencargo_logo.svg
│ ├── img
│ │ ├── docusaurus-social-card.jpg
│ │ ├── docusaurus-social-card.png
│ │ ├── docusaurus.png
│ │ ├── favicon.ico
│ │ ├── github.svg
│ │ ├── logo.svg
│ │ ├── undraw_docusaurus_mountain.svg
│ │ ├── undraw_docusaurus_react.svg
│ │ └── undraw_docusaurus_tree.svg
│ └── robots.txt
├── tailwind.config.js
├── versioned_docs
│ ├── version-1.3.1
│ │ ├── advanced
│ │ │ ├── api.md
│ │ │ ├── app.md
│ │ │ ├── browser.md
│ │ │ ├── command_bus.md
│ │ │ ├── correlation_causation.md
│ │ │ ├── exceptions.md
│ │ │ ├── expected_version.md
│ │ │ ├── gdpr.md
│ │ │ ├── instrumentation.md
│ │ │ ├── mapping_serialization.md
│ │ │ ├── migrating_messages.md
│ │ │ ├── projection.md
│ │ │ ├── repository.md
│ │ │ ├── request_metadata.md
│ │ │ ├── rspec.md
│ │ │ └── without_rails.md
│ │ ├── getting-started
│ │ │ ├── delete.md
│ │ │ ├── install.md
│ │ │ ├── link.md
│ │ │ ├── publish.md
│ │ │ ├── read.md
│ │ │ ├── start.md
│ │ │ └── subscribe.md
│ │ └── tutorials
│ │ │ ├── protobuf.md
│ │ │ └── pubsub.md
│ └── version-2.16.0
│ │ ├── advanced-topics
│ │ ├── bi-temporal.md
│ │ ├── command-bus.md
│ │ ├── custom-repository.md
│ │ ├── event-serialization-formats.md
│ │ ├── gdpr.md
│ │ ├── instrumentation.md
│ │ ├── mappers.md
│ │ ├── mapping-handlers-to-events.md
│ │ ├── migrating-existing-events.md
│ │ ├── protobuf.html.md
│ │ ├── transactions.md
│ │ └── without-rails.md
│ │ ├── common-usage-patterns
│ │ └── publishing_unique_events.md
│ │ ├── contributing
│ │ └── maintenance_policy.md
│ │ ├── core-concepts
│ │ ├── browser.md
│ │ ├── client-errors.md
│ │ ├── correlation-causation.md
│ │ ├── delete.md
│ │ ├── event-sourcing.md
│ │ ├── expected-version.md
│ │ ├── link.md
│ │ ├── projections.md
│ │ ├── publish.md
│ │ ├── pubsub.md
│ │ ├── read.md
│ │ ├── request-metadata.md
│ │ ├── rspec.md
│ │ └── subscribe.md
│ │ ├── custom_components_2_0.html.md
│ │ ├── getting-started
│ │ ├── api.md
│ │ ├── install.mdx
│ │ └── introduction.md
│ │ └── minitest.html.md
├── versioned_sidebars
│ ├── version-1.3.1-sidebars.json
│ └── version-2.16.0-sidebars.json
└── versions.json
├── ruby_event_store-active_record
├── .mutant.yml
├── Gemfile
├── Gemfile.activerecord_7_1
├── Gemfile.activerecord_7_1.lock
├── Gemfile.activerecord_7_2
├── Gemfile.activerecord_7_2.lock
├── Gemfile.lock
├── Makefile
├── README.md
├── bin
│ ├── mutant
│ └── rspec
├── lib
│ ├── rails_event_store_active_record.rb
│ └── ruby_event_store
│ │ ├── active_record.rb
│ │ └── active_record
│ │ ├── batch_enumerator.rb
│ │ ├── event.rb
│ │ ├── event_repository.rb
│ │ ├── event_repository_reader.rb
│ │ ├── generators
│ │ ├── database_adapter.rb
│ │ ├── event_id_index_migration_generator.rb
│ │ ├── foreign_key_on_event_id_migration_generator.rb
│ │ ├── migration_generator.rb
│ │ ├── rails_event_id_index_migration_generator.rb
│ │ ├── rails_foreign_key_on_event_id_migration_generator.rb
│ │ ├── rails_migration_generator.rb
│ │ └── templates
│ │ │ ├── add_event_id_index_to_event_store_events_in_streams_template.erb
│ │ │ ├── add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb
│ │ │ ├── create_event_store_events_template.erb
│ │ │ ├── mysql
│ │ │ ├── add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb
│ │ │ └── create_event_store_events_template.erb
│ │ │ └── postgres
│ │ │ ├── add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb
│ │ │ ├── create_event_store_events_template.erb
│ │ │ └── validate_add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb
│ │ ├── index_violation_detector.rb
│ │ ├── pg_linearized_event_repository.rb
│ │ ├── railtie.rb
│ │ ├── rake_task.rb
│ │ ├── tasks
│ │ └── migration_tasks.rake
│ │ ├── version.rb
│ │ ├── with_abstract_base_class.rb
│ │ └── with_default_models.rb
├── rails_event_store_active_record.gemspec
├── ruby_event_store-active_record.gemspec
└── spec
│ ├── batch_enumerator_spec.rb
│ ├── database_adapter_spec.rb
│ ├── event_id_index_migration_generator_spec.rb
│ ├── event_repository_spec.rb
│ ├── foreign_key_on_event_id_migration_generator_spec.rb
│ ├── migration_generator_spec.rb
│ ├── migration_test_spec.rb
│ ├── no_warnings_spec.rb
│ ├── pg_linearized_event_repository_spec.rb
│ ├── rake_task_spec.rb
│ ├── skip_ar_serialization_spec.rb
│ ├── spec_helper.rb
│ ├── transactions_spec.rb
│ ├── with_abstract_base_class_spec.rb
│ └── with_default_models_spec.rb
├── ruby_event_store-browser
├── .mutant.yml
├── Gemfile
├── Gemfile.lock
├── Gemfile.rack_2_0
├── Gemfile.rack_2_0.lock
├── Makefile
├── README.md
├── bin
│ ├── generate_timezones_map.rb
│ ├── mutant
│ └── rspec
├── devserver
│ └── config.ru
├── elm
│ ├── README.md
│ ├── elm.json
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ │ ├── Api.elm
│ │ ├── BrowserTime.elm
│ │ ├── Flags.elm
│ │ ├── Layout.elm
│ │ ├── LinkedTimezones.elm
│ │ ├── Main.elm
│ │ ├── Page
│ │ │ ├── ShowEvent.elm
│ │ │ └── ShowStream.elm
│ │ ├── Pagination.elm
│ │ ├── Route.elm
│ │ ├── Search.elm
│ │ ├── Url
│ │ │ └── OurExtra.elm
│ │ ├── WrappedModel.elm
│ │ └── style.css
│ ├── tailwind.config.js
│ └── tests
│ │ ├── ChangingTreeStateTest.elm
│ │ ├── DecodersTest.elm
│ │ └── RouteTest.elm
├── lib
│ └── ruby_event_store
│ │ ├── browser.rb
│ │ └── browser
│ │ ├── app.rb
│ │ ├── gem_source.rb
│ │ ├── get_event.rb
│ │ ├── get_events_from_stream.rb
│ │ ├── get_stream.rb
│ │ ├── json_api_event.rb
│ │ ├── json_api_stream.rb
│ │ ├── router.rb
│ │ ├── urls.rb
│ │ └── version.rb
├── public
│ ├── .gitkeep
│ ├── android-chrome-192x192.png
│ ├── android-chrome-512x512.png
│ ├── apple-touch-icon.png
│ ├── bootstrap.js
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── favicon.ico
│ ├── mstile-144x144.png
│ ├── mstile-150x150.png
│ ├── mstile-310x150.png
│ ├── mstile-310x310.png
│ ├── mstile-70x70.png
│ └── safari-pinned-tab.svg
├── ruby_event_store-browser.gemspec
└── spec
│ ├── api
│ ├── event_correlation_causation_streams_spec.rb
│ ├── event_spec.rb
│ ├── events_from_stream_pagination_spec.rb
│ ├── events_from_stream_spec.rb
│ ├── stream_related_streams_spec.rb
│ └── stream_spec.rb
│ ├── browser_settings_spec.rb
│ ├── deprecation_spec.rb
│ ├── gem_source_spec.rb
│ ├── legacy_event_spec.rb
│ ├── no_warnings_spec.rb
│ ├── router_spec.rb
│ ├── spec_helper.rb
│ ├── support
│ ├── api_client.rb
│ ├── csp_app.rb
│ ├── integration_helpers.rb
│ ├── schema.json
│ └── web_client.rb
│ ├── ui_spec.rb
│ ├── urls_spec.rb
│ └── web_spec.rb
├── ruby_event_store-rspec
├── .mutant.yml
├── Gemfile
├── Gemfile.lock
├── Gemfile.rails_7_2
├── Gemfile.rails_7_2.lock
├── Makefile
├── README.md
├── bin
│ ├── mutant
│ └── rspec
├── lib
│ └── ruby_event_store
│ │ ├── rspec.rb
│ │ └── rspec
│ │ ├── apply.rb
│ │ ├── be_event.rb
│ │ ├── crude_failure_message_formatter.rb
│ │ ├── expected_collection.rb
│ │ ├── fetch_events.rb
│ │ ├── fetch_unpublished_events.rb
│ │ ├── have_applied.rb
│ │ ├── have_published.rb
│ │ ├── have_subscribed_to_events.rb
│ │ ├── match_events.rb
│ │ ├── matchers.rb
│ │ ├── publish.rb
│ │ ├── step_by_step_failure_message_formatter.rb
│ │ └── version.rb
├── ruby_event_store-rspec.gemspec
└── spec
│ ├── no_warnings_spec.rb
│ ├── ruby_event_store
│ └── rspec
│ │ ├── apply_spec.rb
│ │ ├── be_event_spec.rb
│ │ ├── expected_collection_spec.rb
│ │ ├── have_applied_spec.rb
│ │ ├── have_published_spec.rb
│ │ ├── have_subscribed_to_events_spec.rb
│ │ ├── matchers_spec.rb
│ │ ├── publish_spec.rb
│ │ └── step_by_step_failure_message_formatter_spec.rb
│ └── spec_helper.rb
├── ruby_event_store
├── .mutant.yml
├── Gemfile
├── Gemfile.lock
├── Gemfile.rails_7_2
├── Gemfile.rails_7_2.lock
├── Makefile
├── README.md
├── bin
│ ├── mutant
│ └── rspec
├── lib
│ ├── ruby_event_store.rb
│ └── ruby_event_store
│ │ ├── batch_enumerator.rb
│ │ ├── broker.rb
│ │ ├── client.rb
│ │ ├── composed_broker.rb
│ │ ├── composed_dispatcher.rb
│ │ ├── constants.rb
│ │ ├── correlated_commands.rb
│ │ ├── dispatcher.rb
│ │ ├── errors.rb
│ │ ├── event.rb
│ │ ├── event_type_resolver.rb
│ │ ├── expected_version.rb
│ │ ├── immediate_async_dispatcher.rb
│ │ ├── in_memory_repository.rb
│ │ ├── instrumented_broker.rb
│ │ ├── instrumented_dispatcher.rb
│ │ ├── instrumented_repository.rb
│ │ ├── instrumented_subscriptions.rb
│ │ ├── link_by_metadata.rb
│ │ ├── mappers
│ │ ├── batch_mapper.rb
│ │ ├── default.rb
│ │ ├── encryption_key.rb
│ │ ├── encryption_mapper.rb
│ │ ├── forgotten_data.rb
│ │ ├── in_memory_encryption_key_repository.rb
│ │ ├── instrumented_batch_mapper.rb
│ │ ├── instrumented_mapper.rb
│ │ ├── json_mapper.rb
│ │ ├── null_mapper.rb
│ │ ├── pipeline.rb
│ │ ├── pipeline_mapper.rb
│ │ └── transformation
│ │ │ ├── domain_event.rb
│ │ │ ├── encryption.rb
│ │ │ ├── event_class_remapper.rb
│ │ │ ├── preserve_types.rb
│ │ │ ├── stringify_metadata_keys.rb
│ │ │ ├── symbolize_metadata_keys.rb
│ │ │ └── upcast.rb
│ │ ├── metadata.rb
│ │ ├── null.rb
│ │ ├── projection.rb
│ │ ├── record.rb
│ │ ├── serialized_record.rb
│ │ ├── serializers
│ │ └── yaml.rb
│ │ ├── spec
│ │ ├── broker_lint.rb
│ │ ├── dispatcher_lint.rb
│ │ ├── event_lint.rb
│ │ ├── event_repository_lint.rb
│ │ ├── mapper_lint.rb
│ │ ├── scheduler_lint.rb
│ │ └── subscriptions_lint.rb
│ │ ├── specification.rb
│ │ ├── specification_reader.rb
│ │ ├── specification_result.rb
│ │ ├── stream.rb
│ │ ├── subscriptions.rb
│ │ ├── transform_keys.rb
│ │ └── version.rb
├── ruby_event_store.gemspec
└── spec
│ ├── batch_enumerator_spec.rb
│ ├── broker_spec.rb
│ ├── client_notify_subscribers_spec.rb
│ ├── client_spec.rb
│ ├── client_subscriptions_spec.rb
│ ├── composed_broker_spec.rb
│ ├── composed_dispatcher_spec.rb
│ ├── correlated_commands_spec.rb
│ ├── deprecation_spec.rb
│ ├── dispatcher_spec.rb
│ ├── event_type_resolver_spec.rb
│ ├── expected_version_spec.rb
│ ├── get_event_spec.rb
│ ├── immediate_async_dispatcher_spec.rb
│ ├── in_memory_repository_spec.rb
│ ├── instrumented_broker_spec.rb
│ ├── instrumented_dispatcher_spec.rb
│ ├── instrumented_repository_spec.rb
│ ├── instrumented_subscriptions_spec.rb
│ ├── link_by_metadata_spec.rb
│ ├── mappers
│ ├── batch_mapper_spec.rb
│ ├── custom_mapper_with_types_spec.rb
│ ├── default_spec.rb
│ ├── encryption_mapper_spec.rb
│ ├── events.proto3
│ ├── forgotten_data_spec.rb
│ ├── instrumented_batch_mapper_spec.rb
│ ├── instrumented_mapper_spec.rb
│ ├── json_mapper_spec.rb
│ ├── null_mapper_spec.rb
│ ├── pipeline_spec.rb
│ ├── transform_keys_spec.rb
│ └── transformation
│ │ ├── domain_event_spec.rb
│ │ ├── encryption_spec.rb
│ │ ├── event_class_remapper_spec.rb
│ │ ├── preserve_types_spec.rb
│ │ ├── stringify_metadata_keys_spec.rb
│ │ ├── symbolize_metadata_keys_spec.rb
│ │ └── upcast_spec.rb
│ ├── metadata_spec.rb
│ ├── no_warnings_spec.rb
│ ├── projection_spec.rb
│ ├── record_spec.rb
│ ├── serialized_record_spec.rb
│ ├── spec_helper.rb
│ ├── specification_spec.rb
│ ├── stream_spec.rb
│ ├── subscriptions_spec.rb
│ ├── support
│ └── correlatable.rb
│ └── within_spec.rb
└── support
├── bundler
├── Gemfile.database
└── Gemfile.shared
├── ci
└── generate
├── helpers
├── migrator.rb
├── protobuf_helper.rb
├── rspec_defaults.rb
├── rspec_sql_matchers.rb
├── schema_helper.rb
├── silence_stdout.rb
├── silence_warnings.rb
├── subprocess_helper.rb
└── time_enrichment.rb
├── make
├── gem.mk
├── help.mk
├── install.mk
├── mutant.mk
└── test.mk
└── nix
├── mysql_8_0.nix
├── mysql_8_4.nix
├── postgres_13.nix
├── postgres_14.nix
├── postgres_15.nix
├── postgres_16.nix
├── postgres_17.nix
├── pushtrap.sh
└── redis.nix
/.gitignore:
--------------------------------------------------------------------------------
1 | .bundle/
2 | .yardoc
3 | .rspec_status
4 | .sass-cache/
5 | .cache/
6 | _yardoc/
7 | coverage/
8 | log/
9 | pkg/
10 | tmp/
11 | bin/*
12 | !bin/res_outbox
13 | spec/reports/
14 | spec/tmp/
15 | db.sqlite3
16 | node_modules/
17 | elm-stuff/
18 | build/
19 | contributors.json
20 | config/master.key
21 | *.orig
22 | ruby_event_store-browser/public/*
23 | !ruby_event_store-browser/public/bootstrap.js
24 | .inch/
25 | .tmp
26 | support/bundler/*.lock
27 | .docusaurus/
28 | npm-debug.log*
29 | yarn-debug.log*
30 | yarn-error.log*
31 |
--------------------------------------------------------------------------------
/.streerc:
--------------------------------------------------------------------------------
1 | --print-width=120
2 | --plugins=plugin/trailing_comma
3 | --ignore-files=**/*_pb.rb
4 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to this repository
2 |
3 | Contribution Policy for this repository: [https://railseventstore.org/contributing/](https://railseventstore.org/contributing/)
4 |
--------------------------------------------------------------------------------
/RES_VERSION:
--------------------------------------------------------------------------------
1 | 2.16.0
2 |
--------------------------------------------------------------------------------
/aggregate_root/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - aggregate_root
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - AggregateRoot*
17 | ignore:
18 | - AggregateRoot::DefaultApplyStrategy#event_type
19 |
--------------------------------------------------------------------------------
/aggregate_root/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "activesupport", "~> 8.0.0"
10 |
--------------------------------------------------------------------------------
/aggregate_root/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "activesupport", "~> 7.2.0"
10 |
--------------------------------------------------------------------------------
/aggregate_root/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat ../RES_VERSION)
2 | GEM_NAME = aggregate_root
3 |
4 | include ../support/make/install.mk
5 | include ../support/make/test.mk
6 | include ../support/make/mutant.mk
7 | include ../support/make/gem.mk
8 | include ../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/aggregate_root/README.md:
--------------------------------------------------------------------------------
1 | # AggregateRoot
2 |
3 | Event sourced aggregate root implementation for RubyEventStore.
4 |
5 | Find out more at [https://railseventstore.org](https://railseventstore.org/)
6 |
--------------------------------------------------------------------------------
/aggregate_root/bin/mutant:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'mutant' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12 |
13 | bundle_binstub = File.expand_path("bundle", __dir__)
14 |
15 | if File.file?(bundle_binstub)
16 | if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17 | load(bundle_binstub)
18 | else
19 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21 | end
22 | end
23 |
24 | require "rubygems"
25 | require "bundler/setup"
26 |
27 | load Gem.bin_path("mutant", "mutant")
28 |
--------------------------------------------------------------------------------
/aggregate_root/bin/rspec:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'rspec' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12 |
13 | bundle_binstub = File.expand_path("bundle", __dir__)
14 |
15 | if File.file?(bundle_binstub)
16 | if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17 | load(bundle_binstub)
18 | else
19 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21 | end
22 | end
23 |
24 | require "rubygems"
25 | require "bundler/setup"
26 |
27 | load Gem.bin_path("rspec-core", "rspec")
28 |
--------------------------------------------------------------------------------
/aggregate_root/lib/aggregate_root/configuration.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module AggregateRoot
4 | class << self
5 | attr_accessor :configuration
6 | end
7 |
8 | def self.configure
9 | self.configuration ||= Configuration.new
10 | yield(configuration)
11 | end
12 |
13 | class Configuration
14 | attr_accessor :default_event_store
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/aggregate_root/lib/aggregate_root/transform.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module AggregateRoot
4 | class Transform
5 | def self.to_snake_case(name)
6 | name.gsub(/([A-Z])([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/aggregate_root/lib/aggregate_root/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module AggregateRoot
4 | VERSION = "2.16.0"
5 | end
6 |
--------------------------------------------------------------------------------
/aggregate_root/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module AggregateRoot
6 | ::RSpec.describe "no warnings" do
7 | specify { expect(aggregate_root_warnings).to eq([]) }
8 |
9 | def aggregate_root_warnings
10 | warnings.select { |w| w =~ %r{lib/aggregate_root} }
11 | end
12 |
13 | def warnings
14 | `ruby -Ilib -w lib/aggregate_root.rb 2>&1`.split("\n")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/aggregate_root/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "aggregate_root"
4 | require "ruby_event_store"
5 | require_relative "../../support/helpers/rspec_defaults"
6 |
7 | RSpec.configure { |spec| spec.before { AggregateRoot.configure { |config| config.default_event_store = nil } } }
8 |
9 | module Orders
10 | module Events
11 | OrderCreated = Class.new(RubyEventStore::Event)
12 | OrderExpired = Class.new(RubyEventStore::Event)
13 | OrderCanceled = Class.new(RubyEventStore::Event)
14 | SpanishInquisition = Class.new(RubyEventStore::Event)
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/aggregate_root/spec/transform_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module AggregateRoot
6 | ::RSpec.describe Transform do
7 | specify { expect(Transform.to_snake_case("OrderSubmitted")).to eq("order_submitted") }
8 | specify do
9 | expect(Transform.to_snake_case("OrderSubmittedMultipleTimesReally")).to eq(
10 | "order_submitted_multiple_times_really",
11 | )
12 | end
13 | specify { expect(Transform.to_snake_case("SHA1ChecksumComputed")).to eq("sha1_checksum_computed") }
14 | specify { expect(Transform.to_snake_case("OKROfPSAInQ1Reached")).to eq("okr_of_psa_in_q1_reached") }
15 | specify { expect(Transform.to_snake_case("EncryptedWithRot13")).to eq("encrypted_with_rot13") }
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/contrib/README.md:
--------------------------------------------------------------------------------
1 | # Contrib
2 |
3 | A collection of tools supporting or extending Rails Event Store. These are released separately from RES.
4 |
--------------------------------------------------------------------------------
/contrib/dres_client/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 |
10 | gem "webmock"
11 | gem "closed_struct"
12 | gem "equalizer"
13 |
--------------------------------------------------------------------------------
/contrib/dres_client/dres_client.gemspec:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | lib = File.expand_path("../lib", __FILE__)
4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5 | require "dres_client/version"
6 |
7 | Gem::Specification.new do |spec|
8 | spec.name = "dres_client"
9 | spec.version = DresClient::VERSION
10 | spec.authors = ["Robert Pankowecki"]
11 | spec.email = ["dev@arkency.com"]
12 | spec.summary = "Distributed RailsEventStore (DRES) client"
13 | spec.description = "Distributed RailsEventStore (DRES) client"
14 | spec.homepage = "http://railseventstore.org/"
15 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16 | spec.require_paths = ["lib"]
17 |
18 | spec.required_ruby_version = ">= 2.7"
19 |
20 | spec.add_dependency "ruby_event_store", ">= 2.0", "< 3.0"
21 | end
22 |
--------------------------------------------------------------------------------
/contrib/dres_client/lib/dres_client/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module DresClient
4 | VERSION = "0.6.0"
5 | end
6 |
--------------------------------------------------------------------------------
/contrib/dres_client/spec/shared/body1.json:
--------------------------------------------------------------------------------
1 | {
2 | "after": "head",
3 | "events": [
4 | {
5 | "event_id": "dfc7f58d-aae3-4d21-8f3a-957bfa765ef8",
6 | "data": "---\n:one: 1\n",
7 | "metadata": "---\n:correlation_id: 15b861b5-5697-40ae-bfea-7f01329c3385\n",
8 | "event_type": "MyEvent",
9 | "valid_at": "2018-04-07T12:30:00.000Z",
10 | "timestamp": "2018-04-07T12:30:00.000Z"
11 | },
12 | {
13 | "event_id": "b2f58e9c-0887-4fbf-99a8-0bb19cfebeef",
14 | "data": "---\n:two: 2\n",
15 | "metadata": "---\n:correlation_id: 15b861b5-5697-40ae-bfea-7f01329c3385\n",
16 | "event_type": "MyEvent",
17 | "valid_at": "2018-04-07T12:30:00.000Z",
18 | "timestamp": "2018-04-07T12:30:00.000Z"
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/contrib/dres_client/spec/shared/body2.json:
--------------------------------------------------------------------------------
1 | {
2 | "after": "b2f58e9c-0887-4fbf-99a8-0bb19cfebeef",
3 | "events": [
4 | {
5 | "event_id": "d1f7bd58-ff2b-45d8-8a1d-6ea00d8c3dc3",
6 | "data": "---\n:three: 3\n",
7 | "metadata": "---\n:correlation_id: 15b861b5-5697-40ae-bfea-7f01329c3385\n",
8 | "event_type": "MyEvent",
9 | "valid_at": "2018-04-07T12:30:00.000Z",
10 | "timestamp": "2018-04-07T12:30:00.000Z"
11 | },
12 | {
13 | "event_id": "0d29084e-ad75-4e3a-8e63-5c894c540b8d",
14 | "data": "---\n:four: 4\n",
15 | "metadata": "---\n:correlation_id: 15b861b5-5697-40ae-bfea-7f01329c3385\n",
16 | "event_type": "MyEvent",
17 | "valid_at": "2018-04-07T12:30:00.000Z",
18 | "timestamp": "2018-04-07T12:30:00.000Z"
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/contrib/dres_client/spec/shared/body3.json:
--------------------------------------------------------------------------------
1 | { "after": "0d29084e-ad75-4e3a-8e63-5c894c540b8d", "events": [] }
2 |
--------------------------------------------------------------------------------
/contrib/dres_client/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "../../../support/helpers/rspec_defaults"
4 | require "dres_client"
5 | require "webmock/rspec"
6 |
--------------------------------------------------------------------------------
/contrib/dres_rails/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "ruby_event_store-browser", path: "../.."
10 | gem "rails_event_store", path: "../.."
11 | gem "ruby_event_store-active_record", path: "../.."
12 | gem "rails_event_store_active_record", path: "../.."
13 | gem "aggregate_root", path: "../.."
14 |
15 | gem "pg"
16 | gem "childprocess"
17 | gem "rspec-rails"
18 | gem "capybara"
19 | gem "timecop"
20 | gem "zeitwerk", "~> 2.6.0"
21 |
--------------------------------------------------------------------------------
/contrib/dres_rails/app/models/dres_rails/job.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module DresRails
4 | class Job < ::ActiveRecord::Base
5 | self.table_name = "dres_rails_queue_jobs"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/dres_rails/bin/mutant:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'mutant' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12 |
13 | bundle_binstub = File.expand_path("bundle", __dir__)
14 |
15 | if File.file?(bundle_binstub)
16 | if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17 | load(bundle_binstub)
18 | else
19 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21 | end
22 | end
23 |
24 | require "rubygems"
25 | require "bundler/setup"
26 |
27 | load Gem.bin_path("mutant", "mutant")
28 |
--------------------------------------------------------------------------------
/contrib/dres_rails/bin/rails:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | # This command will automatically be run when you run "rails" with Rails gems
5 | # installed from the root of your application.
6 |
7 | ENGINE_ROOT = File.expand_path('../..', __FILE__)
8 | ENGINE_PATH = File.expand_path('../../lib/dres_rails/engine', __FILE__)
9 | APP_PATH = File.expand_path('../../spec/dummy/config/application', __FILE__)
10 |
11 | # Set up gems listed in the Gemfile.
12 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
13 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
14 |
15 | require 'rails/all'
16 | require 'rails/engine/commands'
17 |
--------------------------------------------------------------------------------
/contrib/dres_rails/bin/setup:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | #! /usr/bin/env bash
4 |
5 | set -o nounset # Exit, with error message, when attempting to use an undefined variable.
6 | set -o errexit # Abort script at first error, when a command exits with non-zero status.
7 | set -o pipefail # Return exit status of the last command in the pipe that returned a non-zero return value.
8 | IFS=$'\n\t' # Defines newlines and tabs as delimiters for splitting words and iterating arrays.
9 |
10 | bundle install
11 |
--------------------------------------------------------------------------------
/contrib/dres_rails/config/routes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | DresRails::Engine.routes.draw { get "/" => "application#index" }
4 |
--------------------------------------------------------------------------------
/contrib/dres_rails/db/migrate/20180802140810_create_dres_rails_queues.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateDresRailsQueues < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :dres_rails_queues do |t|
6 | t.string :name, null: false
7 | t.string :last_processed_event_id
8 | t.timestamps
9 | end
10 | add_index :dres_rails_queues, :name, unique: true
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/contrib/dres_rails/db/migrate/20180809123523_create_queue_jobs_table.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CreateQueueJobsTable < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :dres_rails_queue_jobs do |t|
6 | t.integer :queue_id, null: false
7 | t.string :event_id, null: false
8 | t.string :state, null: false
9 | end
10 | add_index :dres_rails_queue_jobs, %i[queue_id event_id]
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/contrib/dres_rails/dres_rails.gemspec:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "lib/dres_rails/identity"
4 |
5 | Gem::Specification.new do |spec|
6 | spec.name = "dres_rails"
7 | spec.version = DresRails::VERSION
8 | spec.license = "MIT"
9 | spec.authors = ["Robert Pankowecki"]
10 | spec.email = ["dev@arkency.com"]
11 | spec.homepage = ""
12 | spec.summary = ""
13 | spec.files = Dir["app/**/*", "bin/**/*", "config/**/*", "db/**/*", "lib/**/*", "vendor/**/*"]
14 | spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
15 | spec.require_paths = ["lib"]
16 |
17 | spec.required_ruby_version = ">= 2.7"
18 |
19 | spec.add_dependency "rails", ">= 6.0", "< 8.0"
20 | spec.add_dependency "ruby_event_store", ">= 2.0", "< 3.0"
21 | spec.add_dependency "rails_event_store", ">= 2.0", "< 3.0"
22 | end
23 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/dres_rails.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "dres_rails/identity"
4 | require "dres_rails/engine"
5 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/dres_rails/engine.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module DresRails
4 | # Defines and registers the Rails engine.
5 | class Engine < ::Rails::Engine
6 | isolate_namespace DresRails
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/dres_rails/identity.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module DresRails
4 | VERSION = "0.6.0"
5 | end
6 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/generators/dres_rails/install/USAGE:
--------------------------------------------------------------------------------
1 | Description:
2 | Installs additional Dres Rails resources.
3 |
4 | Example:
5 | rails generate dres_rails:install
6 |
7 | This will create:
8 | what/will/it/create
9 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/generators/dres_rails/install/install_generator.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module DresRails
4 | # Generator for installing new files.
5 | class InstallGenerator < Rails::Generators::Base
6 | source_root File.join(File.dirname(__FILE__), "..", "templates")
7 |
8 | desc "Installs additional Dres Rails resources."
9 | def install
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/generators/dres_rails/upgrade/USAGE:
--------------------------------------------------------------------------------
1 | Description:
2 | Upgrades previously installed Dres Rails resources.
3 |
4 | Example:
5 | rails generate dres_rails:upgrade
6 |
7 | This will create:
8 | what/will/it/create
9 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/generators/dres_rails/upgrade/upgrade_generator.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module DresRails
4 | # Generator for updating existing files.
5 | class UpgradeGenerator < Rails::Generators::Base
6 | source_root File.join(File.dirname(__FILE__), "..", "templates")
7 |
8 | desc "Upgrades previously installed Dres Rails resources."
9 | def upgrade
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/contrib/dres_rails/lib/tasks/dres_rails_tasks.rake:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # desc "Explaining what the task does"
4 | # task :dres_rails do
5 | # # Task goes here
6 | # end
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/Rakefile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Add your own tasks in files placed in lib/tasks ending in .rake,
4 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5 |
6 | require_relative "config/application"
7 |
8 | Rails.application.load_tasks
9 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../javascripts .js
3 | //= link_directory ../stylesheets .css
4 | //= link dres_rails_manifest.js
5 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/app/assets/images/.keep
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file. JavaScript code in this file should be added after the last require_* statement.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require_tree .
14 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/assets/javascripts/cable.js:
--------------------------------------------------------------------------------
1 | // Action Cable provides the framework to deal with WebSockets in Rails.
2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3 | //
4 | //= require action_cable
5 | //= require_self
6 | //= require_tree ./channels
7 |
8 | (function () {
9 | this.App || (this.App = {});
10 |
11 | App.cable = ActionCable.createConsumer();
12 | }.call(this));
13 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/assets/javascripts/channels/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/app/assets/javascripts/channels/.keep
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationCable
4 | class Channel < ActionCable::Channel::Base
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationCable
4 | class Connection < ActionCable::Connection::Base
5 | end
6 | end
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationController < ActionController::Base
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ApplicationHelper
4 | end
5 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationJob < ActiveJob::Base
4 | end
5 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationMailer < ActionMailer::Base
4 | default from: "from@example.com"
5 | layout "mailer"
6 | end
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ApplicationRecord < ::ActiveRecord::Base
4 | self.abstract_class = true
5 | end
6 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/app/models/concerns/.keep
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Dummy
5 | <%= csrf_meta_tags %>
6 |
7 | <%= stylesheet_link_tag 'application', media: 'all' %>
8 | <%= javascript_include_tag 'application' %>
9 |
10 |
11 |
12 | <%= yield %>
13 |
14 |
15 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/bin/bundle:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5 | load Gem.bin_path('bundler', 'bundle')
6 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/bin/rails:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | APP_PATH = File.expand_path('../config/application', __dir__)
5 | require_relative '../config/boot'
6 | require 'rails/commands'
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/bin/rake:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | require_relative '../config/boot'
5 | require 'rake'
6 | Rake.application.run
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/bin/yarn:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | VENDOR_PATH = File.expand_path('..', __dir__)
5 | Dir.chdir(VENDOR_PATH) do
6 | begin
7 | exec "yarnpkg #{ARGV.join(" ")}"
8 | rescue Errno::ENOENT
9 | $stderr.puts "Yarn executable was not detected in the system."
10 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
11 | exit 1
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config.ru:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This file is used by Rack-based servers to start the application.
4 |
5 | require_relative "config/environment"
6 |
7 | run Rails.application
8 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/boot.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Set up gems listed in the Gemfile.
4 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
5 |
6 | require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
7 | $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
8 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: redis://localhost:6379/1
10 | channel_prefix: dummy_production
11 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: postgresql
9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: ruby_event_store-active_record
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: <%= ENV.fetch("DATABASE_URL") %>
22 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/environment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Load the Rails application.
4 | require_relative "application"
5 |
6 | # Initialize the Rails application.
7 | Rails.application.initialize!
8 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # ActiveSupport::Reloader.to_prepare do
6 | # ApplicationController.renderer.defaults.merge!(
7 | # http_host: 'example.org',
8 | # https: false
9 | # )
10 | # end
11 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Version of your assets, change this if you want to expire all your assets.
6 | # Rails.application.config.assets.version = '1.0'
7 |
8 | # Add additional assets to the asset load path.
9 | # Rails.application.config.assets.paths << Emoji.images_path
10 | # Add Yarn node_modules folder to the asset load path.
11 | # Rails.application.config.assets.paths << Rails.root.join('node_modules')
12 |
13 | # Precompile additional assets.
14 | # application.js, application.css, and all non-JS/CSS in the app/assets
15 | # folder are already added.
16 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
17 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
7 |
8 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
9 | # Rails.backtrace_cleaner.remove_silencers!
10 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Specify a serializer for the signed and encrypted cookie jars.
6 | # Valid options are :json, :marshal, and :hybrid.
7 | Rails.application.config.action_dispatch.cookies_serializer = :json
8 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Configure sensitive parameters which will be filtered from the log file.
6 | Rails.application.config.filter_parameters += [:password]
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Add new inflection rules using the following format. Inflections
6 | # are locale specific, and you may define rules for as many different
7 | # locales as you wish. All of these examples are active by default:
8 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
9 | # inflect.plural /^(ox)$/i, '\1en'
10 | # inflect.singular /^(ox)en/i, '\1'
11 | # inflect.irregular 'person', 'people'
12 | # inflect.uncountable %w( fish sheep )
13 | # end
14 |
15 | # These inflection rules are supported but not enabled by default:
16 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
17 | # inflect.acronym 'RESTful'
18 | # end
19 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Add new mime types for use in respond_to blocks:
6 | # Mime::Type.register "text/richtext", :rtf
7 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # This file contains settings for ActionController::ParamsWrapper which
6 | # is enabled by default.
7 |
8 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9 | ActiveSupport.on_load(:action_controller) { wrap_parameters format: [:json] }
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/routes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.routes.draw do
4 | class CanSeeResEvents
5 | def matches?(request)
6 | request.headers["HTTP_RES_API_KEY"] == "33bbd0ea-b7ce-49d5-bc9d-198f7884c485"
7 | end
8 | end
9 | mount DresRails::Engine => "/dres_rails", :constraints => CanSeeResEvents.new
10 | end
11 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/config/spring.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | %w[.ruby-version .rbenv-vars tmp/restart.txt tmp/caching-dev.txt].each { |path| Spring.watch(path) }
4 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/db/migrate/20180802142436_create_dres_rails_queues.dres_rails.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This migration comes from dres_rails (originally 20180802140810)
4 | class CreateDresRailsQueues < ActiveRecord::Migration[5.2]
5 | def change
6 | create_table :dres_rails_queues do |t|
7 | t.string :name, null: false
8 | t.string :last_processed_event_id
9 | t.timestamps
10 | end
11 | add_index :dres_rails_queues, :name, unique: true
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/db/migrate/20180809123950_create_queue_jobs_table.dres_rails.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # This migration comes from dres_rails (originally 20180809123523)
4 | class CreateQueueJobsTable < ActiveRecord::Migration[5.2]
5 | def change
6 | create_table :dres_rails_queue_jobs do |t|
7 | t.integer :queue_id, null: false
8 | t.string :event_id, null: false
9 | t.string :state, null: false
10 | end
11 | add_index :dres_rails_queue_jobs, %i[queue_id event_id]
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/lib/assets/.keep
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dummy",
3 | "private": true,
4 | "dependencies": {}
5 | }
6 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/public/apple-touch-icon-precomposed.png
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/dummy/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/dres_rails/spec/dummy/public/favicon.ico
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV["RAILS_ENV"] ||= "test"
4 | require File.expand_path "../dummy/config/environment", __FILE__
5 | ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "/dummy"
6 |
7 | require "spec_helper"
8 | require "rspec/rails"
9 | require "dres_rails"
10 |
11 | RSpec.configure do |config|
12 | config.include AbstractController::Translation
13 | config.include ActiveSupport::Testing::TimeHelpers
14 | config.include ActiveJob::TestHelper, type: :job
15 | config.infer_spec_type_from_file_location!
16 | end
17 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/shared/body2.json:
--------------------------------------------------------------------------------
1 | {
2 | "after": "b2f58e9c-0887-4fbf-99a8-0bb19cfebeef",
3 | "events": [
4 | {
5 | "event_id": "d1f7bd58-ff2b-45d8-8a1d-6ea00d8c3dc3",
6 | "data": "---\n:three: 3\n",
7 | "metadata": "---\n:correlation_id: 15b861b5-5697-40ae-bfea-7f01329c3385\n",
8 | "event_type": "MyEvent",
9 | "valid_at": "2018-04-07T12:30:00.000Z",
10 | "timestamp": "2018-04-07T12:30:00.000Z"
11 | },
12 | {
13 | "event_id": "0d29084e-ad75-4e3a-8e63-5c894c540b8d",
14 | "data": "---\n:four: 4\n",
15 | "metadata": "---\n:correlation_id: 15b861b5-5697-40ae-bfea-7f01329c3385\n",
16 | "event_type": "MyEvent",
17 | "valid_at": "2018-04-07T12:30:00.000Z",
18 | "timestamp": "2018-04-07T12:30:00.000Z"
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/shared/body3.json:
--------------------------------------------------------------------------------
1 | { "after": "0d29084e-ad75-4e3a-8e63-5c894c540b8d", "events": [] }
2 |
--------------------------------------------------------------------------------
/contrib/dres_rails/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "../../../support/helpers/rspec_defaults"
4 | require_relative "../../../support/helpers/migrator"
5 | require_relative "../../../support/helpers/schema_helper"
6 |
7 | ENV["DATABASE_URL"] ||= "postgres://localhost/rails_event_store?pool=5"
8 | ENV["DATA_TYPE"] ||= "binary"
9 |
10 | $verbose = ENV.has_key?("VERBOSE") ? true : false
11 | ActiveJob::Base.logger = nil unless $verbose
12 | ActiveRecord::Schema.verbose = $verbose
13 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - minitest/ruby_event_store
6 | includes:
7 | - lib
8 | integration:
9 | name: minitest
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - Minitest::RubyEventStore*
17 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 | gem "ruby_event_store-transformations", path: ".."
11 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 | gem "ruby_event_store-transformations", path: ".."
11 | gem "rails", "~> 7.2.0"
12 | gem "zeitwerk", "~> 2.6.0"
13 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/minitest/ruby_event_store/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = minitest-ruby_event_store
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/mutant.mk
6 | include ../../support/make/gem.mk
7 | include ../../support/make/help.mk
8 |
9 | test:
10 | @bundle exec ruby test/minitest/ruby_event_store_test.rb
11 |
12 | .PHONY: test
13 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/README.md:
--------------------------------------------------------------------------------
1 | # Minitest::RubyEventStore
2 |
3 | Minitest assertions for RubyEventStore.
4 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/lib/minitest/ruby_event_store.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Minitest
4 | module RubyEventStore
5 | class Error < StandardError
6 | end
7 | end
8 | end
9 |
10 | require_relative "ruby_event_store/version"
11 | require_relative "ruby_event_store/assertions"
12 |
13 | module Minitest::Assertions
14 | include Minitest::RubyEventStore::Assertions
15 | end
16 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/lib/minitest/ruby_event_store/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module Minitest
4 | module RubyEventStore
5 | VERSION = "0.1.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/minitest-ruby_event_store/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "minitest/ruby_event_store"
4 | require "ruby_event_store"
5 | require "ruby_event_store/transformations"
6 | require "mutant/minitest/coverage"
7 | require "minitest/autorun"
8 | require_relative "../../../support/helpers/time_enrichment"
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/flipper
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RubyEventStore::Flipper*
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### unreleased
2 |
3 | - add support for activesupport 7.0
4 |
5 | ### 0.2.0
6 |
7 | - initial release
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | gem "ruby_event_store", path: "../.."
8 | gem "ruby_event_store-rspec", path: "../.."
9 |
10 | gem "flipper", "~> 0.19"
11 | gem "byebug"
12 | gem "activesupport", "~> 8.0.0"
13 |
14 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/Gemfile.activesupport_7_1:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | gem "ruby_event_store", path: "../.."
8 | gem "ruby_event_store-rspec", path: "../.."
9 |
10 | gem "flipper", "~> 0.19"
11 | gem "byebug"
12 | gem "activesupport", "~> 7.1.5"
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/Gemfile.activesupport_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | gem "ruby_event_store", path: "../.."
8 | gem "ruby_event_store-rspec", path: "../.."
9 |
10 | gem "flipper", "~> 0.19"
11 | gem "byebug"
12 | gem "activesupport", "~> 7.2.2.1"
13 |
14 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/flipper/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-flipper
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/lib/generators/ruby_event_store/flipper/events_generator.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | begin
4 | require "rails/generators"
5 | rescue LoadError
6 | end
7 |
8 | if defined?(Rails::Generators::Base)
9 | module RubyEventStore
10 | module Flipper
11 | class EventsGenerator < Rails::Generators::Base
12 | source_root File.expand_path(File.join(File.dirname(__FILE__), "./templates"))
13 |
14 | def create_migration
15 | template "events.rb", "app/models/ruby_event_store/flipper/events.rb"
16 | end
17 | end
18 | end
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/lib/ruby_event_store/flipper/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Flipper
5 | VERSION = "0.2.1"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/spec/ruby_event_store/flipper_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | ::RSpec.describe Flipper do
5 | it "has a version number" do
6 | expect(RubyEventStore::Flipper::VERSION).not_to be_nil
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-flipper/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "../../../support/helpers/rspec_defaults"
4 | require "ruby_event_store/flipper"
5 | require "ruby_event_store/rspec"
6 | require "ruby_event_store"
7 | require "active_support"
8 | require "active_support/notifications"
9 | require "flipper"
10 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/newrelic
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RubyEventStore::Newrelic*
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | gem "ruby_event_store", path: "../.."
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | gem "ruby_event_store", path: "../.."
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/newrelic/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-newrelic
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/README.md:
--------------------------------------------------------------------------------
1 | # RubyEventStore::Newrelic
2 |
3 | Newrelic RPM integration for RubyEventStore.
4 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/lib/ruby_event_store/newrelic.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "newrelic/version"
4 |
5 | module RubyEventStore
6 | module Newrelic
7 | class Error < StandardError
8 | end
9 | # Your code goes here...
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/lib/ruby_event_store/newrelic/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Newrelic
5 | VERSION = "0.1.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/spec/ruby_event_store/newrelic_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ::RSpec.describe RubyEventStore::Newrelic do
4 | it "has a version number" do
5 | expect(RubyEventStore::Newrelic::VERSION).not_to be_nil
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-newrelic/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "../../../support/helpers/rspec_defaults"
4 | require "ruby_event_store/newrelic"
5 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ruby:3.2
2 | ARG GEM_VERSION
3 | RUN gem install ruby_event_store-outbox --version $GEM_VERSION
4 | RUN gem install influxdb --version 0.8.1
5 | RUN gem install redis-client mysql2
6 | ENTRYPOINT ["/usr/local/bundle/bin/res_outbox"]
7 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "sidekiq", "~> 7.2"
12 | gem "influxdb", "~> 0.8.1", require: false
13 | gem "childprocess"
14 | gem "rails", "~> 8.0.0"
15 | gem "zeitwerk", "~> 2.6.0"
16 | gem "sqlite3", ">= 2.1"
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/Gemfile.rails_7_1:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "sidekiq", "~> 7.2"
12 | gem "influxdb", "~> 0.8.1", require: false
13 | gem "childprocess"
14 | gem "rails", "~> 7.1.5"
15 | gem "sqlite3", "~> 1.7"
16 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "sidekiq", "~> 7.2"
12 | gem "influxdb", "~> 0.8.1", require: false
13 | gem "childprocess"
14 | gem "rails", "~> 7.2.2.1"
15 | gem "zeitwerk", "~> 2.6.0"
16 | gem "sqlite3", ">= 1.7.3"
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/Gemfile.sidekiq_6_5:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "sidekiq", "~> 6.5"
12 | gem "redis-client"
13 | gem "influxdb", "~> 0.8.1", require: false
14 | gem "childprocess"
15 | gem "rails", "~> 8.0.0"
16 | gem "zeitwerk", "~> 2.6.0"
17 | gem "sqlite3", ">= 2.1"
18 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/outbox/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-outbox
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
10 | docker-build: ## Build docker image
11 | @docker build \
12 | --file Dockerfile \
13 | --build-arg GEM_VERSION=$(GEM_VERSION) \
14 | --tag railseventstore/outbox:$(GEM_VERSION) \
15 | .
16 |
17 | docker-push: ## Push docker image
18 | @DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect railseventstore/outbox:$(GEM_VERSION) > /dev/null || docker push railseventstore/outbox:$(GEM_VERSION)
19 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/bin/res_outbox:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require "ruby_event_store/outbox/cli"
3 |
4 | cli = RubyEventStore::Outbox::CLI.new
5 | cli.run(ARGV)
6 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "outbox/fetch_specification"
4 | require_relative "outbox/repository"
5 | require_relative "outbox/sidekiq_scheduler"
6 | require_relative "outbox/version"
7 | require_relative "outbox/tempo"
8 | require_relative "outbox/batch_result"
9 | require_relative "outbox/cleanup_strategies"
10 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/batch_result.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | class BatchResult
6 | def self.empty
7 | new
8 | end
9 |
10 | def initialize
11 | @success_count = 0
12 | @failed_count = 0
13 | end
14 |
15 | attr_reader :success_count, :failed_count
16 |
17 | def count_success!
18 | @success_count += 1
19 | end
20 |
21 | def count_failed!
22 | @failed_count += 1
23 | end
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/cleanup_strategies.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "cleanup_strategies/none"
4 | require_relative "cleanup_strategies/clean_old_enqueued"
5 |
6 | module RubyEventStore
7 | module Outbox
8 | module CleanupStrategies
9 | def self.build(configuration, repository)
10 | case configuration.cleanup
11 | when :none
12 | None.new
13 | else
14 | CleanOldEnqueued.new(
15 | repository,
16 | ActiveSupport::Duration.parse(configuration.cleanup),
17 | configuration.cleanup_limit,
18 | )
19 | end
20 | end
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/cleanup_strategies/clean_old_enqueued.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | module CleanupStrategies
6 | class CleanOldEnqueued
7 | def initialize(repository, duration, limit)
8 | @repository = repository
9 | @duration = duration
10 | @limit = limit
11 | end
12 |
13 | def call(fetch_specification)
14 | repository.delete_enqueued_older_than(fetch_specification, duration, limit)
15 | end
16 |
17 | private
18 |
19 | attr_reader :repository, :duration, :limit
20 | end
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/cleanup_strategies/none.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | module CleanupStrategies
6 | class None
7 | def initialize
8 | end
9 |
10 | def call(_fetch_specification)
11 | :ok
12 | end
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/fetch_specification.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | class FetchSpecification
6 | def initialize(message_format, split_key)
7 | @message_format = message_format
8 | @split_key = split_key
9 | freeze
10 | end
11 |
12 | attr_reader :message_format, :split_key
13 |
14 | def ==(other)
15 | other.instance_of?(self.class) && other.message_format.eql?(message_format) && other.split_key.eql?(split_key)
16 | end
17 |
18 | def hash
19 | [message_format, split_key].hash ^ self.class.hash
20 | end
21 |
22 | alias_method :eql?, :==
23 | end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/metrics.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | module Metrics
6 | def self.from_url(metrics_url)
7 | if metrics_url.nil?
8 | require_relative "metrics/null"
9 | Null.new
10 | else
11 | require_relative "metrics/influx"
12 | Influx.new(metrics_url)
13 | end
14 | end
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/metrics/null.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | module Metrics
6 | class Null
7 | def write_operation_result(operation, result)
8 | end
9 |
10 | def write_point_queue(**kwargs)
11 | end
12 | end
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/sidekiq5_format.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | SIDEKIQ5_FORMAT = "sidekiq5"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/sidekiq_scheduler.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "sidekiq_producer"
4 |
5 | module RubyEventStore
6 | module Outbox
7 | class SidekiqScheduler
8 | def initialize(serializer: Serializers::YAML)
9 | @serializer = serializer
10 | @sidekiq_producer = SidekiqProducer.new
11 | end
12 |
13 | def call(klass, record)
14 | sidekiq_producer.call(klass, [record.serialize(serializer)])
15 | end
16 |
17 | def verify(subscriber)
18 | Class === subscriber && subscriber.respond_to?(:through_outbox?) && subscriber.through_outbox?
19 | end
20 |
21 | private
22 |
23 | attr_reader :serializer, :sidekiq_producer
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/tempo.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | class Tempo
6 | EXPONENTIAL_MULTIPLIER = 2
7 |
8 | def initialize(max_batch_size)
9 | raise ArgumentError if max_batch_size < 1
10 | @max_batch_size = max_batch_size
11 | end
12 |
13 | def batch_size
14 | @batch_size = next_batch_size
15 | end
16 |
17 | private
18 |
19 | def next_batch_size
20 | return 1 if @batch_size.nil?
21 | [@batch_size * EXPONENTIAL_MULTIPLIER, @max_batch_size].min
22 | end
23 | end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/lib/ruby_event_store/outbox/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Outbox
5 | VERSION = "0.2.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/spec/batch_result_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module Outbox
7 | ::RSpec.describe BatchResult do
8 | specify "::empty" do
9 | batch_result = BatchResult.empty
10 |
11 | expect(batch_result.failed_count).to eq(0)
12 | expect(batch_result.success_count).to eq(0)
13 | end
14 |
15 | specify "adding updated element" do
16 | batch_result = BatchResult.empty
17 |
18 | batch_result.count_success!
19 |
20 | expect(batch_result.success_count).to eq(1)
21 | end
22 |
23 | specify "adding failed element" do
24 | batch_result = BatchResult.empty
25 |
26 | batch_result.count_failed!
27 |
28 | expect(batch_result.failed_count).to eq(1)
29 | end
30 | end
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/spec/metrics/factory_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module Outbox
7 | ::RSpec.describe Metrics do
8 | specify do
9 | adapter = Metrics.from_url(nil)
10 |
11 | expect(adapter).to be_a(Metrics::Null)
12 | end
13 |
14 | specify do
15 | adapter = Metrics.from_url("http://influxdb.service.consul:8086")
16 |
17 | expect(adapter).to be_a(Metrics::Influx)
18 | expect(adapter.influxdb_client.config.hosts).to eq(["influxdb.service.consul"])
19 | end
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/spec/metrics/null_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module Outbox
7 | ::RSpec.describe Metrics::Null do
8 | specify "doesnt do anything" do
9 | null_metrics = Metrics::Null.new
10 |
11 | null_metrics.write_point_queue(some_keyargs: 42)
12 | end
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/spec/support/db.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | def drop_tables
4 | ActiveRecord::Migration.drop_table("event_store_outbox")
5 | ActiveRecord::Migration.drop_table("event_store_outbox_locks")
6 | rescue ::ActiveRecord::StatementInvalid
7 | end
8 |
9 | RSpec.configure do |config|
10 | config.around(:each, :db) do |example|
11 | begin
12 | establish_database_connection
13 | drop_tables
14 | m = Migrator.new(File.expand_path("../../lib/generators/ruby_event_store/outbox/templates", __dir__))
15 | m.run_migration("create_event_store_outbox")
16 | example.run
17 | ensure
18 | drop_tables
19 | close_database_connection
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-outbox/spec/support/sidekiq.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | def reset_sidekiq_middlewares
4 | Sidekiq.configure_client { |config| config.client_middleware { |chain| chain.clear } }
5 | end
6 |
7 | def install_sidekiq_middleware(middleware_klass)
8 | Sidekiq.configure_client { |config| config.client_middleware { |chain| chain.add(middleware_klass) } }
9 | end
10 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-profiler/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/profiler
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RubyEventStore::Profiler*
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-profiler/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 |
11 | gem "activesupport", "~> 8.0.0"
12 |
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-profiler/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 |
11 | gem "activesupport", "~> 7.2.0"
12 |
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-profiler/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/profiler/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-profiler
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-profiler/lib/ruby_event_store/profiler/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class Profiler
5 | VERSION = "0.1.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-profiler/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "../../support/helpers/rspec_defaults"
4 | require "ruby_event_store"
5 | require "ruby_event_store/profiler"
6 | require "active_support/isolated_execution_state"
7 | require "active_support/notifications"
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/protobuf
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RubyEventStore::Protobuf*
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## v2.0.0
2 |
3 | * imposing minimal Protocol Buffers version 26.0
4 |
5 | ## v1.1.0
6 |
7 | * made optional dependencies (`google-protobuf`, `protobuf_nested_struct`) required,
8 | lifting optionality to the decision of using or not this gem
9 |
10 | * imposing minimal Protocol Buffers version 25.7
11 |
12 | # v1.0.0
13 |
14 | * extracted from `ruby_event_store` gem
15 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 | gem "rails_event_store", path: "../.."
11 | gem "ruby_event_store-active_record", path: "../.."
12 | gem "rails_event_store_active_record", path: "../.."
13 | gem "ruby_event_store-browser", path: "../.."
14 |
15 | gem "rails", "~> 8.0.0"
16 | gem "zeitwerk", "~> 2.6.0"
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/Gemfile.rails_7_1:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 | gem "rails_event_store", path: "../.."
11 | gem "ruby_event_store-active_record", path: "../.."
12 | gem "rails_event_store_active_record", path: "../.."
13 | gem "ruby_event_store-browser", path: "../.."
14 |
15 | gem "rails", "~> 7.1.5"
16 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "aggregate_root", path: "../.."
10 | gem "rails_event_store", path: "../.."
11 | gem "ruby_event_store-active_record", path: "../.."
12 | gem "rails_event_store_active_record", path: "../.."
13 | gem "ruby_event_store-browser", path: "../.."
14 |
15 | gem "rails", "~> 7.2.2.1"
16 | gem "zeitwerk", "~> 2.6.0"
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/protobuf/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-protobuf
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/README.md:
--------------------------------------------------------------------------------
1 | # Ruby Event Store Protobuf
2 |
3 | Moved from RubyEventStore (based on version 1.3.0).
4 |
5 | 
6 |
7 | ## How to use this gem
8 |
9 | Add to your gemfile in application:
10 |
11 | ```ruby
12 | gem "ruby_event_store-protobuf"
13 | ```
14 |
15 | Read more about [using Rails Event Store with Protobuf](https://railseventstore.org/docs/v2/protobuf/#configure-protobuf-mapper)
16 |
17 | ## Contributing
18 |
19 | Bug reports and pull requests are welcome on GitHub at https://github.com/RailsEventStore/rails_event_store.
20 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/lib/ruby_event_store/protobuf/mappers/transformation/proto_event.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Protobuf
5 | module Mappers
6 | module Transformation
7 | class ProtoEvent < RubyEventStore::Mappers::Transformation::DomainEvent
8 | def load(record)
9 | Proto.new(
10 | event_id: record.event_id,
11 | data: record.data,
12 | metadata: record.metadata.merge(timestamp: record.timestamp, valid_at: record.valid_at),
13 | )
14 | end
15 | end
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/lib/ruby_event_store/protobuf/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Protobuf
5 | VERSION = "2.0.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/spec/link_by_metadata_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe LinkByMetadata do
7 | specify "links to stream based on selected metadata (proto)" do
8 | event_store = RubyEventStore::Client.new(mapper: RubyEventStore::Protobuf::Mappers::Protobuf.new)
9 | event_store.subscribe_to_all_events(LinkByMetadata.new(event_store: event_store, key: :city))
10 | ev =
11 | RubyEventStore::Protobuf::Proto.new(
12 | data: ResTesting::OrderCreated.new(customer_id: 123, order_id: "K3THNX9"),
13 | metadata: {
14 | city: "Chicago",
15 | },
16 | )
17 | event_store.publish(ev)
18 |
19 | expect(event_store.read.stream("$by_city_Chicago").to_a).to eq([ev])
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/spec/mappers/events.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package res_testing;
3 |
4 | message OrderCreated {
5 | string order_id = 1;
6 | int32 customer_id = 2;
7 | }
8 |
9 | message OrderPaid {
10 | };
11 |
12 | message SpanishInquisition {
13 | };
14 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module Protobuf
7 | ::RSpec.describe "no warnings", mutant: false do
8 | specify { expect(ruby_event_store_protobuf_warnings).to eq([]) }
9 |
10 | def ruby_event_store_protobuf_warnings
11 | warnings.select { |w| w =~ %r{lib/ruby_event_store/protobuf} }
12 | end
13 |
14 | def warnings
15 | `ruby -Ilib -w lib/ruby_event_store/protobuf.rb 2>&1`.split("\n")
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-protobuf/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store"
4 | require "ruby_event_store/protobuf"
5 | require_relative "mappers/events_pb"
6 | require_relative "../../../ruby_event_store/spec/support/correlatable"
7 | require_relative "../../../support/helpers/protobuf_helper"
8 | require_relative "../../../support/helpers/rspec_defaults"
9 | require_relative "../../../support/helpers/time_enrichment"
10 |
11 | ENV["DATABASE_URL"] ||= "sqlite3::memory:"
12 |
13 | TestEvent = Class.new(RubyEventStore::Event)
14 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/rom
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | timeout: 1.0
13 | coverage_criteria:
14 | timeout: true
15 | process_abort: true
16 | matcher:
17 | subjects:
18 | - RubyEventStore::ROM*
19 | ignore:
20 | - RubyEventStore::ROM.rom_container
21 | - RubyEventStore::ROM.setup
22 | - RubyEventStore::ROM::Changesets::UpdateEvents#commit
23 | - RubyEventStore::ROM::Changesets::UpdateEvents#commit_insert_conflict_update
24 | - RubyEventStore::ROM::Changesets::UpdateEvents#commit_on_duplicate_key_update
25 | - RubyEventStore::ROM::Changesets::UpdateEvents#supports_on_duplicate_key_update?
26 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "activesupport", "~> 8.0.0"
12 | gem "dry-core", "<= 1.0.0"
13 | gem "zeitwerk", "~> 2.6.0"
14 | gem "sqlite3", ">= 1.7.3"
15 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "activesupport", "~> 7.2.0"
12 | gem "dry-core", "<= 1.0.0"
13 | gem "zeitwerk", "~> 2.6.0"
14 | gem "sqlite3", ">= 1.7.3"
15 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/rom/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-rom
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/Rakefile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "bundler/gem_tasks"
4 | require "rspec/core/rake_task"
5 | require "ruby_event_store/rom/adapters/sql/rake_task"
6 |
7 | RSpec::Core::RakeTask.new(:spec)
8 | task default: [:ci]
9 |
10 | desc "Run CI tasks"
11 | task ci: [:spec]
12 |
13 | begin
14 | require "rubocop/rake_task"
15 |
16 | Rake::Task[:default].enhance [:rubocop]
17 |
18 | RuboCop::RakeTask.new { |task| task.options << "--display-cop-names" }
19 | rescue LoadError
20 | end
21 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/lib/ruby_event_store-rom.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store/rom"
4 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/lib/ruby_event_store/rom/changesets/create_events.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ROM
5 | module Changesets
6 | class CreateEvents < ::ROM::Changeset::Create
7 | relation :events
8 |
9 | map(&:to_h)
10 | map do
11 | rename_keys timestamp: :created_at
12 | map_value :created_at, ->(time) { Time.iso8601(time).localtime }
13 | map_value :valid_at, ->(time) { Time.iso8601(time).localtime }
14 | accept_keys %i[event_id data metadata event_type created_at valid_at]
15 | end
16 |
17 | def commit
18 | relation.multi_insert(to_a)
19 | end
20 | end
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/lib/ruby_event_store/rom/changesets/create_stream_entries.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ROM
5 | module Changesets
6 | class CreateStreamEntries < ::ROM::Changeset::Create
7 | relation :stream_entries
8 |
9 | map { |tuple| Hash(created_at: RubyEventStore::ROM::Types::DateTime.call(nil)).merge(tuple) }
10 | map { map_value :created_at, ->(datetime) { datetime.to_time.localtime } }
11 | end
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/lib/ruby_event_store/rom/rake_task.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "rom/sql/rake_task"
4 | require "ruby_event_store/rom"
5 | load "ruby_event_store/rom/tasks/migration_tasks.rake"
6 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/lib/ruby_event_store/rom/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ROM
5 | VERSION = "2.2.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/spec/rom/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module ROM
7 | ::RSpec.describe "no warnings", mutant: false do
8 | specify { expect(ruby_event_store_rom_warnings).to eq([]) }
9 |
10 | def ruby_event_store_rom_warnings
11 | warnings.select { |w| w =~ %r{lib/ruby_event_store-rom} }
12 | end
13 |
14 | def warnings
15 | `ruby -Ilib -w lib/ruby_event_store-rom.rb 2>&1`.split("\n")
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-rom/tmp/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/contrib/ruby_event_store-rom/tmp/.gitkeep
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/sequel
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | timeout: 1.0
13 | coverage_criteria:
14 | timeout: true
15 | process_abort: true
16 | matcher:
17 | subjects:
18 | - RubyEventStore::Sequel*
19 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### Unreleased
2 |
3 | - Add: Initial repository implementation. Aimed as a SQL replacement for `ruby_event_store-rom` repository. Useful for apps, that do not use ActiveRecord, i.e. Hanami.
4 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "activesupport", "~> 8.0.0"
12 | gem "sqlite3", ">= 2.1"
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 | eval_gemfile "../../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: "../.."
10 |
11 | gem "activesupport", "~> 7.2.0"
12 | gem "sqlite3", ">= 2.1"
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/sequel/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-sequel
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/lib/ruby_event_store/sequel.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store"
4 | require "sequel"
5 |
6 | require_relative "sequel/index_violation_detector"
7 | require_relative "sequel/event_repository"
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sequel/lib/ruby_event_store/sequel/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Sequel
5 | VERSION = "0.1.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/sidekiq_scheduler
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RubyEventStore::SidekiqScheduler*
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "sidekiq", "~> 7.2"
9 | gem "ruby_event_store", path: "../.."
10 | gem "rails_event_store", path: "../.."
11 | gem "rails", "~> 8.0.0"
12 | gem "zeitwerk", "~> 2.6.0"
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "sidekiq", "~> 7.2"
9 | gem "ruby_event_store", path: "../.."
10 | gem "rails_event_store", path: "../.."
11 | gem "rails", "~> 7.2.0"
12 | gem "zeitwerk", "~> 2.6.0"
13 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/Gemfile.sidekiq_6_5:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 | gemspec
3 |
4 | eval_gemfile "../../support/bundler/Gemfile.shared"
5 |
6 | gem "sidekiq", "~> 6.5"
7 | gem "ruby_event_store", path: "../.."
8 | gem "rails_event_store", path: "../.."
9 | gem "rails", "~> 8.0.0"
10 | gem "zeitwerk", "~> 2.6.0"
11 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/sidekiq_scheduler/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-sidekiq_scheduler
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/lib/ruby_event_store/sidekiq_scheduler.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "sidekiq"
4 |
5 | module RubyEventStore
6 | class SidekiqScheduler
7 | def initialize(serializer:)
8 | @serializer = serializer
9 | end
10 |
11 | def call(klass, record)
12 | klass.perform_async(record.serialize(serializer).to_h.transform_keys(&:to_s))
13 | end
14 |
15 | def verify(subscriber)
16 | if Class === subscriber
17 | !!(subscriber < Sidekiq::Worker)
18 | else
19 | subscriber.instance_of?(Sidekiq::Worker::Setter)
20 | end
21 | end
22 |
23 | private
24 |
25 | attr_reader :serializer
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/lib/ruby_event_store/sidekiq_scheduler/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class SidekiqScheduler
5 | VERSION = "0.1.3"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-sidekiq_scheduler/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe "no warnings", mutant: false do
7 | specify { expect(ruby_event_store_sidekiq_scheduler_warnings).to eq([]) }
8 |
9 | def ruby_event_store_sidekiq_scheduler_warnings
10 | warnings.select { |w| w =~ %r{lib/ruby_event_store/sidekiq_scheduler} }
11 | end
12 |
13 | def warnings
14 | `ruby -Ilib -w lib/ruby_event_store/sidekiq_scheduler.rb 2>&1`.split("\n")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/transformations
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RubyEventStore::Transformations*
17 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: "../.."
9 | gem "rails", "~> 7.2.0"
10 | gem "zeitwerk", "~> 2.6.0"
11 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat lib/ruby_event_store/transformations/version.rb | grep VERSION | egrep -o '[0-9]+\.[0-9]+\.[0-9]+')
2 | GEM_NAME = ruby_event_store-transformations
3 |
4 | include ../../support/make/install.mk
5 | include ../../support/make/test.mk
6 | include ../../support/make/mutant.mk
7 | include ../../support/make/gem.mk
8 | include ../../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/README.md:
--------------------------------------------------------------------------------
1 | # RubyEventStore::Transformations
2 |
3 | Additional transformations for PipelineMapper.
4 |
5 | Currently consists of:
6 |
7 | - IdentityMap
8 |
9 | Loads records into previously-known event instances, retaining their object_id.
10 | Useful in some test asserting on inpect output.
11 |
12 | - WithIndifferentAccess
13 |
14 | Deep-symbolizes data and metadata before writing, decorates with HashWithIndifferentAccess on reads.
15 | Useful for JSON-backed data and metadata.
16 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/lib/ruby_event_store/transformations.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "transformations/version"
4 | require_relative "transformations/with_indifferent_access"
5 | require_relative "transformations/identity_map"
6 |
7 | module RubyEventStore
8 | module Transformations
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/lib/ruby_event_store/transformations/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Transformations
5 | VERSION = "0.1.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module Transformations
7 | ::RSpec.describe "no warnings", mutant: false do
8 | specify { expect(ruby_event_store_transformations_warnings).to eq([]) }
9 |
10 | def ruby_event_store_transformations_warnings
11 | warnings.select { |w| w =~ %r{lib/ruby_event_store/transformations} }
12 | end
13 |
14 | def warnings
15 | `ruby -Ilib -w lib/ruby_event_store/transformations.rb 2>&1`.split("\n")
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/contrib/ruby_event_store-transformations/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store"
4 | require "ruby_event_store/transformations"
5 | require_relative "../../../support/helpers/time_enrichment"
6 | require_relative "../../../support/helpers/rspec_defaults"
7 |
--------------------------------------------------------------------------------
/rails_event_store/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - rails_event_store
6 | includes:
7 | - lib
8 | integration:
9 | name: rspec
10 | mutation:
11 | operators: light
12 | coverage_criteria:
13 | process_abort: true
14 | matcher:
15 | subjects:
16 | - RailsEventStore*
17 | ignore:
18 | - RailsEventStore::Client#initialize
19 | - RailsEventStore::JSONClient#initialize
20 | - RailsEventStore::AfterCommitAsyncDispatcher::AsyncRecord*
21 | - RailsEventStore::AfterCommitAsyncDispatcher#async_record
22 | - RailsEventStore::AsyncHandler.with
23 |
--------------------------------------------------------------------------------
/rails_event_store/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "ruby_event_store-browser", path: ".."
10 | gem "ruby_event_store-active_record", path: ".."
11 | gem "rails_event_store_active_record", path: ".."
12 | gem "aggregate_root", path: ".."
13 |
14 | gem "rack-test"
15 | gem "rails", "~> 8.0.0"
16 | gem "sqlite3", ">= 2.1"
17 | gem "zeitwerk", "~> 2.6.0"
18 | gem "ostruct"
19 |
--------------------------------------------------------------------------------
/rails_event_store/Gemfile.rails_7_1:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "ruby_event_store-browser", path: ".."
10 | gem "ruby_event_store-active_record", path: ".."
11 | gem "rails_event_store_active_record", path: ".."
12 | gem "aggregate_root", path: ".."
13 |
14 | gem "rack-test"
15 | gem "rails", "~> 7.1.5"
16 | gem "sqlite3", "~> 1.7"
17 |
--------------------------------------------------------------------------------
/rails_event_store/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "ruby_event_store-browser", path: ".."
10 | gem "ruby_event_store-active_record", path: ".."
11 | gem "rails_event_store_active_record", path: ".."
12 | gem "aggregate_root", path: ".."
13 |
14 | gem "rack-test"
15 | gem "rails", "~> 7.2.2.1"
16 | gem "sqlite3", ">= 1.7.3"
17 | gem "zeitwerk", "~> 2.6.0"
18 |
--------------------------------------------------------------------------------
/rails_event_store/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat ../RES_VERSION)
2 | GEM_NAME = rails_event_store
3 |
4 | include ../support/make/install.mk
5 | include ../support/make/test.mk
6 | include ../support/make/mutant.mk
7 | include ../support/make/gem.mk
8 | include ../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/rails_event_store/README.md:
--------------------------------------------------------------------------------
1 | # RailsEventStore
2 |
3 | Rails wrapper for RubyEventStore with batteries included.
4 |
5 | Ships with asynchronous after-commit event dispatch on top of ActiveJob, ActiveSupport::Notifications instrumentation enabled, request metadata enrichment and opinionated directory structure generator for bounded contexts.
6 |
7 | Find out more at [https://railseventstore.org](https://railseventstore.org/)
8 |
--------------------------------------------------------------------------------
/rails_event_store/bin/mutant:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'mutant' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12 |
13 | bundle_binstub = File.expand_path("bundle", __dir__)
14 |
15 | if File.file?(bundle_binstub)
16 | if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17 | load(bundle_binstub)
18 | else
19 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21 | end
22 | end
23 |
24 | require "rubygems"
25 | require "bundler/setup"
26 |
27 | load Gem.bin_path("mutant", "mutant")
28 |
--------------------------------------------------------------------------------
/rails_event_store/bin/rspec:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'rspec' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12 |
13 | bundle_binstub = File.expand_path("bundle", __dir__)
14 |
15 | if File.file?(bundle_binstub)
16 | if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17 | load(bundle_binstub)
18 | else
19 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21 | end
22 | end
23 |
24 | require "rubygems"
25 | require "bundler/setup"
26 |
27 | load Gem.bin_path("rspec-core", "rspec")
28 |
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/rails_event_store/test_unit_generator.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "rails/generators"
4 |
5 | module RailsEventStore
6 | module Generators
7 | class TestUnitGenerator < Rails::Generators::NamedBase
8 | source_root File.expand_path(File.join(File.dirname(__FILE__), "../templates"))
9 |
10 | def test_helper
11 | template "test_helper.erb", "#{bounded_context_name}/test/test_helper.rb"
12 | end
13 |
14 | def require_bc_test
15 | template "require_bc_test.erb", "test/#{bounded_context_name}_test.rb"
16 | end
17 |
18 | private
19 |
20 | def bounded_context_name
21 | name.underscore
22 | end
23 | end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/templates/bc_spec.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "spec_helper"
4 |
5 | ::RSpec.describe <%= bounded_context_namespace %> do
6 | end
7 |
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/templates/module.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module <%= bounded_context_namespace %>
4 | end
5 |
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/templates/require_bc_spec.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "rails_helper"
4 |
5 | path = Rails.root.join("<%= bounded_context_name %>/spec")
6 | Dir.glob("#{path}/**/*_spec.rb") { |file| require file }
7 |
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/templates/require_bc_test.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "test_helper"
4 |
5 | Dir[Rails.root.join("<%= bounded_context_name %>/test/*_test.rb")].each { |file| require file }
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/templates/spec_helper.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV["RAILS_ENV"] = "test"
4 |
5 | $LOAD_PATH.push File.expand_path("../../../spec", __FILE__)
6 | require File.expand_path("../../../config/environment", __FILE__)
7 | require File.expand_path("../../../spec/rails_helper", __FILE__)
8 |
9 | require_relative "../lib/<%= bounded_context_name %>"
10 |
--------------------------------------------------------------------------------
/rails_event_store/lib/generators/templates/test_helper.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "../lib/<%= bounded_context_name %>"
4 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "rails_event_store_active_record"
4 | require_relative "rails_event_store/all"
5 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store/active_job_id_only_scheduler.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "active_job"
4 |
5 | module RailsEventStore
6 | class ActiveJobIdOnlyScheduler
7 | def call(klass, record)
8 | klass.perform_later({ "event_id" => record.event_id })
9 | end
10 |
11 | def verify(subscriber)
12 | Class === subscriber && !!(subscriber < ActiveJob::Base)
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store/active_job_scheduler.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "active_job"
4 |
5 | module RailsEventStore
6 | class ActiveJobScheduler
7 | def initialize(serializer:)
8 | @serializer = serializer
9 | end
10 |
11 | def call(klass, record)
12 | klass.perform_later(record.serialize(serializer).to_h.transform_keys(&:to_s))
13 | end
14 |
15 | def verify(subscriber)
16 | if Class === subscriber
17 | !!(subscriber < ActiveJob::Base)
18 | else
19 | subscriber.instance_of?(ActiveJob::ConfiguredJob)
20 | end
21 | end
22 |
23 | private
24 |
25 | attr_reader :serializer
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store/browser.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store/browser/app"
4 | require "rails/engine"
5 |
6 | module RailsEventStore
7 | class Browser < Rails::Engine
8 | endpoint RubyEventStore::Browser::App.for(event_store_locator: -> { Rails.configuration.event_store })
9 |
10 | railtie_name "ruby_event_store_browser_app"
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store/middleware.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RailsEventStore
4 | class Middleware
5 | def initialize(app)
6 | @app = app
7 | end
8 |
9 | def call(env)
10 | if config.respond_to?(:event_store)
11 | config.event_store.with_request_metadata(env) { @app.call(env) }
12 | else
13 | @app.call(env)
14 | end
15 | end
16 |
17 | private
18 |
19 | def config
20 | Rails.application.config
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store/railtie.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "rails/railtie"
4 | require_relative "middleware"
5 |
6 | module RailsEventStore
7 | class Railtie < ::Rails::Railtie
8 | initializer "rails_event_store.middleware" do |rails|
9 | rails.middleware.use(::RailsEventStore::Middleware)
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/rails_event_store/lib/rails_event_store/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RailsEventStore
4 | VERSION = "2.16.0"
5 | end
6 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails_event_store", path: "../../"
6 | gem "ruby_event_store", path: "../../../ruby_event_store"
7 | gem "ruby_event_store-browser", path: "../../../ruby_event_store-browser"
8 | gem "ruby_event_store-active_record", path: "../../../ruby_event_store-active_record"
9 | gem "rails_event_store_active_record", path: "../../../ruby_event_store-active_record"
10 | gem "aggregate_root", path: "../../../aggregate_root"
11 |
12 | gem "rails", "~> 7.1.3"
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/Rakefile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Add your own tasks in files placed in lib/tasks ending in .rake,
4 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5 |
6 | require_relative "config/application"
7 |
8 | Rails.application.load_tasks
9 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../config/application', __dir__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/boot.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
4 |
5 | require "bundler/setup" # Set up gems listed in the Gemfile.
6 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | jXb4DnjuYfkrUNRa5K08fK7t8Vh2Yf5TmLwWoQaBxo5TfQTh1s0/j3SzsyAmlGIE8DKjO3XRP/RqTDKTgJLprCPCy17L8mu2o6NxfCnO3D8u5elLd2HGg88RQeHjzGCYhS66kjdDH1fs0QWOg+wngKwejNBf/VAF2AVn8Z2xBOnBb/PSnunrz925NYme5l9exStdDbsiLyMbPKFBTSHLAoh8ZOm3OIOgonMFjiVto0OWWJySUM8OOqotSwTEZEji+OjQ4hZFhcLdc4GwFm9YIFl80yXZ6hN+qkLng/64odsZm1yUJ8wlKqvOpNdOFJNWLfEQUSqf+oOgcbxBXXKM54AFvcWl3cRnG6Utp3zHDQv//VjNryKMJk8Y8u28QwiZg4nO/KArSB5Hz2/PmNM4T4NeoPPc1Iyecx6z--NstamNL+4GviyLZo--NQtQqqQv9YAlYFEmcVGilw==
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/environment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Load the Rails application.
4 | require_relative "application"
5 |
6 | # Initialize the Rails application.
7 | Rails.application.initialize!
8 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # ActiveSupport::Reloader.to_prepare do
6 | # ApplicationController.renderer.defaults.merge!(
7 | # http_host: 'example.org',
8 | # https: false
9 | # )
10 | # end
11 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6 | # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
7 |
8 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
9 | # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
10 | Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
11 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Specify a serializer for the signed and encrypted cookie jars.
6 | # Valid options are :json, :marshal, and :hybrid.
7 | Rails.application.config.action_dispatch.cookies_serializer = :json
8 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Configure sensitive parameters which will be filtered from the log file.
6 | Rails.application.config.filter_parameters += %i[passw secret token _key crypt salt certificate otp ssn]
7 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Add new inflection rules using the following format. Inflections
6 | # are locale specific, and you may define rules for as many different
7 | # locales as you wish. All of these examples are active by default:
8 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
9 | # inflect.plural /^(ox)$/i, '\1en'
10 | # inflect.singular /^(ox)en/i, '\1'
11 | # inflect.irregular 'person', 'people'
12 | # inflect.uncountable %w( fish sheep )
13 | # end
14 |
15 | # These inflection rules are supported but not enabled by default:
16 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
17 | # inflect.acronym 'RESTful'
18 | # end
19 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # Add new mime types for use in respond_to blocks:
6 | # Mime::Type.register "text/richtext", :rtf
7 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/permissions_policy.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Define an application-wide HTTP permissions policy. For further
4 | # information see https://developers.google.com/web/updates/2018/06/feature-policy
5 | #
6 | # Rails.application.config.permissions_policy do |f|
7 | # f.camera :none
8 | # f.gyroscope :none
9 | # f.microphone :none
10 | # f.usb :none
11 | # f.fullscreen :self
12 | # f.payment :self, "https://secure.example.com"
13 | # end
14 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Be sure to restart your server when you modify this file.
4 |
5 | # This file contains settings for ActionController::ParamsWrapper which
6 | # is enabled by default.
7 |
8 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9 | ActiveSupport.on_load(:action_controller) { wrap_parameters format: [:json] }
10 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/master.key:
--------------------------------------------------------------------------------
1 | 597adf4a2bc30360bb31a5a313331fd5
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/routes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Rails.application.routes.draw do
4 | # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
5 | end
6 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/config/spring.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | Spring.watch(".ruby-version", ".rbenv-vars", "tmp/restart.txt", "tmp/caching-dev.txt")
4 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_1/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | ENV["RAILS_ENV"] ||= "test"
4 | require_relative "../config/environment"
5 | require "rails/test_help"
6 |
7 | class ActiveSupport::TestCase
8 | # Run tests in parallel with specified workers
9 | parallelize(workers: :number_of_processors)
10 |
11 | # Add more helper methods to be used by all tests here...
12 | end
13 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 |
5 | gem "rails_event_store", path: "../../"
6 | gem "ruby_event_store", path: "../../../ruby_event_store"
7 | gem "ruby_event_store-browser", path: "../../../ruby_event_store-browser"
8 | gem "ruby_event_store-active_record",
9 | path: "../../../ruby_event_store-active_record"
10 | gem "rails_event_store_active_record",
11 | path: "../../../ruby_event_store-active_record"
12 | gem "aggregate_root", path: "../../../aggregate_root"
13 |
14 | gem "rails", "~> 7.2.2", ">= 7.2.2.1"
15 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative "config/application"
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path("../config/application", __dir__)
3 | require_relative "../config/boot"
4 | require "rails/commands"
5 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2 |
3 | require "bundler/setup" # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | L8SLqv3Pudy+oahd8KxXTvrbuzfeDJ5BRjRD8GptQAeQXz1vU1VLwUlvS3Rv3Xr1nLGYEQMZNZoV1kxfA6xVCn3pUxp/4Bna6I6+xPOQJoMZCFYYnbKi5RjlHwph6iMe4tuAaBQdpG9R0xlIyEsQcuwpFYC0V9FWD9CLC+IxZt4qIh6Q+Uv/Tx5d9RXth3utOlNT11QSNbS1WdfIqCkHzX9rSZ7ADJyhH9pjj9gOS0+oi8UdnuQ0mM651XjtrL7+gqKcQBN1uVJ4QAeOIHhtOniDBrYRZcVmAJI65Od+KflGtkGdk0aaq92Y6ZcM/7Mcms+oWTHn3JUxJs9r7szne3nbYovZcsl6wipLwnHUl5SX4hoa3MpKYSrXL7039tDh/2AsZsGPOWfpnXU5JS6Y9D5I2FQZ--Jzaouos3g5gl8gS5--QvIsS/Z/i8VfXGqlWNmUww==
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative "application"
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4 | # Use this to limit dissemination of sensitive information.
5 | # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6 | Rails.application.config.filter_parameters += %i[passw email secret token _key crypt salt certificate otp ssn]
7 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, "\\1en"
8 | # inflect.singular /^(ox)en/i, "\\1"
9 | # inflect.irregular "person", "people"
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym "RESTful"
16 | # end
17 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/initializers/permissions_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide HTTP permissions policy. For further
4 | # information see: https://developers.google.com/web/updates/2018/06/feature-policy
5 |
6 | # Rails.application.config.permissions_policy do |policy|
7 | # policy.camera :none
8 | # policy.gyroscope :none
9 | # policy.microphone :none
10 | # policy.usb :none
11 | # policy.fullscreen :self
12 | # policy.payment :self, "https://secure.example.com"
13 | # end
14 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/master.key:
--------------------------------------------------------------------------------
1 | 83aa647d62a5f5d645fe785e264ffd51
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
3 |
4 | # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
5 | # Can be used by load balancers and uptime monitors to verify that the app is live.
6 | get "up" => "rails/health#show", :as => :rails_health_check
7 |
8 | # Render dynamic PWA files from app/views/pwa/*
9 | get "service-worker" => "rails/pwa#service_worker", :as => :pwa_service_worker
10 | get "manifest" => "rails/pwa#manifest", :as => :pwa_manifest
11 |
12 | # Defines the root path route ("/")
13 | # root "posts#index"
14 | end
15 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_7_2/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV["RAILS_ENV"] ||= "test"
2 | require_relative "../config/environment"
3 | require "rails/test_help"
4 |
5 | module ActiveSupport
6 | class TestCase
7 | # Run tests in parallel with specified workers
8 | parallelize(workers: :number_of_processors)
9 |
10 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
11 | fixtures :all
12 |
13 | # Add more helper methods to be used by all tests here...
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative "config/application"
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path("../config/application", __dir__)
3 | require_relative "../config/boot"
4 | require "rails/commands"
5 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2 |
3 | require "bundler/setup" # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | mjRg5O7oGw8BkebZkgJs6CYFSyFjlB3B63sA4S4cTBAtJPt+G4meswjuY1ljjha1G1ZFCMNBrHCyCIODsihU3TaZWhk7TdZytioBhSiuQv507X/4A3zTjCp9johfS5VjvWznaLQVYlTg/1dPSaiPLAczvnKKH8IrUSeCCtu6G3Zt9ddULSaEPrTaame44MkEqWXZw88i7i9fmmj5zHWJ1q3PNoKAQUiTVh5yN7XAK79p9n0jKiUMcU/A0NDJ5cwrY7vj6XNu3r9W070QW1LN+EGLzVhZU0cMu1D3YUn5IiYk1cD/UCTuamo2G5NY3Qk0WO/IaJF9JIhZkVy5+/T2OwL9DY3GlS54zAZTkmYE/w2LH+Pzj9cMX+YyZvEiA5UEjE8I7/INE5B3GTaWXh49fQpM/T97n5CvlUJ/q52sXVhPzKPcGoU9RxSpv94RB9Ww0Zn3SCW4QhnaGT6aEgNMCw5XILctaSSVvZzYwDESI1WeZX0ENA0U8xSz--TqsU6jASNsoMDA1W--DC8kmImxTVBhFrx4WDuVrA==
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative "application"
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4 | # Use this to limit dissemination of sensitive information.
5 | # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6 | Rails.application.config.filter_parameters += %i[passw email secret token _key crypt salt certificate otp ssn cvv cvc]
7 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, "\\1en"
8 | # inflect.singular /^(ox)en/i, "\\1"
9 | # inflect.irregular "person", "people"
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym "RESTful"
16 | # end
17 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/master.key:
--------------------------------------------------------------------------------
1 | 70afc472a2791e3633b939fac66984f8
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
3 |
4 | # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
5 | # Can be used by load balancers and uptime monitors to verify that the app is live.
6 | get "up" => "rails/health#show", :as => :rails_health_check
7 |
8 | # Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
9 | # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
10 | # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
11 |
12 | # Defines the root path route ("/")
13 | # root "posts#index"
14 | end
15 |
--------------------------------------------------------------------------------
/rails_event_store/spec/dummy_8_0/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV["RAILS_ENV"] ||= "test"
2 | require_relative "../config/environment"
3 | require "rails/test_help"
4 |
5 | module ActiveSupport
6 | class TestCase
7 | # Run tests in parallel with specified workers
8 | parallelize(workers: :number_of_processors)
9 |
10 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
11 | fixtures :all
12 |
13 | # Add more helper methods to be used by all tests here...
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/rails_event_store/spec/migration_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RailsEventStore
6 | ::RSpec.describe "Migration" do
7 | specify { expect(Rails::Generators.public_namespaces).to include("rails_event_store_active_record:migration") }
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/rails_event_store/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe "no warnings" do
7 | specify { expect(rails_event_store_warnings).to eq([]) }
8 |
9 | def rails_event_store_warnings
10 | warnings.select { |w| w =~ %r{lib/rails_event_store} }
11 | end
12 |
13 | def warnings
14 | `ruby -Ilib -w lib/rails_event_store.rb 2>&1`.split("\n")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/rails_event_store/spec/support/fake_configuration.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class FakeConfiguration
4 | def initialize
5 | @options = {}
6 | end
7 |
8 | private
9 |
10 | def method_missing(name, *args, &blk)
11 | if name.to_s =~ /=$/
12 | @options[$`.to_sym] = args.first
13 | elsif @options.key?(name)
14 | @options[name]
15 | else
16 | super
17 | end
18 | end
19 |
20 | def respond_to_missing?(name, include_private = false)
21 | @options.key?(name) || super
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/rails_event_store/spec/support/test_application.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "action_controller/railtie"
4 | require "rails_event_store/railtie"
5 | require "securerandom"
6 |
7 | class TestApplication < Rails::Application
8 | config.hosts = nil
9 | config.eager_load = false
10 | config.secret_key_base = SecureRandom.hex(16)
11 | config.event_store = RailsEventStore::Client.new
12 | config.active_support.to_time_preserves_timezone = :zone
13 |
14 | routes.append { mount RailsEventStore::Browser => "/res" }
15 | routes.default_url_options = { host: "example.org" }
16 | end
17 |
18 | TestApplication.initialize!
19 |
--------------------------------------------------------------------------------
/railseventstore.org/Makefile:
--------------------------------------------------------------------------------
1 | install: ## Install dependencies
2 | @npm install --no-fund --no-audit
3 | .PHONY: install
4 |
5 | build: ## Output static files (production)
6 | @npm run build
7 | .PHONY: build
8 |
9 | serve:
10 | @npm run serve
11 | .PHONY: serve
12 |
13 | watch:
14 | @npx chokidar-cli "docs/**/*.md*" \
15 | "src/**/*.js" \
16 | -c "make build" \
17 | --initial
18 | .PHONY: watch
19 |
20 | dev: ## Run server (development)
21 | @$(MAKE) -j2 watch serve
22 | .PHONY: dev
23 |
24 | include ../support/make/help.mk
25 |
--------------------------------------------------------------------------------
/railseventstore.org/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3 | };
4 |
--------------------------------------------------------------------------------
/railseventstore.org/docs/advanced-topics/mapping-handlers-to-events.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Mapping handlers to events'
3 | ---
4 |
5 | RailsEventStore client provides an API that helps you find all subscribers (also called event handlers) for specified event type.
6 |
7 | This method is also useful when you have to answer the question if the handler subscribed to an event properly.
8 |
9 | ## Example
10 | Use following method to find all handlers for event of specific type.
11 |
12 | ```ruby
13 | event_store.subscribers_for(AccountUpdated) # => [...]
14 | ```
15 |
16 | This method returns array of all subscribers that subscribe to specified type of event.
17 |
--------------------------------------------------------------------------------
/railseventstore.org/docs/core-concepts/delete.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Deleting stream
3 | ---
4 |
5 | You can permanently delete all events from a specific stream.
6 |
7 | ```ruby
8 | stream_name = "product_1"
9 | client.delete_stream(stream_name)
10 | ```
11 |
12 | When you do it, events remain intact but they are no longer linked to the stream.
13 |
--------------------------------------------------------------------------------
/railseventstore.org/docs/getting-started/api.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: API Documentation
3 | ---
4 |
5 | API documentation is automatically generated by [yard](http://yardoc.org).
6 |
7 |
8 |
--------------------------------------------------------------------------------
/railseventstore.org/plugins/tailwind-config.cjs:
--------------------------------------------------------------------------------
1 | function tailwindPlugin(context, options) {
2 | return {
3 | name: 'tailwind-plugin',
4 | configurePostCss(postcssOptions) {
5 | postcssOptions.plugins = [
6 | require('postcss-import'),
7 | require('tailwindcss'),
8 | require('autoprefixer'),
9 | ];
10 | return postcssOptions;
11 | },
12 | };
13 | }
14 |
15 | module.exports = tailwindPlugin;
--------------------------------------------------------------------------------
/railseventstore.org/source/images/anenta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/source/images/anenta.png
--------------------------------------------------------------------------------
/railseventstore.org/source/images/billetto-chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/source/images/billetto-chart.png
--------------------------------------------------------------------------------
/railseventstore.org/src/components/Asciinema.js:
--------------------------------------------------------------------------------
1 | import BrowserOnly from "@docusaurus/BrowserOnly";
2 | import React, { useEffect, useRef } from "react";
3 |
4 | const AsciinemaContent = ({ src, id }) => {
5 | const ref = useRef(null);
6 |
7 | useEffect(() => {
8 | const script = document.createElement("script");
9 | script.src = src;
10 | script.id = id;
11 | script.async = true;
12 | ref.current?.appendChild(script);
13 |
14 | return () => {
15 | ref.current?.removeChild(script);
16 | };
17 | }, [src, id]);
18 |
19 | return ;
20 | };
21 |
22 | const AsciinemaWidget = (props) => {
23 | return (
24 | Loading asciinema cast...}>
25 | {() => }
26 |
27 | );
28 | };
29 |
30 | export default AsciinemaWidget;
31 |
--------------------------------------------------------------------------------
/railseventstore.org/src/helpers/getYoutubeId.js:
--------------------------------------------------------------------------------
1 | const getYoutubeID = (url) => {
2 | const regex =
3 | /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/;
4 | const match = url.match(regex);
5 | return match && match[1] ? match[1] : null;
6 | };
7 |
8 | export default getYoutubeID;
--------------------------------------------------------------------------------
/railseventstore.org/src/pages/data/gems_v1.json:
--------------------------------------------------------------------------------
1 | [
2 | "aggregate_root",
3 | "bounded_context",
4 | "rails_event_store",
5 | "rails_event_store-rspec",
6 | "rails_event_store_active_record",
7 | "ruby_event_store",
8 | "ruby_event_store-browser",
9 | "ruby_event_store-rom"
10 | ]
11 |
--------------------------------------------------------------------------------
/railseventstore.org/src/pages/data/gems_v2.json:
--------------------------------------------------------------------------------
1 | [
2 | "aggregate_root",
3 | "rails_event_store",
4 | "rails_event_store_active_record",
5 | "ruby_event_store",
6 | "ruby_event_store-browser",
7 | "ruby_event_store-rspec"
8 | ]
9 |
--------------------------------------------------------------------------------
/railseventstore.org/src/theme/DocItem/Content/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import Content from "@theme-original/DocItem/Content";
3 |
4 | export default function ContentWrapper(props) {
5 | return (
6 | <>
7 |
8 |
9 |
10 | >
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/railseventstore.org/static/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/.nojekyll
--------------------------------------------------------------------------------
/railseventstore.org/static/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/.keep
--------------------------------------------------------------------------------
/railseventstore.org/static/images/anenta.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/anenta.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/assist_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/assist_logo.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/bi_temporal_event_sourcing_when_things_go_smoothly.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/bi_temporal_event_sourcing_when_things_go_smoothly.jpg
--------------------------------------------------------------------------------
/railseventstore.org/static/images/bi_temporal_valid_at_event_sourcing.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/bi_temporal_valid_at_event_sourcing.jpg
--------------------------------------------------------------------------------
/railseventstore.org/static/images/billetto-chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/billetto-chart.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-120x120.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-152x152.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-160x160.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-160x160.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-167x167.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-167x167.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-16x16.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-180x180.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-192x192.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-270x270.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-270x270.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-310x310.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-32x32.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-70x70.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/favicons/res-rubies-96x96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/favicons/res-rubies-96x96.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/localhost_3000_res_.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/localhost_3000_res_.png
--------------------------------------------------------------------------------
/railseventstore.org/static/images/zencargo_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/images/zencargo_logo.png
--------------------------------------------------------------------------------
/railseventstore.org/static/img/docusaurus-social-card.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/img/docusaurus-social-card.jpg
--------------------------------------------------------------------------------
/railseventstore.org/static/img/docusaurus-social-card.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/img/docusaurus-social-card.png
--------------------------------------------------------------------------------
/railseventstore.org/static/img/docusaurus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/img/docusaurus.png
--------------------------------------------------------------------------------
/railseventstore.org/static/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/railseventstore.org/static/img/favicon.ico
--------------------------------------------------------------------------------
/railseventstore.org/static/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow: /search/
3 |
4 | Sitemap: https://railseventstore.org/sitemap.xml
--------------------------------------------------------------------------------
/railseventstore.org/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const { fontFamily } = require("tailwindcss/defaultTheme");
2 |
3 | /** @type {import('tailwindcss').Config} */
4 | module.exports = {
5 |
6 | darkMode: ["selector", '[data-theme="dark"]'],
7 | content: ["./src/**/*.{js,jsx,tsx,html}", "./docs/**/*.{md,mdx}"],
8 | theme: {
9 | extend: {
10 | fontFamily: {
11 | sans: ['"Inter"', ...fontFamily.sans],
12 | jakarta: ['"Plus Jakarta Sans"', ...fontFamily.sans],
13 | mono: ['"Fira Code"', ...fontFamily.mono],
14 | },
15 | borderRadius: {
16 | sm: "4px",
17 | },
18 | colors: {
19 | res: "#BB4539",
20 | },
21 | },
22 | },
23 | safelist: ["mt-8", "w-20", "-translate-y-[3px]", "max-w-4xl"],
24 | plugins: [
25 | require('@tailwindcss/typography'),
26 | ],
27 | };
28 |
--------------------------------------------------------------------------------
/railseventstore.org/versioned_docs/version-1.3.1/getting-started/delete.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Deleting stream
3 | ---
4 |
5 | You can permanently delete all events from a specific stream. Use this wisely.
6 |
7 | ```ruby
8 | stream_name = "product_1"
9 | client.delete_stream(stream_name)
10 | ```
11 |
--------------------------------------------------------------------------------
/railseventstore.org/versioned_docs/version-2.16.0/advanced-topics/mapping-handlers-to-events.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Mapping handlers to events'
3 | ---
4 |
5 | RailsEventStore client provides an API that helps you find all subscribers (also called event handlers) for specified event type.
6 |
7 | This method is also useful when you have to answer the question if the handler subscribed to an event properly.
8 |
9 | ## Example
10 | Use following method to find all handlers for event of specific type.
11 |
12 | ```ruby
13 | event_store.subscribers_for(AccountUpdated) # => [...]
14 | ```
15 |
16 | This method returns array of all subscribers that subscribe to specified type of event.
17 |
--------------------------------------------------------------------------------
/railseventstore.org/versioned_docs/version-2.16.0/core-concepts/delete.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Deleting stream
3 | ---
4 |
5 | You can permanently delete all events from a specific stream.
6 |
7 | ```ruby
8 | stream_name = "product_1"
9 | client.delete_stream(stream_name)
10 | ```
11 |
12 | When you do it, events remain intact but they are no longer linked to the stream.
13 |
--------------------------------------------------------------------------------
/railseventstore.org/versioned_docs/version-2.16.0/getting-started/api.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: API Documentation
3 | ---
4 |
5 | API documentation is automatically generated by [yard](http://yardoc.org).
6 |
7 |
8 |
--------------------------------------------------------------------------------
/railseventstore.org/versions.json:
--------------------------------------------------------------------------------
1 | [
2 | "2.16.0",
3 | "1.3.1"
4 | ]
5 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec name: "ruby_event_store-active_record"
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 | eval_gemfile "../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: ".."
10 |
11 | gem "childprocess"
12 | gem "activerecord", "~> 8.0.0"
13 | gem "sqlite3", ">= 2.1"
14 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/Gemfile.activerecord_7_1:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec name: "ruby_event_store-active_record"
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 | eval_gemfile "../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: ".."
10 |
11 | gem "childprocess"
12 | gem "activerecord", "~> 7.1.5"
13 | gem "sqlite3", "~> 1.7"
14 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/Gemfile.activerecord_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec name: "ruby_event_store-active_record"
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 | eval_gemfile "../support/bundler/Gemfile.database"
8 |
9 | gem "ruby_event_store", path: ".."
10 |
11 | gem "childprocess"
12 | gem "activerecord", "~> 7.2.2.1"
13 | gem "sqlite3", ">= 1.7.3"
14 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat ../RES_VERSION)
2 | GEM_NAME = ruby_event_store-active_record
3 | OLD_GEM_NAME = rails_event_store_active_record
4 |
5 | include ../support/make/install.mk
6 | include ../support/make/test.mk
7 | include ../support/make/mutant.mk
8 | include ../support/make/help.mk
9 |
10 | build push clean:
11 | @GEM_NAME=$(GEM_NAME) GEM_VERSION=$(GEM_VERSION) $(MAKE) -f ../support/make/gem.mk $@
12 | @GEM_NAME=$(OLD_GEM_NAME) GEM_VERSION=$(GEM_VERSION) $(MAKE) -f ../support/make/gem.mk $@
13 |
14 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/README.md:
--------------------------------------------------------------------------------
1 | # RubyEventStore::ActiveRecord
2 |
3 | Persistent event repository implementation for RubyEventStore based on ActiveRecord. Ships with database schema and migrations suitable for PostgreSQL, MySQL ans SQLite database engines.
4 |
5 | Includes repository implementation with linearized writes to achieve log-like properties of streams on top of SQL database engine.
6 |
7 | Find out more at [https://railseventstore.org](https://railseventstore.org/)
8 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/rails_event_store_active_record.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store/active_record"
4 |
5 | RailsEventStoreActiveRecord = RubyEventStore::ActiveRecord
6 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/generators/templates/add_event_id_index_to_event_store_events_in_streams_template.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AddEventIdIndexToEventStoreEventsInStreams < ActiveRecord::Migration[<%= migration_version %>]
4 | def change
5 | return if index_exists?(:event_store_events_in_streams, :event_id)
6 |
7 | add_index :event_store_events_in_streams, [:event_id]
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/generators/templates/add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AddForeignKeyOnEventIdToEventStoreEventsInStreams < ActiveRecord::Migration[<%= migration_version %>]
4 | def change
5 | add_foreign_key :event_store_events_in_streams, :event_store_events, column: :event_id, primary_key: :event_id, if_not_exists: true
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/generators/templates/mysql/add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AddForeignKeyOnEventIdToEventStoreEventsInStreams < ActiveRecord::Migration[<%= migration_version %>]
4 | def change
5 | add_foreign_key :event_store_events_in_streams, :event_store_events, column: :event_id, primary_key: :event_id, if_not_exists: true
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/generators/templates/postgres/add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class AddForeignKeyOnEventIdToEventStoreEventsInStreams < ActiveRecord::Migration[<%= migration_version %>]
4 | def change
5 | add_foreign_key :event_store_events_in_streams, :event_store_events, column: :event_id, primary_key: :event_id, if_not_exists: true, validate: false
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/generators/templates/postgres/validate_add_foreign_key_on_event_id_to_event_store_events_in_streams_template.erb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class ValidateAddForeignKeyOnEventIdToEventStoreEventsInStreams < ActiveRecord::Migration[<%= migration_version %>]
4 | def change
5 | validate_foreign_key :event_store_events_in_streams, :event_store_events, column: :event_id, primary_key: :event_id
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/pg_linearized_event_repository.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ActiveRecord
5 | class PgLinearizedEventRepository < EventRepository
6 | def start_transaction(&proc)
7 | ::ActiveRecord::Base.transaction(requires_new: true) do
8 | ::ActiveRecord::Base.connection.execute("SELECT pg_advisory_xact_lock(1845240511599988039) as l").each {}
9 |
10 | proc.call
11 | end
12 | end
13 | end
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/railtie.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ActiveRecord
5 | class Railtie < ::Rails::Railtie
6 | initializer "ruby_event_store-active_record" do
7 | ActiveSupport.on_load(:active_record) { require_relative "../active_record/event" }
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/rake_task.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store/active_record"
4 | require "active_record"
5 | load "ruby_event_store/active_record/tasks/migration_tasks.rake"
6 |
7 | include ActiveRecord::Tasks
8 |
9 | db_dir = ENV["DATABASE_DIR"] || "./db"
10 |
11 | task :environment do
12 | connection = ActiveRecord::Base.establish_connection(ENV["DATABASE_URL"])
13 | DatabaseTasks.env = connection.db_config.env_name
14 | DatabaseTasks.db_dir = db_dir
15 | DatabaseTasks.migrations_paths = ENV["MIGRATIONS_PATH"] || File.join(db_dir, "migrate")
16 | end
17 |
18 | load "active_record/railties/databases.rake"
19 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ActiveRecord
5 | VERSION = "2.16.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/lib/ruby_event_store/active_record/with_default_models.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module ActiveRecord
5 | class WithDefaultModels
6 | def call
7 | [Event, EventInStream]
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module ActiveRecord
7 | ::RSpec.describe "no warnings", mutant: false do
8 | specify { expect(ruby_event_store_active_record_warnings).to eq([]) }
9 |
10 | def ruby_event_store_active_record_warnings
11 | warnings.select { |w| w =~ %r{lib/ruby_event_store/active_record} }
12 | end
13 |
14 | def warnings
15 | `ruby -Ilib -w lib/ruby_event_store/active_record.rb 2>&1`.split("\n")
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/ruby_event_store-active_record/spec/with_default_models_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | module ActiveRecord
7 | ::RSpec.describe WithDefaultModels do
8 | specify do
9 | event_klass, stream_klass = WithDefaultModels.new.call
10 |
11 | expect(event_klass).to eq(Event)
12 | expect(stream_klass).to eq(EventInStream)
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/.mutant.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/mbj/mutant/blob/master/docs/configuration.md
2 |
3 | usage: opensource
4 | requires:
5 | - ruby_event_store/browser
6 | - ruby_event_store/browser/app
7 | includes:
8 | - lib
9 | integration:
10 | name: rspec
11 | mutation:
12 | operators: light
13 | coverage_criteria:
14 | process_abort: true
15 | matcher:
16 | subjects:
17 | - RubyEventStore::Browser*
18 | ignore:
19 | - RubyEventStore::Browser::App#res_version
20 | - RubyEventStore::Browser::App.for
21 | - RubyEventStore::Browser::App#initialize
22 | - RubyEventStore::Browser::Urls#with_request
23 | - RubyEventStore::Browser::Urls#initialize
24 | - RubyEventStore::Browser::Router#initialize
25 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 |
10 | gem "rack-test"
11 | gem "capybara", "~> 3.35"
12 | gem "json-schema"
13 | gem "rack", "~> 3.0", "< 3.1.0"
14 | gem "webrick"
15 | gem "cuprite"
16 | gem "rackup"
17 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/Gemfile.rack_2_0:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 | gemspec
3 |
4 | eval_gemfile "../support/bundler/Gemfile.shared"
5 |
6 | gem "ruby_event_store", path: ".."
7 |
8 | gem "rack-test"
9 | gem "capybara", "~> 3.35"
10 | gem "json-schema"
11 | gem "rack", "~> 2.0"
12 | gem "webrick"
13 | gem "cuprite"
14 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/README.md:
--------------------------------------------------------------------------------
1 | # RubyEventStore::Browser
2 |
3 | Event browser companion application for RubyEventStore. Inspect stream contents and event details. Explore correlation and causation connections.
4 |
5 | Find out more at [https://railseventstore.org](https://railseventstore.org/)
6 |
7 | ## UI Dev mode
8 |
9 | `make install clean dev` will auto-compile JS/CSS from ELM in the background and also serve standalone browser on http://localhost:9393
10 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/README.md:
--------------------------------------------------------------------------------
1 | # Browser
2 |
3 | Stream browser for RubyEventStore.
4 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ruby_event_store_browser",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "repository": "git@github.com:RubyEventStore/browser.git",
6 | "author": "dev@arkency.com",
7 | "license": "MIT",
8 | "devDependencies": {
9 | "@elm-tooling/elm-language-server": "^2.8.0",
10 | "chokidar-cli": "^3.0.0",
11 | "elm": "^0.19.1-6",
12 | "elm-format": "^0.8.7",
13 | "elm-test": "^0.19.1-revision15",
14 | "tailwindcss": "^3.4.9",
15 | "uglify-js": "^3.19.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/src/Flags.elm:
--------------------------------------------------------------------------------
1 | module Flags exposing (Flags, RawFlags, buildFlags)
2 |
3 | import Url
4 |
5 |
6 | type alias RawFlags =
7 | { rootUrl : String
8 | , apiUrl : String
9 | , resVersion : String
10 | , platform : String
11 | }
12 |
13 |
14 | type alias Flags =
15 | { rootUrl : Url.Url
16 | , apiUrl : Url.Url
17 | , resVersion : String
18 | , platform : String
19 | }
20 |
21 |
22 | buildFlags : RawFlags -> Maybe Flags
23 | buildFlags { rootUrl, apiUrl, resVersion, platform } =
24 | Maybe.map4 Flags (Url.fromString rootUrl) (Url.fromString apiUrl) (Just resVersion) (Just platform)
25 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/src/Pagination.elm:
--------------------------------------------------------------------------------
1 | module Pagination exposing (Specification, empty)
2 |
3 |
4 | type alias Specification =
5 | { position : Maybe String
6 | , direction : Maybe String
7 | , count : Maybe String
8 | }
9 |
10 |
11 | empty : Specification
12 | empty =
13 | Specification Nothing Nothing Nothing
14 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/src/Url/OurExtra.elm:
--------------------------------------------------------------------------------
1 | module Url.OurExtra exposing (maybeQueryParameter)
2 |
3 | import Maybe
4 | import Url.Builder
5 |
6 |
7 | maybeQueryParameter : String -> Maybe String -> Maybe Url.Builder.QueryParameter
8 | maybeQueryParameter name maybeValue =
9 | Maybe.map (\val -> Url.Builder.string name val) maybeValue
10 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/src/WrappedModel.elm:
--------------------------------------------------------------------------------
1 | module WrappedModel exposing (WrappedModel)
2 |
3 | import Browser.Navigation
4 | import BrowserTime
5 | import Flags exposing (Flags)
6 |
7 |
8 | type alias WrappedModel a =
9 | { internal : a
10 | , key : Browser.Navigation.Key
11 | , time :
12 | { selected : BrowserTime.TimeZone
13 | , detected : BrowserTime.TimeZone
14 | }
15 | , flags : Flags
16 | }
17 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/src/style.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | input::-webkit-calendar-picker-indicator {
6 | opacity: 0;
7 | }
--------------------------------------------------------------------------------
/ruby_event_store-browser/elm/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | content: ["./src/style.css", "./src/**/*.elm"],
3 | theme: {
4 | extend: {},
5 | },
6 | plugins: [],
7 | };
8 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/lib/ruby_event_store/browser.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Browser
5 | PAGE_SIZE = 20
6 | SERIALIZED_GLOBAL_STREAM_NAME = "all".freeze
7 | DEFAULT_RELATED_STREAMS_QUERY = ->(stream_name) { [] }
8 | end
9 | end
10 |
11 | require_relative "browser/get_event"
12 | require_relative "browser/json_api_event"
13 | require_relative "browser/json_api_stream"
14 | require_relative "browser/get_events_from_stream"
15 | require_relative "browser/get_stream"
16 | require_relative "browser/urls"
17 | require_relative "browser/gem_source"
18 | require_relative "browser/router"
19 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/lib/ruby_event_store/browser/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Browser
5 | VERSION = "2.16.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/.gitkeep
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/android-chrome-192x192.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/android-chrome-512x512.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/apple-touch-icon.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/favicon-16x16.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/favicon-32x32.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/favicon.ico
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/mstile-144x144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/mstile-144x144.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/mstile-150x150.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/mstile-310x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/mstile-310x150.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/mstile-310x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/mstile-310x310.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/public/mstile-70x70.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RailsEventStore/rails_event_store/9cb9ac13a13a1137918e33e843d519ba5bf76c6d/ruby_event_store-browser/public/mstile-70x70.png
--------------------------------------------------------------------------------
/ruby_event_store-browser/spec/legacy_event_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe Browser do
7 | let(:timestamp) { Time.utc(2020, 1, 1, 12, 0, 0, 1) }
8 | let(:parent_event) { TimeEnrichment.with(DummyEvent.new, timestamp: timestamp) }
9 | let(:dummy_event) { TimeEnrichment.with(DummyEvent.new, timestamp: timestamp) }
10 |
11 | specify "without persisted correlation_id" do
12 | json_event = Browser::JsonApiEvent.new(dummy_event, parent_event).to_h
13 | expect(json_event["correlation_stream_name"]).to be_nil
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe "no warnings" do
7 | specify { expect(ruby_event_store_browser_warnings).to eq([]) }
8 |
9 | def ruby_event_store_browser_warnings
10 | warnings.select { |w| w =~ %r{lib/ruby_event_store/browser} }
11 | end
12 |
13 | def warnings
14 | `ruby -Ilib -w lib/ruby_event_store/browser.rb 2>&1`.split("\n")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "ruby_event_store"
4 | require "ruby_event_store/browser/app"
5 | require "rack/test"
6 | require "support/web_client"
7 | require "support/api_client"
8 | require "support/csp_app"
9 | require "support/integration_helpers"
10 | require_relative "../../support/helpers/rspec_defaults"
11 | require_relative "../../support/helpers/time_enrichment"
12 |
13 | ENV["RACK_ENV"] = "test"
14 |
15 | require "capybara/cuprite"
16 | Capybara.server = :webrick
17 | Capybara.register_driver(:cuprite) do |app|
18 | Capybara::Cuprite::Driver.new(app, process_timeout: 30, browser_options: { "no-sandbox" => nil })
19 | end
20 |
21 | DummyEvent = Class.new(::RubyEventStore::Event)
22 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/spec/support/csp_app.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class CspApp
4 | def initialize(app, policy)
5 | @app = app
6 | @policy = policy
7 | end
8 |
9 | def call(env)
10 | status, headers, response = @app.call(env)
11 |
12 | headers["content-security-policy"] = @policy
13 | [status, headers, response]
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/spec/support/web_client.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class WebClient
4 | extend Forwardable
5 | def_delegators :@session, :get, :post
6 |
7 | def initialize(app, host = "example.org")
8 | @session = Rack::MockSession.new(Rack::Lint.new(app), host)
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/ruby_event_store-browser/spec/web_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe Browser do
7 | include Browser::IntegrationHelpers
8 |
9 | specify { expect(web_client.get("/")).to be_ok }
10 |
11 | specify { expect(web_client.get("/").content_type).to eq("text/html;charset=utf-8") }
12 |
13 | specify { expect(web_client.post("/")).to be_not_found }
14 | specify { expect(web_client.get("/streams/all")).to be_ok }
15 |
16 | specify do
17 | event_store.append(event = DummyEvent.new)
18 | expect(web_client.get("/events/#{event.event_id}")).to be_ok
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "aggregate_root", path: ".."
10 | gem "ruby_event_store-transformations", path: "../contrib/ruby_event_store-transformations"
11 |
12 | gem "diff-lcs", "= 1.3.0"
13 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 | gemspec
5 |
6 | eval_gemfile "../support/bundler/Gemfile.shared"
7 |
8 | gem "ruby_event_store", path: ".."
9 | gem "aggregate_root", path: ".."
10 | gem "ruby_event_store-transformations", path: "../contrib/ruby_event_store-transformations"
11 |
12 | gem "diff-lcs", "= 1.3.0"
13 | gem "rails", "~> 7.2.0"
14 | gem "zeitwerk", "~> 2.6.0"
15 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat ../RES_VERSION)
2 | GEM_NAME = ruby_event_store-rspec
3 |
4 | include ../support/make/install.mk
5 | include ../support/make/test.mk
6 | include ../support/make/mutant.mk
7 | include ../support/make/gem.mk
8 | include ../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/README.md:
--------------------------------------------------------------------------------
1 | # RubyEventStore::RSpec
2 |
3 | RSpec matchers for RubyEventStore.
4 |
5 | Find out more at [https://railseventstore.org](https://railseventstore.org/)
6 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/lib/ruby_event_store/rspec/fetch_events.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module RSpec
5 | class FetchEvents
6 | MissingEventStore = Class.new(StandardError)
7 |
8 | def from(event_id)
9 | @start = event_id
10 | end
11 |
12 | def stream(stream_name)
13 | @stream_name = stream_name
14 | end
15 |
16 | def in(event_store)
17 | @event_store = event_store
18 | end
19 |
20 | def call
21 | raise MissingEventStore if event_store.nil?
22 | events = event_store.read
23 | events = events.stream(stream_name) if stream_name
24 | events = events.from(start) if start
25 | events
26 | end
27 |
28 | attr_reader :start, :stream_name, :event_store
29 | end
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/lib/ruby_event_store/rspec/fetch_unpublished_events.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module RSpec
5 | class FetchUnpublishedEvents
6 | def in(aggregate)
7 | @aggregate = aggregate
8 | end
9 |
10 | def call
11 | aggregate.unpublished_events.to_a
12 | end
13 |
14 | def aggregate?
15 | !aggregate.nil?
16 | end
17 |
18 | attr_reader :aggregate
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/lib/ruby_event_store/rspec/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module RSpec
5 | VERSION = "2.16.0"
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe "no warnings" do
7 | specify { expect(ruby_event_store_rspec_warnings).to eq([]) }
8 |
9 | def ruby_event_store_rspec_warnings
10 | warnings.select { |w| w =~ %r{lib/ruby_event_store/rspec} }
11 | end
12 |
13 | def warnings
14 | `ruby -Ilib -w lib/ruby_event_store/rspec.rb 2>&1`.split("\n")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/ruby_event_store-rspec/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "aggregate_root"
4 | require "ruby_event_store"
5 | require "ruby_event_store/rspec"
6 | require "ruby_event_store/transformations"
7 | require_relative "../../support/helpers/rspec_defaults"
8 |
9 | FooEvent = Class.new(RubyEventStore::Event)
10 | BarEvent = Class.new(RubyEventStore::Event)
11 | BazEvent = Class.new(RubyEventStore::Event)
12 |
13 | class TestAggregate
14 | include AggregateRoot.with_strategy(-> { AggregateRoot::DefaultApplyStrategy.new(strict: false) })
15 |
16 | def foo
17 | apply(FooEvent.new)
18 | end
19 |
20 | def bar
21 | apply(BarEvent.new)
22 | end
23 |
24 | def baz
25 | apply(BazEvent.new)
26 | end
27 | end
28 |
29 | class Handler
30 | def call(event)
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/ruby_event_store/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 |
5 | gemspec
6 |
7 | eval_gemfile "../support/bundler/Gemfile.shared"
8 |
9 | gem "activesupport", "~> 8.0.0"
10 | gem "concurrent-ruby", "~> 1.2"
11 | gem "ostruct"
12 |
--------------------------------------------------------------------------------
/ruby_event_store/Gemfile.rails_7_2:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 |
5 | gemspec
6 |
7 | eval_gemfile "../support/bundler/Gemfile.shared"
8 |
9 | gem "activesupport", "~> 7.2.0"
10 | gem "concurrent-ruby", "~> 1.2"
11 | gem "ostruct"
12 |
--------------------------------------------------------------------------------
/ruby_event_store/Makefile:
--------------------------------------------------------------------------------
1 | GEM_VERSION = $(shell cat ../RES_VERSION)
2 | GEM_NAME = ruby_event_store
3 |
4 | include ../support/make/install.mk
5 | include ../support/make/test.mk
6 | include ../support/make/mutant.mk
7 | include ../support/make/gem.mk
8 | include ../support/make/help.mk
9 |
--------------------------------------------------------------------------------
/ruby_event_store/README.md:
--------------------------------------------------------------------------------
1 | # RubyEventStore
2 |
3 | Ruby implementation of an event store. Ships with in-memory event repository, generic instrumentation and dispatches events synchronously.
4 |
5 | Find out more at [https://railseventstore.org](https://railseventstore.org/)
6 |
--------------------------------------------------------------------------------
/ruby_event_store/bin/mutant:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'mutant' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12 |
13 | bundle_binstub = File.expand_path("bundle", __dir__)
14 |
15 | if File.file?(bundle_binstub)
16 | if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17 | load(bundle_binstub)
18 | else
19 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21 | end
22 | end
23 |
24 | require "rubygems"
25 | require "bundler/setup"
26 |
27 | load Gem.bin_path("mutant", "mutant")
28 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/composed_dispatcher.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class ComposedDispatcher
5 | def initialize(*dispatchers)
6 | @dispatchers = dispatchers
7 | end
8 |
9 | def call(subscriber, event, record)
10 | @dispatchers.each do |dispatcher|
11 | if dispatcher.verify(subscriber)
12 | dispatcher.call(subscriber, event, record)
13 | break
14 | end
15 | end
16 | end
17 |
18 | def verify(subscriber)
19 | @dispatchers.any? { |dispatcher| dispatcher.verify(subscriber) }
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/constants.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | GLOBAL_STREAM = Object.new
5 | PAGE_SIZE = 100.freeze
6 | TIMESTAMP_PRECISION = 6
7 | end
8 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/dispatcher.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class Dispatcher
5 | def call(subscriber, event, _)
6 | subscriber = subscriber.new if Class === subscriber
7 | subscriber.call(event)
8 | end
9 |
10 | def verify(subscriber)
11 | begin
12 | subscriber_instance = Class === subscriber ? subscriber.new : subscriber
13 | rescue ArgumentError
14 | false
15 | else
16 | subscriber_instance.respond_to?(:call)
17 | end
18 | end
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/event_type_resolver.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class EventTypeResolver
5 | def call(value)
6 | value.to_s
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/immediate_async_dispatcher.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class ImmediateAsyncDispatcher
5 | def initialize(scheduler:)
6 | @scheduler = scheduler
7 | end
8 |
9 | def call(subscriber, _, record)
10 | @scheduler.call(subscriber, record)
11 | end
12 |
13 | def verify(subscriber)
14 | @scheduler.verify(subscriber)
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/batch_mapper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class BatchMapper
6 | def initialize(mapper = Default.new)
7 | @mapper = mapper
8 | end
9 |
10 | def events_to_records(events)
11 | events.map { |event| @mapper.event_to_record(event) }
12 | end
13 |
14 | def records_to_events(records)
15 | records.map { |record| @mapper.record_to_event(record) }
16 | end
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/default.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class Default < PipelineMapper
6 | def initialize(events_class_remapping: {})
7 | super(
8 | Pipeline.new(
9 | Transformation::EventClassRemapper.new(events_class_remapping),
10 | Transformation::SymbolizeMetadataKeys.new,
11 | ),
12 | )
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/encryption_mapper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class EncryptionMapper < PipelineMapper
6 | def initialize(key_repository, serializer: Serializers::YAML, forgotten_data: ForgottenData.new)
7 | super(
8 | Pipeline.new(
9 | Transformation::Encryption.new(key_repository, serializer: serializer, forgotten_data: forgotten_data),
10 | Transformation::SymbolizeMetadataKeys.new,
11 | ),
12 | )
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/forgotten_data.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class ForgottenData
6 | FORGOTTEN_DATA = "FORGOTTEN_DATA".freeze
7 |
8 | def initialize(string = FORGOTTEN_DATA)
9 | @string = string
10 | end
11 |
12 | def to_s
13 | @string
14 | end
15 |
16 | def ==(other)
17 | @string == other
18 | end
19 | alias_method :eql?, :==
20 |
21 | def method_missing(*)
22 | self
23 | end
24 |
25 | def respond_to_missing?(*)
26 | true
27 | end
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/instrumented_mapper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class InstrumentedMapper
6 | def initialize(mapper, instrumentation)
7 | @mapper = mapper
8 | @instrumentation = instrumentation
9 | end
10 |
11 | def event_to_record(event)
12 | instrumentation.instrument("serialize.mapper.rails_event_store", domain_event: event) do
13 | mapper.event_to_record(event)
14 | end
15 | end
16 |
17 | def record_to_event(record)
18 | instrumentation.instrument("deserialize.mapper.rails_event_store", record: record) do
19 | mapper.record_to_event(record)
20 | end
21 | end
22 |
23 | private
24 |
25 | attr_reader :instrumentation, :mapper
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/json_mapper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class JSONMapper < Default
6 | def initialize(events_class_remapping: {})
7 | warn <<~EOW
8 | Please replace RubyEventStore::Mappers::JSONMapper with RubyEventStore::Mappers::Default
9 |
10 | They're now identical and the former will be removed in next major release.
11 | EOW
12 | super
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/null_mapper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class NullMapper < PipelineMapper
6 | def initialize
7 | super(Pipeline.new)
8 | end
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/pipeline.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class Pipeline
6 | def initialize(*transformations, to_domain_event: Transformation::DomainEvent.new)
7 | @transformations = [to_domain_event, transformations].flatten.freeze
8 | end
9 |
10 | def dump(event)
11 | transformations.reduce(event) { |item, transform| transform.dump(item) }
12 | end
13 |
14 | def load(record)
15 | transformations.reverse.reduce(record) { |item, transform| transform.load(item) }
16 | end
17 |
18 | attr_reader :transformations
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/pipeline_mapper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | class PipelineMapper
6 | def initialize(pipeline)
7 | @pipeline = pipeline
8 | end
9 |
10 | def event_to_record(event)
11 | pipeline.dump(event)
12 | end
13 |
14 | def record_to_event(record)
15 | pipeline.load(record)
16 | end
17 |
18 | private
19 |
20 | attr_reader :pipeline
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/transformation/stringify_metadata_keys.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | module Transformation
6 | class StringifyMetadataKeys
7 | def dump(record)
8 | stringify(record)
9 | end
10 |
11 | def load(record)
12 | stringify(record)
13 | end
14 |
15 | private
16 |
17 | def stringify(record)
18 | Record.new(
19 | event_id: record.event_id,
20 | event_type: record.event_type,
21 | data: record.data,
22 | metadata: TransformKeys.stringify(record.metadata),
23 | timestamp: record.timestamp,
24 | valid_at: record.valid_at,
25 | )
26 | end
27 | end
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/mappers/transformation/symbolize_metadata_keys.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module Mappers
5 | module Transformation
6 | class SymbolizeMetadataKeys
7 | def dump(record)
8 | symbolize(record)
9 | end
10 |
11 | def load(record)
12 | symbolize(record)
13 | end
14 |
15 | private
16 |
17 | def symbolize(record)
18 | Record.new(
19 | event_id: record.event_id,
20 | event_type: record.event_type,
21 | data: record.data,
22 | metadata: TransformKeys.symbolize(record.metadata),
23 | timestamp: record.timestamp,
24 | valid_at: record.valid_at,
25 | )
26 | end
27 | end
28 | end
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/null.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | module NULL
5 | def self.dump(value)
6 | value
7 | end
8 |
9 | def self.load(value)
10 | value
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/serializers/yaml.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "yaml"
4 |
5 | module RubyEventStore
6 | module Serializers
7 | class YAML
8 | def self.dump(value)
9 | ::YAML.dump(value)
10 | end
11 |
12 | def self.load(serialized)
13 | ::YAML.respond_to?(:unsafe_load) ? ::YAML.unsafe_load(serialized) : ::YAML.load(serialized)
14 | end
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/spec/dispatcher_lint.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.shared_examples "dispatcher" do |dispatcher|
4 | specify "#call" do
5 | expect(dispatcher).to respond_to(:call).with(3).arguments
6 | end
7 |
8 | specify "#verify" do
9 | expect(dispatcher).to respond_to(:verify).with(1).argument
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/spec/mapper_lint.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | ::RSpec.shared_examples "mapper" do |mapper, event|
5 | specify "event_to_record returns instance of Record" do
6 | record = mapper.event_to_record(event)
7 |
8 | expect(record).to be_a(Record)
9 | expect(record.event_id).to eq(event.event_id)
10 | expect(record.event_type).to eq(event.event_type)
11 | end
12 |
13 | specify "serialize and deserialize gives equal event" do
14 | record = mapper.event_to_record(event)
15 |
16 | expect(mapper.record_to_event(record)).to eq(event)
17 | end
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/spec/scheduler_lint.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | RSpec.shared_examples "scheduler" do |scheduler|
4 | specify "#call" do
5 | expect(scheduler).to respond_to(:call).with(2).arguments
6 | end
7 |
8 | specify "#verify" do
9 | expect(scheduler).to respond_to(:verify).with(1).argument
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/stream.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class Stream
5 | def initialize(name)
6 | raise IncorrectStreamData if !name.equal?(GLOBAL_STREAM) && (name.nil? || name.empty?)
7 | @name = name
8 | end
9 |
10 | def global?
11 | name.equal?(GLOBAL_STREAM)
12 | end
13 |
14 | attr_reader :name
15 |
16 | def hash
17 | name.hash ^ self.class.hash
18 | end
19 |
20 | def ==(other_stream)
21 | other_stream.instance_of?(self.class) && other_stream.name.eql?(name)
22 | end
23 |
24 | alias_method :eql?, :==
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/transform_keys.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | class TransformKeys
5 | class << self
6 | def stringify(data)
7 | deep_transform(data, &:to_s)
8 | end
9 |
10 | def symbolize(data)
11 | deep_transform(data, &:to_sym)
12 | end
13 |
14 | private
15 |
16 | def deep_transform(data, &block)
17 | case data
18 | when Hash
19 | data.each_with_object({}) { |(key, value), hash| hash[yield(key)] = deep_transform(value, &block) }
20 | when Array
21 | data.map { |i| deep_transform(i, &block) }
22 | else
23 | data
24 | end
25 | end
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/ruby_event_store/lib/ruby_event_store/version.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module RubyEventStore
4 | VERSION = "2.16.0"
5 | end
6 |
--------------------------------------------------------------------------------
/ruby_event_store/spec/broker_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 | require "ruby_event_store/spec/broker_lint"
5 |
6 | module RubyEventStore
7 | ::RSpec.describe Broker do
8 | it_behaves_like "broker", Broker
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/ruby_event_store/spec/event_type_resolver_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe EventTypeResolver do
7 | specify "resolves event type from class" do
8 | expect(EventTypeResolver.new.call(TestEvent)).to eq("TestEvent")
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/ruby_event_store/spec/mappers/events.proto3:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package res_testing;
3 |
4 | message OrderCreated {
5 | string order_id = 1;
6 | int32 customer_id = 2;
7 | }
8 |
--------------------------------------------------------------------------------
/ruby_event_store/spec/mappers/json_mapper_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 | require "ruby_event_store/spec/mapper_lint"
5 |
6 | SomethingHappenedJSON = Class.new(RubyEventStore::Event)
7 |
8 | module RubyEventStore
9 | module Mappers
10 | ::RSpec.describe JSONMapper do
11 | specify { expect { JSONMapper.new }.to output(<<~EOW).to_stderr }
12 | Please replace RubyEventStore::Mappers::JSONMapper with RubyEventStore::Mappers::Default
13 |
14 | They're now identical and the former will be removed in next major release.
15 | EOW
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/ruby_event_store/spec/no_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 |
5 | module RubyEventStore
6 | ::RSpec.describe "no warnings" do
7 | specify { expect(ruby_event_store_warnings).to eq([]) }
8 |
9 | def ruby_event_store_warnings
10 | warnings.select { |w| w =~ %r{lib/ruby_event_store} }
11 | end
12 |
13 | def warnings
14 | `ruby -Ilib -w lib/ruby_event_store.rb 2>&1`.split("\n")
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/ruby_event_store/spec/subscriptions_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "spec_helper"
4 | require "ruby_event_store/spec/subscriptions_lint"
5 |
6 | module RubyEventStore
7 | ::RSpec.describe Subscriptions do
8 | it_behaves_like "subscriptions", Subscriptions
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/support/bundler/Gemfile.database:
--------------------------------------------------------------------------------
1 | group "database" do
2 | gem "pg", "~> 1.5.6"
3 | gem "mysql2", "~> 0.5.6"
4 | end
5 |
--------------------------------------------------------------------------------
/support/bundler/Gemfile.shared:
--------------------------------------------------------------------------------
1 | gem "rake", ">= 10.0"
2 | gem "rspec"
3 | gem "mutant-rspec", require: false
4 | gem "mutant-minitest", require: false
5 | gem "mutant", require: false
6 | gem "irb"
7 |
--------------------------------------------------------------------------------
/support/helpers/protobuf_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module ProtobufHelper
4 | def require_protobuf_dependencies
5 | begin
6 | require_relative "../../ruby_event_store/spec/mappers/events_pb"
7 | require "protobuf_nested_struct"
8 | yield if block_given?
9 | rescue LoadError
10 | skip if unsupported_ruby_version
11 | end
12 | end
13 |
14 | def unsupported_ruby_version
15 | truffleruby || jruby
16 | end
17 |
18 | def truffleruby
19 | RUBY_ENGINE == "truffleruby"
20 | end
21 |
22 | def jruby
23 | RUBY_PLATFORM == "java"
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/support/helpers/rspec_defaults.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require_relative "silence_warnings"
4 |
5 | RSpec.configure do |config|
6 | config.include SilenceWarnings
7 |
8 | config.expect_with :rspec do |expectations|
9 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
10 | end
11 | config.mock_with :rspec do |mocks|
12 | mocks.verify_partial_doubles = true
13 | end
14 | config.shared_context_metadata_behavior = :apply_to_host_groups
15 | config.example_status_persistence_file_path = ".rspec_status"
16 | config.disable_monkey_patching!
17 |
18 | config.order = :random
19 | Kernel.srand config.seed
20 | end
21 |
--------------------------------------------------------------------------------
/support/helpers/silence_stdout.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "stringio"
4 |
5 | module SilenceStdout
6 | def silence_stdout
7 | $stdout = StringIO.new
8 | yield
9 | ensure
10 | $stdout = STDOUT
11 | end
12 | module_function :silence_stdout
13 | end
14 |
--------------------------------------------------------------------------------
/support/helpers/silence_warnings.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module SilenceWarnings
4 | def silence_warnings
5 | old_verbose, $VERBOSE = $VERBOSE, nil
6 | yield
7 | ensure
8 | $VERBOSE = old_verbose
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/support/helpers/subprocess_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require "childprocess"
4 | require "tempfile"
5 |
6 | module SubprocessHelper
7 | def run_subprocess(script, cwd, env)
8 | process = ChildProcess.build("ruby", script)
9 | env.each { |k, v| process.environment[k] = v }
10 | process.cwd = cwd
11 | process.io.stdout = $stdout
12 | process.io.stderr = $stderr
13 | process.start
14 | begin
15 | process.poll_for_exit(10)
16 | rescue ChildProcess::TimeoutError
17 | process.stop
18 | end
19 | expect(process.exit_code).to eq(0)
20 | end
21 |
22 | def run_in_subprocess(code, cwd: Dir.pwd, env: {})
23 | Tempfile.open do |script|
24 | script.write(code)
25 | script.close
26 | Bundler.with_unbundled_env { run_subprocess(script.path, cwd, env) }
27 | end
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/support/helpers/time_enrichment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | module TimeEnrichment
4 | def with(event, timestamp: Time.now.utc, valid_at: nil)
5 | event.metadata[:timestamp] ||= timestamp
6 | event.metadata[:valid_at] ||= valid_at || timestamp
7 | event
8 | end
9 | module_function :with
10 | end
11 |
--------------------------------------------------------------------------------
/support/make/gem.mk:
--------------------------------------------------------------------------------
1 | build:
2 | @echo "Building gem package"
3 | @gem build -V $(GEM_NAME).gemspec
4 | @mkdir -p pkg/
5 | @mv $(GEM_NAME)-$(GEM_VERSION).gem pkg/
6 |
7 | push:
8 | @echo "Pushing package to RubyGems"
9 | @gem push -k dev_arkency pkg/$(GEM_NAME)-$(GEM_VERSION).gem
10 |
11 | clean:
12 | @echo "Removing previously built $(GEM_NAME)-$(GEM_VERSION).gem package"
13 | @rm pkg/$(GEM_NAME)-$(GEM_VERSION).gem 2>/dev/null || true
14 |
--------------------------------------------------------------------------------
/support/make/help.mk:
--------------------------------------------------------------------------------
1 | help:
2 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = "(:|:[^:]*?## )"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}' | sort
3 |
4 | .PHONY: help
5 | .DEFAULT_GOAL := help
6 |
--------------------------------------------------------------------------------
/support/make/install.mk:
--------------------------------------------------------------------------------
1 | install: ## Install gem dependencies for current Gemfile
2 | @echo "Installing gem dependencies"
3 | @bundle install
4 |
5 | install-all: ## Install gem dependencies from all Gemfiles
6 | @echo "Installing gem dependencies"
7 | @find . -name Gemfile\* -a ! -name \*.lock -exec bundle install --gemfile {} \;
8 |
9 | update-all: ## Update gem dependencies in all Gemfiles
10 | @echo "Updating gem dependencies"
11 | @find . -name Gemfile\* -a ! -name \*.lock -exec bundle update --gemfile {} \;
12 |
--------------------------------------------------------------------------------
/support/make/mutant.mk:
--------------------------------------------------------------------------------
1 | SINCE_SHA ?= master
2 |
3 | mutate: ## Run mutation tests
4 | @echo "Running mutation tests"
5 | @bundle exec mutant run \
6 | $(if $(MUTANT_JOBS), --jobs $(MUTANT_JOBS)) \
7 | $(SUBJECT)
8 |
9 | mutate-fast: ## Run mutation tests with --fail-fast
10 | @echo "Running mutation tests"
11 | @bundle exec mutant run \
12 | $(if $(MUTANT_JOBS), --jobs $(MUTANT_JOBS)) \
13 | --fail-fast \
14 | $(SUBJECT)
15 |
16 | mutate-changes: ## Run incremental mutation tests
17 | @echo "Running mutation tests"
18 | @bundle exec mutant run \
19 | $(if $(MUTANT_JOBS), --jobs $(MUTANT_JOBS)) \
20 | --since $(SINCE_SHA) \
21 | $(SUBJECT)
22 |
--------------------------------------------------------------------------------
/support/make/test.mk:
--------------------------------------------------------------------------------
1 | test: ## Run unit tests
2 | @echo "Running unit tests"
3 | @bundle exec rspec
4 |
5 | test-fast: ## Run unit tests with --fail-fast --order defined --backtrace
6 | @echo "Running unit tests with --fail-fast"
7 | @bundle exec rspec --fail-fast --order defined --backtrace
8 |
9 |
--------------------------------------------------------------------------------
/support/nix/postgres_13.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 |
3 | mkShell {
4 | buildInputs = [ postgresql_13 ];
5 |
6 | shellHook = ''
7 | ${builtins.readFile ./pushtrap.sh}
8 |
9 | TMP=$(mktemp -d)
10 | DB=$TMP/db
11 | SOCKET=$TMP
12 |
13 | initdb -D $DB
14 | pg_ctl -D $DB \
15 | -l $TMP/logfile \
16 | -o "--unix_socket_directories='$SOCKET'" \
17 | -o "--listen_addresses=''\'''\'" \
18 | start
19 |
20 | createdb -h $SOCKET rails_event_store
21 | export DATABASE_URL="postgresql:///rails_event_store?host=$SOCKET"
22 |
23 | pushtrap "pg_ctl -D $DB stop; rm -rf $TMP" EXIT
24 | '';
25 | }
26 |
--------------------------------------------------------------------------------
/support/nix/postgres_14.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 |
3 | mkShell {
4 | buildInputs = [ postgresql_14 ];
5 |
6 | shellHook = ''
7 | ${builtins.readFile ./pushtrap.sh}
8 |
9 | TMP=$(mktemp -d)
10 | DB=$TMP/db
11 | SOCKET=$TMP
12 |
13 | initdb -D $DB
14 | pg_ctl -D $DB \
15 | -l $TMP/logfile \
16 | -o "--unix_socket_directories='$SOCKET'" \
17 | -o "--listen_addresses=''\'''\'" \
18 | start
19 |
20 | createdb -h $SOCKET rails_event_store
21 | export DATABASE_URL="postgresql:///rails_event_store?host=$SOCKET"
22 |
23 | pushtrap "pg_ctl -D $DB stop; rm -rf $TMP" EXIT
24 | '';
25 | }
26 |
--------------------------------------------------------------------------------
/support/nix/postgres_15.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 |
3 | mkShell {
4 | buildInputs = [ postgresql_15 ];
5 |
6 | shellHook = ''
7 | ${builtins.readFile ./pushtrap.sh}
8 |
9 | TMP=$(mktemp -d)
10 | DB=$TMP/db
11 | SOCKET=$TMP
12 |
13 | initdb -D $DB
14 | pg_ctl -D $DB \
15 | -l $TMP/logfile \
16 | -o "--unix_socket_directories='$SOCKET'" \
17 | -o "--listen_addresses=''\'''\'" \
18 | start
19 |
20 | createdb -h $SOCKET rails_event_store
21 | export DATABASE_URL="postgresql:///rails_event_store?host=$SOCKET"
22 |
23 | pushtrap "pg_ctl -D $DB stop; rm -rf $TMP" EXIT
24 | '';
25 | }
26 |
--------------------------------------------------------------------------------
/support/nix/postgres_16.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 |
3 | mkShell {
4 | buildInputs = [ postgresql_16 ];
5 |
6 | shellHook = ''
7 | ${builtins.readFile ./pushtrap.sh}
8 |
9 | TMP=$(mktemp -d)
10 | DB=$TMP/db
11 | SOCKET=$TMP
12 |
13 | initdb -D $DB
14 | pg_ctl -D $DB \
15 | -l $TMP/logfile \
16 | -o "--unix_socket_directories='$SOCKET'" \
17 | -o "--listen_addresses=''\'''\'" \
18 | start
19 |
20 | createdb -h $SOCKET rails_event_store
21 | export DATABASE_URL="postgresql:///rails_event_store?host=$SOCKET"
22 |
23 | pushtrap "pg_ctl -D $DB stop; rm -rf $TMP" EXIT
24 | '';
25 | }
26 |
--------------------------------------------------------------------------------
/support/nix/postgres_17.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 |
3 | mkShell {
4 | buildInputs = [ postgresql ];
5 |
6 | shellHook = ''
7 | ${builtins.readFile ./pushtrap.sh}
8 |
9 | TMP=$(mktemp -d)
10 | DB=$TMP/db
11 | SOCKET=$TMP
12 |
13 | initdb -D $DB
14 | pg_ctl -D $DB \
15 | -l $TMP/logfile \
16 | -o "--unix_socket_directories='$SOCKET'" \
17 | -o "--listen_addresses=''\'''\'" \
18 | start
19 |
20 | createdb -h $SOCKET rails_event_store
21 | export DATABASE_URL="postgresql:///rails_event_store?host=$SOCKET"
22 |
23 | pushtrap "pg_ctl -D $DB stop; rm -rf $TMP" EXIT
24 | '';
25 | }
26 |
--------------------------------------------------------------------------------
/support/nix/pushtrap.sh:
--------------------------------------------------------------------------------
1 | pushtrap () {
2 | test "$traps" || trap 'set +eu; eval $traps' 0;
3 | traps="$*; $traps"
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/support/nix/redis.nix:
--------------------------------------------------------------------------------
1 | with import {};
2 |
3 | mkShell {
4 | buildInputs = [ redis ];
5 |
6 | shellHook = ''
7 | ${builtins.readFile ./pushtrap.sh}
8 |
9 | LANG=C
10 | LC_ALL=C
11 |
12 | TMP=$(mktemp -d)
13 | SOCKET=$TMP/redis.sock
14 | PIDFILE=$TMP/redis.pid
15 |
16 | redis-server \
17 | --protected-mode no \
18 | --port 0 \
19 | --unixsocket $SOCKET \
20 | --save "" \
21 | --daemonize yes \
22 | --pidfile $PIDFILE
23 |
24 | export REDIS_URL="unix://$SOCKET"
25 |
26 | pushtrap "kill -9 $(cat $PIDFILE);rm -rf $TMP" EXIT
27 | '';
28 | }
29 |
--------------------------------------------------------------------------------