@reventlessdev/reventless-core 3.0.0-alpha.260 → 3.0.0-alpha.262

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 (208) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/package.json +10 -10
  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/adapter/Secrets/Secrets_Node_Backend.res +60 -0
  20. package/src/adapter/Secrets/Secrets_Node_Backend.res.mjs +69 -0
  21. package/src/admin/Platform_Admin.res +17 -6
  22. package/src/admin/Platform_AdminApi.res +14 -9
  23. package/src/admin/Platform_Admin_Callback.res +1 -1
  24. package/src/admin/Platform_BakedManifest.res +34 -34
  25. package/src/admin/Platform_ComponentDefinitionsApi.res +9 -21
  26. package/src/admin/Platform_PluginStructuresApi.res +15 -12
  27. package/src/admin/UiFragmentRegistry/StateChange/UiFragmentRegistry.res +1 -1
  28. package/src/components/Aggregate/Aggregate.res +13 -12
  29. package/src/components/Aggregate/Aggregate_Builder.res +22 -21
  30. package/src/components/Aggregate/Aggregate_Callback.res +91 -86
  31. package/src/components/Api/ApiNoApiHelpers.res +1 -3
  32. package/src/components/Api/Api_Ids.res +0 -1
  33. package/src/components/Api/Api_Naming.res +41 -18
  34. package/src/components/Api/GraphQL_FragmentGenerator.res +38 -51
  35. package/src/components/Api/GraphQL_SchemaInspector.res +5 -3
  36. package/src/components/Api/GraphQL_Stitcher.res +9 -10
  37. package/src/components/Api/MCP_SchemaGenerator.res +8 -12
  38. package/src/components/Api/OwnerScopeDiagnostics.res +1 -2
  39. package/src/components/Api/QueryDbListQuery.res +13 -6
  40. package/src/components/Api/SchemaType.res +28 -23
  41. package/src/components/Api/SuryToJsonSchema.res +9 -10
  42. package/src/components/AutomationSlice/AutomationSlice.res +4 -4
  43. package/src/components/AutomationSlice/AutomationSlice_Builder.res +15 -14
  44. package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -3
  45. package/src/components/Builder_Helpers.res +12 -23
  46. package/src/components/CommandGenerator/CommandGenerator.res +6 -1
  47. package/src/components/CommandGenerator/CommandGenerator_Builder.res +29 -21
  48. package/src/components/CommandGenerator/CommandGenerator_Callback.res +17 -21
  49. package/src/components/CommandTopic/CommandTopic.res +3 -3
  50. package/src/components/CommandTopic/CommandTopic_Builder.res +10 -10
  51. package/src/components/CommandTopic/CommandTopic_Callback.res +1 -4
  52. package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -2
  53. package/src/components/Counter/Counter_Builder.res +1 -6
  54. package/src/components/Counter/Counter_Callback.res +3 -3
  55. package/src/components/Dcb/Dcb_Builder.res +970 -956
  56. package/src/components/DcbEventLog/DcbEventLog.res +4 -4
  57. package/src/components/DcbEventLog/DcbEventLog_Builder.res +0 -1
  58. package/src/components/DcbEventLog/DcbEventLog_Operations.res +17 -18
  59. package/src/components/EventCollector/EventCollector_Builder.res +2 -1
  60. package/src/components/EventLog/EventLog.res +5 -1
  61. package/src/components/EventLog/EventLog_Operations.res +12 -8
  62. package/src/components/EventMapper/EventMapper.res +8 -10
  63. package/src/components/EventMapper/EventMapper_Builder.res +4 -1
  64. package/src/components/EventMapper/EventMapper_Callback.res +46 -31
  65. package/src/components/EventTopic/EventTopic.res +3 -3
  66. package/src/components/EventTopic/EventTopic_Builder.res +1 -1
  67. package/src/components/Extension/Extension.res +4 -1
  68. package/src/components/Extension/Extension_Operations.res +11 -3
  69. package/src/components/ExtensionPoint/ExtensionPoint.res +3 -3
  70. package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +9 -10
  71. package/src/components/ExtensionPoint/ExtensionPoint_Callback.res +2 -6
  72. package/src/components/ExtensionPoint/ExtensionPoint_Operations.res +13 -5
  73. package/src/components/Heartbeat/Heartbeat_Callback.res +3 -3
  74. package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +4 -4
  75. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +7 -10
  76. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice.res +4 -4
  77. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +15 -14
  78. package/src/components/QueryDb/QueryDb_Adapter.res +1 -3
  79. package/src/components/QueryDb/QueryDb_Operations.res +10 -10
  80. package/src/components/ReadModel/ReadModel.res +3 -3
  81. package/src/components/ReadModel/ReadModel_Builder.res +1 -2
  82. package/src/components/ReadModel/ReadModel_Callback.res +2 -1
  83. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +5 -2
  84. package/src/components/StateChangeSlice/StateChangeSlice.res +3 -3
  85. package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +23 -4
  86. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +22 -6
  87. package/src/components/StateTopic.res +1 -3
  88. package/src/components/StateViewSlice/StateViewSlice.res +4 -4
  89. package/src/components/StateViewSlice/StateViewSlice_Builder.res +79 -68
  90. package/src/components/StateViewSlice/StateViewSlice_Callback.res +3 -1
  91. package/src/components/Task/Task.res +3 -3
  92. package/src/components/Task/Task_Adapter.res +4 -1
  93. package/src/components/Task/Task_Builder.res +24 -21
  94. package/src/plugin/api/PluginBaseFragment.res +9 -3
  95. package/src/plugin/component/Capability_Inference.res +8 -10
  96. package/src/plugin/component/Plugin.res +6 -6
  97. package/src/plugin/component/Plugin_Builder.res +54 -50
  98. package/src/plugin/component/Plugin_Callback.res +10 -6
  99. package/src/plugin/component/Plugin_Helpers.res +264 -230
  100. package/src/plugin/component/Plugin_Structure.res +370 -324
  101. package/src/plugin/component/Plugin_SubscriptionSchema.res +8 -6
  102. package/src/plugin/component/SchemaWalker.res +11 -12
  103. package/src/plugin/connect/PluginConnectExtension_Mapping.res +45 -50
  104. package/src/plugin/lifecycle/PluginBehavior.res +3 -4
  105. package/src/plugin/lifecycle/PluginSpec.res +1 -2
  106. package/src/plugin/lifecycle/PluginsProjection.res +16 -5
  107. package/src/plugin/lifecycle/PluginsReadModelSpec.res +0 -2
  108. package/src/util/CommandPublisher.res +9 -2
  109. package/src/util/CsvStream.res +3 -3
  110. package/src/util/Interstack.res +7 -15
  111. package/src/util/Interstack.resi +3 -3
  112. package/src/util/LogFormat.res +5 -9
  113. package/src/util/Logger.res +1 -2
  114. package/src/util/Lru.res +2 -1
  115. package/src/util/Lru.resi +2 -3
  116. package/src/util/ScheduleOps.res +24 -27
  117. package/src/util/StorePrefixCollision.res +6 -9
  118. package/src/util/Util_Promise.res +4 -1
  119. package/src/util/Util_Promise.res.mjs +1 -1
  120. package/tests/IdentityTest.res +166 -113
  121. package/tests/ResourceAttributionTest.res +28 -25
  122. package/tests/Secrets_Node_BackendTest.res +141 -0
  123. package/tests/Secrets_Node_BackendTest.res.mjs +152 -0
  124. package/tests/StorePrefixCollisionTest.res +2 -1
  125. package/tests/TaskBucketNamingTest.res +3 -2
  126. package/tests/adapter/EventLogProvisioningTest.res +51 -48
  127. package/tests/adapter/MonitoringTest.res +81 -38
  128. package/tests/adapter/QueryInterceptionTest.res +2 -2
  129. package/tests/adapter/RefusalVocabularyTest.res +31 -23
  130. package/tests/adapter/RuntimeExtensionHookReachTest.res +9 -8
  131. package/tests/adapter/RuntimeExtensionTest.res +5 -3
  132. package/tests/admin/AdminApiSchemaDriftTest.res +22 -16
  133. package/tests/admin/Platform_Admin_StructureTest.res +22 -14
  134. package/tests/admin/Platform_Admin_StructureTest.res.mjs +4 -3
  135. package/tests/admin/Platform_BakedManifestTest.res +31 -35
  136. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +18 -15
  137. package/tests/admin/Platform_PluginStructuresApiTest.res +5 -3
  138. package/tests/admin/Platform_UIFragmentsApiTest.res +6 -3
  139. package/tests/aggregate/AggregateCacheTest.res +10 -12
  140. package/tests/aggregate/AggregateCallbackTest.res +75 -46
  141. package/tests/aggregate/AggregateCausationTest.res +19 -20
  142. package/tests/aggregate/AggregateConflictTest.res +41 -19
  143. package/tests/aggregate/AggregateFixtures.res +15 -5
  144. package/tests/aggregate/AggregateRejectionTest.res +97 -80
  145. package/tests/aggregate/AggregateSnapshotTest.res +44 -16
  146. package/tests/api/Api_IdsTest.res +10 -4
  147. package/tests/api/BrandedMarkerCompositionTest.res +48 -36
  148. package/tests/api/GeolocationSemanticTest.res +3 -3
  149. package/tests/api/GraphQL_FragmentGeneratorTest.res +66 -54
  150. package/tests/api/OwnerScopeDiagnosticsTest.res +31 -27
  151. package/tests/api/StorageRefFieldsTest.res +30 -18
  152. package/tests/api/SuryToJsonSchemaTest.res +1315 -1014
  153. package/tests/api/TaggedUnionSchemaTest.res +17 -24
  154. package/tests/commandgenerator/CommandGeneratorCallbackTest.res +235 -179
  155. package/tests/commandgenerator/CommandGeneratorFixtures.res +8 -13
  156. package/tests/commandgenerator/OwnerStampingTest.res +91 -76
  157. package/tests/commandtopic/CommandOutcomeHookTest.res +198 -155
  158. package/tests/commandtopic/CommandTopicCallbackFixtures.res +5 -4
  159. package/tests/commandtopic/CommandTopicCallbackTest.res +61 -43
  160. package/tests/commandtopic/CommandTopicHelpersRejectionTest.res +70 -55
  161. package/tests/counter/CounterCallbackTest.res +40 -34
  162. package/tests/counter/CounterFixtures.res +4 -4
  163. package/tests/dcb/DcbDecodeTest.res +115 -84
  164. package/tests/dcb/DcbEventLogOperationsTest.res +194 -143
  165. package/tests/dcb/DcbEventLogSchemaTest.res +13 -13
  166. package/tests/dcb/DcbFixtures.res +4 -5
  167. package/tests/dcb/DcbScopeInferenceTest.res +173 -114
  168. package/tests/dcb/DcbStateChangeSliceTest.res +391 -262
  169. package/tests/dcb/DcbTagTest.res +22 -11
  170. package/tests/dcb/DcbValidationTest.res +288 -218
  171. package/tests/eventlog/EventLogFixtures.res +4 -4
  172. package/tests/eventlog/EventLogOperationsTest.res +102 -67
  173. package/tests/eventlog/EventLogRetryTest.res +104 -65
  174. package/tests/eventmapper/EventMapperCallbackTest.res +118 -83
  175. package/tests/eventmapper/EventMapperFixtures.res +15 -23
  176. package/tests/eventmapper/EventMapperTest.res +54 -38
  177. package/tests/eventtopic/EventTopicFixtures.res +3 -4
  178. package/tests/eventtopic/EventTopicOperationsTest.res +41 -29
  179. package/tests/extensionpoint/ExtensionPointCallbackTest.res +58 -45
  180. package/tests/extensionpoint/ExtensionPointFixtures.res +16 -20
  181. package/tests/extensionpoint/ExtensionPointOperationsTest.res +70 -49
  182. package/tests/extensionpoint/PluginDisconnectScheduleTest.res +2 -1
  183. package/tests/logger/LogFormatTest.res +104 -82
  184. package/tests/logger/LoggerLazyTest.res +21 -12
  185. package/tests/message/MessageTest.res +96 -93
  186. package/tests/message/MetaEnvelopeTest.res +26 -30
  187. package/tests/plugin/HeartbeatDisconnectGraceTest.res +31 -25
  188. package/tests/plugin/ManifestVisibilityTest.res +20 -12
  189. package/tests/plugin/PluginDefinitionScalars.res +1 -2
  190. package/tests/plugin/PluginLifecycleCorpusTest.res +15 -12
  191. package/tests/plugin/PluginSpecExperiment.res +0 -1
  192. package/tests/plugin/PluginStructureTest.res +1529 -1045
  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 +4 -4
  197. package/tests/plugin/StateView/PsCustomersView.res +4 -4
  198. package/tests/plugin/StateView/PsShipmentsView.res +3 -2
  199. package/tests/projection/LifecycleTrailTest.res +1 -4
  200. package/tests/projection/ProjectionOptimizeTest.res +13 -9
  201. package/tests/querydb/QueryDbFixtures.res +0 -1
  202. package/tests/querydb/QueryDbOperationsTest.res +99 -64
  203. package/tests/querydb/TaggedUnionStampTest.res +10 -8
  204. package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res +50 -35
  205. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +4 -10
  206. package/tests/util/CommandPublisherTest.res +0 -1
  207. package/tests/util/CsvStreamTest.res +3 -3
  208. 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,