@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
@@ -42,7 +42,11 @@ let queryEntries: array<querySchemaEntry> = [
42
42
  // No `excludeFields`: the three fields this entry used to name are declared
43
43
  // `@internal` on the spec, and `deriveObjectTypeWithNested` reads that off the
44
44
  // schema itself.
45
- subIdField: ?PluginsReadModelSpec.subIdConfig->Option.map((c: Reventless.ReadModel.subIdConfig<_>) => c.subIdField),
45
+ subIdField: ?(
46
+ PluginsReadModelSpec.subIdConfig->Option.map((c: Reventless.ReadModel.subIdConfig<_>) =>
47
+ c.subIdField
48
+ )
49
+ ),
46
50
  indexQueries: ?indexQueriesOfConfig(PluginsReadModelSpec.config),
47
51
  },
48
52
  ]
@@ -67,8 +71,10 @@ let queryEntries: array<querySchemaEntry> = [
67
71
  let pluginAggregateMutationEntries: array<mutationSchemaEntry> = {
68
72
  let commandSchema = PluginSpec.commandSchema->S.castToUnknown
69
73
  let constructorNames = Reventless.DcbTag.extractAllVariantNames(PluginSpec.commandSchema)
70
- let filteredConstructorNames =
71
- ApiNoApiHelpers.filterNoApiVariants(constructorNames, commandSchema)
74
+ let filteredConstructorNames = ApiNoApiHelpers.filterNoApiVariants(
75
+ constructorNames,
76
+ commandSchema,
77
+ )
72
78
  let fieldNames =
73
79
  filteredConstructorNames->Array.map(cname =>
74
80
  Api_Naming.adminField(~name=PluginSpec.name ++ "_" ++ cname)
@@ -36,7 +36,8 @@ let warningsFromProperties = (~component, properties: dict<S.t<unknown>>): array
36
36
  ->Dict.toArray
37
37
  ->Array.filterMap(((field, fieldSchema)) =>
38
38
  switch fieldSchema {
39
- | String(_) if field != "TAG" &&
39
+ | String(_)
40
+ if field != "TAG" &&
40
41
  nameMatches(field) &&
41
42
  Reventless.StorageRef.getStore(fieldSchema)->Option.isNone =>
42
43
  Some({component, field})
@@ -64,8 +65,7 @@ let scanSchema = (~component: string, schema: S.t<unknown>): array<warning> => {
64
65
  and say what to do when the heuristic is wrong. */
65
66
  let message = (w: warning): string =>
66
67
  `${w.component}.${w.field} looks like a stored-object reference but declares no store — ` ++
67
- `annotate it \`@storageRef("<store>")\` so the deployment provisions the store it needs, ` ++
68
- `or rename the field if it holds an external URL. Heuristic matches are never provisioned.`
68
+ `annotate it \`@storageRef("<store>")\` so the deployment provisions the store it needs, ` ++ `or rename the field if it holds an external URL. Heuristic matches are never provisioned.`
69
69
 
70
70
  // ── Near-duplicate stores ──────────────────────────────────────────────────
71
71
  //
@@ -103,8 +103,7 @@ let withinOneEdit = (a: string, b: string): bool => {
103
103
  switch diffs {
104
104
  | [] => true
105
105
  | [_] => true
106
- | [i, j] if j == i + 1 =>
107
- charAt(a, i) == charAt(b, j) && charAt(a, j) == charAt(b, i)
106
+ | [i, j] if j == i + 1 => charAt(a, i) == charAt(b, j) && charAt(a, j) == charAt(b, i)
108
107
  | _ => false
109
108
  }
110
109
  } else if la - lb == 1 || lb - la == 1 {
@@ -147,9 +146,9 @@ Pairs of declared stores that are probably one store misspelled twice.
147
146
  Compared within an owning plugin only: two plugins may legitimately hold stores
148
147
  whose names are one edit apart, and neither can be a typo for the other.
149
148
  */
150
- let collisions = (
151
- declarations: array<Reventless.Plugin.requiredStoreDeclaration>,
152
- ): array<collision> => {
149
+ let collisions = (declarations: array<Reventless.Plugin.requiredStoreDeclaration>): array<
150
+ collision,
151
+ > => {
153
152
  // One entry per store, keeping the first declaration site as the one the
154
153
  // message names — several fields naming one store is ordinary, not a clash.
155
154
  let byStore: dict<Reventless.Plugin.requiredStoreDeclaration> = Dict.make()
@@ -181,5 +180,4 @@ let collisionMessage = (c: collision): string =>
181
180
  `${c.a.store} (${c.a.component}.${c.a.field}) and ${c.b.store} ` ++
182
181
  `(${c.b.component}.${c.b.field}) differ by one edit — one is probably a typo for ` ++
183
182
  `the other, and both would be provisioned, splitting objects across two stores. ` ++
184
- `Fix the field name, or name the store explicitly with \`@storageRef("<store>")\` ` ++
185
- `if the two really are separate stores.`
183
+ `Fix the field name, or name the store explicitly with \`@storageRef("<store>")\` ` ++ `if the two really are separate stores.`
@@ -43,7 +43,9 @@ module type T = {
43
43
  let makePluginDefinition: (
44
44
  ~name: string,
45
45
  ~aggregates: array<module(ReventlessInfra.Aggregate.T with type api = api)>=?,
46
- ~readModels: array<module(ReventlessInfra.ReadModel.T with type api = api and type role = role)>=?,
46
+ ~readModels: array<
47
+ module(ReventlessInfra.ReadModel.T with type api = api and type role = role),
48
+ >=?,
47
49
  ~stateViewSlices: array<module(ReventlessInfra.StateViewSlice.T)>=?,
48
50
  ~stateChangeSlices: array<module(ReventlessInfra.StateChangeSlice.T)>=?,
49
51
  ~automationSlices: array<module(ReventlessInfra.AutomationSlice.T)>=?,
@@ -63,13 +65,11 @@ let makeId = (name, version) => `${name}@${version}`
63
65
  // the platform invariant is one version per plugin at a time — so anything
64
66
  // crossing into the UI (routes, federation remote name, subscription
65
67
  // payloads) gets the bare name. If the input has no `@`, returns it as-is.
66
- let name = (id: string): string =>
67
- id->String.split("@")->Array.get(0)->Option.getOr(id)
68
+ let name = (id: string): string => id->String.split("@")->Array.get(0)->Option.getOr(id)
68
69
 
69
70
  // Version segment of a plugin id (`name@version`). Empty string when the id
70
71
  // carries no `@` (e.g. the synthetic admin plugin id).
71
- let version = (id: string): string =>
72
- id->String.split("@")->Array.get(1)->Option.getOr("")
72
+ let version = (id: string): string => id->String.split("@")->Array.get(1)->Option.getOr("")
73
73
 
74
74
  // Compare two plugin version strings (e.g. "0.10.0-alpha.73"), newest-first:
75
75
  // returns 1 when `a` is newer than `b`, -1 when older, 0 when equal. Separators
@@ -79,7 +79,7 @@ let version = (id: string): string =>
79
79
  // the admin manifest resolvers to enforce the one-version-per-plugin invariant
80
80
  // when more than one version lingers in `Connected` state.
81
81
  let compareVersions = (a: string, b: string): int => {
82
- let parts = s => s->String.replaceRegExp(%re("/[-+]/g"), ".")->String.split(".")
82
+ let parts = s => s->String.replaceRegExp(/[-+]/g, ".")->String.split(".")
83
83
  let pa = parts(a)
84
84
  let pb = parts(b)
85
85
  let len = pa->Array.length > pb->Array.length ? pa->Array.length : pb->Array.length
@@ -190,10 +190,17 @@ module Make = (
190
190
  []
191
191
  } else {
192
192
  let constructorNames = Reventless.DcbTag.extractAllVariantNames(M.Spec.commandSchema)
193
- let filteredConstructorNames = ApiNoApiHelpers.filterNoApiVariants(constructorNames, commandSchema)
193
+ let filteredConstructorNames = ApiNoApiHelpers.filterNoApiVariants(
194
+ constructorNames,
195
+ commandSchema,
196
+ )
194
197
  let fieldNames =
195
198
  filteredConstructorNames->Array.map(cname =>
196
- Api_Naming.aggregateMutationField(~plugin=name, ~aggregate=M.Spec.name, ~command=cname)
199
+ Api_Naming.aggregateMutationField(
200
+ ~plugin=name,
201
+ ~aggregate=M.Spec.name,
202
+ ~command=cname,
203
+ )
197
204
  )
198
205
  // Register plugin-prefixed field names for CommandGenerator_Builder.
199
206
  Plugin_Helpers.aggregateMutationFieldsRegistry->Dict.set(M.Spec.name, fieldNames)
@@ -223,20 +230,23 @@ module Make = (
223
230
  let fieldPermissions = Dict.make()
224
231
  filteredConstructorNames->Array.forEachWithIndex((cname, idx) => {
225
232
  let fieldName = fieldNames->Array.getUnsafe(idx)
226
- let hasPayload =
227
- Reventless.DcbTag.isVariantPayloadBearing(M.Spec.commandSchema->Obj.magic, cname)
228
- let syntheticCmd: unknown =
229
- hasPayload ? {"TAG": cname}->Obj.magic : cname->Obj.magic
233
+ let hasPayload = Reventless.DcbTag.isVariantPayloadBearing(
234
+ M.Spec.commandSchema->Obj.magic,
235
+ cname,
236
+ )
237
+ let syntheticCmd: unknown = hasPayload ? {"TAG": cname}->Obj.magic : cname->Obj.magic
230
238
  let rule = M.Spec.commandAuthorization(syntheticCmd->Obj.magic)
231
239
  fieldPermissions->Dict.set(fieldName, rule)
232
240
  })
233
- [{
234
- ReventlessInfra.Api.fieldNames,
235
- commandSchema,
236
- fieldPermissions,
237
- linkedViews: ?aggDef->Option.map(d => d.linkedViews),
238
- consistencyRead: ?aggDef->Option.flatMap(d => d.consistencyRead),
239
- }]
241
+ [
242
+ {
243
+ ReventlessInfra.Api.fieldNames,
244
+ commandSchema,
245
+ fieldPermissions,
246
+ linkedViews: ?(aggDef->Option.map(d => d.linkedViews)),
247
+ consistencyRead: ?(aggDef->Option.flatMap(d => d.consistencyRead)),
248
+ },
249
+ ]
240
250
  }
241
251
  }
242
252
  })
@@ -264,7 +274,7 @@ module Make = (
264
274
  authorization: None,
265
275
  permission: R.Spec.authorization,
266
276
  connectionSpec: true,
267
- subIdField: ?subIdField,
277
+ ?subIdField,
268
278
  indexQueries: ?(indexes->Array.length > 0 ? Some(indexes) : None),
269
279
  resolvedFields: ?(resolvedFields->Array.length > 0 ? Some(resolvedFields) : None),
270
280
  }
@@ -299,8 +309,7 @@ module Make = (
299
309
  connectionFilterTypeName: qn.returnTypeName ++ "Filter",
300
310
  }
301
311
  let qn = switch R.Spec.subIdConfig {
302
- | Some(_) =>
303
- {
312
+ | Some(_) => {
304
313
  ...qn,
305
314
  itemsFieldName: qn.singleFieldName ++ "Items",
306
315
  itemsFilterTypeName: qn.returnTypeName ++ "ItemsFilter",
@@ -308,18 +317,12 @@ module Make = (
308
317
  | None => qn
309
318
  }
310
319
  Plugin_Helpers.queryFieldNamesRegistry->Dict.set(R.Spec.name, qn)
311
- Plugin_Helpers.stateSchemaRegistry->Dict.set(
312
- R.Spec.name,
313
- R.Spec.stateSchema->S.castToUnknown,
314
- )
320
+ Plugin_Helpers.stateSchemaRegistry->Dict.set(R.Spec.name, R.Spec.stateSchema->S.castToUnknown)
315
321
  })
316
322
 
317
323
  let apiSchemaFragment = {
318
324
  let baseFragment = FragmentProvider.generateFragment(~mutationEntries, ~queryEntries)
319
- let subResult = Plugin_SubscriptionSchema.generate(
320
- ~mutationEntries,
321
- ~eventLogEntries,
322
- )
325
+ let subResult = Plugin_SubscriptionSchema.generate(~mutationEntries, ~eventLogEntries)
323
326
  // The historical read counterpart of the Source A subscription — same
324
327
  // event logs, same generation point, so the two cannot disagree about
325
328
  // which streams exist.
@@ -442,12 +445,8 @@ module Make = (
442
445
  commandTypes: extractTypes(M.Spec.commandSchema),
443
446
  eventTypes: extractTypes(M.Spec.eventSchema),
444
447
  errorTypes: extractTypes(M.Spec.errorSchema),
445
- commandSchemas: [
446
- SchemaWalker.walk(M.Spec.name ++ ".command", M.Spec.commandSchema),
447
- ],
448
- eventSchemas: [
449
- SchemaWalker.walk(M.Spec.name ++ ".event", M.Spec.eventSchema),
450
- ],
448
+ commandSchemas: [SchemaWalker.walk(M.Spec.name ++ ".command", M.Spec.commandSchema)],
449
+ eventSchemas: [SchemaWalker.walk(M.Spec.name ++ ".event", M.Spec.eventSchema)],
451
450
  chapter: ?chapterFor(M.Spec.name),
452
451
  }
453
452
  Plugin_Helpers.componentSchemaRegistry->Dict.set(M.Spec.name, schema)
@@ -595,10 +594,10 @@ module Make = (
595
594
  hook({
596
595
  name,
597
596
  version,
598
- kind: ?meta->Option.flatMap(m => m.kind),
599
- displayName: ?meta->Option.flatMap(m => m.displayName),
600
- vendor: ?meta->Option.flatMap(m => m.vendor),
601
- architectureType: ?meta->Option.flatMap(m => m.architectureType),
597
+ kind: ?(meta->Option.flatMap(m => m.kind)),
598
+ displayName: ?(meta->Option.flatMap(m => m.displayName)),
599
+ vendor: ?(meta->Option.flatMap(m => m.vendor)),
600
+ architectureType: ?(meta->Option.flatMap(m => m.architectureType)),
602
601
  components,
603
602
  })
604
603
  | None => ()
@@ -790,24 +789,29 @@ module Make = (
790
789
  // topics → this plugin's EventCollector, and vice-versa. The eventTopic
791
790
  // resource's `id` is the SNS topic ARN (same convention as
792
791
  // extensionPointDefinition.eventTopic).
793
- let dcbEventLogDef: Pulumi.Output.t<option<Reventless.Plugin.dcbEventLogDefinition>> =
794
- switch dcbResult.dcbEventLogOutputs {
792
+ let dcbEventLogDef: Pulumi.Output.t<
793
+ option<Reventless.Plugin.dcbEventLogDefinition>,
794
+ > = switch dcbResult.dcbEventLogOutputs {
795
+ | None => Pulumi.Output.make(None)
796
+ | Some(dcbOutputs) =>
797
+ switch dcbOutputs.eventTopic.resources->Array.get(0) {
798
+ | Some(r) =>
799
+ r.id->Pulumi.Output.apply(arn => Some({
800
+ Reventless.Plugin.name: name ++ "DcbEventLog",
801
+ eventTopicArn: arn,
802
+ }))
795
803
  | None => Pulumi.Output.make(None)
796
- | Some(dcbOutputs) =>
797
- switch dcbOutputs.eventTopic.resources->Array.get(0) {
798
- | Some(r) =>
799
- r.id->Pulumi.Output.apply(arn => Some({
800
- Reventless.Plugin.name: name ++ "DcbEventLog",
801
- eventTopicArn: arn,
802
- }))
803
- | None => Pulumi.Output.make(None)
804
- }
805
804
  }
805
+ }
806
806
 
807
807
  let pluginDefinition =
808
808
  (extensionPointsDefinitions, eventCollectorUrn, dcbEventLogDef)
809
809
  ->Pulumi.Output.all3
810
- ->Pulumi.Output.apply(((extensionPointsDefinitions, eventCollectorUrn, dcbEventLogDef)) => {
810
+ ->Pulumi.Output.apply(((
811
+ extensionPointsDefinitions,
812
+ eventCollectorUrn,
813
+ dcbEventLogDef,
814
+ )) => {
811
815
  Reventless.Plugin.id,
812
816
  name,
813
817
  version,
@@ -854,13 +858,13 @@ module Make = (
854
858
  readModelsOutputs
855
859
  ->Dict.toArray
856
860
  ->Array.forEach(((rmName, rmOut)) => {
857
- let urlOutput =
858
- rmOut.eventCollector->Pulumi.Output.flatMap(ecOutputs =>
861
+ let urlOutput = rmOut.eventCollector->Pulumi.Output.flatMap(
862
+ ecOutputs =>
859
863
  switch ecOutputs.resources->Array.get(0) {
860
864
  | Some(r) => r.id
861
865
  | None => Pulumi.Output.make("")
862
- }
863
- )
866
+ },
867
+ )
864
868
  readModelQueueUrls->Dict.set(rmName, urlOutput)
865
869
  })
866
870
 
@@ -75,10 +75,14 @@ module Make = (Spec: Spec): T => {
75
75
  Spec.outgoingExtensionEventHandlers->Dict.get(serviceName)->Option.isSome ||
76
76
  Spec.incomingExtensionEventHandlers->Dict.get(serviceName)->Option.isSome
77
77
  if isHandled {
78
- EffectLogger.logInfo(~comp=`Plugin(${id})`, `incoming event: ${LogFormat.eventSummary(eventJson')}`)
79
- ->Effect.zipRight(
80
- handleEventEffect(eventJson', Spec.incomingConnectExtensionEventHandlers)
81
- ->Effect.zipRight(
78
+ EffectLogger.logInfo(
79
+ ~comp=`Plugin(${id})`,
80
+ `incoming event: ${LogFormat.eventSummary(eventJson')}`,
81
+ )->Effect.zipRight(
82
+ handleEventEffect(
83
+ eventJson',
84
+ Spec.incomingConnectExtensionEventHandlers,
85
+ )->Effect.zipRight(
82
86
  Effect.all(
83
87
  [
84
88
  handleEventEffect(eventJson', Spec.outgoingExtensionPointEventHandlers),
@@ -86,8 +90,8 @@ module Make = (Spec: Spec): T => {
86
90
  handleEventEffect(eventJson', Spec.incomingExtensionEventHandlers),
87
91
  ],
88
92
  {"concurrency": "unbounded"},
89
- )->Effect.map(_ => ())
90
- )
93
+ )->Effect.map(_ => ()),
94
+ ),
91
95
  )
92
96
  } else {
93
97
  warnUnmatchedServiceOnce(~id, ~serviceName)