event_store_client 1.1.7 → 1.2.3

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: 1caaf3d9b1bf170cab8f89c3585d7cd635c65a2ba2d8aefb4fc355ab15177efc
4
- data.tar.gz: 57372c5f82bc058dcbb7e8fe2ee9118557832e4eb4e767ac6439ad040d0ea5fd
3
+ metadata.gz: 9f72e92a631da57d27b68c2ba2644a1a089f3cd60ef910151801afd5d74bb3f1
4
+ data.tar.gz: c92a76c6955aec9296bd4cbf57d29584672dea95887c2d9e531238dd8adfe347
5
5
  SHA512:
6
- metadata.gz: 29880f6eca0dd49dd9e53a8c2a29e15278f0077ca5fba3239ab454c521e569a88902fd42452a9e9e67b51532698f93dd87c3713857f36069dc80751056e5449c
7
- data.tar.gz: 41a71df3e9f61c2a1aa9733bae51aa79429a659e3e50b5df481a2aa8040798d4130a7415d97449b66d253cc8aee5e7e0e14646db01eb8692fed7f211b783bdea
6
+ metadata.gz: 25e44c8b41e5c22e2b469e096db5789e6c2aad0b18bfb82283a0959ddf73860058a700095aaf614fb931722f6e7184b91c050516cc208b7bf72b11d4cb277023
7
+ data.tar.gz: 00e87f69e1da44a28995c187397d42f19cbec0701120b6961a64f3e489c4a6c6598fcfc0701f5a2954a46019ea81b3efd0d7f17d07fb44af7ac514892adec2b9
@@ -84,10 +84,12 @@ module EventStoreClient
84
84
  #
85
85
  def listen(subscription, options: {})
86
86
  consume_feed(subscription, options: options) do |event|
87
- yield event if block_given?
87
+ begin
88
+ yield event if block_given?
89
+ rescue StandardError => e
90
+ config.error_handler&.call(e)
91
+ end
88
92
  end
89
- rescue StandardError => e
90
- config.error_handler&.call(e)
91
93
  end
92
94
 
93
95
  # Subscribe to a stream
@@ -27,9 +27,9 @@ module EventStoreClient
27
27
  'content-type': event_metadata['content-type']
28
28
  }
29
29
  custom_metadata['encryption'] = event_metadata['encryption'] unless event_metadata['encryption'].nil?
30
+ custom_metadata['transaction'] = event_metadata['transaction'] unless event_metadata['transaction'].nil?
30
31
  event_metadata = event_metadata.select { |k| ['type', 'content-type', 'created_at'].include?(k) }
31
32
 
32
-
33
33
  payload = [
34
34
  request.new(
35
35
  options: {
@@ -52,7 +52,7 @@ module EventStoreClient
52
52
  ]
53
53
  service.append(payload, metadata: metadata)
54
54
  end
55
- Success()
55
+ Success(events)
56
56
  end
57
57
  end
58
58
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'dry/monads'
4
+
4
5
  module EventStoreClient
5
6
  class InMemory
6
7
  Response = Struct.new(:body, :status) do
@@ -22,7 +23,7 @@ module EventStoreClient
22
23
  'positionEventNumber' => event_store[stream_name].length
23
24
  )
24
25
  end
25
- Dry::Monads::Success()
26
+ Dry::Monads::Success(events)
26
27
  end
27
28
 
28
29
  def delete_stream(stream_name, options: {}) # rubocop:disable Lint/UnusedMethodArgument
@@ -5,6 +5,8 @@ module EventStoreClient
5
5
  FILTER_DEFAULT_MAX = 32
6
6
  FILTER_DEFAULT_CHECKPOINT_INTERVAL_MULTIPLIER = 10000
7
7
 
8
+ include Configuration
9
+
8
10
  def create_or_load(subscriber, filter: {})
9
11
  filter_options = prepare_filter_options(filter)
10
12
  position = subscription_store.load_all_position(CatchUpSubscription.name(subscriber))
@@ -41,10 +43,10 @@ module EventStoreClient
41
43
  logger&.info(msg)
42
44
  break
43
45
  end
44
- rescue StandardError
46
+ rescue StandardError => e
45
47
  subscription.position = old_position
46
48
  subscription_store.update_position(subscription)
47
- raise
49
+ config.error_handler&.call(e)
48
50
  end
49
51
  end
50
52
 
@@ -11,7 +11,8 @@ module EventStoreClient
11
11
 
12
12
  def publish(stream:, events:, options: {})
13
13
  res = connection.append_to_stream(stream, events, options: options)
14
- raise WrongExpectedEventVersion.new(e.message) if res.failure?
14
+ raise WrongExpectedEventVersion.new(res.failure) if res.failure?
15
+ res
15
16
  end
16
17
 
17
18
  def read(stream, options: {})
@@ -14,7 +14,7 @@ module EventStoreClient
14
14
 
15
15
  private
16
16
 
17
- def initialize(**args)
17
+ def initialize(args = {})
18
18
  args[:id] = SecureRandom.uuid if args[:id].nil?
19
19
  hash_meta = JSON.parse(args[:metadata] || '{}')
20
20
  hash_meta['created_at'] ||= Time.now
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EventStoreClient
4
- VERSION = '1.1.7'
4
+ VERSION = '1.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_store_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Wilgosz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2021-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable