event_engine 0.2.3 → 0.2.4

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: e487942b070a87cfa23e72a27d34e9247704caadfa887be26c1cd63eb3d4506d
4
- data.tar.gz: 4f87ddcd5d44b28009ad2e45bc46296ab52d9f047037ec7023067238554f6a4e
3
+ metadata.gz: d41f3bf5979d9b7bf564192af007e2345acb7cb5a8557af84a56a9a140ba7b49
4
+ data.tar.gz: c295ec1cc5a9ad2f1d3f2dec987067e7fbfe33dbf2a6037914989acc5caad9fc
5
5
  SHA512:
6
- metadata.gz: 6f63838b3a3c2835e9c1511172413f6991cb0831afdf3b21247e5ef5ba03f0d40a92fb21ba1282ef6ce100a5081837821999de9b51f3cc920a2a5b30a94ec9fa
7
- data.tar.gz: 688da6973e692d3b57b6d468191c37e9f701fa767888c030aec9318a0193685388ba6441b88be08d5fb54ff85ee6f8f019eee4a91791259ee4cce2af4a3baef2
6
+ metadata.gz: 0ac2e2d99a33c2a69dd1300d00c53f283504eecba38f79d4ca7b87f4ae8098a689abc9a3588f45e992c31f2141e0c3bf454c21eda0a5bb101bbdbcaa8c813df2
7
+ data.tar.gz: 0bb6f4f3f401336adfd11076a3df889ea11ddbc5d913125a69af65b40dd04a95c9163f11fe6d20356c01594bccbce7ae943a4d0607c2978aacd7a0770fda62c9
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.4] - 2026-11-07
11
+
12
+ ### Added
13
+
14
+ - A rule of `recorded` runs no processor and still passes the event to the handlers registered for every process type in the same call, so an event that is only kept, such as a history a store records, needs no processor or subscriber. It passes `validate_rules!` with no processor registered under that name.
15
+
10
16
  ## [0.2.3] - 2026-10-23
11
17
 
12
18
  ### Added
data/README.md CHANGED
@@ -235,6 +235,7 @@ events:
235
235
  invoice_voided: audit # this one event
236
236
  lead_converted: # catalogued but undecided
237
237
  lead_scored: unrouted # defined, not routed yet
238
+ lead_viewed: recorded # kept by every-type handlers, processed by nothing
238
239
  ```
239
240
 
240
241
  A rule names a **registered processor**. Resolution is **event → pack → default**,
@@ -259,6 +260,15 @@ passes `validate_rules!` and `event_engine:rules:check`, and emitting it raises
259
260
  `EventEngine::UnroutableEventError`. Replace `unrouted` with a processor name once
260
261
  the event has one.
261
262
 
263
+ ### Keeping an event without processing it
264
+
265
+ Give an event the rule `recorded` when nothing should process it but it should still
266
+ reach the handlers registered for every process type, such as a store that keeps
267
+ each event. No processor runs and none needs to be registered under that name, and
268
+ emitting it passes the event to those handlers in the same call, so an error a
269
+ handler raises reaches the code that emitted it. The event's `process_type` is
270
+ `recorded`.
271
+
262
272
  ### When a rule is wrong
263
273
 
264
274
  Both misconfigurations fail loudly and name the fix:
@@ -3,6 +3,7 @@ require "yaml"
3
3
  module EventEngine
4
4
  class ProcessingRules
5
5
  UNROUTED = :unrouted
6
+ RECORDED = :recorded
6
7
 
7
8
  def self.load(path)
8
9
  return new unless File.exist?(path.to_s)
@@ -35,7 +36,7 @@ module EventEngine
35
36
  end
36
37
 
37
38
  def processor_names
38
- ([ @default ] + @packs.values + @events.values).compact.uniq - [ UNROUTED ]
39
+ ([ @default ] + @packs.values + @events.values).compact.uniq - [ UNROUTED, RECORDED ]
39
40
  end
40
41
  end
41
42
  end
@@ -1,3 +1,3 @@
1
1
  module EventEngine
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/event_engine.rb CHANGED
@@ -145,6 +145,8 @@ module EventEngine
145
145
  return event unless resolver.routes?
146
146
 
147
147
  name = resolver.resolve(event)
148
+ return event if name == ProcessingRules::RECORDED
149
+
148
150
  processor = processor_registry.fetch(name) || raise(UnregisteredProcessorError.new(name, event))
149
151
 
150
152
  processor.call(event)
@@ -147,6 +147,10 @@ off to that local first and come back.
147
147
  Keep steps 3 and 4 in the same initializer so they cannot drift.
148
148
  - A rule of `unrouted` defines an event before anything handles it. It passes the
149
149
  rules check, and emitting it raises `EventEngine::UnroutableEventError`.
150
+ - A rule of `recorded` runs no processor and still passes the event to every
151
+ handler registered for all process types, such as a store that keeps each event,
152
+ in the same call. It needs no processor registered under that name and passes
153
+ the rules check. Use it for an event that is only kept as a history.
150
154
  - A pack helper firing an event that is not in the committed catalog raises
151
155
  `EventEngine::DefinitionPublisher::EventNotInCatalogError`. That means the
152
156
  catalog is stale — rebuild it in step 2, do not work around it in app code.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider