@reventlessdev/reventless-spec 3.0.0-alpha.78 → 3.0.0-alpha.80

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.80 (2026-07-22)
7
+
8
+ ### Features
9
+
10
+ * **core:** annotate event-collector logs with the element's comp ([eda413a](https://github.com/ReventlessDev/reventless-core/commit/eda413ab00eb8bb02b30e029af2d6221e3e9ba75)), closes [#1](https://github.com/ReventlessDev/reventless-core/issues/1)
11
+
12
+
13
+ # 3.0.0-alpha.79 (2026-07-17)
14
+
15
+ **Note:** Version bump only for package @reventlessdev/reventless-spec
16
+
17
+
18
+
19
+
20
+
6
21
  # 3.0.0-alpha.78 (2026-07-16)
7
22
 
8
23
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-spec",
3
- "version": "3.0.0-alpha.78",
3
+ "version": "3.0.0-alpha.80",
4
4
  "description": "Specifications for Reventless",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "rescript": "12.3.0",
25
- "@reventlessdev/rescript-jest": "1.0.0-alpha.8"
25
+ "@reventlessdev/rescript-jest": "1.0.0-alpha.9"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "rescript": "12.3.0"
@@ -33,7 +33,7 @@
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "git+https://github.com/ReventlessDev/reventless-core.git",
36
- "directory": "reventless/reventless-spec"
36
+ "directory": "reventless/spec"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "rescript build",
package/src/LogPrefix.res CHANGED
@@ -12,6 +12,8 @@ Resolution priority for a comp string like `"Kind(Name)"`:
12
12
  - strip trailing `Plugin` (handles `CommandTopic(FooPlugin)`)
13
13
  - last dot segment (handles `Extension(Catalog.Products.Ordering)`)
14
14
  - first dot segment (handles `ExtensionPoint(Catalog.Products)`)
15
+ 4. Longest registered component name that prefixes the inner name (handles
16
+ kind-suffixed resource names like `EventCollector(CustomersReadModel)`).
15
17
 
16
18
  `Plugin_Builder` registers every component (and the plugin's self-name) when
17
19
  constructing a plugin, so all transformation candidates resolve to a
@@ -100,6 +102,26 @@ let lastDotSegment = (s: string): option<string> => {
100
102
  let lookup = (name: string): option<string> =>
101
103
  componentPluginRegistry.contents->Dict.get(name)
102
104
 
105
+ // Last-resort candidate: the inner name is a registered component name carrying a
106
+ // component-kind suffix (`Customers` + `ReadModel` → `CustomersReadModel`), which is
107
+ // how event-collector resources are named. Longest prefix wins so `OrdersReadModel`
108
+ // resolves via `Orders` rather than a shorter `Order` registered by another plugin.
109
+ // LogPrefix sits below `ComponentType`, so this stays suffix-table-free.
110
+ let longestRegisteredPrefix = (name: string): option<string> =>
111
+ componentPluginRegistry.contents
112
+ ->Dict.keysToArray
113
+ ->Array.reduce(None, (acc, key) =>
114
+ if key->String.length < name->String.length && name->String.startsWith(key) {
115
+ switch acc {
116
+ | Some(best) if best->String.length >= key->String.length => acc
117
+ | _ => Some(key)
118
+ }
119
+ } else {
120
+ acc
121
+ }
122
+ )
123
+ ->Option.flatMap(lookup)
124
+
103
125
  let resolvePlugin = (~comp=?, ()) =>
104
126
  switch comp {
105
127
  | Some(c) =>
@@ -118,12 +140,14 @@ let resolvePlugin = (~comp=?, ()) =>
118
140
  lastDotSegment(inner),
119
141
  firstDotSegment(inner),
120
142
  ]
121
- candidates->Array.reduce(None, (acc, candidate) =>
143
+ candidates
144
+ ->Array.reduce(None, (acc, candidate) =>
122
145
  switch acc {
123
146
  | Some(_) => acc
124
147
  | None => candidate->Option.flatMap(lookup)
125
148
  }
126
149
  )
150
+ ->Option.orElse(longestRegisteredPrefix(inner))
127
151
  }
128
152
  }
129
153
  | None => currentPluginName.contents
@@ -80,6 +80,16 @@ function lookup(name) {
80
80
  return componentPluginRegistry.contents[name];
81
81
  }
82
82
 
83
+ function longestRegisteredPrefix(name) {
84
+ return Stdlib_Option.flatMap(Stdlib_Array.reduce(Object.keys(componentPluginRegistry.contents), undefined, (acc, key) => {
85
+ if (key.length < name.length && name.startsWith(key) && !(acc !== undefined && acc.length >= key.length)) {
86
+ return key;
87
+ } else {
88
+ return acc;
89
+ }
90
+ }), lookup);
91
+ }
92
+
83
93
  function resolvePlugin(comp, param) {
84
94
  if (comp === undefined) {
85
95
  return currentPluginName.contents;
@@ -102,13 +112,13 @@ function resolvePlugin(comp, param) {
102
112
  lastDotSegment(inner),
103
113
  firstDotSegment(inner)
104
114
  ];
105
- return Stdlib_Array.reduce(candidates, undefined, (acc, candidate) => {
115
+ return Stdlib_Option.orElse(Stdlib_Array.reduce(candidates, undefined, (acc, candidate) => {
106
116
  if (acc !== undefined) {
107
117
  return acc;
108
118
  } else {
109
119
  return Stdlib_Option.flatMap(candidate, lookup);
110
120
  }
111
- });
121
+ }), longestRegisteredPrefix(inner));
112
122
  }
113
123
 
114
124
  function fmtPlainPrefix(comp, param) {
@@ -141,6 +151,7 @@ export {
141
151
  firstDotSegment,
142
152
  lastDotSegment,
143
153
  lookup,
154
+ longestRegisteredPrefix,
144
155
  resolvePlugin,
145
156
  fmtPlainPrefix,
146
157
  fmtComp,
@@ -40,7 +40,7 @@ let fromModuleUrl = (url: string) => findVersion(url->fileURLToPath->dirname)
40
40
  let callerFile: unit => option<string> = %raw(`
41
41
  function() {
42
42
  var frameworkMarkers = [
43
- '/reventless/reventless-',
43
+ '/reventless/',
44
44
  '/@reventlessdev/reventless-',
45
45
  ];
46
46
  var oldPrepare = Error.prepareStackTrace;
@@ -37,7 +37,7 @@ function fromModuleUrl(url) {
37
37
 
38
38
  let callerFile = (function() {
39
39
  var frameworkMarkers = [
40
- '/reventless/reventless-',
40
+ '/reventless/',
41
41
  '/@reventlessdev/reventless-',
42
42
  ];
43
43
  var oldPrepare = Error.prepareStackTrace;