@reventlessdev/reventless-spec 3.0.0-alpha.76 → 3.0.0-alpha.77

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,13 @@
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.77 (2026-07-15)
7
+
8
+ ### Performance Improvements
9
+
10
+ * **spec:** reverse-convert DcbTag extraction instead of stringify round-trip ([4311c7b](https://github.com/ReventlessDev/reventless-core/commit/4311c7b863f99e582911ced529d77dca7cc36381))
11
+
12
+
6
13
  # 3.0.0-alpha.76 (2026-07-12)
7
14
 
8
15
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-spec",
3
- "version": "3.0.0-alpha.76",
3
+ "version": "3.0.0-alpha.77",
4
4
  "description": "Specifications for Reventless",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {
@@ -399,7 +399,11 @@ let extractTagsFromJson = (schema: S.t<unknown>, json: JSON.t): array<tag> =>
399
399
  /**
400
400
  Extracts DCB tags from a typed event value using its sury schema.
401
401
 
402
- Serializes the value to JSON first, then delegates to `extractTagsFromJson`.
402
+ Reverse-converts the value to JSON through its schema, then delegates to
403
+ `extractTagsFromJson`. Using the schema-aware reverse convert (instead of a
404
+ `JSON.stringifyAny -> parseOrThrow` string round-trip) avoids serializing the
405
+ whole event to a string per message and emits the schema's serialized field
406
+ keys — so `@as`-renamed tagged fields are found by the same-schema walker.
403
407
 
404
408
  @example
405
409
  ```rescript
@@ -410,10 +414,8 @@ let tags = DcbTag.extractTags(
410
414
  // [{key: "categoryId", value: "cat-1"}]
411
415
  ```
412
416
  */
413
- let extractTags = (schema: S.t<'a>, value: 'a): array<tag> => {
414
- let json = value->JSON.stringifyAny->Option.getOrThrow->JSON.parseOrThrow
415
- extractTagsFromJson(schema->toUnknownSchema, json)
416
- }
417
+ let extractTags = (schema: S.t<'a>, value: 'a): array<tag> =>
418
+ extractTagsFromJson(schema->toUnknownSchema, value->S.reverseConvertToJsonOrThrow(schema))
417
419
 
418
420
  // --- Extract variant constructor names from a tagged union schema ---
419
421
  // For a variant type like `type event = ItemCreated({...}) | ItemRenamed({...})`,
@@ -596,10 +598,8 @@ let tags = DcbTag.extractTagsExpanded(
596
598
  // [{key: "orderId", value: "ord-1"}, {key: "productIds", value: "p1"}, {key: "productIds", value: "p2"}]
597
599
  ```
598
600
  */
599
- let extractTagsExpanded = (schema: S.t<'a>, value: 'a): array<tag> => {
600
- let json = value->JSON.stringifyAny->Option.getOrThrow->JSON.parseOrThrow
601
- extractTagsFromJsonExpanded(schema->toUnknownSchema, json)
602
- }
601
+ let extractTagsExpanded = (schema: S.t<'a>, value: 'a): array<tag> =>
602
+ extractTagsFromJsonExpanded(schema->toUnknownSchema, value->S.reverseConvertToJsonOrThrow(schema))
603
603
 
604
604
  // --- Automatic query construction from command schema ---
605
605
 
@@ -202,8 +202,7 @@ function extractTagsFromJson(schema, json) {
202
202
  }
203
203
 
204
204
  function extractTags(schema, value) {
205
- let json = JSON.parse(Stdlib_Option.getOrThrow(JSON.stringify(value), undefined));
206
- return extractTagsFromJson(schema, json);
205
+ return extractTagsFromJson(schema, S.reverseConvertToJsonOrThrow(value, schema));
207
206
  }
208
207
 
209
208
  function extractVariantNames(schema) {
@@ -345,8 +344,7 @@ function extractTagsFromJsonExpanded(schema, json) {
345
344
  }
346
345
 
347
346
  function extractTagsExpanded(schema, value) {
348
- let json = JSON.parse(Stdlib_Option.getOrThrow(JSON.stringify(value), undefined));
349
- return extractTagsFromJsonExpanded(schema, json);
347
+ return extractTagsFromJsonExpanded(schema, S.reverseConvertToJsonOrThrow(value, schema));
350
348
  }
351
349
 
352
350
  function hasTaggedArrayFields(schema) {
@@ -368,23 +368,6 @@ type pluginStructure = {
368
368
 
369
369
  let pluginStructureOptionSchema = _jsNullable(pluginStructureSchema, ())
370
370
 
371
- // ── Event graph types (cross-plugin component graph) ──────────────────────────
372
-
373
- @schema
374
- type graphNode = {pluginName: string, componentName: string, kind: string}
375
-
376
- @schema
377
- type graphEdge = {
378
- source: graphNode,
379
- target: graphNode,
380
- mechanism: string,
381
- viaEvents: array<string>,
382
- implicit: bool,
383
- }
384
-
385
- @schema
386
- type platformEventGraph = {nodes: array<graphNode>, edges: array<graphEdge>}
387
-
388
371
  /**
389
372
  The self-description of a deployed plugin, persisted in the plugin's event store.
390
373
 
@@ -190,25 +190,6 @@ let pluginStructureSchema = S.schema(s => ({
190
190
 
191
191
  let pluginStructureOptionSchema = SuryResMjs.js_nullable(pluginStructureSchema);
192
192
 
193
- let graphNodeSchema = S.schema(s => ({
194
- pluginName: s.m(S.string),
195
- componentName: s.m(S.string),
196
- kind: s.m(S.string)
197
- }));
198
-
199
- let graphEdgeSchema = S.schema(s => ({
200
- source: s.m(graphNodeSchema),
201
- target: s.m(graphNodeSchema),
202
- mechanism: s.m(S.string),
203
- viaEvents: s.m(S.array(S.string)),
204
- implicit: s.m(S.bool)
205
- }));
206
-
207
- let platformEventGraphSchema = S.schema(s => ({
208
- nodes: s.m(S.array(graphNodeSchema)),
209
- edges: s.m(S.array(graphEdgeSchema))
210
- }));
211
-
212
193
  let pluginDefinitionSchema = S.schema(s => ({
213
194
  id: s.m(S.string),
214
195
  name: s.m(S.string),
@@ -262,9 +243,6 @@ export {
262
243
  extensionPointDefArrayOptionSchema,
263
244
  pluginStructureSchema,
264
245
  pluginStructureOptionSchema,
265
- graphNodeSchema,
266
- graphEdgeSchema,
267
- platformEventGraphSchema,
268
246
  pluginDefinitionSchema,
269
247
  }
270
248
  /* pluginKindSchema Not a pure module */