ruby_event_store 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84c9dfec3ecbad7ae594ae3711ab6b12a44b49cf5306a61b4ff7d5f7c82008df
4
- data.tar.gz: 4a3e8cdc5afece95365214ea8aa91e9ea8fadd198fff4e200eaacbc732f06cf0
3
+ metadata.gz: 36e7110d2b9570a081d8c27c092fb49f745e2fc52df0f5ac8a1fef43e9c947b5
4
+ data.tar.gz: eca5201fd1e093a988d0dbd405a46fbd78c1da27e2733fc263e6fcd4b474eed8
5
5
  SHA512:
6
- metadata.gz: 7ca0ed84febadc05cf0e88bcefec7ac041289d2215483076ff5a9c9be042d53cd66db186f587b11de9f45666bb19c9a80310d0f13b7a08d7ed5811042a724682
7
- data.tar.gz: d842809113364ba5f60fc6be88a9ab94f1b18f6deefa4b4b264bdab0b0ad0d5746c244565bd528e5855dc908f15392ebdda1c5feea4a455d3cda979c76683096
6
+ metadata.gz: aa50fda1e6bf1deb3d8ea4b22b39d4e039a18b3ad6fd325c1b6295195f435214f4210a14fb4f164ad5113db0a8f0bd8d27ff083bd2cccdb6a6714c01cda3239f
7
+ data.tar.gz: d7bf94647c93fa324249b63495a792bd56678037db5bc0a03fb654679e7298d8d15fbd4846e174a98335986c6eeccd9d326c4c8b67435b0e03edb84a94a2249d
data/Gemfile CHANGED
@@ -6,5 +6,5 @@ gemspec
6
6
  eval_gemfile File.expand_path('../support/bundler/Gemfile.shared', __dir__)
7
7
 
8
8
  gem 'protobuf_nested_struct'
9
- gem 'google-protobuf', '~> 3.7.0'
9
+ gem 'google-protobuf', '~> 3.12.2', '>= 3.12.2'
10
10
  gem 'activesupport', '~> 5.0'
@@ -5,12 +5,6 @@ module RubyEventStore
5
5
  def event_type
6
6
  data.class.descriptor.name
7
7
  end
8
-
9
- def ==(other_event)
10
- other_event.instance_of?(self.class) &&
11
- other_event.event_id.eql?(event_id) &&
12
- other_event.data == data # https://github.com/google/protobuf/issues/4455
13
- end
14
8
  end
15
9
 
16
10
  module Mappers
@@ -82,14 +82,14 @@ module RubyEventStore
82
82
 
83
83
  def encrypt_data(data, meta)
84
84
  meta.reduce(data) do |acc, (key, value)|
85
- acc[key] = encrypt_attribute(acc, key, value)
85
+ acc[key] = encrypt_attribute(acc, key, value) if data.has_key?(key)
86
86
  acc
87
87
  end
88
88
  end
89
89
 
90
90
  def decrypt_data(data, meta)
91
91
  meta.reduce(data) do |acc, (key, value)|
92
- acc[key] = decrypt_attribute(data, key, value)
92
+ acc[key] = decrypt_attribute(data, key, value) if data.has_key?(key)
93
93
  acc
94
94
  end
95
95
  end
@@ -9,8 +9,7 @@ module RubyEventStore
9
9
  end
10
10
 
11
11
  def dump(item)
12
- stringify = StringifyMetadataKeys.new
13
- metadata = ProtobufNestedStruct::HashMapStringValue.dump(stringify.dump(item).metadata)
12
+ metadata = ProtobufNestedStruct::HashMapStringValue.dump(item.metadata)
14
13
  item.merge(metadata: metadata)
15
14
  end
16
15
 
@@ -51,6 +51,7 @@ module RubyEventStore
51
51
  end
52
52
 
53
53
  def run(event_store, start: nil, count: PAGE_SIZE)
54
+ return initial_state if handled_events.empty?
54
55
  if streams.any?
55
56
  reduce_from_streams(event_store, start, count)
56
57
  else
@@ -1,9 +1,7 @@
1
- RSpec.shared_examples :event do |event_class|
1
+ RSpec.shared_examples :event do |event_class, data, metadata|
2
2
  it 'allows initialization' do
3
3
  expect {
4
- metadata = double(:metadata)
5
- allow(metadata).to receive(:to_h).and_return({})
6
- event_class.new(event_id: Object.new, data: Object.new, metadata: metadata)
4
+ event_class.new(event_id: Object.new, data: data || Object.new, metadata: metadata || {})
7
5
  }.not_to raise_error
8
6
  end
9
7
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyEventStore
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby