@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
@@ -24,9 +24,10 @@ open ReventlessInfra.Api
24
24
  // CommandAccepted | CommandRejected | CommandPending). AppSync requires the
25
25
  // subscription return type to be a strict subset of the linked mutation's
26
26
  // return type, so the subscription field has to declare CommandResult as well.
27
- let sourceCFields = (
28
- ~mutationEntries: array<mutationSchemaEntry>,
29
- ): (array<string>, array<GraphQL_Stitcher.subscriptionSource>) => {
27
+ let sourceCFields = (~mutationEntries: array<mutationSchemaEntry>): (
28
+ array<string>,
29
+ array<GraphQL_Stitcher.subscriptionSource>,
30
+ ) => {
30
31
  let fields: array<string> = []
31
32
  let sources: array<GraphQL_Stitcher.subscriptionSource> = []
32
33
  let pushField = (fieldName: string) => {
@@ -77,9 +78,10 @@ let sourceCFields = (
77
78
  // Returns (subscriptionFields, supportingTypes) — the supporting type is the
78
79
  // {DisplayName}EventLogEvent type that carries position, eventType, and payload.
79
80
 
80
- let sourceAFieldsAndTypes = (
81
- ~eventLogEntries: array<eventLogSchemaEntry>,
82
- ): (array<string>, array<string>) => {
81
+ let sourceAFieldsAndTypes = (~eventLogEntries: array<eventLogSchemaEntry>): (
82
+ array<string>,
83
+ array<string>,
84
+ ) => {
83
85
  let seen: Set.t<string> = Set.make()
84
86
  let fields: array<string> = []
85
87
  let types: array<string> = []
@@ -160,22 +160,21 @@ let walkSchema = (typeName: string, schema: S.t<unknown>): typeSchema =>
160
160
  // It's an optional/nullable scalar at the top level, treat as unknown.
161
161
  {typeName, kind: "unknown", fields: [], structuralHash: ""}
162
162
  } else {
163
- let constructors =
164
- anyOf->Array.filterMap(variantSchema =>
165
- switch variantSchema {
166
- | Object({properties}) =>
167
- tagConstOf(properties)->Option.map(name => {
168
- name,
169
- fields: extractFields(properties),
170
- })
171
- | _ => None
172
- }
173
- )
163
+ let constructors = anyOf->Array.filterMap(variantSchema =>
164
+ switch variantSchema {
165
+ | Object({properties}) =>
166
+ tagConstOf(properties)->Option.map(name => {
167
+ name,
168
+ fields: extractFields(properties),
169
+ })
170
+ | _ => None
171
+ }
172
+ )
174
173
  {
175
174
  typeName,
176
175
  kind: "variant",
177
176
  fields: [],
178
- constructors: constructors,
177
+ constructors,
179
178
  structuralHash: hashConstructors(constructors),
180
179
  }
181
180
  }
@@ -27,63 +27,58 @@ module type Spec = {
27
27
  }
28
28
 
29
29
  module Make = (Spec: Spec) => {
30
- module ConnectPluginMapping = ExtensionMapping.Make(
31
- {
32
- module ExtensionPoint = PluginExtensionPointSpec
33
- module Delegate = ReventlessInfra.ExtensionMapping.NoDelegate
30
+ module ConnectPluginMapping = ExtensionMapping.Make({
31
+ module ExtensionPoint = PluginExtensionPointSpec
32
+ module Delegate = ReventlessInfra.ExtensionMapping.NoDelegate
34
33
 
35
- // Unused by ExtensionMapping.Make (it reads Delegate.moduleUrl, not the
36
- // arg's); present only to satisfy the input module type. The actually
37
- // dynamic-imported specifier is the file-level `moduleUrl` (@@reventless.spec
38
- // injected, move-safe) referenced from Plugin_Helpers.
39
- let moduleUrl = PluginExtensionPointSpec.moduleUrl
34
+ // Unused by ExtensionMapping.Make (it reads Delegate.moduleUrl, not the
35
+ // arg's); present only to satisfy the input module type. The actually
36
+ // dynamic-imported specifier is the file-level `moduleUrl` (@@reventless.spec
37
+ // injected, move-safe) referenced from Plugin_Helpers.
38
+ let moduleUrl = PluginExtensionPointSpec.moduleUrl
40
39
 
41
- let delegateModuleUrl = Delegate.moduleUrl
40
+ let delegateModuleUrl = Delegate.moduleUrl
42
41
 
43
- let mapIncomingEvent: ReventlessInfra.ExtensionMapping.mapIncomingEvent<
44
- PluginExtensionPointSpec.event,
45
- Delegate.command,
46
- PluginExtensionPointSpec.command,
47
- PluginExtensionPointSpec.directive,
48
- > = (pluginId, event, _meta, _pluginDef, _queryEngine) => {
49
- let pluginDefinition = Spec.pluginDefinition
50
- let id = pluginDefinition.id
42
+ let mapIncomingEvent: ReventlessInfra.ExtensionMapping.mapIncomingEvent<
43
+ PluginExtensionPointSpec.event,
44
+ Delegate.command,
45
+ PluginExtensionPointSpec.command,
46
+ PluginExtensionPointSpec.directive,
47
+ > = (pluginId, event, _meta, _pluginDef, _queryEngine) => {
48
+ let pluginDefinition = Spec.pluginDefinition
49
+ let id = pluginDefinition.id
51
50
 
52
- switch event {
53
- // Answer the handshake, and — when this plugin ships a UI-fragment manifest — register
54
- // it with the admin UiFragmentRegistry slice in the same step (the admin EP's
55
- // UI-fragment mapping routes RegisterUiFragment to the slice). Nested switch (not
56
- // Array.concat) so the outer branch's expected type disambiguates the bare
57
- // PublishExtensionPointCommand constructor.
58
- | PluginExtensionPointSpec.UnknownPluginDetected if pluginId == id =>
59
- switch Spec.uiFragments {
60
- | Some(manifest) => [
61
- PublishExtensionPointCommand(
62
- id,
63
- PluginExtensionPointSpec.ConnectPlugin(pluginDefinition),
64
- ),
65
- PublishExtensionPointCommand(
66
- id,
67
- PluginExtensionPointSpec.RegisterUiFragment(manifest),
68
- ),
69
- ]
70
- | None => [
71
- PublishExtensionPointCommand(
72
- id,
73
- PluginExtensionPointSpec.ConnectPlugin(pluginDefinition),
74
- ),
75
- ]
76
- }
77
- // A peer's PluginConnected / PluginDeactivated used to subscribe or
78
- // unsubscribe this plugin's own queue to peer EP topics. Admin owns that
79
- // now (manageSubscriptions), so these drop to no-ops.
80
- | _ => []
51
+ switch event {
52
+ // Answer the handshake, and — when this plugin ships a UI-fragment manifest — register
53
+ // it with the admin UiFragmentRegistry slice in the same step (the admin EP's
54
+ // UI-fragment mapping routes RegisterUiFragment to the slice). Nested switch (not
55
+ // Array.concat) so the outer branch's expected type disambiguates the bare
56
+ // PublishExtensionPointCommand constructor.
57
+ | PluginExtensionPointSpec.UnknownPluginDetected if pluginId == id =>
58
+ switch Spec.uiFragments {
59
+ | Some(manifest) => [
60
+ PublishExtensionPointCommand(
61
+ id,
62
+ PluginExtensionPointSpec.ConnectPlugin(pluginDefinition),
63
+ ),
64
+ PublishExtensionPointCommand(id, PluginExtensionPointSpec.RegisterUiFragment(manifest)),
65
+ ]
66
+ | None => [
67
+ PublishExtensionPointCommand(
68
+ id,
69
+ PluginExtensionPointSpec.ConnectPlugin(pluginDefinition),
70
+ ),
71
+ ]
81
72
  }
73
+ // A peer's PluginConnected / PluginDeactivated used to subscribe or
74
+ // unsubscribe this plugin's own queue to peer EP topics. Admin owns that
75
+ // now (manageSubscriptions), so these drop to no-ops.
76
+ | _ => []
82
77
  }
78
+ }
83
79
 
84
- let mapOutgoingEvent = None
85
- },
86
- )
80
+ let mapOutgoingEvent = None
81
+ })
87
82
 
88
83
  module ConnectPluginMappings = {
89
84
  module Spec = PluginExtensionPointSpec
@@ -54,9 +54,7 @@ let highestConnected = (known: dict<knownVersion>): option<version> =>
54
54
  )
55
55
 
56
56
  // Highest Connected version other than `exclude`.
57
- let highestConnectedExcluding = (known: dict<knownVersion>, exclude: version): option<
58
- version,
59
- > =>
57
+ let highestConnectedExcluding = (known: dict<knownVersion>, exclude: version): option<version> =>
60
58
  known
61
59
  ->Dict.toArray
62
60
  ->Array.reduce(None, (acc, (v, kv)) =>
@@ -150,7 +148,8 @@ let decide = (state, command) =>
150
148
  // definition (e.g. a newly added `kind`, updated protocols) re-emit
151
149
  // VersionConnected to overwrite the stored def and re-project the row. The version
152
150
  // is already current, so connectEvents' supersede stays empty — a bare refresh.
153
- | Some({status: Connected, definition}) => definition == def ? Ok([]) : Ok([VersionConnected(def)])
151
+ | Some({status: Connected, definition}) =>
152
+ definition == def ? Ok([]) : Ok([VersionConnected(def)])
154
153
  | _ => Ok(connectEvents(state, v, def))
155
154
  }
156
155
  | Disconnect(v) =>
@@ -102,7 +102,6 @@ let commandTransition = (command: command): Reventless.Transition.t<lifecycleSta
102
102
  | Disconnect(_) => Moves([Plugins.Connected], Plugins.Disconnected)
103
103
  | Activate(_) => Moves([Plugins.Inactive, Plugins.Retired], Plugins.Connected)
104
104
  | Deactivate(_) => Moves([Plugins.Connected, Plugins.Disconnected], Plugins.Inactive)
105
- | Retire(_) =>
106
- Moves([Plugins.Connected, Plugins.Disconnected, Plugins.Inactive], Plugins.Retired)
105
+ | Retire(_) => Moves([Plugins.Connected, Plugins.Disconnected, Plugins.Inactive], Plugins.Retired)
107
106
  }
108
107
  }
@@ -24,7 +24,9 @@ module Util = {
24
24
  // Every version this row knows to be currently Connected — the `other` set
25
25
  // plus the row's own version when its status is Connected.
26
26
  let connectedVersions = (state: PluginsReadModelSpec.state): array<Reventless.Plugin.version> =>
27
- isConnected(state.status) ? state.otherConnectedVersions->withVersion(state.version) : state.otherConnectedVersions
27
+ isConnected(state.status)
28
+ ? state.otherConnectedVersions->withVersion(state.version)
29
+ : state.otherConnectedVersions
28
30
 
29
31
  // Highest version (compareVersions) in the set, or None for an empty set.
30
32
  let highest = (versions: array<Reventless.Plugin.version>): option<Reventless.Plugin.version> =>
@@ -83,7 +85,7 @@ module PluginMapping = Reventless.Projection.Mapping.Make(
83
85
  PluginSpec,
84
86
  PluginsReadModelSpec,
85
87
  {
86
- let project = ({event, id, meta: {time, user: ?user}}) => {
88
+ let project = ({event, id, meta: {time, ?user}}) => {
87
89
  let statusChange = {at: time, by: user->Option.getOr("")}
88
90
  switch event {
89
91
  // Handshake trigger, supersession record and incompatibility
@@ -133,7 +135,10 @@ module PluginMapping = Reventless.Projection.Mapping.Make(
133
135
  state =>
134
136
  state.version == def.version
135
137
  ? {...state, status: Disconnected, statusChange}
136
- : {...state, otherConnectedVersions: state.otherConnectedVersions->Util.without(def.version)},
138
+ : {
139
+ ...state,
140
+ otherConnectedVersions: state.otherConnectedVersions->Util.without(def.version),
141
+ },
137
142
  )
138
143
  | VersionDeactivated(def) =>
139
144
  Reventless.Projection.UpdateWithDefault(
@@ -142,7 +147,10 @@ module PluginMapping = Reventless.Projection.Mapping.Make(
142
147
  state =>
143
148
  state.version == def.version
144
149
  ? {...state, status: Inactive, statusChange}
145
- : {...state, otherConnectedVersions: state.otherConnectedVersions->Util.without(def.version)},
150
+ : {
151
+ ...state,
152
+ otherConnectedVersions: state.otherConnectedVersions->Util.without(def.version),
153
+ },
146
154
  )
147
155
  | VersionRetired(def) =>
148
156
  Reventless.Projection.UpdateWithDefault(
@@ -151,7 +159,10 @@ module PluginMapping = Reventless.Projection.Mapping.Make(
151
159
  state =>
152
160
  state.version == def.version
153
161
  ? {...state, status: Retired, statusChange}
154
- : {...state, otherConnectedVersions: state.otherConnectedVersions->Util.without(def.version)},
162
+ : {
163
+ ...state,
164
+ otherConnectedVersions: state.otherConnectedVersions->Util.without(def.version),
165
+ },
155
166
  )
156
167
  }
157
168
  }
@@ -114,5 +114,3 @@ type queryResult = {
114
114
  dcbEventLog: option<Reventless.Plugin.dcbEventLogDefinition>,
115
115
  kind: option<Reventless.Plugin.pluginKind>,
116
116
  }
117
-
118
-
@@ -26,7 +26,10 @@ module Make = (Spec: Spec, Config: Config) => {
26
26
  try await promise catch {
27
27
  | JsExn(e) =>
28
28
  let errMsg = e->JsExn.message->Option.getOr("unknown")
29
- EffectLogger.logError(~comp="CommandPublisher", `Couldn't publish commands: ${errMsg}`)->Effect.runSync
29
+ EffectLogger.logError(
30
+ ~comp="CommandPublisher",
31
+ `Couldn't publish commands: ${errMsg}`,
32
+ )->Effect.runSync
30
33
  }
31
34
  }
32
35
 
@@ -72,7 +75,11 @@ module Make = (Spec: Spec, Config: Config) => {
72
75
  let promise = Config.publishCommands(Spec.name, commandsToSend->toJsons)
73
76
  running := Some(promise)
74
77
  switch await promise {
75
- | () => EffectLogger.logDebug(~comp="CommandPublisher", `send: finished chunk ${chunkCountStr}: ${sizeStr}`)->Effect.runSync
78
+ | () =>
79
+ EffectLogger.logDebug(
80
+ ~comp="CommandPublisher",
81
+ `send: finished chunk ${chunkCountStr}: ${sizeStr}`,
82
+ )->Effect.runSync
76
83
  | exception JsExn(e) =>
77
84
  let errorMessage = e->JsExn.message->Option.getOr("unknown Error")
78
85
  EffectLogger.logError(
@@ -17,7 +17,8 @@
17
17
  let parseRows = (~path: string): Stream.t<CSV.row, string, unit> =>
18
18
  Queue.unbounded()
19
19
  ->Effect.flatMap(queue => {
20
- let _ = CSV.parseFile(~path, ~options={headers: CSV.Options.Bool(true)})
20
+ let _ =
21
+ CSV.parseFile(~path, ~options={headers: CSV.Options.Bool(true)})
21
22
  ->CSV.onData(row => Queue.offer(queue, Ok(row))->Effect.runSyncExit->ignore)
22
23
  ->CSV.onEnd(_ => Queue.shutdown(queue)->Effect.runSyncExit->ignore)
23
24
  ->CSV.onError(err => {
@@ -29,8 +30,7 @@ let parseRows = (~path: string): Stream.t<CSV.row, string, unit> =>
29
30
  })
30
31
  ->Stream.fromEffect
31
32
  ->Stream.flatMap(queue =>
32
- Stream.fromQueue(queue)
33
- ->Stream.mapEffect(item =>
33
+ Stream.fromQueue(queue)->Stream.mapEffect(item =>
34
34
  switch item {
35
35
  | Ok(row) => Effect.succeed(row)
36
36
  | Error(msg) => Effect.fail(msg)
@@ -1,9 +1,7 @@
1
1
  let platformStackReference =
2
2
  Pulumi.Config.make(Some("platform"))
3
3
  ->Pulumi.Config.get("stack")
4
- ->Option.map(stack =>
5
- Pulumi.StackReference.makeWithName(stack ++ "-interstack", {"name": stack})
6
- )
4
+ ->Option.map(stack => Pulumi.StackReference.makeWithName(stack ++ "-interstack", {"name": stack}))
7
5
 
8
6
  // -----------------------------------------------------------------------
9
7
  // Typed, validated cross-stack queries using the reventless-interop engine.
@@ -21,11 +19,9 @@ module DefaultTaskQuery = ReventlessInterop.Query.Task.Make({
21
19
  let requiredFields = ["name"]
22
20
  let optionalFields = ["bucketNames", "sideEffectSources"]
23
21
  let fromJson = (json: JSON.t) =>
24
- try Ok(json->S.parseOrThrow(~to=ReventlessInterop.Task.resolvedOutputsSchema))
25
- catch {
22
+ try Ok(json->S.parseOrThrow(~to=ReventlessInterop.Task.resolvedOutputsSchema)) catch {
26
23
  | exn =>
27
- let msg =
28
- exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("parse error")
24
+ let msg = exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("parse error")
29
25
  Error(msg)
30
26
  }
31
27
  })
@@ -35,11 +31,9 @@ module DefaultEventMapperQuery = ReventlessInterop.Query.EventMapper.Make({
35
31
  let requiredFields = ["name", "eventCollector"]
36
32
  let optionalFields = ["counter"]
37
33
  let fromJson = (json: JSON.t) =>
38
- try Ok(json->S.parseOrThrow(~to=ReventlessInterop.EventMapper.resolvedOutputsSchema))
39
- catch {
34
+ try Ok(json->S.parseOrThrow(~to=ReventlessInterop.EventMapper.resolvedOutputsSchema)) catch {
40
35
  | exn =>
41
- let msg =
42
- exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("parse error")
36
+ let msg = exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("parse error")
43
37
  Error(msg)
44
38
  }
45
39
  })
@@ -54,11 +48,9 @@ module DefaultExtensionPointQuery = ReventlessInterop.Query.ExtensionPoint.Make(
54
48
  let requiredFields = ["name", "commandTopic", "eventTopic"]
55
49
  let optionalFields = []
56
50
  let fromJson = (json: JSON.t) =>
57
- try Ok(json->S.parseOrThrow(~to=ReventlessInterop.ExtensionPoint.resolvedOutputsSchema))
58
- catch {
51
+ try Ok(json->S.parseOrThrow(~to=ReventlessInterop.ExtensionPoint.resolvedOutputsSchema)) catch {
59
52
  | exn =>
60
- let msg =
61
- exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("parse error")
53
+ let msg = exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("parse error")
62
54
  Error(msg)
63
55
  }
64
56
  })
@@ -20,6 +20,6 @@ let mergeEventMappers: array<ReventlessInterop.EventMapper.resolvedOutputs> => P
20
20
  array<ReventlessInterop.EventMapper.resolvedOutputs>,
21
21
  >
22
22
 
23
- let mergeExtensionPoints: array<ReventlessInterop.ExtensionPoint.resolvedOutputs> => Pulumi.Output.t<
24
- array<ReventlessInterop.ExtensionPoint.resolvedOutputs>,
25
- >
23
+ let mergeExtensionPoints: array<
24
+ ReventlessInterop.ExtensionPoint.resolvedOutputs,
25
+ > => Pulumi.Output.t<array<ReventlessInterop.ExtensionPoint.resolvedOutputs>>
@@ -59,23 +59,21 @@ let truncate = (s: string): string => {
59
59
  s
60
60
  } else {
61
61
  `${s->String.slice(~start=0, ~end=maxValueChars)}…(+${(len - maxValueChars)
62
- ->Int.toString} chars)`
62
+ ->Int.toString} chars)`
63
63
  }
64
64
  }
65
65
 
66
66
  // ─── Commands ────────────────────────────────────────────────────────────────
67
67
 
68
68
  // "Add" (bold)
69
- let cmdName = (msg: Message.commandJson): string =>
70
- msg.commandJson->Message.variantNameOfJson->bold
69
+ let cmdName = (msg: Message.commandJson): string => msg.commandJson->Message.variantNameOfJson->bold
71
70
 
72
71
  // "[Add,Remove]"
73
72
  let cmdNames = (msgs: array<Message.commandJson>): string =>
74
73
  `[${msgs->Array.map(cmdName)->Array.join(",")}]`
75
74
 
76
75
  // "Add(1)"
77
- let cmdSummary = (msg: Message.commandJson): string =>
78
- `${msg->cmdName}(${msg.id})`
76
+ let cmdSummary = (msg: Message.commandJson): string => `${msg->cmdName}(${msg.id})`
79
77
 
80
78
  // "[Add(1),Remove(2)]"
81
79
  let cmdSummaries = (msgs: array<Message.commandJson>): string =>
@@ -150,8 +148,7 @@ let cmdFulls = (msgs: array<Message.commandJson>): string =>
150
148
  // ─── Events (JSON.t event' envelope) ─────────────────────────────────────────
151
149
 
152
150
  // "Added" (bold)
153
- let eventName = (j: JSON.t): string =>
154
- j->Message.eventNameOfEvent'Json->bold
151
+ let eventName = (j: JSON.t): string => j->Message.eventNameOfEvent'Json->bold
155
152
 
156
153
  // "[Added,Removed]"
157
154
  let eventNames = (events: array<JSON.t>): string =>
@@ -260,8 +257,7 @@ let commandJsonsToLogMessages: array<Message.commandJson> => array<string> = cmd
260
257
  `${idx}/${count}: ${cmdJson->cmdSummary}: ${cmdJson->cmdFull}`
261
258
  })
262
259
  }
263
- let event'JsonToLogMessage = (j: JSON.t): string =>
264
- `${j->eventSummary}: ${j->eventFull}`
260
+ let event'JsonToLogMessage = (j: JSON.t): string => `${j->eventSummary}: ${j->eventFull}`
265
261
 
266
262
  // Legacy concise aliases
267
263
  let fmtCmd = cmdSummary
@@ -196,8 +196,7 @@ let makeLoggerWith = (shouldLog: level => bool): t => {
196
196
 
197
197
  // Fixed-level logger — the level is baked at creation. Used by tests that assert
198
198
  // a specific minimum regardless of env/platform default.
199
- let makeLogger = (~minLevel=Info): t =>
200
- makeLoggerWith(l => levelToInt(l) >= levelToInt(minLevel))
199
+ let makeLogger = (~minLevel=Info): t => makeLoggerWith(l => levelToInt(l) >= levelToInt(minLevel))
201
200
 
202
201
  let silent: t = {
203
202
  debug: (~comp as _=?, ~data as _=?, _) => (),
package/src/util/Lru.res CHANGED
@@ -36,7 +36,8 @@ let put = (cache: t<'k, 'v>, key: 'k, value: 'v): unit =>
36
36
  if cache.store->Map.size > cache.capacity {
37
37
  // Evict the least-recently-used entry = oldest insertion = first key.
38
38
  switch cache.store->Map.keys->Array.fromIterator->Array.get(0) {
39
- | Some(oldest) => let _ = cache.store->Map.delete(oldest)
39
+ | Some(oldest) =>
40
+ let _ = cache.store->Map.delete(oldest)
40
41
  | None => ()
41
42
  }
42
43
  }
package/src/util/Lru.resi CHANGED
@@ -10,7 +10,6 @@ next same-entity command reads only the delta instead of folding full history.
10
10
  `capacity`, `put` evicts the least-recently-used key. A `capacity <= 0` disables
11
11
  the cache entirely (`get` always misses, `put` is a no-op) so a slice can opt out.
12
12
  */
13
-
14
13
  type t<'k, 'v>
15
14
 
16
15
  /** Creates an empty cache holding at most `capacity` entries (`<= 0` disables it). */
@@ -26,7 +25,7 @@ let put: (t<'k, 'v>, 'k, 'v) => unit
26
25
  let invalidate: (t<'k, 'v>, 'k) => unit
27
26
 
28
27
  /** Drops every entry. */
29
- let clear: (t<'k, 'v>) => unit
28
+ let clear: t<'k, 'v> => unit
30
29
 
31
30
  /** Current number of live entries. */
32
- let size: (t<'k, 'v>) => int
31
+ let size: t<'k, 'v> => int
@@ -71,23 +71,20 @@ let create = (
71
71
  let name = schedule.name->resourceNaming.validateName
72
72
  let schedule = {...schedule, name}
73
73
  let createSchedule = scheduler.createSchedule
74
- let exit =
75
- await Effect.tryPromise(
76
- ~catch=err => Util.Error.messageFromUnknown(err, "schedule create"),
77
- () => createSchedule(channelResources, schedule),
78
- )
79
- ->Effect.tap(_ =>
80
- EffectLogger.logInfo(
81
- ~comp=__MODULE__,
82
- `create: created ${schedule->JSON.stringifyAny->Option.getOr("")}`,
83
- )
74
+ let exit = await Effect.tryPromise(
75
+ ~catch=err => Util.Error.messageFromUnknown(err, "schedule create"),
76
+ () => createSchedule(channelResources, schedule),
77
+ )
78
+ ->Effect.tap(_ =>
79
+ EffectLogger.logInfo(
80
+ ~comp=__MODULE__,
81
+ `create: created ${schedule->JSON.stringifyAny->Option.getOr("")}`,
84
82
  )
85
- ->Effect.runPromiseExit
83
+ )
84
+ ->Effect.runPromiseExit
86
85
  if !(exit->Exit.isSuccess) {
87
- let errMsg = exit->Exit.match(
88
- ~onFailure=cause => cause->Cause.pretty,
89
- ~onSuccess=_ => "unknown",
90
- )
86
+ let errMsg =
87
+ exit->Exit.match(~onFailure=cause => cause->Cause.pretty, ~onSuccess=_ => "unknown")
91
88
  EffectLogger.logError(
92
89
  ~comp=__MODULE__,
93
90
  `create: couldn't create ${schedule
@@ -106,19 +103,19 @@ let delete = (
106
103
  async name => {
107
104
  let name = name->resourceNaming.validateName
108
105
  let deleteSchedule = scheduler.deleteSchedule
109
- let exit =
110
- await Effect.tryPromise(
111
- ~catch=err => Util.Error.messageFromUnknown(err, "schedule delete"),
112
- () => deleteSchedule(channelResources, name),
113
- )
114
- ->Effect.tap(_ => EffectLogger.logInfo(~comp=__MODULE__, `delete: deleted ${name}`))
115
- ->Effect.runPromiseExit
106
+ let exit = await Effect.tryPromise(
107
+ ~catch=err => Util.Error.messageFromUnknown(err, "schedule delete"),
108
+ () => deleteSchedule(channelResources, name),
109
+ )
110
+ ->Effect.tap(_ => EffectLogger.logInfo(~comp=__MODULE__, `delete: deleted ${name}`))
111
+ ->Effect.runPromiseExit
116
112
  if !(exit->Exit.isSuccess) {
117
- let errMsg = exit->Exit.match(
118
- ~onFailure=cause => cause->Cause.pretty,
119
- ~onSuccess=_ => "unknown",
120
- )
121
- EffectLogger.logError(~comp=__MODULE__, `delete: couldn't delete ${name}: ${errMsg}`)->Effect.runSync
113
+ let errMsg =
114
+ exit->Exit.match(~onFailure=cause => cause->Cause.pretty, ~onSuccess=_ => "unknown")
115
+ EffectLogger.logError(
116
+ ~comp=__MODULE__,
117
+ `delete: couldn't delete ${name}: ${errMsg}`,
118
+ )->Effect.runSync
122
119
  throw(ScheduleNotDeleted(name))
123
120
  }
124
121
  }
@@ -73,24 +73,21 @@ let collisionMessage = (c: collision): string => {
73
73
  | None => ""
74
74
  }
75
75
  let sites = site(c.first) ++ site(c.second)
76
- let where = sites == ""
77
- ? ` Both keys appear in the platform's generated capability file, which records each ` ++
78
- `declaring component and field as a comment.\n`
79
- : sites
76
+ let where =
77
+ sites == ""
78
+ ? ` Both keys appear in the platform's generated capability file, which records each ` ++ `declaring component and field as a comment.\n`
79
+ : sites
80
80
  if c.nested {
81
81
  `Object store "${c.first.qualified}" is rooted at "${c.first.prefix}/", which encloses ` ++
82
82
  `"${c.second.qualified}" at "${c.second.prefix}/".\n` ++
83
83
  where ++
84
- ` One store's objects would sit inside the other's — for serving, for upload grants and ` ++
85
- `for a store wipe alike. Rename one of them.`
84
+ ` One store's objects would sit inside the other's — for serving, for upload grants and ` ++ `for a store wipe alike. Rename one of them.`
86
85
  } else {
87
86
  `Object stores "${c.first.qualified}" and "${c.second.qualified}" both root their objects ` ++
88
87
  `at "${c.first.prefix}/".\n` ++
89
88
  where ++
90
89
  ` A platform serves one cache behavior per prefix and scopes upload grants by prefix, so ` ++
91
90
  `two stores cannot share one.\n` ++
92
- ` Rename one store, or — if they were meant to be one shared store — qualify the ` ++
93
- `\`@storageRef\` annotation with the owning plugin.`
91
+ ` Rename one store, or — if they were meant to be one shared store — qualify the ` ++ `\`@storageRef\` annotation with the owning plugin.`
94
92
  }
95
93
  }
96
-
@@ -52,7 +52,10 @@ let onEndHandler = async (flush, resolve) => {
52
52
  let _ = switch await flush() {
53
53
  | _res => resolve()
54
54
  | exception JsExn(e) =>
55
- EffectLogger.logError(~comp=__MODULE__, `${__LOC__}: ${e->JsExn.message->Option.getOr("unknown")}`)->Effect.runSync
55
+ EffectLogger.logError(
56
+ ~comp=__MODULE__,
57
+ `${__LOC__}: ${e->JsExn.message->Option.getOr("unknown")}`,
58
+ )->Effect.runSync
56
59
  }
57
60
  }
58
61
 
@@ -70,7 +70,7 @@ async function onEndHandler(flush, resolve) {
70
70
  } catch (raw_e) {
71
71
  let e = Primitive_exceptions.internalToException(raw_e);
72
72
  if (e.RE_EXN_ID === "JsExn") {
73
- Effect.runSync(EffectLogger$ReventlessCore.logError("Util_Promise-ReventlessCore", undefined, "File \"Util_Promise.res\", line 55, characters 47-54" + `: ` + Stdlib_Option.getOr(Stdlib_JsExn.message(e._1), "unknown")));
73
+ Effect.runSync(EffectLogger$ReventlessCore.logError("Util_Promise-ReventlessCore", undefined, "File \"Util_Promise.res\", line 57, characters 9-16" + `: ` + Stdlib_Option.getOr(Stdlib_JsExn.message(e._1), "unknown")));
74
74
  } else {
75
75
  throw e;
76
76
  }