rails_event_store 2.6.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: a1ce1d435ddbd30de0cda595e1b9d9b68b7de00eb6a9d7902b062f7c3bce6f3f
4
- data.tar.gz: acbe8704725c7a160d6d09dea94fec1fbf5440f5ed859f5536e2f03fdbc1dd32
3
+ metadata.gz: 9d14a0a9296ac00861142fbd2695b4593805acbb77d9dd1e25770887749e5196
4
+ data.tar.gz: 925baa193ad64c8ae058ad9539161bfbe30fb8278f0a2bf456ccc37bf8267765
5
5
  SHA512:
6
- metadata.gz: 62d3ec178a107ac8b08cfb70f2d53e246d028e14e1c84c49a64b08228be65ede420c22c0682b3e1723046f2410af4ff62be845247f66ed041373fa425af10b5c
7
- data.tar.gz: d5d4c81ac3cb9c2538aaea856ceef4c4dbfcdc73a3c4738864a9d2ea41903bc1a105a58cbfa42cef19a7e2a2b88b6cab0c07644da7f98715dba81b23773f598d
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
@@ -1,4 +1,4 @@
1
1
  require_relative "spec_helper"
2
2
 
3
- RSpec.describe <%= bounded_context_namespace %> do
3
+ ::RSpec.describe <%= bounded_context_namespace %> do
4
4
  end
@@ -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
@@ -14,7 +14,7 @@ module RailsEventStore
14
14
  Module.new do
15
15
  define_method :perform do |payload|
16
16
  event_store = event_store_locator.call if event_store_locator
17
- super(event_store.deserialize(serializer: serializer, **payload.symbolize_keys))
17
+ super(event_store.deserialize(serializer: serializer, **payload.transform_keys(&:to_sym)))
18
18
  end
19
19
  end
20
20
  end
@@ -6,7 +6,7 @@ module RailsEventStore
6
6
 
7
7
  def initialize(
8
8
  mapper: RubyEventStore::Mappers::Default.new,
9
- repository: RailsEventStoreActiveRecord::EventRepository.new(serializer: RubyEventStore::Serializers::YAML),
9
+ repository: RubyEventStore::ActiveRecord::EventRepository.new(serializer: RubyEventStore::Serializers::YAML),
10
10
  subscriptions: RubyEventStore::Subscriptions.new,
11
11
  dispatcher: RubyEventStore::ComposedDispatcher.new(
12
12
  RailsEventStore::AfterCommitAsyncDispatcher.new(
@@ -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.6.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.6.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-11-29 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.6.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.6.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.6.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.6.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.6.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.6.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.6.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.6.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