rails_event_store 1.3.1 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16d83cb5cb45f3e9eb9597ac6af7ad8159afb6c893f119885ce5176252e935b1
4
- data.tar.gz: 624d2e6e2398b960513e0e3391ced52a05a9334e23395adacb74906c3fec6461
3
+ metadata.gz: f547a33f75be9a69d32ffc99ea19b680fb35744d5c20b478effcba828439ac2e
4
+ data.tar.gz: d6103a7a68b1ee7230f254445be460983b160c8d6e7383c300e658261a6702e2
5
5
  SHA512:
6
- metadata.gz: f2a91f244de5f5afba31f60a2cf347eb42924afab65f73fc2651247661d3f5467716396ffac0e882e7fc2429ddce3f8ce7e428927fd0270d3999953f7a0aee93
7
- data.tar.gz: 14ec0811e1270e03a91bfcfd0fbe48422190a88d5bf78b91ab23f5d75ba4ba031b69e9f6976c30bdf3ad87e7581842c0ed680b0060e9bcc6cec5240a9ce3d211
6
+ metadata.gz: 772a73bc208254277062b9cde2d811c29414cea5a698b2abeb36dfe32892155cf634223f32707fbb344df24205c36d793f55e6e23091d0a693950db803cce2c3
7
+ data.tar.gz: a1b8e4dd54fba0594cdefec218561b7abcfd8ca16f58f78c3e746e2b70de59ebacf8da4e188c0c5ed9e845aaed6dd700d7acb5c3df4b2b7bd35b0eeac02555f0
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
1
  # RailsEventStore
2
2
 
3
- Rails wrapper for Ruby Event Store with batteries included.
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/)
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module RailsEventStore
6
+ module Generators
7
+ class BoundedContextGenerator < Rails::Generators::NamedBase
8
+ source_root File.expand_path(File.join(File.dirname(__FILE__), "../templates"))
9
+ hook_for :test_framework
10
+
11
+ def create_bounded_context
12
+ create_file "#{bounded_context_name}/lib/#{bounded_context_name}/.keep"
13
+
14
+ template "module.rb", "#{bounded_context_name}/lib/#{bounded_context_name}.rb"
15
+
16
+ application { "config.paths.add '#{bounded_context_name}/lib', eager_load: true" }
17
+ end
18
+
19
+ private
20
+
21
+ def bounded_context_namespace
22
+ name.camelize
23
+ end
24
+
25
+ def bounded_context_name
26
+ name.underscore
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+
5
+ module RailsEventStore
6
+ module Generators
7
+ class RspecGenerator < Rails::Generators::NamedBase
8
+ source_root File.expand_path(File.join(File.dirname(__FILE__), "../templates"))
9
+
10
+ def spec_helper
11
+ template "spec_helper.rb", "#{bounded_context_name}/spec/spec_helper.rb"
12
+ end
13
+
14
+ def bc_spec
15
+ template "bc_spec.rb", "#{bounded_context_name}/spec/#{bounded_context_name}_spec.rb"
16
+ end
17
+
18
+ def require_bc_spec
19
+ template "require_bc_spec.rb", "spec/#{bounded_context_name}_spec.rb"
20
+ end
21
+
22
+ private
23
+
24
+ def bounded_context_namespace
25
+ name.camelize
26
+ end
27
+
28
+ def bounded_context_name
29
+ name.underscore
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,25 @@
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.rb", "#{bounded_context_name}/test/test_helper.rb"
12
+ end
13
+
14
+ def require_bc_test
15
+ template "require_bc_test.rb", "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
@@ -0,0 +1,4 @@
1
+ require_relative "spec_helper"
2
+
3
+ ::RSpec.describe <%= bounded_context_namespace %> do
4
+ end
@@ -0,0 +1,2 @@
1
+ module <%= bounded_context_namespace %>
2
+ end
@@ -0,0 +1,4 @@
1
+ require "rails_helper"
2
+
3
+ path = Rails.root.join("<%= bounded_context_name %>/spec")
4
+ Dir.glob("#{path}/**/*_spec.rb") { |file| require file }
@@ -0,0 +1,3 @@
1
+ require "test_helper"
2
+
3
+ Dir[Rails.root.join("<%= bounded_context_name %>/test/*_test.rb")].each { |file| require file }
@@ -0,0 +1,7 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+
3
+ $LOAD_PATH.push File.expand_path("../../../spec", __FILE__)
4
+ require File.expand_path("../../../config/environment", __FILE__)
5
+ require File.expand_path("../../../spec/rails_helper", __FILE__)
6
+
7
+ require_relative "../lib/<%= bounded_context_name %>"
@@ -0,0 +1 @@
1
+ require_relative "../lib/<%= bounded_context_name %>"
@@ -1,15 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_job'
3
+ require "active_job"
4
4
 
