@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
@@ -56,11 +56,13 @@ describe("disconnectGrace", () => {
56
56
  testSync("always leaves at least a full interval of headroom past one beat", () => {
57
57
  // Grace must exceed the interval (else a single beat's cadence trips a
58
58
  // disconnect) and keep the historical ≥ +2 min floor for small intervals.
59
- [1, 2, 5, 10, 30, 60, 120]->Array.forEach(interval => {
60
- let grace = PluginExtensionPoint_Plugin.disconnectGrace(interval)
61
- expect(grace > interval)->toBe(true)
62
- expect(grace >= interval + 2)->toBe(true)
63
- })
59
+ [1, 2, 5, 10, 30, 60, 120]->Array.forEach(
60
+ interval => {
61
+ let grace = PluginExtensionPoint_Plugin.disconnectGrace(interval)
62
+ expect(grace > interval)->toBe(true)
63
+ expect(grace >= interval + 2)->toBe(true)
64
+ },
65
+ )
64
66
  })
65
67
 
66
68
  testSync("a 60-min cadence gets far more than the old fixed +2 grace", () => {
@@ -71,28 +73,32 @@ describe("disconnectGrace", () => {
71
73
 
72
74
  describe("PluginExtensionPoint mapping arms the disconnect schedule from the beat interval", () => {
73
75
  testSync("Heartbeat(interval) → CreateDisconnectSchedule(_, disconnectGrace(interval))", () => {
74
- [5, 10, 60]->Array.forEach(interval => {
75
- let actions = TestMapping.PluginMapping.mapIncomingCommand(
76
- "Test@1",
77
- PluginExtensionPointSpec.Heartbeat(interval),
78
- meta,
79
- )
80
- expect(actions->graceFromActions)->toEqual(
81
- Some(PluginExtensionPoint_Plugin.disconnectGrace(interval)),
82
- )
83
- })
76
+ [5, 10, 60]->Array.forEach(
77
+ interval => {
78
+ let actions = TestMapping.PluginMapping.mapIncomingCommand(
79
+ "Test@1",
80
+ PluginExtensionPointSpec.Heartbeat(interval),
81
+ meta,
82
+ )
83
+ expect(actions->graceFromActions)->toEqual(
84
+ Some(PluginExtensionPoint_Plugin.disconnectGrace(interval)),
85
+ )
86
+ },
87
+ )
84
88
  })
85
89
 
86
90
  testSync("RedetectPlugin(interval) arms the same interval-derived grace as a heartbeat", () => {
87
- [5, 10, 60]->Array.forEach(interval => {
88
- let actions = TestMapping.PluginMapping.mapIncomingCommand(
89
- "Test@1",
90
- PluginExtensionPointSpec.RedetectPlugin(interval),
91
- meta,
92
- )
93
- expect(actions->graceFromActions)->toEqual(
94
- Some(PluginExtensionPoint_Plugin.disconnectGrace(interval)),
95
- )
96
- })
91
+ [5, 10, 60]->Array.forEach(
92
+ interval => {
93
+ let actions = TestMapping.PluginMapping.mapIncomingCommand(
94
+ "Test@1",
95
+ PluginExtensionPointSpec.RedetectPlugin(interval),
96
+ meta,
97
+ )
98
+ expect(actions->graceFromActions)->toEqual(
99
+ Some(PluginExtensionPoint_Plugin.disconnectGrace(interval)),
100
+ )
101
+ },
102
+ )
97
103
  })
98
104
  })
@@ -38,8 +38,7 @@ module InternalSpec = {
38
38
  let visibility: Reventless.Visibility.t = Internal
39
39
  }
40
40
 
41
- module PublicReadModel: ReventlessInfra.ReadModel.T
42
- with type api = unit and type role = unit = {
41
+ module PublicReadModel: ReventlessInfra.ReadModel.T with type api = unit and type role = unit = {
43
42
  module Spec = PublicSpec
44
43
  type api = unit
45
44
  type role = unit
@@ -48,24 +47,33 @@ module PublicReadModel: ReventlessInfra.ReadModel.T
48
47
  // A read model that projects an event reaching it via a (DCB-log-sourced) mapping — the
49
48
  // case Plugin_Structure must surface as a qualified `consumedEventTypes` entry.
50
49
  let consumedEventNames: array<string> = ["OrderPlaced"]
51
- let make = (~api as _, ~apiRole as _, ~allEventTopics as _, ~runtime as _=?, ~opts as _=?): component =>
52
- Obj.magic(0)
50
+ let make = (
51
+ ~api as _,
52
+ ~apiRole as _,
53
+ ~allEventTopics as _,
54
+ ~runtime as _=?,
55
+ ~opts as _=?,
56
+ ): component => Obj.magic(0)
53
57
  let outputs = (_: component): ReventlessInfra.ReadModel.outputs => Obj.magic(0)
54
58
  let operations = (_: component): Pulumi.Output.t<ReventlessInfra.ReadModel.operations> =>
55
59
  Obj.magic(0)
56
60
  let finish = () => ()
57
61
  }
58
62
 
59
- module InternalReadModel: ReventlessInfra.ReadModel.T
60
- with type api = unit and type role = unit = {
63
+ module InternalReadModel: ReventlessInfra.ReadModel.T with type api = unit and type role = unit = {
61
64
  module Spec = InternalSpec
62
65
  type api = unit
63
66
  type role = unit
64
67
  type component
65
68
  let sourceNames: array<string> = []
66
69
  let consumedEventNames: array<string> = []
67
- let make = (~api as _, ~apiRole as _, ~allEventTopics as _, ~runtime as _=?, ~opts as _=?): component =>
68
- Obj.magic(0)
70
+ let make = (
71
+ ~api as _,
72
+ ~apiRole as _,
73
+ ~allEventTopics as _,
74
+ ~runtime as _=?,
75
+ ~opts as _=?,
76
+ ): component => Obj.magic(0)
69
77
  let outputs = (_: component): ReventlessInfra.ReadModel.outputs => Obj.magic(0)
70
78
  let operations = (_: component): Pulumi.Output.t<ReventlessInfra.ReadModel.operations> =>
71
79
  Obj.magic(0)
@@ -143,9 +151,9 @@ describe("Plugin_Structure.make — visibility tagging", () => {
143
151
  })
144
152
 
145
153
  testSync("aggregates / stateViewSlices stay empty when none are passed (sanity)", () => {
146
- expect((
147
- structure.aggregates->Array.length,
148
- structure.stateViewSlices->Array.length,
149
- ))->toEqual((0, 0))
154
+ expect((structure.aggregates->Array.length, structure.stateViewSlices->Array.length))->toEqual((
155
+ 0,
156
+ 0,
157
+ ))
150
158
  })
151
159
  })
@@ -67,8 +67,7 @@ let collect = (root: S.t<'a>): array<string> => {
67
67
  if !isEnum {
68
68
  // Either optional encoding: the healer leaves an absent `T | undefined`
69
69
  // alone and writes `null` for a `T | null`, so neither invents a scalar.
70
- let optional =
71
- has.null->Option.getOr(false) || has.undefined->Option.getOr(false)
70
+ let optional = has.null->Option.getOr(false) || has.undefined->Option.getOr(false)
72
71
  anyOf->Array.forEach(member =>
73
72
  switch member {
74
73
  | Undefined(_) | Null(_) => ()
@@ -35,17 +35,20 @@ describe("The stored plugin-lifecycle payload corpus", () => {
35
35
  )
36
36
 
37
37
  entries->Array.forEach(entry =>
38
- testSync(`still decodes: ${entry.name}`, () => {
39
- // Sury's own error carries the field path, which is the whole value of
40
- // this suite's failure message — report it verbatim rather than "it threw".
41
- // sury 11 throws a plain JS `SuryError` with no ReScript exception
42
- // constructor to match on, so the message comes off the JS exception.
43
- let outcome = switch decodeStored(entry) {
44
- | _ => "decodes"
45
- | exception JsExn(e) => JsExn.message(e)->Option.getOr("threw: no message")
46
- | exception _ => "threw a non-JS exception"
47
- }
48
- expect(outcome)->toBe("decodes")
49
- })
38
+ testSync(
39
+ `still decodes: ${entry.name}`,
40
+ () => {
41
+ // Sury's own error carries the field path, which is the whole value of
42
+ // this suite's failure message — report it verbatim rather than "it threw".
43
+ // sury 11 throws a plain JS `SuryError` with no ReScript exception
44
+ // constructor to match on, so the message comes off the JS exception.
45
+ let outcome = switch decodeStored(entry) {
46
+ | _ => "decodes"
47
+ | exception JsExn(e) => JsExn.message(e)->Option.getOr("threw: no message")
48
+ | exception _ => "threw a non-JS exception"
49
+ }
50
+ expect(outcome)->toBe("decodes")
51
+ },
52
+ )
50
53
  )
51
54
  })
@@ -1,4 +1,3 @@
1
-
2
1
  @schema
3
2
  type record = {
4
3
  a: @s.meta({description: "aaa"}) string,