@reventlessdev/reventless-core 3.0.0-alpha.259 → 3.0.0-alpha.261

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.
Files changed (209) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +11 -11
  3. package/src/Behavior.res +1 -4
  4. package/src/Message.res +17 -14
  5. package/src/Projection.res +51 -25
  6. package/src/RequestContext.res +8 -9
  7. package/src/ResourceAttribution.res +28 -14
  8. package/src/adapter/Adapter.res +48 -4
  9. package/src/adapter/EventLogProvisioning/EventLogProvisioning.res +5 -5
  10. package/src/adapter/Messaging/Messaging_Log_Backend.res +10 -7
  11. package/src/adapter/Messaging/Messaging_Log_Backend.res.mjs +2 -4
  12. package/src/adapter/Monitoring/Monitoring.res +16 -17
  13. package/src/adapter/QueryInterception/QueryInterception.res +0 -1
  14. package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res +12 -5
  15. package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +11 -7
  16. package/src/adapter/Runtime/PluginRuntime_Builder_Micro.res +1 -7
  17. package/src/adapter/Runtime/PluginRuntime_Builder_Single.res +1 -7
  18. package/src/adapter/RuntimeExtension/RuntimeExtension.res +0 -1
  19. package/src/admin/Platform_Admin.res +17 -6
  20. package/src/admin/Platform_AdminApi.res +14 -9
  21. package/src/admin/Platform_Admin_Callback.res +1 -1
  22. package/src/admin/Platform_BakedManifest.res +34 -34
  23. package/src/admin/Platform_ComponentDefinitionsApi.res +9 -21
  24. package/src/admin/Platform_PluginStructuresApi.res +15 -12
  25. package/src/admin/UiFragmentRegistry/StateChange/UiFragmentRegistry.res +1 -1
  26. package/src/components/Aggregate/Aggregate.res +13 -12
  27. package/src/components/Aggregate/Aggregate_Builder.res +22 -21
  28. package/src/components/Aggregate/Aggregate_Callback.res +91 -86
  29. package/src/components/Api/ApiNoApiHelpers.res +1 -3
  30. package/src/components/Api/Api_Ids.res +0 -1
  31. package/src/components/Api/Api_Naming.res +41 -18
  32. package/src/components/Api/GraphQL_FragmentGenerator.res +42 -52
  33. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +11 -4
  34. package/src/components/Api/GraphQL_SchemaInspector.res +5 -3
  35. package/src/components/Api/GraphQL_Stitcher.res +9 -10
  36. package/src/components/Api/MCP_SchemaGenerator.res +8 -12
  37. package/src/components/Api/OwnerScopeDiagnostics.res +1 -2
  38. package/src/components/Api/QueryDbListQuery.res +13 -6
  39. package/src/components/Api/SchemaType.res +40 -20
  40. package/src/components/Api/SchemaType.res.mjs +16 -0
  41. package/src/components/Api/SuryToJsonSchema.res +18 -10
  42. package/src/components/Api/SuryToJsonSchema.res.mjs +135 -121
  43. package/src/components/AutomationSlice/AutomationSlice.res +4 -4
  44. package/src/components/AutomationSlice/AutomationSlice_Builder.res +15 -14
  45. package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -3
  46. package/src/components/Builder_Helpers.res +12 -23
  47. package/src/components/CommandGenerator/CommandGenerator.res +6 -1
  48. package/src/components/CommandGenerator/CommandGenerator_Builder.res +29 -21
  49. package/src/components/CommandGenerator/CommandGenerator_Callback.res +17 -21
  50. package/src/components/CommandTopic/CommandTopic.res +3 -3
  51. package/src/components/CommandTopic/CommandTopic_Builder.res +10 -10
  52. package/src/components/CommandTopic/CommandTopic_Callback.res +1 -4
  53. package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -2
  54. package/src/components/Counter/Counter_Builder.res +1 -6
  55. package/src/components/Counter/Counter_Callback.res +3 -3
  56. package/src/components/Dcb/Dcb_Builder.res +970 -956
  57. package/src/components/DcbEventLog/DcbEventLog.res +4 -4
  58. package/src/components/DcbEventLog/DcbEventLog_Builder.res +0 -1
  59. package/src/components/DcbEventLog/DcbEventLog_Operations.res +17 -18
  60. package/src/components/EventCollector/EventCollector_Builder.res +2 -1
  61. package/src/components/EventLog/EventLog.res +5 -1
  62. package/src/components/EventLog/EventLog_Operations.res +12 -8
  63. package/src/components/EventMapper/EventMapper.res +8 -10
  64. package/src/components/EventMapper/EventMapper_Builder.res +4 -1
  65. package/src/components/EventMapper/EventMapper_Callback.res +46 -31
  66. package/src/components/EventTopic/EventTopic.res +3 -3
  67. package/src/components/EventTopic/EventTopic_Builder.res +1 -1
  68. package/src/components/Extension/Extension.res +4 -1
  69. package/src/components/Extension/Extension_Operations.res +11 -3
  70. package/src/components/ExtensionPoint/ExtensionPoint.res +3 -3
  71. package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +9 -10
  72. package/src/components/ExtensionPoint/ExtensionPoint_Callback.res +2 -6
  73. package/src/components/ExtensionPoint/ExtensionPoint_Operations.res +13 -5
  74. package/src/components/Heartbeat/Heartbeat_Callback.res +3 -3
  75. package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +4 -4
  76. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +7 -10
  77. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice.res +4 -4
  78. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +15 -14
  79. package/src/components/QueryDb/QueryDb_Adapter.res +1 -3
  80. package/src/components/QueryDb/QueryDb_Operations.res +10 -10
  81. package/src/components/ReadModel/ReadModel.res +3 -3
  82. package/src/components/ReadModel/ReadModel_Builder.res +1 -2
  83. package/src/components/ReadModel/ReadModel_Callback.res +2 -1
  84. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +5 -2
  85. package/src/components/StateChangeSlice/StateChangeSlice.res +3 -3
  86. package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +23 -4
  87. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +22 -6
  88. package/src/components/StateTopic.res +1 -3
  89. package/src/components/StateViewSlice/StateViewSlice.res +4 -4
  90. package/src/components/StateViewSlice/StateViewSlice_Builder.res +79 -68
  91. package/src/components/StateViewSlice/StateViewSlice_Callback.res +3 -1
  92. package/src/components/Task/Task.res +3 -3
  93. package/src/components/Task/Task_Adapter.res +4 -1
  94. package/src/components/Task/Task_Builder.res +24 -21
  95. package/src/plugin/api/PluginBaseFragment.res +9 -3
  96. package/src/plugin/component/Capability_Inference.res +8 -10
  97. package/src/plugin/component/Plugin.res +6 -6
  98. package/src/plugin/component/Plugin_Builder.res +54 -50
  99. package/src/plugin/component/Plugin_Callback.res +10 -6
  100. package/src/plugin/component/Plugin_Helpers.res +264 -230
  101. package/src/plugin/component/Plugin_Structure.res +370 -324
  102. package/src/plugin/component/Plugin_SubscriptionSchema.res +8 -6
  103. package/src/plugin/component/SchemaWalker.res +11 -12
  104. package/src/plugin/connect/PluginConnectExtension_Mapping.res +45 -50
  105. package/src/plugin/lifecycle/PluginBehavior.res +3 -4
  106. package/src/plugin/lifecycle/PluginSpec.res +1 -2
  107. package/src/plugin/lifecycle/PluginsProjection.res +16 -5
  108. package/src/plugin/lifecycle/PluginsReadModelSpec.res +0 -2
  109. package/src/util/CommandPublisher.res +9 -2
  110. package/src/util/CsvStream.res +3 -3
  111. package/src/util/Interstack.res +7 -15
  112. package/src/util/Interstack.resi +3 -3
  113. package/src/util/LogFormat.res +5 -9
  114. package/src/util/Logger.res +1 -2
  115. package/src/util/Lru.res +2 -1
  116. package/src/util/Lru.resi +2 -3
  117. package/src/util/ScheduleOps.res +24 -27
  118. package/src/util/StorePrefixCollision.res +6 -9
  119. package/src/util/Util_Promise.res +4 -1
  120. package/src/util/Util_Promise.res.mjs +1 -1
  121. package/tests/IdentityTest.res +166 -113
  122. package/tests/ResourceAttributionTest.res +28 -25
  123. package/tests/StorePrefixCollisionTest.res +2 -1
  124. package/tests/TaskBucketNamingTest.res +3 -2
  125. package/tests/adapter/EventLogProvisioningTest.res +51 -48
  126. package/tests/adapter/MonitoringTest.res +81 -38
  127. package/tests/adapter/QueryInterceptionTest.res +2 -2
  128. package/tests/adapter/RefusalVocabularyTest.res +31 -23
  129. package/tests/adapter/RuntimeExtensionHookReachTest.res +9 -8
  130. package/tests/adapter/RuntimeExtensionTest.res +5 -3
  131. package/tests/admin/AdminApiSchemaDriftTest.res +22 -16
  132. package/tests/admin/Platform_Admin_StructureTest.res +10 -11
  133. package/tests/admin/Platform_BakedManifestTest.res +31 -35
  134. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +18 -15
  135. package/tests/admin/Platform_PluginStructuresApiTest.res +5 -3
  136. package/tests/admin/Platform_UIFragmentsApiTest.res +6 -3
  137. package/tests/aggregate/AggregateCacheTest.res +10 -12
  138. package/tests/aggregate/AggregateCallbackTest.res +75 -46
  139. package/tests/aggregate/AggregateCausationTest.res +19 -20
  140. package/tests/aggregate/AggregateConflictTest.res +41 -19
  141. package/tests/aggregate/AggregateFixtures.res +15 -5
  142. package/tests/aggregate/AggregateRejectionTest.res +97 -80
  143. package/tests/aggregate/AggregateSnapshotTest.res +44 -16
  144. package/tests/api/Api_IdsTest.res +10 -4
  145. package/tests/api/BrandedMarkerCompositionTest.res +48 -36
  146. package/tests/api/GeolocationSemanticTest.res +3 -3
  147. package/tests/api/GraphQL_FragmentGeneratorTest.res +66 -54
  148. package/tests/api/OwnerScopeDiagnosticsTest.res +31 -27
  149. package/tests/api/StorageRefFieldsTest.res +30 -18
  150. package/tests/api/SuryToJsonSchemaTest.res +1338 -981
  151. package/tests/api/SuryToJsonSchemaTest.res.mjs +31 -0
  152. package/tests/api/TaggedUnionSchemaTest.res +17 -24
  153. package/tests/commandgenerator/CommandGeneratorCallbackTest.res +235 -179
  154. package/tests/commandgenerator/CommandGeneratorFixtures.res +8 -13
  155. package/tests/commandgenerator/OwnerStampingTest.res +91 -76
  156. package/tests/commandtopic/CommandOutcomeHookTest.res +198 -155
  157. package/tests/commandtopic/CommandTopicCallbackFixtures.res +5 -4
  158. package/tests/commandtopic/CommandTopicCallbackTest.res +61 -43
  159. package/tests/commandtopic/CommandTopicHelpersRejectionTest.res +70 -55
  160. package/tests/counter/CounterCallbackTest.res +40 -34
  161. package/tests/counter/CounterFixtures.res +4 -4
  162. package/tests/dcb/DcbDecodeTest.res +115 -84
  163. package/tests/dcb/DcbEventLogOperationsTest.res +194 -143
  164. package/tests/dcb/DcbEventLogSchemaTest.res +13 -13
  165. package/tests/dcb/DcbFixtures.res +4 -5
  166. package/tests/dcb/DcbScopeInferenceTest.res +173 -114
  167. package/tests/dcb/DcbStateChangeSliceTest.res +391 -262
  168. package/tests/dcb/DcbTagTest.res +22 -11
  169. package/tests/dcb/DcbValidationTest.res +288 -218
  170. package/tests/eventlog/EventLogFixtures.res +4 -4
  171. package/tests/eventlog/EventLogOperationsTest.res +102 -67
  172. package/tests/eventlog/EventLogRetryTest.res +104 -65
  173. package/tests/eventmapper/EventMapperCallbackTest.res +118 -83
  174. package/tests/eventmapper/EventMapperFixtures.res +15 -23
  175. package/tests/eventmapper/EventMapperTest.res +54 -38
  176. package/tests/eventtopic/EventTopicFixtures.res +3 -4
  177. package/tests/eventtopic/EventTopicOperationsTest.res +41 -29
  178. package/tests/extensionpoint/ExtensionPointCallbackTest.res +58 -45
  179. package/tests/extensionpoint/ExtensionPointFixtures.res +16 -20
  180. package/tests/extensionpoint/ExtensionPointOperationsTest.res +70 -49
  181. package/tests/extensionpoint/PluginDisconnectScheduleTest.res +2 -1
  182. package/tests/logger/LogFormatTest.res +104 -82
  183. package/tests/logger/LoggerLazyTest.res +21 -12
  184. package/tests/message/MessageTest.res +96 -93
  185. package/tests/message/MetaEnvelopeTest.res +26 -30
  186. package/tests/plugin/HeartbeatDisconnectGraceTest.res +31 -25
  187. package/tests/plugin/ManifestVisibilityTest.res +20 -12
  188. package/tests/plugin/PluginDefinitionScalars.res +1 -2
  189. package/tests/plugin/PluginLifecycleCorpusTest.res +15 -12
  190. package/tests/plugin/PluginSpecExperiment.res +0 -1
  191. package/tests/plugin/PluginStructureTest.res +1533 -1030
  192. package/tests/plugin/PluginStructureTest.res.mjs +6 -0
  193. package/tests/plugin/Plugin_EventQuerySchemaTest.res +21 -10
  194. package/tests/plugin/SchemaWalkerTest.res +116 -70
  195. package/tests/plugin/StateChange/PsReserveStock.res +4 -4
  196. package/tests/plugin/StateView/PsAnnotatedView.res +6 -4
  197. package/tests/plugin/StateView/PsAnnotatedView.res.mjs +7 -3
  198. package/tests/plugin/StateView/PsCustomersView.res +4 -4
  199. package/tests/plugin/StateView/PsShipmentsView.res +3 -2
  200. package/tests/projection/LifecycleTrailTest.res +1 -4
  201. package/tests/projection/ProjectionOptimizeTest.res +13 -9
  202. package/tests/querydb/QueryDbFixtures.res +0 -1
  203. package/tests/querydb/QueryDbOperationsTest.res +99 -64
  204. package/tests/querydb/TaggedUnionStampTest.res +10 -8
  205. package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res +50 -35
  206. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +4 -10
  207. package/tests/util/CommandPublisherTest.res +0 -1
  208. package/tests/util/CsvStreamTest.res +3 -3
  209. package/tests/util/LruTest.res +84 -56