5
5
  module RailsEventStore
6
6
  class ActiveJobScheduler
7
- def call(klass, serialized_event)
8
- klass.perform_later(serialized_event.to_h)
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))
9
13
  end
10
14
 
11
15
  def verify(subscriber)
12
16
  Class === subscriber && !!(subscriber < ActiveJob::Base)
13
17
  end
18
+
19
+ private
20
+
21
+ attr_reader :serializer
14
22
  end
15
23
  end
@@ -6,10 +6,8 @@ module RailsEventStore
6
6
  @scheduler = scheduler
7
7
  end
8
8
 
9
- def call(subscriber, _, serialized_event)
10
- run do
11
- @scheduler.call(subscriber, serialized_event)
12
- end
9
+ def call(subscriber, _, record)
10
+ run { @scheduler.call(subscriber, record) }
13
11
  end
14
12
 
15
13
  def run(&schedule_proc)
@@ -40,18 +38,15 @@ module RailsEventStore
40
38
  schedule_proc.call
41
39
  end
42
40
 
43
- def rolledback!(*)
44
- end
41
+ def rolledback!(*); end
45
42
 
46
- def before_committed!
47
- end
43
+ def before_committed!; end
48
44
 
49
45
  def add_to_transaction
50
46
  dispatcher.run(&schedule_proc)
51
47
  end
52
48
 
53
- def trigger_transactional_callbacks?
54
- end
49
+ def trigger_transactional_callbacks?; end
55
50
 
56
51
  attr_reader :schedule_proc, :dispatcher
57
52
  end
@@ -1,31 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ruby_event_store'
4
- require 'rails_event_store/async_handler_helpers'
5
- require 'rails_event_store/link_by_metadata'
6
- require 'rails_event_store/after_commit_async_dispatcher'
7
- require 'rails_event_store/active_job_scheduler'
8
- require 'rails_event_store/client'
9
- require 'rails_event_store/version'
10
- require 'rails_event_store/railtie'
11
- require 'rails_event_store/browser'
3
+ require "ruby_event_store"
4
+ require_relative "async_handler_helpers"
5
+ require_relative "link_by_metadata"
6
+ require_relative "after_commit_async_dispatcher"
7
+ require_relative "active_job_scheduler"
8
+ require_relative "client"
9
+ require_relative "json_client"
10
+ require_relative "version"
11
+ require_relative "railtie"
12
+ require_relative "browser"
12
13
 
13
14
  module RailsEventStore
14
- Event = RubyEventStore::Event
15
- InMemoryRepository = RubyEventStore::InMemoryRepository
16
- Subscriptions = RubyEventStore::Subscriptions
17
- Projection = RubyEventStore::Projection
18
- WrongExpectedEventVersion = RubyEventStore::WrongExpectedEventVersion
19
- InvalidExpectedVersion = RubyEventStore::InvalidExpectedVersion
20
- IncorrectStreamData = RubyEventStore::IncorrectStreamData
21
- EventNotFound = RubyEventStore::EventNotFound
22
- SubscriberNotExist = RubyEventStore::SubscriberNotExist
23
- InvalidHandler = RubyEventStore::InvalidHandler
24
- InvalidPageStart = RubyEventStore::InvalidPageStart
25
- InvalidPageStop = RubyEventStore::InvalidPageStop
26
- InvalidPageSize = RubyEventStore::InvalidPageSize
27
- CorrelatedCommands = RubyEventStore::CorrelatedCommands
28
- GLOBAL_STREAM = RubyEventStore::GLOBAL_STREAM
29
- PAGE_SIZE = RubyEventStore::PAGE_SIZE
30
- ImmediateAsyncDispatcher = RubyEventStore::ImmediateAsyncDispatcher
15
+ Event = RubyEventStore::Event
16
+ InMemoryRepository = RubyEventStore::InMemoryRepository
17
+ Subscriptions = RubyEventStore::Subscriptions
18
+ Projection = RubyEventStore::Projection
19
+ WrongExpectedEventVersion = RubyEventStore::WrongExpectedEventVersion
20
+ InvalidExpectedVersion = RubyEventStore::InvalidExpectedVersion
21
+ IncorrectStreamData = RubyEventStore::IncorrectStreamData
22
+ EventNotFound = RubyEventStore::EventNotFound
23
+ SubscriberNotExist = RubyEventStore::SubscriberNotExist
24
+ InvalidHandler = RubyEventStore::InvalidHandler
25
+ InvalidPageStart = RubyEventStore::InvalidPageStart
26
+ InvalidPageStop = RubyEventStore::InvalidPageStop
27
+ InvalidPageSize = RubyEventStore::InvalidPageSize
28
+ CorrelatedCommands = RubyEventStore::CorrelatedCommands
29
+ GLOBAL_STREAM = RubyEventStore::GLOBAL_STREAM
30
+ PAGE_SIZE = RubyEventStore::PAGE_SIZE
31
+ ImmediateAsyncDispatcher = RubyEventStore::ImmediateAsyncDispatcher
31
32
  end
@@ -2,19 +2,34 @@
2
2
 
3
3
  module RailsEventStore
4
4
  module AsyncHandler
5
- def perform(payload)
6
- super(Rails.configuration.event_store.deserialize(**payload.symbolize_keys))
5
+ def self.with_defaults
6
+ with
7
+ end
8
+
9
+ def self.with(
10
+ event_store: Rails.configuration.event_store,
11
+ event_store_locator: nil,
12
+ serializer: RubyEventStore::Serializers::YAML
13
+ )
14
+ Module.new do
15
+ define_method :perform do |payload|
16
+ event_store = event_store_locator.call if event_store_locator
17
+ super(event_store.deserialize(serializer: serializer, **payload.transform_keys(&:to_sym)))
18
+ end
19
+ end
20
+ end
21
+
22
+ def self.prepended(host_class)
23
+ host_class.prepend with_defaults
7
24
  end
8
25
  end
9
26
 
10
27
  module CorrelatedHandler
11
28
  def perform(event)
12
- Rails.configuration.event_store.with_metadata(
13
- correlation_id: event.metadata[:correlation_id],
14
- causation_id: event.event_id
15
- ) do
16
- super
17
- end
29
+ Rails
30
+ .configuration
31
+ .event_store
32
+ .with_metadata(correlation_id: event.metadata[:correlation_id], causation_id: event.event_id) { super }
18
33
  end
19
34
  end
20
35
  end
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ruby_event_store/browser/app'
3
+ require "ruby_event_store/browser/app"
4
+ require "rails/engine"
4
5
 
5
6
  module RailsEventStore
6
- Browser = RubyEventStore::Browser::App.for(event_store_locator: -> { Rails.configuration.event_store })
7
- end
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
@@ -4,35 +4,41 @@ module RailsEventStore
4
4
  class Client < RubyEventStore::Client
5
5
  attr_reader :request_metadata
6
6
 
7
- def initialize(repository: RailsEventStoreActiveRecord::EventRepository.new,
8
- mapper: RubyEventStore::Mappers::Default.new,
9
- subscriptions: RubyEventStore::Subscriptions.new,
10
- dispatcher: RubyEventStore::ComposedDispatcher.new(
11
- RubyEventStore::ImmediateAsyncDispatcher.new(scheduler: ActiveJobScheduler.new),
12
- RubyEventStore::Dispatcher.new),
13
- request_metadata: default_request_metadata)
14
- super(repository: RubyEventStore::InstrumentedRepository.new(repository, ActiveSupport::Notifications),
15
- mapper: RubyEventStore::Mappers::InstrumentedMapper.new(mapper, ActiveSupport::Notifications),
16
- subscriptions: subscriptions,
17
- dispatcher: RubyEventStore::InstrumentedDispatcher.new(dispatcher, ActiveSupport::Notifications)
18
- )
7
+ def initialize(
8
+ mapper: RubyEventStore::Mappers::Default.new,
9
+ repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::Serializers::YAML),
10
+ subscriptions: RubyEventStore::Subscriptions.new,
11
+ dispatcher: RubyEventStore::ComposedDispatcher.new(
12
+ RailsEventStore::AfterCommitAsyncDispatcher.new(
13
+ scheduler: ActiveJobScheduler.new(serializer: RubyEventStore::Serializers::YAML)
14
+ ),
15
+ RubyEventStore::Dispatcher.new
16
+ ),
17
+ clock: default_clock,
18
+ correlation_id_generator: default_correlation_id_generator,
19
+ request_metadata: default_request_metadata
20
+ )
21
+ super(
22
+ repository: RubyEventStore::InstrumentedRepository.new(repository, ActiveSupport::Notifications),
23
+ mapper: RubyEventStore::Mappers::InstrumentedMapper.new(mapper, ActiveSupport::Notifications),
24
+ subscriptions: RubyEventStore::InstrumentedSubscriptions.new(subscriptions, ActiveSupport::Notifications),
25
+ clock: clock,
26
+ correlation_id_generator: correlation_id_generator,
27
+ dispatcher: RubyEventStore::InstrumentedDispatcher.new(dispatcher, ActiveSupport::Notifications)
28
+ )
19
29
  @request_metadata = request_metadata
20
30
  end
21
31
 
22
32
  def with_request_metadata(env, &block)
23
- with_metadata(request_metadata.call(env)) do
24
- block.call
25
- end
33
+ with_metadata(request_metadata.call(env)) { block.call }
26
34
  end
27
35
 
28
36
  private
37
+
29
38
  def default_request_metadata
30
39
  ->(env) do
31
40
  request = ActionDispatch::Request.new(env)
32
- {
33
- remote_ip: request.remote_ip,
34
- request_id: request.uuid
35
- }
41
+ { remote_ip: request.remote_ip, request_id: request.uuid }
36
42
  end
37
43
  end
38
44
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsEventStore
4
+ class JSONClient < Client
5
+ def initialize(
6
+ mapper: RubyEventStore::Mappers::Default.new,
7
+ repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::NULL),
8
+ subscriptions: RubyEventStore::Subscriptions.new,
9
+ dispatcher: RubyEventStore::ComposedDispatcher.new(
10
+ RailsEventStore::AfterCommitAsyncDispatcher.new(
11
+ scheduler: ActiveJobScheduler.new(serializer: RubyEventStore::Serializers::YAML)
12
+ ),
13
+ RubyEventStore::Dispatcher.new
14
+ ),
15
+ clock: default_clock,
16
+ correlation_id_generator: default_correlation_id_generator,
17
+ request_metadata: default_request_metadata
18
+ )
19
+ super(
20
+ mapper:
21
+ RubyEventStore::Mappers::InstrumentedMapper.new(
22
+ RubyEventStore::Mappers::PipelineMapper.new(
23
+ RubyEventStore::Mappers::Pipeline.new(
24
+ RubyEventStore::Mappers::Transformation::PreserveTypes
25
+ .new
26
+ .register(Symbol, serializer: ->(v) { v.to_s }, deserializer: ->(v) { v.to_sym })
27
+ .register(
28
+ Time,
29
+ serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) },
30
+ deserializer: ->(v) { Time.iso8601(v) }
31
+ )
32
+ .register(
33
+ ActiveSupport::TimeWithZone,
34
+ serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) },
35
+ deserializer: ->(v) { Time.iso8601(v).in_time_zone },
36
+ stored_type: ->(*) { "ActiveSupport::TimeWithZone" }
37
+ )
38
+ .register(Date, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { Date.iso8601(v) })
39
+ .register(DateTime, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { DateTime.iso8601(v) })
40
+ .register(BigDecimal, serializer: ->(v) { v.to_s }, deserializer: ->(v) { BigDecimal(v) }),
41
+ RubyEventStore::Mappers::Transformation::SymbolizeMetadataKeys.new
42
+ )
43
+ ),
44
+ ActiveSupport::Notifications
45
+ ),
46
+ repository: RubyEventStore::InstrumentedRepository.new(repository, ActiveSupport::Notifications),
47
+ subscriptions: RubyEventStore::InstrumentedSubscriptions.new(subscriptions, ActiveSupport::Notifications),
48
+ clock: clock,
49
+ correlation_id_generator: correlation_id_generator,
50
+ dispatcher: RubyEventStore::InstrumentedDispatcher.new(dispatcher, ActiveSupport::Notifications)
51
+ )
52
+ @request_metadata = request_metadata
53
+ end
54
+ end
55
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsEventStore
4
-
5
4
  class LinkByMetadata < RubyEventStore::LinkByMetadata
6
5
  def initialize(event_store: Rails.configuration.event_store, key:, prefix: nil)
7
6
  super
@@ -25,5 +24,4 @@ module RailsEventStore
25
24
  super
26
25
  end
27
26
  end
28
-
29
27
  end
@@ -8,9 +8,7 @@ module RailsEventStore
8
8
 
9
9
  def call(env)
10
10
  if config.respond_to?(:event_store)
11
- config.event_store.with_request_metadata(env) do
12
- @app.call(env)
13
- end
11
+ config.event_store.with_request_metadata(env) { @app.call(env) }
14
12
  else
15
13
  @app.call(env)
16
14
  end
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails/railtie'
4
- require 'rails_event_store/middleware'
3
+ require "rails/railtie"
4
+ require_relative "middleware"
5
5
 
6
6
  module RailsEventStore
7
7
  class Railtie < ::Rails::Railtie
8
- initializer 'rails_event_store.middleware' do |rails|
8
+ initializer "rails_event_store.middleware" do |rails|
9
9
  rails.middleware.use(::RailsEventStore::Middleware)
10
10
  end
11
11
  end
12
12
  end
13
-
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsEventStore
4
- VERSION = "1.3.1"
4
+ VERSION = "2.9.1"
5
5
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails_event_store_active_record'
4
- require 'rails_event_store/all'
3
+ require "rails_event_store_active_record"
4
+ require_relative "rails_event_store/all"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-05 00:00:00.000000000 Z
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_event_store
@@ -16,112 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.1
19
+ version: 2.9.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.3.1
26
+ version: 2.9.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby_event_store-browser
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.1
33
+ version: 2.9.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.1
40
+ version: 2.9.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rails_event_store_active_record
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.1
47
+ version: 2.9.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.1
54
+ version: 2.9.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: aggregate_root
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.1
61
+ version: 2.9.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.3.1
69
- - !ruby/object:Gem::Dependency
70
- name: bounded_context
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 1.3.1
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 1.3.1
68
+ version: 2.9.1
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: activesupport
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: '3.0'
75
+ version: '6.0'
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: '3.0'
82
+ version: '6.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: activemodel
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
102
88
  - !ruby/object:Gem::Version
103
- version: '3.0'
89
+ version: '6.0'
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - ">="
109
95
  - !ruby/object:Gem::Version
110
- version: '3.0'
96
+ version: '6.0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: activejob
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
116
102
  - !ruby/object:Gem::Version
117
- version: '3.0'
103
+ version: '6.0'
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - ">="
123
109
  - !ruby/object:Gem::Version
124
- version: '3.0'
110
+ version: '6.0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: arkency-command_bus
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -136,17 +122,26 @@ dependencies:
136
122
  - - ">="
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0.4'
139
- description: Implementation of Event Store in Ruby
140
- email:
141
- - dev@arkency.com
125
+ description: |
126
+ Rails wrapper for RubyEventStore with batteries included. Ships with asynchronous after-commit event dispatch
127
+ on top of ActiveJob, ActiveSupport::Notifications instrumentation enabled, request metadata enrichment
128
+ and opinionated directory structure generator for bounded contexts.
129
+ email: dev@arkency.com
142
130
  executables: []
143
131
  extensions: []
144
- extra_rdoc_files: []
132
+ extra_rdoc_files:
133
+ - README.md
145
134
  files:
146
- - CHANGELOG.md
147
- - Gemfile
148
- - Makefile
149
135
  - README.md
136
+ - lib/generators/rails_event_store/bounded_context_generator.rb
137
+ - lib/generators/rails_event_store/rspec_generator.rb
138
+ - lib/generators/rails_event_store/test_unit_generator.rb
139
+ - lib/generators/templates/bc_spec.rb
140
+ - lib/generators/templates/module.rb
141
+ - lib/generators/templates/require_bc_spec.rb
142
+ - lib/generators/templates/require_bc_test.rb
143
+ - lib/generators/templates/spec_helper.rb
144
+ - lib/generators/templates/test_helper.rb
150
145
  - lib/rails_event_store.rb
151
146
  - lib/rails_event_store/active_job_scheduler.rb
152
147
  - lib/rails_event_store/after_commit_async_dispatcher.rb
@@ -154,19 +149,20 @@ files:
154
149
  - lib/rails_event_store/async_handler_helpers.rb
155
150
  - lib/rails_event_store/browser.rb
156
151
  - lib/rails_event_store/client.rb
152
+ - lib/rails_event_store/json_client.rb
157
153
  - lib/rails_event_store/link_by_metadata.rb
158
154
  - lib/rails_event_store/middleware.rb
159
155
  - lib/rails_event_store/railtie.rb
160
156
  - lib/rails_event_store/version.rb
161
- - rails_event_store.gemspec
162
157
  homepage: https://railseventstore.org
163
158
  licenses:
164
159
  - MIT
165
160
  metadata:
166
- homepage_uri: https://railseventstore.org/
161
+ homepage_uri: https://railseventstore.org
167
162
  changelog_uri: https://github.com/RailsEventStore/rails_event_store/releases
168
163
  source_code_uri: https://github.com/RailsEventStore/rails_event_store
169
164
  bug_tracker_uri: https://github.com/RailsEventStore/rails_event_store/issues
165
+ rubygems_mfa_required: 'true'
170
166
  post_install_message:
171
167
  rdoc_options: []
172
168
  require_paths:
@@ -175,15 +171,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
171
  requirements:
176
172
  - - ">="
177
173
  - !ruby/object:Gem::Version
178
- version: '0'
174
+ version: '2.7'
179
175
  required_rubygems_version: !ruby/object:Gem::Requirement
180
176
  requirements:
181
177
  - - ">="
182
178
  - !ruby/object:Gem::Version
183
179
  version: '0'
184
180
  requirements: []
185
- rubygems_version: 3.1.4
181
+ rubygems_version: 3.3.7
186
182
  signing_key:
187
183
  specification_version: 4
188
- summary: Event Store in Ruby
184
+ summary: Rails wrapper for RubyEventStore with batteries included
189
185
  test_files: []
