rails_event_store 2.7.0 → 2.8.0

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: ef5465ce4a4c2899766de95a197855c2353b988b9d826cacdff4e5cc706c54a4
4
- data.tar.gz: 942acb57ddeda4b51c0a9f7e8ee59636f7340d173ad9f93e4b3aec7ededb4179
3
+ metadata.gz: 9d14a0a9296ac00861142fbd2695b4593805acbb77d9dd1e25770887749e5196
4
+ data.tar.gz: 925baa193ad64c8ae058ad9539161bfbe30fb8278f0a2bf456ccc37bf8267765
5
5
  SHA512:
6
- metadata.gz: 49f6b17e95f1588b730f958157f5755df5d7e092d8756428ca30b175860210a03efbd4bfff8bd583604711845492160c64291ae81c6edf9553dd79d11862897e
7
- data.tar.gz: 122e8b50708844046ac3187323c4a13e36f0a5b97526a4b69954601ebcb8cd7533263975812c0f05bfbc9bffa6b8a1d77bc64d66ee12642602cd275ae777f303
6
+ metadata.gz: 361e469a72631d8c7dd2f29b719358514205adc56f21ff9c6bee3d99188db6dcdee792cb74078dead42bba6a4d988abe51cf6c3ad67991979e09be5d383e8acf
7
+ data.tar.gz: 17c9eac1478c9facc57041103e766f9d3d876fac83988dae7c9ddff3fb1a7606ca7389b484cf278e5d61fbed69d789e87ec881f67558ba7393df4665ca47c8c1
@@ -11,6 +11,10 @@ module RailsEventStore
11
11
  template "test_helper.rb", "#{bounded_context_name}/test/test_helper.rb"
12
12
  end
13
13
 
14
+ def require_bc_test
15
+ template "require_bc_test.rb", "test/#{bounded_context_name}_test.rb"
16
+ end
17
+
14
18
  private
15
19
 
16
20
  def bounded_context_name
@@ -0,0 +1,3 @@
1
+ require "test_helper"
2
+
3
+ Dir[Rails.root.join("<%= bounded_context_name %>/test/*_test.rb")].each { |file| require file }
@@ -6,9 +6,11 @@ require_relative "link_by_metadata"
6
6
  require_relative "after_commit_async_dispatcher"
7
7
  require_relative "active_job_scheduler"
8
8
  require_relative "client"
9
+ require_relative "json_client"
9
10
  require_relative "version"
10
11
  require_relative "railtie"
11
12
  require_relative "browser"
13
+ require_relative "default_client_profile"
12
14
 
13
15
  module RailsEventStore
14
16
  Event = RubyEventStore::Event
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsEventStore
4
+ class DefaultClientProfile
5
+ def call(adapter)
6
+ adapter.downcase.eql?("postgresql") ? "RailsEventStore::JSONClient.new" : "RailsEventStore::Client.new"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsEventStore
4
+ class JSONClient < Client
5
+ def initialize(repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::NULL))
6
+ super(
7
+ mapper:
8
+ RubyEventStore::Mappers::PipelineMapper.new(
9
+ RubyEventStore::Mappers::Pipeline.new(
10
+ RubyEventStore::Mappers::Transformation::PreserveTypes
11
+ .new
12
+ .register(Symbol, serializer: ->(v) { v.to_s }, deserializer: ->(v) { v.to_sym })
13
+ .register(
14
+ Time,
15
+ serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) },
16
+ deserializer: ->(v) { Time.iso8601(v) }
17
+ )
18
+ .register(
19
+ ActiveSupport::TimeWithZone,
20
+ serializer: ->(v) { v.iso8601(RubyEventStore::TIMESTAMP_PRECISION) },
21
+ deserializer: ->(v) { Time.iso8601(v).in_time_zone },
22
+ stored_type: ->(*) { "ActiveSupport::TimeWithZone" }
23
+ )
24
+ .register(Date, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { Date.iso8601(v) })
25
+ .register(DateTime, serializer: ->(v) { v.iso8601 }, deserializer: ->(v) { DateTime.iso8601(v) }),
26
+ RubyEventStore::Mappers::Transformation::SymbolizeMetadataKeys.new
27
+ )
28
+ ),
29
+ repository: repository
30
+ )
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsEventStore
4
- VERSION = "2.7.0"
4
+ VERSION = "2.8.0"
5
5
  end
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: 2.7.0
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_event_store
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.0
19
+ version: 2.8.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: 2.7.0
26
+ version: 2.8.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: 2.7.0
33
+ version: 2.8.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: 2.7.0
40
+ version: 2.8.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: 2.7.0
47
+ version: 2.8.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: 2.7.0
54
+ version: 2.8.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: 2.7.0
61
+ version: 2.8.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: 2.7.0
68
+ version: 2.8.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +139,7 @@ files:
139
139
  - lib/generators/templates/bc_spec.rb
140
140
  - lib/generators/templates/module.rb
141
141
  - lib/generators/templates/require_bc_spec.rb
142
+ - lib/generators/templates/require_bc_test.rb
142
143
  - lib/generators/templates/spec_helper.rb
143
144
  - lib/generators/templates/test_helper.rb
144
145
  - lib/rails_event_store.rb
@@ -148,6 +149,8 @@ files:
148
149
  - lib/rails_event_store/async_handler_helpers.rb
149
150
  - lib/rails_event_store/browser.rb
150
151
  - lib/rails_event_store/client.rb
152
+ - lib/rails_event_store/default_client_profile.rb
153
+ - lib/rails_event_store/json_client.rb
151
154
  - lib/rails_event_store/link_by_metadata.rb
152
155
  - lib/rails_event_store/middleware.rb
153
156
  - lib/rails_event_store/railtie.rb