@@ -5,80 +5,93 @@ let _ = beforeEach(() => reset())
5
5
 
6
6
  describe("ExtensionPoint_Callback.handleIncomingCommands:", () => {
7
7
  describe("AbstractPublishCommand — known aggregate", () => {
8
- testPromise("dispatches to aggregate publishJsons, returns Ok(reference)", async () => {
9
- let results =
10
- await Stream.fromIterable([makeTopicItem("ref-1", TestEPSpec.RouteToAgg({aggId: "agg-1"}))])
8
+ testPromise(
9
+ "dispatches to aggregate publishJsons, returns Ok(reference)",
10
+ async () => {
11
+ let results = await Stream.fromIterable([
12
+ makeTopicItem("ref-1", TestEPSpec.RouteToAgg({aggId: "agg-1"})),
13
+ ])
11
14
  ->TestHandler.handleIncomingCommands
12
15
  ->Effect.runPromise
13
- expect((results, capturedPublishedCmds.contents->Array.length))->toEqual(([Ok("ref-1")], 1))
14
- })
16
+ expect((results, capturedPublishedCmds.contents->Array.length))->toEqual(([Ok("ref-1")], 1))
17
+ },
18
+ )
15
19
  })
16
20
 
17
21
  describe("AbstractPublishCommand — unknown aggregate", () => {
18
- testPromise("throws internally, returns Error(reference)", async () => {
19
- // Create a mapping that routes to an aggregate not in publishToAggregates
20
- // We'll directly build a topic item that our TestMapping won't route to "TestTargetAgg"
21
- // Instead test via a handler that produces AbstractPublishCommand for an unknown name.
22
- // We can't easily override the mapping, so we test via the applyCommandAction path:
23
- // the TestMapping always routes RouteToAgg to "TestTargetAgg" which IS in the dict.
24
- // For the "unknown" case, we rely on applyCommandAction's own error path.
25
- // We test this by calling handleIncomingCommands with 2 items where the second
26
- // targets a known aggregate — verify both refs in results.
27
- let results =
28
- await Stream.fromIterable([
22
+ testPromise(
23
+ "throws internally, returns Error(reference)",
24
+ async () => {
25
+ // Create a mapping that routes to an aggregate not in publishToAggregates
26
+ // We'll directly build a topic item that our TestMapping won't route to "TestTargetAgg"
27
+ // Instead test via a handler that produces AbstractPublishCommand for an unknown name.
28
+ // We can't easily override the mapping, so we test via the applyCommandAction path:
29
+ // the TestMapping always routes RouteToAgg to "TestTargetAgg" which IS in the dict.
30
+ // For the "unknown" case, we rely on applyCommandAction's own error path.
31
+ // We test this by calling handleIncomingCommands with 2 items where the second
32
+ // targets a known aggregate — verify both refs in results.
33
+ let results = await Stream.fromIterable([
29
34
  makeTopicItem("ref-a", TestEPSpec.RouteToAgg({aggId: "agg-1"})),
30
35
  makeTopicItem("ref-b", TestEPSpec.RouteToAgg({aggId: "agg-2"})),
31
36
  ])
32
37
  ->TestHandler.handleIncomingCommands
33
38
  ->Effect.runPromise
34
- // Both route to "TestTargetAgg" (known) — both should return Ok
35
- expect(results->Array.length)->toBe(2)
36
- let allOk = results->Array.every(r =>
37
- switch r {
38
- | Ok(_) => true
39
- | Error(_) => false
40
- }
41
- )
42
- expect(allOk)->toBe(true)
43
- })
39
+ // Both route to "TestTargetAgg" (known) — both should return Ok
40
+ expect(results->Array.length)->toBe(2)
41
+ let allOk = results->Array.every(
42
+ r =>
43
+ switch r {
44
+ | Ok(_) => true
45
+ | Error(_) => false
46
+ },
47
+ )
48
+ expect(allOk)->toBe(true)
49
+ },
50
+ )
44
51
  })
45
52
 
46
53
  describe("AbstractHandleDirective handler succeeds", () => {
47
- testPromise("handler called, returns Ok(reference)", async () => {
48
- let results =
49
- await Stream.fromIterable([
54
+ testPromise(
55
+ "handler called, returns Ok(reference)",
56
+ async () => {
57
+ let results = await Stream.fromIterable([
50
58
  makeTopicItem("ref-1", TestEPSpec.TriggerDirective({value: "test"})),
51
59
  ])
52
60
  ->TestHandler.handleIncomingCommands
53
61
  ->Effect.runPromise
54
- expect((results, capturedCallCount.contents))->toEqual(([Ok("ref-1")], 1))
55
- })
62
+ expect((results, capturedCallCount.contents))->toEqual(([Ok("ref-1")], 1))
63
+ },
64
+ )
56
65
  })
57
66
 
58
67
  describe("mixed actions", () => {
59
- testPromise("AbstractPublishCommand and AbstractHandleDirective both resolved", async () => {
60
- let results =
61
- await Stream.fromIterable([
68
+ testPromise(
69
+ "AbstractPublishCommand and AbstractHandleDirective both resolved",
70
+ async () => {
71
+ let results = await Stream.fromIterable([
62
72
  makeTopicItem("ref-pub", TestEPSpec.RouteToAgg({aggId: "agg-1"})),
63
73
  makeTopicItem("ref-call", TestEPSpec.TriggerDirective({value: "v"})),
64
74
  ])
65
75
  ->TestHandler.handleIncomingCommands
66
76
  ->Effect.runPromise
67
- expect((
68
- results->Array.length,
69
- capturedPublishedCmds.contents->Array.length,
70
- capturedCallCount.contents,
71
- ))->toEqual((2, 1, 1))
72
- })
77
+ expect((
78
+ results->Array.length,
79
+ capturedPublishedCmds.contents->Array.length,
80
+ capturedCallCount.contents,
81
+ ))->toEqual((2, 1, 1))
82
+ },
83
+ )
73
84
  })
74
85
 
75
86
  describe("empty batch", () => {
76
- testPromise("returns empty array", async () => {
77
- let results =
78
- await Stream.fromIterable([])
87
+ testPromise(
88
+ "returns empty array",
89
+ async () => {
90
+ let results = await Stream.fromIterable([])
79
91
  ->TestHandler.handleIncomingCommands
80
92
  ->Effect.runPromise
81
- expect(results)->toEqual([])
82
- })
93
+ expect(results)->toEqual([])
94
+ },
95
+ )
83
96
  })
84
97
  })
@@ -14,10 +14,10 @@ module TestEPSpec = {
14
14
  | TriggerDirective({value: string})
15
15
 
16
16
  @schema
17
- type event = | Done({result: string})
17
+ type event = Done({result: string})
18
18
 
19
19
  @schema
20
- type directive = | DirectiveA
20
+ type directive = DirectiveA
21
21
 
22
22
  let moduleUrl: string = %raw(`import.meta.url`)
23
23
  }
@@ -75,9 +75,7 @@ module TestMapping = {
75
75
  Reventless.Schedule.create,
76
76
  Reventless.Schedule.delete,
77
77
  Reventless.QueryEngine.operations,
78
- ) => array<
79
- ReventlessInfra.ExtensionPointMapping.abstractEventAction<TestEPSpec.event>,
80
- >,
78
+ ) => array<ReventlessInfra.ExtensionPointMapping.abstractEventAction<TestEPSpec.event>>,
81
79
  > = None
82
80
  }
83
81
 
@@ -87,7 +85,8 @@ module TestMapping = {
87
85
 
88
86
  module TestMappings = {
89
87
  module Spec = TestEPSpec
90
- module type Mapping = ReventlessInfra.ExtensionPointMapping.T with module ExtensionPoint := TestEPSpec
88
+ module type Mapping = ReventlessInfra.ExtensionPointMapping.T
89
+ with module ExtensionPoint := TestEPSpec
91
90
  let name = "TestMappings"
92
91
  let moduleUrl: string = %raw(`import.meta.url`)
93
92
  let mappings: array<module(Mapping)> = [module(TestMapping)]
@@ -98,16 +97,14 @@ module TestMappings = {
98
97
  // ─────────────────────────────────────────────────────────────
99
98
 
100
99
  module TestCallbackSpec: ExtensionPoint_Callback.Spec = {
101
- let publishToAggregates: dict<CommandTopic.publishJsons> =
102
- Dict.fromArray([
103
- (
104
- "TestTargetAgg",
105
- async cmds => {
106
- capturedPublishedCmds :=
107
- capturedPublishedCmds.contents->Array.concat(cmds)
108
- },
109
- ),
110
- ])
100
+ let publishToAggregates: dict<CommandTopic.publishJsons> = Dict.fromArray([
101
+ (
102
+ "TestTargetAgg",
103
+ async cmds => {
104
+ capturedPublishedCmds := capturedPublishedCmds.contents->Array.concat(cmds)
105
+ },
106
+ ),
107
+ ])
111
108
 
112
109
  let commandTopicResources: array<Adapter.resolvedResource> = []
113
110
 
@@ -154,10 +151,9 @@ let testMeta: Message.meta = {
154
151
  correlationId: "ep-corr-1",
155
152
  }
156
153
 
157
- let makeTopicItem = (
158
- reference,
159
- command,
160
- ): CommandTopic.topicItem<Message.command'<Reventless.Id.String.t, TestEPSpec.command>> => {
154
+ let makeTopicItem = (reference, command): CommandTopic.topicItem<
155
+ Message.command'<Reventless.Id.String.t, TestEPSpec.command>,
156
+ > => {
161
157
  command: {
162
158
  id: reference->Reventless.Id.String.makeFromString,
163
159
  meta: testMeta,
@@ -3,7 +3,6 @@
3
3
 
4
4
  open JestGlobals
5
5
 
6
-
7
6
  // ─────────────────────────────────────────────────────────────
8
7
  // EP Spec — minimal types for operations tests
9
8
  // ─────────────────────────────────────────────────────────────
@@ -12,13 +11,13 @@ module OpsEPSpec = {
12
11
  let name = "OpsTestEP"
13
12
 
14
13
  @schema
15
- type command = | OpsEPCmd({id: string})
14
+ type command = OpsEPCmd({id: string})
16
15
 
17
16
  @schema
18
- type event = | OpsEPEvent({result: string})
17
+ type event = OpsEPEvent({result: string})
19
18
 
20
19
  @schema
21
- type directive = | OpsEPNoDirective
20
+ type directive = OpsEPNoDirective
22
21
 
23
22
  let moduleUrl: string = %raw(`import.meta.url`)
24
23
  }
@@ -57,7 +56,11 @@ module TestPublishMapping = {
57
56
  let mapOutgoingEvent = Some(
58
57
  (eventJson, _createSchedule, _deleteSchedule, _queryEngine) => {
59
58
  [
60
- ReventlessInfra.ExtensionPointMapping.AbstractPublishEvent("ep-dest", outgoingMeta, eventJson),
59
+ ReventlessInfra.ExtensionPointMapping.AbstractPublishEvent(
60
+ "ep-dest",
61
+ outgoingMeta,
62
+ eventJson,
63
+ ),
61
64
  ]
62
65
  },
63
66
  )
@@ -81,9 +84,11 @@ module TestCallMapping = {
81
84
  let mapOutgoingEvent = Some(
82
85
  (_eventJson, _createSchedule, _deleteSchedule, _queryEngine) => {
83
86
  [
84
- ReventlessInfra.ExtensionPointMapping.AbstractHandleDirective(async () => {
85
- capturedCallCount := capturedCallCount.contents + 1
86
- }),
87
+ ReventlessInfra.ExtensionPointMapping.AbstractHandleDirective(
88
+ async () => {
89
+ capturedCallCount := capturedCallCount.contents + 1
90
+ },
91
+ ),
87
92
  ]
88
93
  },
89
94
  )
@@ -122,7 +127,8 @@ module TestAsyncMapping = {
122
127
 
123
128
  module TestOpsMappings = {
124
129
  module Spec = OpsEPSpec
125
- module type Mapping = ReventlessInfra.ExtensionPointMapping.T with module ExtensionPoint := OpsEPSpec
130
+ module type Mapping = ReventlessInfra.ExtensionPointMapping.T
131
+ with module ExtensionPoint := OpsEPSpec
126
132
  let name = "TestOpsMappings"
127
133
  let moduleUrl: string = %raw(`import.meta.url`)
128
134
  let mappings: array<module(Mapping)> = [
@@ -207,54 +213,69 @@ describe("ExtensionPoint_Operations.Make:", () => {
207
213
  let _ = beforeEach(() => reset())
208
214
 
209
215
  describe("outgoingJsonEventsHandler — AbstractPublishEvent:", () => {
210
- testPromise("known aggregate calls publishToEventTopic with correct destination id", async () => {
211
- let eventJson = makeEventJsonForAgg("PublishAgg")
212
- await EpOps.outgoingJsonEventsHandler(eventJson, ())
213
- expect(capturedPublished.contents->Array.length)->toBe(1)
214
- let item = capturedPublished.contents->Array.getUnsafe(0)
215
- let (id, _, _) = item
216
- expect(id)->toBe("ep-dest")
217
- })
218
-
219
- testPromise("publishToEventTopic receives the original event JSON", async () => {
220
- let eventJson = makeEventJsonForAgg("PublishAgg")
221
- await EpOps.outgoingJsonEventsHandler(eventJson, ())
222
- let item = capturedPublished.contents->Array.getUnsafe(0)
223
- let (_, _, capturedEventJson) = item
224
- expect(capturedEventJson)->toEqual(eventJson)
225
- })
216
+ testPromise(
217
+ "known aggregate calls publishToEventTopic with correct destination id",
218
+ async () => {
219
+ let eventJson = makeEventJsonForAgg("PublishAgg")
220
+ await EpOps.outgoingJsonEventsHandler(eventJson, ())
221
+ expect(capturedPublished.contents->Array.length)->toBe(1)
222
+ let item = capturedPublished.contents->Array.getUnsafe(0)
223
+ let (id, _, _) = item
224
+ expect(id)->toBe("ep-dest")
225
+ },
226
+ )
227
+
228
+ testPromise(
229
+ "publishToEventTopic receives the original event JSON",
230
+ async () => {
231
+ let eventJson = makeEventJsonForAgg("PublishAgg")
232
+ await EpOps.outgoingJsonEventsHandler(eventJson, ())
233
+ let item = capturedPublished.contents->Array.getUnsafe(0)
234
+ let (_, _, capturedEventJson) = item
235
+ expect(capturedEventJson)->toEqual(eventJson)
236
+ },
237
+ )
226
238
  })
227
239
 
228
240
  describe("outgoingJsonEventsHandler — AbstractHandleDirective:", () => {
229
- testPromise("known aggregate with AbstractHandleDirective invokes the handler", async () => {
230
- let eventJson = makeEventJsonForAgg("CallAgg")
231
- await EpOps.outgoingJsonEventsHandler(eventJson, ())
232
- expect(capturedCallCount.contents)->toBe(1)
233
- expect(capturedPublished.contents->Array.length)->toBe(0)
234
- })
241
+ testPromise(
242
+ "known aggregate with AbstractHandleDirective invokes the handler",
243
+ async () => {
244
+ let eventJson = makeEventJsonForAgg("CallAgg")
245
+ await EpOps.outgoingJsonEventsHandler(eventJson, ())
246
+ expect(capturedCallCount.contents)->toBe(1)
247
+ expect(capturedPublished.contents->Array.length)->toBe(0)
248
+ },
249
+ )
235
250
  })
236
251
 
237
252
  describe("outgoingJsonEventsHandler — AbstractPublishEventAsync:", () => {
238
- testPromise("async mapping resolves and calls publishToEventTopic", async () => {
239
- let eventJson = makeEventJsonForAgg("AsyncAgg")
240
- await EpOps.outgoingJsonEventsHandler(eventJson, ())
241
- expect(capturedPublished.contents->Array.length)->toBe(1)
242
- let item = capturedPublished.contents->Array.getUnsafe(0)
243
- let (id, _, _) = item
244
- expect(id)->toBe("ep-async-dest")
245
- })
253
+ testPromise(
254
+ "async mapping resolves and calls publishToEventTopic",
255
+ async () => {
256
+ let eventJson = makeEventJsonForAgg("AsyncAgg")
257
+ await EpOps.outgoingJsonEventsHandler(eventJson, ())
258
+ expect(capturedPublished.contents->Array.length)->toBe(1)
259
+ let item = capturedPublished.contents->Array.getUnsafe(0)
260
+ let (id, _, _) = item
261
+ expect(id)->toBe("ep-async-dest")
262
+ },
263
+ )
246
264
  })
247
265
 
248
266
  describe("outgoingJsonEventsHandler — no matching mapping:", () => {
249
- testPromise("event from unknown aggregate throws", async () => {
250
- let eventJson = makeEventJsonForAgg("UnknownAgg")
251
- let didThrow = ref(false)
252
- try {
253
- await EpOps.outgoingJsonEventsHandler(eventJson, ())
254
- } catch {
255
- | _ => didThrow := true
256
- }
257
- expect(didThrow.contents)->toBe(true)
258
- })
267
+ testPromise(
268
+ "event from unknown aggregate throws",
269
+ async () => {
270
+ let eventJson = makeEventJsonForAgg("UnknownAgg")
271
+ let didThrow = ref(false)
272
+ try {
273
+ await EpOps.outgoingJsonEventsHandler(eventJson, ())
274
+ } catch {
275
+ | _ => didThrow := true
276
+ }
277
+ expect(didThrow.contents)->toBe(true)
278
+ },
279
+ )
259
280
  })
260
281
  })
@@ -45,7 +45,8 @@ let queryEngine: Reventless.QueryEngine.operations = {
45
45
 
46
46
  let pluginId = "Catalog_1.0.0-alpha.169"
47
47
 
48
- let handle = directive => EP.directiveHandler(createSchedule, deleteSchedule, queryEngine, directive)
48
+ let handle = directive =>
49
+ EP.directiveHandler(createSchedule, deleteSchedule, queryEngine, directive)
49
50
 
50
51
  describe("plugin disconnect schedule", () => {
51
52
  test("create and delete address the same rule name", async () => {