event_engine 0.2.2 → 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: 147bcd5804bc40820fdbe36f46bd6e5ca76a7b7d09b39bf1955ccbda2925e1cd
4
- data.tar.gz: bdb36c1bf535f603b58950749ef12d1ea19bbbbd1c59e4f3831525c4d336342b
3
+ metadata.gz: d41f3bf5979d9b7bf564192af007e2345acb7cb5a8557af84a56a9a140ba7b49
4
+ data.tar.gz: c295ec1cc5a9ad2f1d3f2dec987067e7fbfe33dbf2a6037914989acc5caad9fc
5
5
  SHA512:
6
- metadata.gz: 90690f42ed2498c5516a52230b750273777d115fa136af306e84c0c3a2dd4615f79d63570aa14ba0d34087a2c582e036f9a3acad6175a757305783225404c93c
7
- data.tar.gz: 507ce9e63e9a161436a88eabcb7d6114f06bdd77e7fa88a23296c3655910994b7e9696f3f0a5cd4420876e39f02da963c748773c8551096f39cec22d0076c4a4
6
+ metadata.gz: 0ac2e2d99a33c2a69dd1300d00c53f283504eecba38f79d4ca7b87f4ae8098a689abc9a3588f45e992c31f2141e0c3bf454c21eda0a5bb101bbdbcaa8c813df2
7
+ data.tar.gz: 0bb6f4f3f401336adfd11076a3df889ea11ddbc5d913125a69af65b40dd04a95c9163f11fe6d20356c01594bccbce7ae943a4d0607c2978aacd7a0770fda62c9
data/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ 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
+
16
+ ## [0.2.3] - 2026-10-23
17
+
18
+ ### Added
19
+
20
+ - **Unrouted events.** A rule of `unrouted` defines an event before anything
21
+ handles it. It passes `validate_rules!`, and emitting it raises
22
+ `EventEngine::UnroutableEventError`.
23
+
10
24
  ## [0.2.2] - 2026-09-06
11
25
 
12
26
  ### Fixed
data/README.md CHANGED
@@ -234,6 +234,8 @@ packs:
234
234
  events:
235
235
  invoice_voided: audit # this one event
236
236
  lead_converted: # catalogued but undecided
237
+ lead_scored: unrouted # defined, not routed yet
238
+ lead_viewed: recorded # kept by every-type handlers, processed by nothing
237
239
  ```
238
240
 
239
241
  A rule names a **registered processor**. Resolution is **event → pack → default**,
@@ -251,6 +253,22 @@ and the resolved name is both the processor invoked and the value stamped on
251
253
  A newly catalogued event appears with no value. It falls through to its pack rule or
252
254
  the default; if neither exists, emitting it raises rather than being dropped.
253
255
 
256
+ ### Defining an event before it is routed
257
+
258
+ Give an event the rule `unrouted` to define it before anything handles it. It
259
+ passes `validate_rules!` and `event_engine:rules:check`, and emitting it raises
260
+ `EventEngine::UnroutableEventError`. Replace `unrouted` with a processor name once
261
+ the event has one.
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
+
254
272
  ### When a rule is wrong
255
273
 
256
274
  Both misconfigurations fail loudly and name the fix:
@@ -2,6 +2,9 @@ require "yaml"
2
2
 
3
3
  module EventEngine
4
4
  class ProcessingRules
5
+ UNROUTED = :unrouted
6
+ RECORDED = :recorded
7
+
5
8
  def self.load(path)
6
9
  return new unless File.exist?(path.to_s)
7
10
 
@@ -33,7 +36,7 @@ module EventEngine
33
36
  end
34
37
 
35
38
  def processor_names
36
- ([ @default ] + @packs.values + @events.values).compact.uniq
39
+ ([ @default ] + @packs.values + @events.values).compact.uniq - [ UNROUTED, RECORDED ]
37
40
  end
38
41
  end
39
42
  end
@@ -9,8 +9,10 @@ module EventEngine
9
9
  end
10
10
 
11
11
  def resolve(event)
12
- @rules.for(event_name: event.event_name, pack: event.domain) ||
13
- raise(UnroutableEventError.new(event))
12
+ name = @rules.for(event_name: event.event_name, pack: event.domain)
13
+ raise UnroutableEventError.new(event) if name.nil? || name == ProcessingRules::UNROUTED
14
+
15
+ name
14
16
  end
15
17
  end
16
18
  end
@@ -1,3 +1,3 @@
1
1
  module EventEngine
2
- VERSION = "0.2.2"
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)
@@ -145,6 +145,12 @@ off to that local first and come back.
145
145
  domain; pair narrow rules with a `default_processor`.
146
146
  - Routing at a name with no registered processor fails at emit time, not at boot.
147
147
  Keep steps 3 and 4 in the same initializer so they cannot drift.
148
+ - A rule of `unrouted` defines an event before anything handles it. It passes the
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.
148
154
  - A pack helper firing an event that is not in the committed catalog raises
149
155
  `EventEngine::DefinitionPublisher::EventNotInCatalogError`. That means the
150
156
  catalog is stale — rebuild it in step 2, do not work around it in app code.
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-09-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: railties
@@ -102,7 +101,6 @@ metadata:
102
101
  changelog_uri: https://github.com/DYB-Development/event_engine/blob/main/CHANGELOG.md
103
102
  bug_tracker_uri: https://github.com/DYB-Development/event_engine/issues
104
103
  documentation_uri: https://github.com/DYB-Development/event_engine#readme
105
- post_install_message:
106
104
  rdoc_options: []
107
105
  require_paths:
108
106
  - lib
@@ -117,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
115
  - !ruby/object:Gem::Version
118
116
  version: '0'
119
117
  requirements: []
120
- rubygems_version: 3.5.16
121
- signing_key:
118
+ rubygems_version: 4.0.20
122
119
  specification_version: 4
123
120
  summary: The Rails host runtime for the schema-first EventEngine pipeline
124
121
  test_files: []