rails_event_store 1.1.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,19 +2,35 @@
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
+ Module.new do
7
+ def self.prepended(host_class)
8
+ host_class.prepend AsyncHandler.with
9
+ end
10
+ end
11
+ end
12
+
13
+ def self.with(event_store: Rails.configuration.event_store, serializer: event_store.__send__(:mapper).serializer)
14
+ Module.new do
15
+ define_method :perform do |payload|
16
+ super(event_store.deserialize(serializer: serializer, **payload.symbolize_keys))
17
+ end
18
+ end
19
+ end
20
+
21
+ def self.prepended(host_class)
22
+ host_class.prepend with_defaults
7
23
  end
8
24
  end
9
25
 
10
26
  module CorrelatedHandler
11
27
  def perform(event)
12
28
  Rails.configuration.event_store.with_metadata(
13
- correlation_id: event.metadata[:correlation_id] || event.event_id,
14
- causation_id: event.event_id
29
+ correlation_id: event.metadata[:correlation_id],
30
+ causation_id: event.event_id
15
31
  ) do
16
32
  super
17
33
  end
18
34
  end
19
35
  end
20
- end
36
+ end
@@ -4,16 +4,20 @@ 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,
7
+ def initialize(mapper: RubyEventStore::Mappers::Default.new,
8
+ repository: RailsEventStoreActiveRecord::EventRepository.new(serializer: mapper.serializer),
9
9
  subscriptions: RubyEventStore::Subscriptions.new,
10
10
  dispatcher: RubyEventStore::ComposedDispatcher.new(
11
- RubyEventStore::ImmediateAsyncDispatcher.new(scheduler: ActiveJobScheduler.new),
11
+ RailsEventStore::AfterCommitAsyncDispatcher.new(scheduler: ActiveJobScheduler.new(serializer: mapper.serializer)),
12
12
  RubyEventStore::Dispatcher.new),
13
+ clock: default_clock,
14
+ correlation_id_generator: default_correlation_id_generator,
13
15
  request_metadata: default_request_metadata)
14
16
  super(repository: RubyEventStore::InstrumentedRepository.new(repository, ActiveSupport::Notifications),
15
17
  mapper: RubyEventStore::Mappers::InstrumentedMapper.new(mapper, ActiveSupport::Notifications),
16
18
  subscriptions: subscriptions,
19
+ clock: clock,
20
+ correlation_id_generator: correlation_id_generator,
17
21
  dispatcher: RubyEventStore::InstrumentedDispatcher.new(dispatcher, ActiveSupport::Notifications)
18
22
  )
19
23
  @request_metadata = request_metadata
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsEventStore
4
- VERSION = "1.1.1"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -21,15 +21,12 @@ Gem::Specification.new do |spec|
21
21
  }
22
22
 
23
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
24
  spec.require_paths = ['lib']
27
25
 
28
- spec.add_dependency 'ruby_event_store', '= 1.1.1'
29
- spec.add_dependency 'ruby_event_store-browser', '= 1.1.1'
30
- spec.add_dependency 'rails_event_store_active_record', '= 1.1.1'
31
- spec.add_dependency 'aggregate_root', '= 1.1.1'
32
- spec.add_dependency 'bounded_context', '= 1.1.1'
26
+ spec.add_dependency 'ruby_event_store', '= 2.0.0'
27
+ spec.add_dependency 'ruby_event_store-browser', '= 2.0.0'
28
+ spec.add_dependency 'rails_event_store_active_record', '= 2.0.0'
29
+ spec.add_dependency 'aggregate_root', '= 2.0.0'
33
30
  spec.add_dependency 'activesupport', '>= 3.0'
34
31
  spec.add_dependency 'activemodel', '>= 3.0'
35
32
  spec.add_dependency 'activejob', '>= 3.0'
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.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_event_store
@@ -16,70 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.1
19
+ version: 2.0.0
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.1.1
26
+ version: 2.0.0
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.1.1
33
+ version: 2.0.0
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.1.1
40
+ version: 2.0.0
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.1.1
47
+ version: 2.0.0
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.1.1
54
+ version: 2.0.0
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.1.1
61
+ version: 2.0.0
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.1.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.1.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.1.1
68
+ version: 2.0.0
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: activesupport
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -143,10 +129,28 @@ executables: []
143
129
  extensions: []
144
130
  extra_rdoc_files: []
145
131
  files:
132
+ - ".mutant.yml"
146
133
  - CHANGELOG.md
147
134
  - Gemfile
135
+ - Gemfile.lock
136
+ - Gemfile.rails_5_0
137
+ - Gemfile.rails_5_0.lock
138
+ - Gemfile.rails_5_1
139
+ - Gemfile.rails_5_1.lock
140
+ - Gemfile.rails_5_2
141
+ - Gemfile.rails_5_2.lock
142
+ - Gemfile.rails_6_0
143
+ - Gemfile.rails_6_0.lock
148
144
  - Makefile
149
145
  - README.md
146
+ - lib/generators/rails_event_store/bounded_context_generator.rb
147
+ - lib/generators/rails_event_store/rspec_generator.rb
148
+ - lib/generators/rails_event_store/test_unit_generator.rb
149
+ - lib/generators/templates/bc_spec.rb
150
+ - lib/generators/templates/module.rb
151
+ - lib/generators/templates/require_bc_spec.rb
152
+ - lib/generators/templates/spec_helper.rb
153
+ - lib/generators/templates/test_helper.rb
150
154
  - lib/rails_event_store.rb
151
155
  - lib/rails_event_store/active_job_scheduler.rb
152
156
  - lib/rails_event_store/after_commit_async_dispatcher.rb
@@ -167,7 +171,7 @@ metadata:
167
171
  changelog_uri: https://github.com/RailsEventStore/rails_event_store/releases
168
172
  source_code_uri: https://github.com/RailsEventStore/rails_event_store
169
173
  bug_tracker_uri: https://github.com/RailsEventStore/rails_event_store/issues
170
- post_install_message:
174
+ post_install_message:
171
175
  rdoc_options: []
172
176
  require_paths:
173
177
  - lib
@@ -182,8 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
186
  - !ruby/object:Gem::Version
183
187
  version: '0'
184
188
  requirements: []
185
- rubygems_version: 3.0.3
186
- signing_key:
189
+ rubygems_version: 3.1.4
190
+ signing_key:
187
191
  specification_version: 4
188
192
  summary: Event Store in Ruby
189
193
  test_files: []