event_sourcery-postgres 1.0.0 → 1.0.1

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: 05b4e104f8ead624e85b64116db8a9347ff6fd4b6b0af4abc8b4c60c0d49d926
4
- data.tar.gz: c019944e4b6d194088945d8e7c9fe9cfd7a494fc6d8cba8f90df56cc839bfc24
3
+ metadata.gz: d0257d9a0f70fe078196251fc6de2944278cb2ddf7dda70e2125ce1217d62af6
4
+ data.tar.gz: 4ff91be144b82ec02988d7993a7094618e002ffce96ec7dfde1cde054fb15668
5
5
  SHA512:
6
- metadata.gz: 76861f96df82c5ebe3de33f29de17ab6a86e9c5fd45fb72bb092469567eb8961d32e3fcf848e646023f5b12a5a1e9d5d2e6c8b292d15181ed2ea4d05e1b2b645
7
- data.tar.gz: c59050c981cc4dac1ec32d5695a872351ed8bdc45ba5cb8a7d903c15fb06ea83ca13ce924db2095b62d6dda9d335302811522eed84ec8b568e116fac6a802706
6
+ metadata.gz: 5cd37ea3284ab95e970e704bbabdb14c2160dd3a7612a48927fc99e15a72b074d8c704c0239a75256a158bf468df93c110dcaa0d0ce46da4f871ceb1fd0390c9
7
+ data.tar.gz: d9e5f9281bcc91bb364e1dd607065199b97f144118841183807ce78a3a7a0ab4997fc6e12a625d0f15aaf3b15076d769a03b56362e47201906539ed29d8fefb4
data/CHANGELOG.md CHANGED
@@ -7,7 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- [Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v1.0.0...HEAD
10
+ [Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v1.0.1...HEAD
11
+
12
+ ## [1.0.1] - 2026-01-17
13
+
14
+ ### Changed
15
+
16
+ - Resolve issues as identified by RuboCop ([#85]).
17
+
18
+ [1.0.0]: https://github.com/envato/event_sourcery-postgres/compare/v1.0.0...v1.0.1
19
+ [#85]: https://github.com/envato/event_sourcery-postgres/pull/85
11
20
 
12
21
  ## [1.0.0] - 2025-12-28
13
22
 
data/README.md CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  ## Development Status
6
6
 
7
- EventSourcery is currently being used in production by multiple apps but we
8
- haven't finalized the API yet and things are still moving rapidly. Until we
9
- release a 1.0 things may change without first being deprecated.
7
+ EventSourcery::Postgres is in production use at [Envato](http://envato.com).
10
8
 
11
9
  ## Installation
12
10
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  'allowed_push_host' => 'https://rubygems.org',
20
20
  'bug_tracker_uri' => "#{spec.homepage}/issues",
21
21
  'changelog_uri' => "#{spec.homepage}/blob/HEAD/CHANGELOG.md",
22
- 'documentation_uri' => "https://www.rubydoc.info/gems/event_sourcery-postgres/#{spec.version}",
22
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{spec.name}/#{spec.version}",
23
23
  'source_code_uri' => "#{spec.homepage}/tree/v#{spec.version}"
24
24
  }
25
25
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # Configuration settings for the PostgreSQL event store and projections.
5
6
  class Config
6
7
  attr_accessor :lock_table_to_guarantee_linear_sequence_id_growth,
7
8
  :write_events_function_name,
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # PostgreSQL implementation of an event store for persisting and retrieving domain events.
5
6
  class EventStore
6
7
  include EventSourcery::EventStore::EachByRange
7
8
 
@@ -54,7 +54,7 @@ module EventSourcery
54
54
  after_listen_callback = if after_listen
55
55
  proc do
56
56
  after_listen.call
57
- @after_listen.call if @after_listen
57
+ @after_listen&.call
58
58
  end
59
59
  else
60
60
  @after_listen
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # Mixin providing projection capabilities for processing events into read models.
5
6
  module Projector
6
7
  def self.included(base)
7
8
  base.include(EventProcessing::EventStreamProcessor)
@@ -17,6 +18,7 @@ module EventSourcery
17
18
  end
18
19
  end
19
20
 
21
+ # Instance methods for projector event processing and tracking.
20
22
  module InstanceMethods
21
23
  def initialize(tracker: EventSourcery::Postgres.config.event_tracker,
22
24
  db_connection: EventSourcery::Postgres.config.projections_database,
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # Queue that invokes a callback at regular intervals when no items are available.
5
6
  class QueueWithIntervalCallback < ::Queue
6
7
  attr_accessor :callback
7
8
 
@@ -16,7 +17,7 @@ module EventSourcery
16
17
  super()
17
18
  end
18
19
 
19
- def pop(non_block_without_callback = false)
20
+ def pop(non_block_without_callback = false) # rubocop:disable Style/OptionalBooleanParameter
20
21
  return super if non_block_without_callback
21
22
 
22
23
  pop_with_interval_callback
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # Mixin providing reactor capabilities for processing events and emitting new events in response.
5
6
  module Reactor
6
7
  UndeclaredEventEmissionError = Class.new(StandardError)
7
8
 
@@ -12,6 +13,7 @@ module EventSourcery
12
13
  base.include(InstanceMethods)
13
14
  end
14
15
 
16
+ # Class methods for declaring and querying emitted event types.
15
17
  module ClassMethods
16
18
  # Assign the types of events this reactor can emit.
17
19
  #
@@ -22,7 +24,7 @@ module EventSourcery
22
24
 
23
25
  # @return [Array] an array of the types of events this reactor can emit
24
26
  def emit_events
25
- @emits_event_types ||= []
27
+ @emits_event_types ||= [] # rubocop:disable Naming/MemoizedInstanceVariableName
26
28
  end
27
29
 
28
30
  # This will tell you if this reactor emits any type of event.
@@ -41,6 +43,7 @@ module EventSourcery
41
43
  end
42
44
  end
43
45
 
46
+ # Instance methods for reactor initialisation and event emission.
44
47
  module InstanceMethods
45
48
  def initialize(tracker: EventSourcery::Postgres.config.event_tracker,
46
49
  db_connection: EventSourcery::Postgres.config.projections_database,
@@ -75,7 +78,7 @@ module EventSourcery
75
78
  end
76
79
 
77
80
  def invoke_action_and_emit_event(event, action)
78
- action.call(event.body) if action
81
+ action&.call(event.body)
79
82
  event_sink.sink(event)
80
83
  end
81
84
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # Schema management for creating event store and projector tables in PostgreSQL.
5
6
  module Schema
6
7
  module_function
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
+ # Mixin providing table management capabilities for projectors and reactors.
5
6
  module TableOwner
6
7
  DefaultTableError = Class.new(StandardError)
7
8
  NoSuchTableError = Class.new(StandardError)
@@ -10,6 +11,7 @@ module EventSourcery
10
11
  base.extend(ClassMethods)
11
12
  end
12
13
 
14
+ # Class methods for defining and managing database tables.
13
15
  module ClassMethods
14
16
  # Hash of the tables and their corresponding blocks.
15
17
  #
@@ -38,7 +40,7 @@ module EventSourcery
38
40
 
39
41
  # Reset by dropping each table.
40
42
  def reset
41
- self.class.tables.keys.each do |table_name|
43
+ self.class.tables.each_key do |table_name|
42
44
  prefixed_name = table_name_prefixed(table_name)
43
45
  @db_connection.drop_table(prefixed_name, cascade: true) if @db_connection.table_exists?(prefixed_name)
44
46
  end
@@ -49,7 +51,7 @@ module EventSourcery
49
51
  # This will truncate all the tables and reset the tracker back to 0,
50
52
  # done as a transaction.
51
53
  def truncate
52
- self.class.tables.each do |table_name, _|
54
+ self.class.tables.each_key do |table_name|
53
55
  @db_connection.transaction do
54
56
  prefixed_name = table_name_prefixed(table_name)
55
57
  @db_connection[prefixed_name].truncate
@@ -2,6 +2,6 @@
2
2
 
3
3
  module EventSourcery
4
4
  module Postgres
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
@@ -17,6 +17,7 @@ require 'event_sourcery/postgres/reactor'
17
17
  require 'event_sourcery/postgres/tracker'
18
18
 
19
19
  module EventSourcery
20
+ # PostgreSQL adapter for EventSourcery providing event store and projection capabilities.
20
21
  module Postgres
21
22
  def self.configure
22
23
  yield config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_sourcery-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Envato
@@ -164,8 +164,8 @@ metadata:
164
164
  allowed_push_host: https://rubygems.org
165
165
  bug_tracker_uri: https://github.com/envato/event_sourcery-postgres/issues
166
166
  changelog_uri: https://github.com/envato/event_sourcery-postgres/blob/HEAD/CHANGELOG.md
167
- documentation_uri: https://www.rubydoc.info/gems/event_sourcery-postgres/1.0.0
168
- source_code_uri: https://github.com/envato/event_sourcery-postgres/tree/v1.0.0
167
+ documentation_uri: https://www.rubydoc.info/gems/event_sourcery-postgres/1.0.1
168
+ source_code_uri: https://github.com/envato/event_sourcery-postgres/tree/v1.0.1
169
169
  rdoc_options: []
170
170
  require_paths:
171
171
  - lib
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  requirements: []
183
- rubygems_version: 4.0.3
183
+ rubygems_version: 4.0.4
184
184
  specification_version: 4
185
185
  summary: Postgres event store for use with EventSourcery
186
186
  test_files: []