@reventlessdev/reventless-core 3.0.0-alpha.239 → 3.0.0-alpha.241

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 (172) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +11 -11
  3. package/src/Message.res +11 -11
  4. package/src/Message.res.mjs +15 -14
  5. package/src/Projection.res +2 -2
  6. package/src/Projection.res.mjs +5 -4
  7. package/src/adapter/Monitoring/Monitoring.res +24 -2
  8. package/src/adapter/Monitoring/Monitoring.res.mjs +3 -3
  9. package/src/admin/Platform_Admin.res +1 -16
  10. package/src/admin/Platform_Admin.res.mjs +2 -30
  11. package/src/admin/Platform_AdminApi.res.mjs +3 -3
  12. package/src/admin/Platform_Admin_Structure.res +58 -113
  13. package/src/admin/Platform_Admin_Structure.res.mjs +24 -139
  14. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +12 -12
  15. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs +14 -14
  16. package/src/components/Aggregate/Aggregate_Callback.res +2 -2
  17. package/src/components/Aggregate/Aggregate_Callback.res.mjs +4 -4
  18. package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +3 -3
  19. package/src/components/Api/ApiNoApiHelpers.res.mjs +5 -5
  20. package/src/components/Api/ApiTargetStateHelpers.res.mjs +3 -3
  21. package/src/components/Api/GraphQL_FragmentGenerator.res +18 -12
  22. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +7 -13
  23. package/src/components/Api/GraphQL_SchemaInspector.res +1 -1
  24. package/src/components/Api/GraphQL_SchemaInspector.res.mjs +1 -1
  25. package/src/components/Api/MCP_SchemaGenerator.res +1 -1
  26. package/src/components/Api/MCP_SchemaGenerator.res.mjs +1 -1
  27. package/src/components/Api/SchemaType.res +6 -10
  28. package/src/components/Api/SchemaType.res.mjs +4 -4
  29. package/src/components/Api/StorageRefFields.res +1 -1
  30. package/src/components/Api/StorageRefFields.res.mjs +1 -1
  31. package/src/components/Api/SuryToJsonSchema.res +11 -0
  32. package/src/components/Api/SuryToJsonSchema.res.mjs +2 -1
  33. package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -4
  34. package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +22 -23
  35. package/src/components/CommandTopic/CommandTopic_Callback.res +1 -2
  36. package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +3 -4
  37. package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -1
  38. package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +3 -3
  39. package/src/components/Counter/Counter.res.mjs +2 -2
  40. package/src/components/Counter/Counter_Callback.res.mjs +4 -4
  41. package/src/components/Counter/Counter_Operations.res.mjs +4 -4
  42. package/src/components/Dcb/Dcb_Builder.res +1 -1
  43. package/src/components/Dcb/Dcb_Builder.res.mjs +8 -6
  44. package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +4 -3
  45. package/src/components/EventCollector/EventCollector_Builder.res +1 -1
  46. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +1 -2
  47. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +11 -12
  48. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +3 -4
  49. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +24 -25
  50. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +1 -1
  51. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +3 -3
  52. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +2 -2
  53. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
  54. package/src/components/StateViewSlice/StateViewSlice_Builder.res +1 -1
  55. package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +3 -3
  56. package/src/plugin/api/PluginBaseFragment.res +12 -29
  57. package/src/plugin/api/PluginBaseFragment.res.mjs +3 -22
  58. package/src/plugin/component/Capability_Inference.res +118 -1
  59. package/src/plugin/component/Capability_Inference.res.mjs +128 -1
  60. package/src/plugin/component/Plugin_Builder.res +2 -2
  61. package/src/plugin/component/Plugin_Builder.res.mjs +2 -1
  62. package/src/plugin/component/Plugin_Helpers.res +11 -11
  63. package/src/plugin/component/Plugin_Helpers.res.mjs +11 -10
  64. package/src/plugin/component/Plugin_Structure.res +349 -274
  65. package/src/plugin/component/Plugin_Structure.res.mjs +212 -175
  66. package/src/plugin/component/Plugin_SubscriptionSchema.res +1 -1
  67. package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +1 -1
  68. package/src/plugin/component/SchemaWalker.res +11 -11
  69. package/src/plugin/component/SchemaWalker.res.mjs +8 -9
  70. package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +15 -15
  71. package/src/plugin/lifecycle/PluginBehavior.res.mjs +55 -55
  72. package/src/plugin/lifecycle/PluginSpec.res +22 -7
  73. package/src/plugin/lifecycle/PluginSpec.res.mjs +91 -36
  74. package/src/plugin/lifecycle/PluginsReadModelSpec.res +36 -9
  75. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +33 -22
  76. package/src/util/Interstack.res +3 -3
  77. package/src/util/LogFormat.res +1 -2
  78. package/src/util/LogFormat.res.mjs +2 -2
  79. package/tests/IdentityTest.res +6 -7
  80. package/tests/IdentityTest.res.mjs +7 -9
  81. package/tests/adapter/MonitoringTest.res +30 -3
  82. package/tests/adapter/MonitoringTest.res.mjs +31 -12
  83. package/tests/adapter/RuntimeExtensionHookReachTest.res +0 -1
  84. package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +5 -7
  85. package/tests/admin/Platform_Admin_StructureTest.res +254 -0
  86. package/tests/admin/Platform_Admin_StructureTest.res.mjs +219 -0
  87. package/tests/aggregate/AggregateCacheTest.res +0 -1
  88. package/tests/aggregate/AggregateCacheTest.res.mjs +13 -15
  89. package/tests/aggregate/AggregateConflictTest.res +0 -1
  90. package/tests/aggregate/AggregateConflictTest.res.mjs +7 -9
  91. package/tests/aggregate/AggregateFixtures.res +0 -1
  92. package/tests/aggregate/AggregateFixtures.res.mjs +19 -21
  93. package/tests/aggregate/AggregateSnapshotTest.res +1 -2
  94. package/tests/aggregate/AggregateSnapshotTest.res.mjs +15 -16
  95. package/tests/api/ApiNoApiTest.res.mjs +17 -9
  96. package/tests/api/GraphQL_FragmentGeneratorTest.res +62 -1
  97. package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +102 -58
  98. package/tests/api/PsInternalFieldsReadModel.res +21 -0
  99. package/tests/api/PsInternalFieldsReadModel.res.mjs +74 -0
  100. package/tests/api/StorageRefFieldsTest.res.mjs +13 -13
  101. package/tests/api/SuryToJsonSchemaTest.res +43 -0
  102. package/tests/api/SuryToJsonSchemaTest.res.mjs +352 -849
  103. package/tests/commandgenerator/CommandGeneratorFixtures.res +0 -1
  104. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +19 -21
  105. package/tests/commandgenerator/OwnerStampingTest.res +0 -1
  106. package/tests/commandgenerator/OwnerStampingTest.res.mjs +9 -11
  107. package/tests/commandtopic/CommandTopicCallbackFixtures.res +0 -1
  108. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +7 -9
  109. package/tests/counter/CounterFixtures.res +0 -1
  110. package/tests/counter/CounterFixtures.res.mjs +1 -4
  111. package/tests/dcb/DcbDecodeTest.res.mjs +24 -24
  112. package/tests/dcb/DcbEventLogOperationsTest.res +2 -2
  113. package/tests/dcb/DcbEventLogOperationsTest.res.mjs +3 -3
  114. package/tests/dcb/DcbEventLogSchemaTest.res.mjs +7 -7
  115. package/tests/dcb/DcbFixtures.res +0 -1
  116. package/tests/dcb/DcbFixtures.res.mjs +87 -89
  117. package/tests/dcb/DcbTagTest.res.mjs +6 -6
  118. package/tests/dcb/DcbValidationTest.res.mjs +52 -52
  119. package/tests/eventlog/EventLogFixtures.res +0 -1
  120. package/tests/eventlog/EventLogFixtures.res.mjs +7 -9
  121. package/tests/eventmapper/EventMapperFixtures.res +0 -1
  122. package/tests/eventmapper/EventMapperFixtures.res.mjs +24 -26
  123. package/tests/eventtopic/EventTopicFixtures.res +0 -1
  124. package/tests/eventtopic/EventTopicFixtures.res.mjs +7 -9
  125. package/tests/extensionpoint/ExtensionPointFixtures.res +0 -1
  126. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +10 -12
  127. package/tests/extensionpoint/ExtensionPointOperationsTest.res +1 -2
  128. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -10
  129. package/tests/logger/LogFormatTest.res +3 -2
  130. package/tests/logger/LogFormatTest.res.mjs +7 -9
  131. package/tests/message/MessageTest.res +2 -2
  132. package/tests/message/MessageTest.res.mjs +8 -7
  133. package/tests/message/MetaEnvelopeTest.res +5 -5
  134. package/tests/message/MetaEnvelopeTest.res.mjs +12 -11
  135. package/tests/plugin/ManifestVisibilityTest.res.mjs +7 -7
  136. package/tests/plugin/PluginDefinitionScalars.res +5 -3
  137. package/tests/plugin/PluginDefinitionScalars.res.mjs +2 -2
  138. package/tests/plugin/PluginLifecycleCorpusTest.res +4 -3
  139. package/tests/plugin/PluginLifecycleCorpusTest.res.mjs +3 -6
  140. package/tests/plugin/PluginSpecExperiment.res +0 -1
  141. package/tests/plugin/PluginSpecExperiment.res.mjs +12 -14
  142. package/tests/plugin/PluginStructureTest.res +188 -1
  143. package/tests/plugin/PluginStructureTest.res.mjs +293 -102
  144. package/tests/plugin/Plugin_EventQuerySchemaTest.res.mjs +3 -3
  145. package/tests/plugin/SchemaWalkerTest.res +0 -1
  146. package/tests/plugin/SchemaWalkerTest.res.mjs +17 -19
  147. package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +5 -5
  148. package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -8
  149. package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +5 -5
  150. package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +9 -9
  151. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +5 -5
  152. package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -8
  153. package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +15 -15
  154. package/tests/plugin/StateChangeSlice/PsTypoStore.res +31 -0
  155. package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +62 -0
  156. package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -8
  157. package/tests/plugin/StateChangeSlice/PsUploadImages.res +40 -0
  158. package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +66 -0
  159. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +13 -12
  160. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +8 -8
  161. package/tests/plugin/StateViewSlice/PsCategoriesView.res.mjs +6 -6
  162. package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +10 -10
  163. package/tests/plugin/StateViewSlice/PsGatedView.res.mjs +6 -6
  164. package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +9 -9
  165. package/tests/plugin/StateViewSlice/PsShipmentsView.res.mjs +11 -10
  166. package/tests/plugin/pluginDefinitionRequiredScalars.txt +15 -0
  167. package/tests/querydb/QueryDbFixtures.res +0 -1
  168. package/tests/querydb/QueryDbFixtures.res.mjs +5 -7
  169. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +0 -1
  170. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -6
  171. package/tests/util/CommandPublisherTest.res +0 -1
  172. package/tests/util/CommandPublisherTest.res.mjs +4 -6