data/CHANGELOG.md DELETED
@@ -1,159 +0,0 @@
1
- Further changes can be tracked at [releases page](https://github.com/RailsEventStore/rails_event_store/releases).
2
-
3
- ### 0.14.5 (24.08.2017)
4
-
5
- * Change: ruby_event_store updated to 0.14.0
6
-
7
- ### 0.14.4 (18.08.2017)
8
-
9
- * Change: rails_event_store_active_record updated to 0.6.11
10
- * Fix: Explicit order when querying forward. Leaving it implcit to database engine choice gives different results on different engines.
11
- * Fix: Explicitly require railtie to load middleware in Rails to enrich event metadata with request metadata (PR #65)
12
-
13
- ### 0.14.3 (24.11.2016)
14
-
15
- * Fix: Fixes where is initialized event repository #62
16
-
17
- ### 0.14.2 (23.11.2016)
18
-
19
- * Change: rails_event_store_active_record updated to 0.6.10
20
- This time it will really allow to avoid ActiveRecord dependency when not using rails_event_store_active_record's
21
- event repository.
22
-
23
- ### 0.14.1 (21.11.2016)
24
-
25
- * Change: Allows to set the event repository used. #61
26
- Allow to avoid ActiveRecord dependency when not using rails_event_store_active_record's
27
- event repository. See documentation for mode details https://railseventstore.arkency.com/docs/repository.html
28
-
29
- ### 0.14.0 (28.10.2016)
30
-
31
- * Change: aggregate_root updated to 0.4.0
32
- This is a breaking change only if you use aggregate_root gem.
33
- Nothing has changed in RailsEventStore however the aggregate_root gem
34
- has been redesigned completely.
35
-
36
- ### 0.13.0 (21.10.2016)
37
-
38
- * Change: ruby_event_store updated to 0.13.0
39
- * Change: RailsEventStore::Client methods signarures aligned with RubyEventStore::Client
40
- RailsEventStore::Client is just a specialization of RubyEventStore::Client
41
- with sensible defaults. Nothing more. This will ensure both are compatible.
42
- * Change: No more ClosedStruct in Event class, you need use hashes to access data & metadata.
43
- This is a breaking change.
44
-
45
- ### 0.12.1 (11.08.2016)
46
-
47
- * Fix: aggregate_root gem updated to 0.3.5 fixing invalid method name generated for events wrapped in namespace
48
-
49
- ### 0.12.0 (10.08.2016)
50
-
51
- * Change: Updated Ruby Event Store method calls according to the newer version PR #53
52
-
53
- ### 0.11.0 (12.07.2016)
54
-
55
- * Breaking change in domain event class (Part of PR #48)
56
- * no more simple `TestEvent.new(some_attr: 'some value')`
57
- use `TestEvent.new(data: { some_attr: 'some value' })` instead
58
- * all data & metadata attributes accessible via `data` & `metadata` properties
59
- of event class
60
- * This will avoid name clashes when defining domain event data,
61
- especially important for `event_id`
62
- * Breaking change: deprecated `handle_event` method removed, use `call` instead
63
- * some domain event handlers might need method rename
64
- * Change: Mark aliased methods as deprecated (soon to be removed)
65
- * Change: Update RubyEventStore to 0.11.0 PR #48
66
- * RubyEventStore::Facade renamed to RubyEventStore::Client
67
- * Fix: Improve mutation tests coverage PR #47
68
-
69
- ### 0.10.0 (30.06.2016)
70
-
71
- * Change: Rails request details in event metadata PR #39
72
- * Change: Add dynamic subscriptions (implemented by ruby_event_store 0.9.0) PR #43
73
- * Fix: In-memory sqlite3 with schema load over prebaked filesystem blob in testing PR #41
74
-
75
- ### 0.9.0 (24.06.2016)
76
-
77
- * Change: ruby_event_store updated to 0.9.0 (Call instead of handle_event)
78
- * Change: aggregate_root updated to 0.3.1 (licensing info)
79
- * Fix: Clarify Licensing terms #36 - MIT licence it is from now
80
-
81
- ### 0.8.0 (21.06.2016)
82
-
83
- * Change: ruby_event_store updated to 0.8.0 (dynamic subscriptions)
84
- * Change: aggregate_root updated to 0.3.0 (fix circular dependency)
85
- * Change: remove SlackEventHandler
86
-
87
- ### 0.7.0 (01.06.2016)
88
-
89
- * Change: ruby_event_store updated to 0.6.0 (adding basic projections support)
90
-
91
- ### 0.6.1 (25.05.2016)
92
-
93
- * Fix: Allow to read events backward PR #32 (bugfix)
94
-
95
- ### 0.6.0 (11.04.2016)
96
-
97
- * Change: EventRepository moved to separate gem [rails_event_store_active_record](https://github.com/RailsEventStore/rails_event_store_active_record)
98
- * Change: rails_event_store_active_record updated to version 0.5.1 - allows to use custom event class
99
-
100
- ### 0.5.0 (21.03.2016)
101
-
102
- * Align with changes in `ruby_event_store` 0.5.0:
103
- * Change: Event class refactoring to make default values more explicit
104
- * Change: Let event broker to be given as a dependency
105
- * Change: No nils, use symbols instead - :any & :none replaced meaningless nil value
106
- * Change: Remove Event#event_type - use class instead
107
- * Fix: Typo fix (appent_to_stream corrected to append_to_stream)
108
- * Change: Encapsulate internals fo RailsEventStore::Client
109
- * Change: Hide `ruby_event_store` internals by adding classes in RailsEventStore module
110
-
111
- ### 0.4.1 (17.03.2016)
112
-
113
- * Fix: aggregate_root gem aligned with changes in rails_event_store
114
-
115
- ### 0.4.0 (17.03.2016)
116
-
117
- * Change: Use class names to subscribe events (ruby_event_store update to 0.4.0)
118
- * Change: EventRepository now recreate events using orginal classes
119
-
120
- ### 0.3.1 (13.03.2016)
121
-
122
- * Update to ruby_event_store 0.3.1 - fix changing timestamp on reads from repository
123
-
124
- ### 0.3.0 (03.03.2016)
125
-
126
- * Update to ruby_event_store 0.3.0 - see ruby_event_store changelog for more details
127
- * Implement reading forward & backward (aliasold methods to read forward)
128
- * Implement paging when reading from all streams
129
-
130
- ### 0.2.2 (25.02.2016)
131
-
132
- * Restore AggregateRoot in RES, but this time as a dependency on aggregate_root gem
133
-
134
- ### 0.2.1 (25.02.2016)
135
-
136
- * Fix: Error when trying to #read_all_streams #20
137
-
138
- ### 0.2.0 (29.01.2016)
139
-
140
- * Removed EventEntity class
141
- * All read & returned events are not instances of RailsEventStore::Event class
142
- * RailsEventStore::Event class allows for easier events creation and access to data attributes
143
- * AggregateRoot module & repository extracted to new gem (aggregate_root)
144
-
145
- ### 0.1.2 (26.05.2015)
146
-
147
- * Moved most core features to the separate gem `ruby_event_store`. We left only rails related implementation here.
148
- * It's now assumed that `event_id` has a unique index in the database (the same is applied to the initial migration generator)
149
- * Model is no longer validating uniqueness of `event_id` via ActiveRecord
150
- * Event does not need any data now, it can be created just like `OrderCreated.new` (without any arguments)
151
- * Migration generator is no more generating the `updated_at` field in the `event_store_events` table. We also advise to remove this column, since events shouldn't be *ever* modified.
152
- * In the event's metadata there's a new field `published_at`
153
- * Added the `subscribe_to_all_events` method to `RailsEventStore::Client`
154
- * Subscribing to only one event via `client.subscribe(subscriber, 'OrderCreated')` no longer works. You should use `client.subscribe(subscriber, ['OrderCreated'])` instead.
155
- * Default event's name is no longer `OrderCreated` for the `OrderCreated` event in the `Orders` namespace, now it's `Orders::OrderCreated`
156
-
157
- ### 0.1.1 (22.04.2015)
158
-
159
- Initial release.
data/Gemfile DELETED
@@ -1,23 +0,0 @@
1
- source 'https://rubygems.org'
2
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
- gemspec
4
-
5
- eval_gemfile File.expand_path('../support/bundler/Gemfile.shared', __dir__)
6
-
7
- gem 'ruby_event_store', path: '../ruby_event_store'
8
- gem 'ruby_event_store-browser', path: '../ruby_event_store-browser'
9
- gem 'rails_event_store_active_record', path: '../rails_event_store_active_record'
10
- gem 'aggregate_root', path: '../aggregate_root'
11
- gem 'bounded_context', path: '../bounded_context'
12
- gem 'protobuf_nested_struct'
13
- gem 'sidekiq'
14
- gem 'rack-test'
15
- gem 'google-protobuf', '~> 3.12.2', '>= 3.12.2'
16
- gem 'pry'
17
- gem 'rails', ENV['RAILS_VERSION']
18
-
19
- if Gem::Version.new(ENV['RAILS_VERSION']) >= Gem::Version.new('6.0.0')
20
- gem 'sqlite3', '1.4.2'
21
- else
22
- gem 'sqlite3', '1.3.13'
23
- end
data/Makefile DELETED
@@ -1,14 +0,0 @@
1
- GEM_VERSION = $(shell cat ../RES_VERSION)
2
- GEM_NAME = rails_event_store
3
- REQUIRE = $(GEM_NAME)
4
- IGNORE = RailsEventStore::Client\#initialize \
5
- RailsEventStore::AfterCommitAsyncDispatcher::AsyncRecord* \
6
- RailsEventStore::AfterCommitAsyncDispatcher\#async_record
7
- SUBJECT ?= RailsEventStore*
8
- DATABASE_URL ?= sqlite3::memory:
9
-
10
- include ../support/make/install.mk
11
- include ../support/make/test.mk
12
- include ../support/make/mutant.mk
13
- include ../support/make/gem.mk
14
- include ../support/make/help.mk
@@ -1,37 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rails_event_store/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'rails_event_store'
8
- spec.version = RailsEventStore::VERSION
9
- spec.licenses = ['MIT']
10
- spec.authors = ['Arkency']
11
- spec.email = ['dev@arkency.com']
12
-
13
- spec.summary = %q{Event Store in Ruby}
14
- spec.description = %q{Implementation of Event Store in Ruby}
15
- spec.homepage = 'https://railseventstore.org'
16
- spec.metadata = {
17
- "homepage_uri" => "https://railseventstore.org/",
18
- "changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
19
- "source_code_uri" => "https://github.com/RailsEventStore/rails_event_store",
20
- "bug_tracker_uri" => "https://github.com/RailsEventStore/rails_event_store/issues",
21
- }
22
-
23
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
- spec.bindir = 'exe'
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ['lib']
27
-
28
- spec.add_dependency 'ruby_event_store', '= 1.3.1'
29
- spec.add_dependency 'ruby_event_store-browser', '= 1.3.1'
30
- spec.add_dependency 'rails_event_store_active_record', '= 1.3.1'
31
- spec.add_dependency 'aggregate_root', '= 1.3.1'
32
- spec.add_dependency 'bounded_context', '= 1.3.1'
33
- spec.add_dependency 'activesupport', '>= 3.0'
34
- spec.add_dependency 'activemodel', '>= 3.0'
35
- spec.add_dependency 'activejob', '>= 3.0'
36
- spec.add_dependency 'arkency-command_bus', '>= 0.4'
37
- end