@@ -132,6 +132,21 @@ let deriveObjectTypeWithNested = (
132
132
  ): array<string> =>
133
133
  switch SchemaType.fromSuryObject(~typeName, schema) {
134
134
  | Some(fields) =>
135
+ // `@internal` joins the caller's exclusions rather than replacing them. The
136
+ // caller's list is a decision made where the query entry is assembled; this
137
+ // one is a declaration on the field itself, and the schema is the better
138
+ // place for it — a hand-written list has to be kept in step with the record
139
+ // by whoever next edits it, which is the drift that made a hand-maintained
140
+ // `pluginExcludeFields` necessary in the first place.
141
+ //
142
+ // This is the single point for the SDL: every generated object type is
143
+ // derived here, so a field declared internal is absent from all of them
144
+ // without any entry having to say so.
145
+ let declaredInternal =
146
+ Reventless.StateAnnotations.getSpec(schema)
147
+ ->Option.flatMap(spec => spec.internal)
148
+ ->Option.getOr([])
149
+ let excludeFields = Array.concat(excludeFields, declaredInternal)
135
150
  let filteredFields = if excludeFields->Array.length > 0 {
136
151
  let d = Dict.make()
137
152
  fields
@@ -641,7 +656,7 @@ let generate = (
641
656
  // schema shape — see `mutationSchemaEntry.injectIdArg`.
642
657
  let injectIdArg = entry.injectIdArg->Option.getOr(true)
643
658
  switch schema {
644
- | Union({anyOf}) =>
659
+ | AnyOf({anyOf}) =>
645
660
  // Map each fieldName to its variant in anyOf by matching the constructor
646
661
  // name. Position-based pairing (anyOf index ↔ fieldNames index) breaks
647
662
  // when `@noApi` filters out some variants but the schema still carries
@@ -650,17 +665,8 @@ let generate = (
650
665
  // index 1, leaking a stale `_0: Platform_Plugin_Deactivate_0` arg.
651
666
  let variantNames = anyOf->Array.map(v =>
652
667
  switch v {
653
- | Object({items}) =>
654
- items
655
- ->Array.find(item => item.location == "TAG")
656
- ->Option.flatMap(item =>
657
- switch item.schema {
658
- | String({const}) => Some(const)
659
- | _ => None
660
- }
661
- )
662
- ->Option.getOr("")
663
- | String({const}) => const
668
+ | Object({properties}) => SchemaWalker.tagConstOf(properties)->Option.getOr("")
669
+ | String({const: ?Some(const)}) => const
664
670
  | _ => ""
665
671
  }
666
672
  )
@@ -5,6 +5,7 @@ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
5
  import * as Stdlib_String from "@rescript/runtime/lib/es6/Stdlib_String.js";
6
6
  import * as Api_Naming$ReventlessCore from "./Api_Naming.res.mjs";
7
7
  import * as SchemaType$ReventlessCore from "./SchemaType.res.mjs";
8
+ import * as SchemaWalker$ReventlessCore from "../../plugin/component/SchemaWalker.res.mjs";
8
9
  import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
9
10
  import * as GraphQL_Stitcher$ReventlessCore from "./GraphQL_Stitcher.res.mjs";
10
11
 
@@ -116,12 +117,14 @@ function deriveObjectTypeWithNested(typeName, excludeFieldsOpt, includeIdParamOp
116
117
  if (fields === undefined) {
117
118
  return [];
118
119
  }
120
+ let declaredInternal = Stdlib_Option.getOr(Stdlib_Option.flatMap(StateAnnotations$Reventless.getSpec(schema), spec => spec.internal), []);
121
+ let excludeFields$1 = excludeFields.concat(declaredInternal);
119
122
  let filteredFields;
120
- if (excludeFields.length !== 0) {
123
+ if (excludeFields$1.length !== 0) {
121
124
  let d = {};
122
125
  Object.entries(fields).forEach(param => {
123
126
  let k = param[0];
124
- if (!excludeFields.some(ex => ex === k)) {
127
+ if (!excludeFields$1.some(ex => ex === k)) {
125
128
  d[k] = param[1];
126
129
  return;
127
130
  }
@@ -444,7 +447,7 @@ function generate(mutationEntries, queryEntries) {
444
447
  } else {
445
448
  return;
446
449
  }
447
- case "union" :
450
+ case "anyOf" :
448
451
  let anyOf = schema.anyOf;
449
452
  let variantNames = anyOf.map(v => {
450
453
  switch (v.type) {
@@ -456,16 +459,7 @@ function generate(mutationEntries, queryEntries) {
456
459
  return "";
457
460
  }
458
461
  case "object" :
459
- return Stdlib_Option.getOr(Stdlib_Option.flatMap(v.items.find(item => item.location === "TAG"), item => {
460
- let match = item.schema;
461
- if (match.type !== "string") {
462
- return;
463
- }
464
- let $$const = match.const;
465
- if ($$const !== undefined) {
466
- return $$const;
467
- }
468
- }), "");
462
+ return Stdlib_Option.getOr(SchemaWalker$ReventlessCore.tagConstOf(v.properties), "");
469
463
  default:
470
464
  return "";
471
465
  }
@@ -29,7 +29,7 @@ let inspectMutationFields = (~fieldPrefix: string, commandSchema: S.t<'a>): arra
29
29
  let collectedTypes: array<string> = []
30
30
  let seenTypes = Set.make()
31
31
  switch schema {
32
- | Union({anyOf}) =>
32
+ | AnyOf({anyOf}) =>
33
33
  let constructorNames = Reventless.DcbTag.extractAllVariantNames(commandSchema)
34
34
  anyOf->Array.forEachWithIndex((variantSchema, i) => {
35
35
  let fieldName = switch constructorNames->Array.get(i) {
@@ -27,7 +27,7 @@ function inspectMutationFields(fieldPrefix, commandSchema) {
27
27
  fields.push(field);
28
28
  });
29
29
  break;
30
- case "union" :
30
+ case "anyOf" :
31
31
  let constructorNames = DcbTag$Reventless.extractAllVariantNames(commandSchema);
32
32
  commandSchema.anyOf.forEach((variantSchema, i) => {
33
33
  let name = constructorNames[i];
@@ -52,7 +52,7 @@ let generateTools = (
52
52
  let entryDescription = entry.description->Option.getOr("")
53
53
 
54
54
  switch schema {
55
- | Union({anyOf}) =>
55
+ | AnyOf({anyOf}) =>
56
56
  // Aggregate commands: each variant is a separate tool.
57
57
  // Inject an "id" property (aggregate instance ID) since aggregate
58
58
  // commands target a specific instance.
@@ -33,7 +33,7 @@ function generateTools(pluginName, mutationEntries) {
33
33
  inputSchema: inputSchema
34
34
  });
35
35
  return;
36
- case "union" :
36
+ case "anyOf" :
37
37
  schema.anyOf.forEach((variantSchema, i) => {
38
38
  let fieldName = Stdlib_Option.getOr(entry.fieldNames[i], "");
39
39
  if (fieldName.length <= 0) {
@@ -99,15 +99,11 @@ and shapeOf = (~parentName: string, ~fieldName: string, schema: S.t<unknown>): s
99
99
  | BigInt(_) => ScalarBigInt
100
100
  | Array({items, additionalItems}) =>
101
101
  let itemType = switch items->Array.get(0) {
102
- | Some({schema: itemSchema}) =>
103
- fromSury(
104
- ~parentName,
105
- ~fieldName,
106
- itemSchema->(Obj.magic: S.t<unknown> => S.t<unknown>),
107
- )
102
+ | Some(itemSchema) => fromSury(~parentName, ~fieldName, itemSchema)
108
103
  | None =>
109
- // sury stores the item schema in additionalItems (not items) for S.array().
110
- // additionalItems is @unboxed: Strip="strip", Strict="strict", Schema(t) = the schema object.
104
+ // For a homogeneous S.array() sury stores the element schema in
105
+ // additionalItems (items holds fixed tuple positions). additionalItems is
106
+ // @unboxed: Strip="strip" | Strict="strict" | Schema(t) = the schema object.
111
107
  switch additionalItems {
112
108
  | Schema(s) => fromSury(~parentName, ~fieldName, s)
113
109
  | _ => ScalarString
@@ -135,7 +131,7 @@ and shapeOf = (~parentName: string, ~fieldName: string, schema: S.t<unknown>): s
135
131
  } else {
136
132
  ObjectRef(nestedName, fields)
137
133
  }
138
- | Union({anyOf}) =>
134
+ | AnyOf({anyOf}) =>
139
135
  let nonNullVariants = anyOf->Array.filter(v =>
140
136
  switch v {
141
137
  | Null(_) | Undefined(_) => false
@@ -196,7 +192,7 @@ let optionalFieldNames = (schema: S.t<unknown>): array<string> =>
196
192
  ->Dict.toArray
197
193
  ->Array.filterMap(((propName, propSchema)) =>
198
194
  switch propSchema {
199
- | Union({anyOf}) =>
195
+ | AnyOf({anyOf}) =>
200
196
  anyOf->Array.some(v =>
201
197
  switch v {
202
198
  | Null(_) | Undefined(_) => true
@@ -92,8 +92,8 @@ function shapeOf(parentName, fieldName, schema) {
92
92
  };
93
93
  case "array" :
94
94
  let additionalItems = schema.additionalItems;
95
- let match = schema.items[0];
96
- let itemType = match !== undefined ? fromSury(parentName, fieldName, match.schema) : (
95
+ let itemSchema = schema.items[0];
96
+ let itemType = itemSchema !== undefined ? fromSury(parentName, fieldName, itemSchema) : (
97
97
  additionalItems === "strip" || additionalItems === "strict" ? "ScalarString" : fromSury(parentName, fieldName, additionalItems)
98
98
  );
99
99
  let itemType$1 = (isIdsFieldName(fieldName) || isIdFieldName(fieldName)) && itemType === "ScalarString" ? "EntityId" : itemType;
@@ -120,7 +120,7 @@ function shapeOf(parentName, fieldName, schema) {
120
120
  _1: fields
121
121
  };
122
122
  }
123
- case "union" :
123
+ case "anyOf" :
124
124
  let anyOf = schema.anyOf;
125
125
  let nonNullVariants = anyOf.filter(v => {
126
126
  switch (v.type) {
@@ -173,7 +173,7 @@ function optionalFieldNames(schema) {
173
173
  if (schema.type === "object") {
174
174
  return Stdlib_Array.filterMap(Object.entries(schema.properties), param => {
175
175
  let propSchema = param[1];
176
- if (propSchema.type === "union" && propSchema.anyOf.some(v => {
176
+ if (propSchema.type === "anyOf" && propSchema.anyOf.some(v => {
177
177
  switch (v.type) {
178
178
  case "null" :
179
179
  case "undefined" :
@@ -78,7 +78,7 @@ to qualify a store the annotation left unqualified.
78
78
  */
79
79
  let fromEventSchema = (~plugin: string, eventSchema: S.t<unknown>): array<eventRefFields> =>
80
80
  switch eventSchema {
81
- | Union({anyOf}) => anyOf->Array.filterMap(v => fromVariant(~plugin, v))
81
+ | AnyOf({anyOf}) => anyOf->Array.filterMap(v => fromVariant(~plugin, v))
82
82
  | other => fromVariant(~plugin, other)->Option.mapOr([], e => [e])
83
83
  }
84
84
 
@@ -44,7 +44,7 @@ function fromVariant(plugin, variant) {
44
44
  }
45
45
 
46
46
  function fromEventSchema(plugin, eventSchema) {
47
- if (eventSchema.type === "union") {
47
+ if (eventSchema.type === "anyOf") {
48
48
  return Stdlib_Array.filterMap(eventSchema.anyOf, v => fromVariant(plugin, v));
49
49
  } else {
50
50
  return Stdlib_Option.mapOr(fromVariant(plugin, eventSchema), [], e => [e]);
@@ -263,8 +263,19 @@ and objectRefToJsonSchema = (
263
263
  ): JSON.t => {
264
264
  let props = Dict.make()
265
265
  let required: array<string> = []
266
+ // `@internal` fields are dropped rather than annotated. A marker would be the
267
+ // right answer for a field that is on the surface and merely unwanted (that is
268
+ // `@hidden`); this one is not on the surface at all, so there is nothing for a
269
+ // consumer to describe and an entry here would advertise a field the SDL does
270
+ // not declare — which is precisely the mismatch that made read-model queries
271
+ // reference fields the server rejects.
272
+ //
273
+ // This is the single point for every JSON-Schema consumer: `queryableDef.schema`,
274
+ // the MCP generator and the manifest all derive through this walk.
275
+ let internal = annotations->Option.flatMap(spec => spec.internal)->Option.getOr([])
266
276
  fields
267
277
  ->Dict.toArray
278
+ ->Array.filter(((fieldName, _)) => !(internal->Array.includes(fieldName)))
268
279
  ->Array.forEach(((fieldName, fieldType)) => {
269
280
  let baseSchema = fromSchemaType(fieldType)
270
281
  let withAnnotations = switch annotations {
@@ -281,7 +281,8 @@ function objectRefToJsonSchema(annotations, optionalOpt, ownersOpt, fields) {
281
281
  let owners = ownersOpt !== undefined ? ownersOpt : [];
282
282
  let props = {};
283
283
  let required = [];
284
- Object.entries(fields).forEach(param => {
284
+ let internal = Stdlib_Option.getOr(Stdlib_Option.flatMap(annotations, spec => spec.internal), []);
285
+ Object.entries(fields).filter(param => !internal.includes(param[0])).forEach(param => {
285
286
  let fieldType = param[1];
286
287
  let fieldName = param[0];
287
288
  let baseSchema = fromSchemaType(fieldType);
@@ -1,4 +1,3 @@
1
- S.enableJson()
2
1
  // AutomationSlice callback — implements the TODO list pattern with mixed-source
3
2
  // dispatch (Plan 04).
4
3
  //
@@ -143,7 +142,7 @@ module Make = (
143
142
  | Some(_) => () // Already exists — skip
144
143
  | None =>
145
144
  let row: todoRow = {
146
- item: item->S.reverseConvertToJsonOrThrow(Spec.todoItemSchema),
145
+ item: item->Reventless.Util_Sury.toJson(Spec.todoItemSchema),
147
146
  status: Pending,
148
147
  createdAt: now(),
149
148
  retryCount: 0,
@@ -198,7 +197,7 @@ module Make = (
198
197
  let commands = []
199
198
 
200
199
  pending->Array.forEach(((id, row)) => {
201
- let item = try row.item->S.parseJsonOrThrow(Spec.todoItemSchema)->Some catch {
200
+ let item = try row.item->Reventless.Util_Sury.fromJson(Spec.todoItemSchema)->Some catch {
202
201
  | exn =>
203
202
  let errMsg =
204
203
  exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
@@ -214,7 +213,7 @@ module Make = (
214
213
  | Some((targetId, command)) =>
215
214
  todoItems->Dict.set(id, {...row, status: Processing, processedAt: now()})
216
215
  let commandJson = try command
217
- ->S.reverseConvertToJsonOrThrow(Spec.commandSchema)
216
+ ->Reventless.Util_Sury.toJson(Spec.commandSchema)
218
217
  ->Some catch {
219
218
  | exn =>
220
219
  let errMsg =
@@ -1,6 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
5
5
  import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
6
6
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
@@ -9,35 +9,34 @@ import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js
9
9
  import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
10
10
  import * as DcbDecode$Reventless from "@reventlessdev/reventless-spec/src/components/DcbDecode.res.mjs";
11
11
  import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
12
+ import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
12
13
  import * as Message$ReventlessCore from "../../Message.res.mjs";
13
14
  import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
14
15
 
15
- S.enableJson();
16
-
17
- let todoStatusSchema = S.union([
18
- S.literal("Pending"),
19
- S.literal("Processing"),
20
- S.literal("Completed"),
21
- S.literal("Failed")
16
+ let todoStatusSchema = Sury.union([
17
+ Sury.literal("Pending"),
18
+ Sury.literal("Processing"),
19
+ Sury.literal("Completed"),
20
+ Sury.literal("Failed")
22
21
  ]);
23
22
 
24
- let todoRowSchema = S.schema(s => ({
25
- item: s.m(S.json),
23
+ let todoRowSchema = Sury.$schema(s => ({
24
+ item: s.m(Sury.json),
26
25
  status: s.m(todoStatusSchema),
27
- createdAt: s.m(S.string),
28
- processedAt: s.m(S.option(S.string)),
29
- completedAt: s.m(S.option(S.string)),
30
- retryCount: s.m(S.int)
26
+ createdAt: s.m(Sury.string),
27
+ processedAt: s.m(Sury.$option(Sury.string)),
28
+ completedAt: s.m(Sury.$option(Sury.string)),
29
+ retryCount: s.m(Sury.int)
31
30
  }));
32
31
 
33
32
  function todoRowSchemaFor(itemSchema) {
34
- return S.schema(s => ({
33
+ return Sury.$schema(s => ({
35
34
  item: s.m(itemSchema),
36
35
  status: s.m(todoStatusSchema),
37
- createdAt: s.m(S.string),
38
- processedAt: s.m(S.option(S.string)),
39
- completedAt: s.m(S.option(S.string)),
40
- retryCount: s.m(S.int)
36
+ createdAt: s.m(Sury.string),
37
+ processedAt: s.m(Sury.$option(Sury.string)),
38
+ completedAt: s.m(Sury.$option(Sury.string)),
39
+ retryCount: s.m(Sury.int)
41
40
  }));
42
41
  }
43
42
 
@@ -60,7 +59,7 @@ function Make(Spec) {
60
59
  if (match !== undefined) {
61
60
  return;
62
61
  }
63
- let row_item = S.reverseConvertToJsonOrThrow(param[1], Spec.todoItemSchema);
62
+ let row_item = Util_Sury$Reventless.toJson(param[1], Spec.todoItemSchema);
64
63
  let row_createdAt = new Date().toISOString();
65
64
  let row = {
66
65
  item: row_item,
@@ -115,7 +114,7 @@ function Make(Spec) {
115
114
  let id = param[0];
116
115
  let item;
117
116
  try {
118
- item = Primitive_option.some(S.parseJsonOrThrow(row.item, Spec.todoItemSchema));
117
+ item = Primitive_option.some(Util_Sury$Reventless.fromJson(row.item, Spec.todoItemSchema));
119
118
  } catch (raw_exn) {
120
119
  let exn = Primitive_exceptions.internalToException(raw_exn);
121
120
  let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "unknown");
@@ -134,7 +133,7 @@ function Make(Spec) {
134
133
  todoItems[id] = newrecord;
135
134
  let commandJson;
136
135
  try {
137
- commandJson = S.reverseConvertToJsonOrThrow(match[1], Spec.commandSchema);
136
+ commandJson = Util_Sury$Reventless.toJson(match[1], Spec.commandSchema);
138
137
  } catch (raw_exn) {
139
138
  let exn = Primitive_exceptions.internalToException(raw_exn);
140
139
  let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "unknown");
@@ -198,4 +197,4 @@ export {
198
197
  todoRowSchemaFor,
199
198
  Make,
200
199
  }
201
- /* Not a pure module */
200
+ /* todoStatusSchema Not a pure module */
@@ -18,8 +18,7 @@ module Make = (Spec: ReventlessInfra.CommandTopic.T, Ops: Ops with module Spec =
18
18
  | command' => Some({ReventlessInfra.CommandTopic.reference, command: command'})
19
19
  | exception err =>
20
20
  let commandStr = json->JSON.stringify
21
- let errMsg =
22
- err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
21
+ let errMsg = err->Reventless.Util_Sury.exnMessage
23
22
  EffectLogger.logError(
24
23
  ~comp,
25
24
  `decode failed: ${commandStr} err=${errMsg}`,
@@ -1,10 +1,9 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
4
- import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
3
  import * as Effect from "effect/Effect";
6
4
  import * as Stream from "effect/Stream";
7
5
  import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
6
+ import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
8
7
  import * as Message$ReventlessCore from "../../Message.res.mjs";
9
8
  import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
10
9
 
@@ -21,7 +20,7 @@ function Make(Spec) {
21
20
  } catch (raw_err) {
22
21
  let err = Primitive_exceptions.internalToException(raw_err);
23
22
  let commandStr = JSON.stringify(json);
24
- let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
23
+ let errMsg = Util_Sury$Reventless.exnMessage(err, undefined);
25
24
  Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `decode failed: ` + commandStr + ` err=` + errMsg));
26
25
  return;
27
26
  }
@@ -46,4 +45,4 @@ function Make(Spec) {
46
45
  export {
47
46
  Make,
48
47
  }
49
- /* Stdlib_JsExn Not a pure module */
48
+ /* effect/Effect Not a pure module */
@@ -169,7 +169,7 @@ let encodeCommandJson = (cmdJson: Reventless.Message.commandJson): JSON.t =>
169
169
  JSON.Encode.object(
170
170
  Dict.fromArray([
171
171
  ("id", JSON.Encode.string(cmdJson.id)),
172
- ("meta", cmdJson.meta->S.reverseConvertToJsonOrThrow(Reventless.Message.metaSchema)),
172
+ ("meta", cmdJson.meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema)),
173
173
  ("command", cmdJson.commandJson),
174
174
  ]),
175
175
  )
@@ -1,6 +1,5 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
4
3
  import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
5
4
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
6
5
  import * as Effect from "effect/Effect";
@@ -8,6 +7,7 @@ import * as Stream from "effect/Stream";
8
7
  import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
9
8
  import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
10
9
  import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
10
+ import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
11
11
  import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
12
12
 
13
13
  let commandOutcomeHook = {
@@ -127,7 +127,7 @@ function encodeCommandJson(cmdJson) {
127
127
  ],
128
128
  [
129
129
  "meta",
130
- S.reverseConvertToJsonOrThrow(cmdJson.meta, Message$Reventless.metaSchema)
130
+ Util_Sury$Reventless.toJson(cmdJson.meta, Message$Reventless.metaSchema)
131
131
  ],
132
132
  [
133
133
  "command",
@@ -238,4 +238,4 @@ export {
238
238
  registerHandler,
239
239
  getHandlers,
240
240
  }
241
- /* S Not a pure module */
241
+ /* Stdlib_JsExn Not a pure module */
@@ -1,9 +1,9 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
5
5
 
6
- let counterEventSchema = S.literal("CountFinished");
6
+ let counterEventSchema = Sury.literal("CountFinished");
7
7
 
8
8
  let name = ComponentType$ReventlessCore.toName("Counter");
9
9
 
@@ -1,6 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
5
5
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
6
6
  import * as Effect from "effect/Effect";
@@ -10,9 +10,9 @@ import * as Message$ReventlessCore from "../../Message.res.mjs";
10
10
  import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
11
11
  import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
12
12
 
13
- let countsStateSchema = S.schema(s => ({
14
- id: s.m(S.string),
15
- count: s.m(S.int)
13
+ let countsStateSchema = Sury.$schema(s => ({
14
+ id: s.m(Sury.string),
15
+ count: s.m(Sury.int)
16
16
  }));
17
17
 
18
18
  function groupByCounterId(references) {
@@ -1,15 +1,15 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
5
5
  import * as Effect from "effect/Effect";
6
6
  import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
7
7
  import * as Counter$ReventlessCore from "./Counter.res.mjs";
8
8
  import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
9
9
 
10
- let referencesStateSchema = S.schema(s => ({
11
- id: s.m(S.string),
12
- inc: s.m(S.int)
10
+ let referencesStateSchema = Sury.$schema(s => ({
11
+ id: s.m(Sury.string),
12
+ inc: s.m(Sury.int)
13
13
  }));
14
14
 
15
15
  function groupCountItemsByCounterId(countItems) {
@@ -51,7 +51,7 @@ let mergedEventSchema = (schemas: array<S.t<unknown>>) =>
51
51
  many
52
52
  ->Array.flatMap(schema =>
53
53
  switch schema {
54
- | S.Union({anyOf}) => anyOf
54
+ | S.AnyOf({anyOf}) => anyOf
55
55
  | other => [other]
56
56
  }
57
57
  )
@@ -1,6 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
5
5
  import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
6
6
  import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
@@ -81,8 +81,8 @@ function mergedEventSchema(schemas) {
81
81
  return schemas[0];
82
82
  }
83
83
  let seen = new Set();
84
- return S.union(schemas.flatMap(schema => {
85
- if (schema.type === "union") {
84
+ return Sury.union(schemas.flatMap(schema => {
85
+ if (schema.type === "anyOf") {
86
86
  return schema.anyOf;
87
87
  } else {
88
88
  return [schema];
@@ -242,10 +242,11 @@ function Make(DcbEventLogStorage) {
242
242
  let DcbEventLog = DcbEventLog_Builder$ReventlessCore.Make(DcbEventLogStorage)(DcbEventTopicPublisher);
243
243
  let dcbEventLog = DcbEventLog.make(name, indexes$1, partitionTag, effectiveCrossPartitionTagKeys, opts);
244
244
  Stdlib_Option.forEach(HooksConfig.hooks.onDcbEventLogCreated, hook => hook(dcbEventLog));
245
+ let commandSchema = Sury.json;
245
246
  let DcbCommandTopic = CommandTopic_Builder$ReventlessCore.Make({
246
247
  Id: Id$Reventless.$$String,
247
248
  name: childName,
248
- commandSchema: S.json
249
+ commandSchema: commandSchema
249
250
  })(DcbCommandTopicChannel);
250
251
  let dcbCommandTopic = DcbCommandTopic.make(name + `Dcb`, {
251
252
  kind: "Plugin",
@@ -254,10 +255,11 @@ function Make(DcbEventLogStorage) {
254
255
  Stdlib_Option.forEach(HooksConfig.hooks.onDcbCommandTopicCreated, hook => hook(dcbCommandTopic));
255
256
  let publishJsons = Component$ReventlessCore.operations(dcbCommandTopic).apply(ops => ops.publishJsons);
256
257
  let name$1 = childName + "Async";
258
+ let commandSchema$1 = Sury.json;
257
259
  let DcbAsyncCommandTopic = CommandTopic_Builder$ReventlessCore.Make({
258
260
  Id: Id$Reventless.$$String,
259
261
  name: name$1,
260
- commandSchema: S.json
262
+ commandSchema: commandSchema$1
261
263
  })(DcbCommandTopicChannelAsync);
262
264
  let asyncDcbCommandTopicOpt;
263
265
  if (asyncSlices.length !== 0) {
@@ -447,7 +449,7 @@ function Make(DcbEventLogStorage) {
447
449
  });
448
450
  return [
449
451
  byTag$1,
450
- make(S.json)
452
+ make(Sury.json)
451
453
  ];
452
454
  });
453
455
  let dcbHandler = Pulumi.all([
@@ -1,6 +1,6 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
3
+ import * as Sury from "sury";
4
4
  import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
5
5
  import * as Pulumi from "@pulumi/pulumi";
6
6
  import * as Component$ReventlessCore from "../Component.res.mjs";
@@ -13,6 +13,7 @@ import * as DcbEventLog_Operations$ReventlessCore from "./DcbEventLog_Operations
13
13
 
14
14
  function Make(Storage) {
15
15
  return EventTopicPublisher => {
16
+ let eventSchema = Sury.json;
16
17
  let make = (name, indexesOpt, partitionTag, crossPartitionTagKeysOpt, opts) => {
17
18
  let indexes = indexesOpt !== undefined ? indexesOpt : [];
18
19
  let crossPartitionTagKeys = crossPartitionTagKeysOpt !== undefined ? crossPartitionTagKeysOpt : [];
@@ -31,7 +32,7 @@ function Make(Storage) {
31
32
  let SpecificEventTopic = EventTopic_Builder$ReventlessCore.Make({
32
33
  Id: Id$Reventless.$$String,
33
34
  name: "DcbEventLog",
34
- eventSchema: S.json
35
+ eventSchema: eventSchema
35
36
  })(EventTopicPublisher);
36
37
  let eventTopic = SpecificEventTopic.make(extra$1, storage.resources, owner, Util_Pulumi$ReventlessCore.ComponentResourceOptions.ofCustomResourceOptions(opts));
37
38
  Component$ReventlessCore.setOperations(extra, Pulumi.all([
@@ -71,4 +72,4 @@ function Make(Storage) {
71
72
  export {
72
73
  Make,
73
74
  }
74
- /* S Not a pure module */
75
+ /* sury Not a pure module */
@@ -11,7 +11,7 @@ let makeStreamHandler = (
11
11
  let jsonHandler: EventCollector.jsonEventsHandler = stream =>
12
12
  stream
13
13
  ->Stream.mapEffect(json =>
14
- Effect.trySync(~catch=_exn => "decode error", () => json->S.parseOrThrow(schema))
14
+ Effect.trySync(~catch=_exn => "decode error", () => json->S.parseOrThrow(~to=schema))
15
15
  )
16
16
  ->jsonEventsHandler
17
17
 
@@ -1,4 +1,3 @@
1
- S.enableJson()
2
1
  // InboundTranslationSlice callback — receives external input and translates to commands.
3
2
  //
4
3
  // Maintains an audit log QueryDb and delegates translation to Translation.translate.
@@ -113,7 +112,7 @@ module Make = (
113
112
  let requestId = Uuid.v4()
114
113
 
115
114
  // Parse the external input
116
- let input = try inputJson->S.parseOrThrow(Spec.externalInputSchema)->Ok catch {
115
+ let input = try inputJson->S.parseOrThrow(~to=Spec.externalInputSchema)->Ok catch {
117
116
  | exn =>
118
117
  let msg =
119
118
  exn