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

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 (170) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/package.json +9 -9
  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_AdminApi.res.mjs +3 -3
  10. package/src/admin/Platform_Admin_Structure.res +33 -113
  11. package/src/admin/Platform_Admin_Structure.res.mjs +8 -139
  12. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +12 -12
  13. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs +14 -14
  14. package/src/components/Aggregate/Aggregate_Callback.res +2 -2
  15. package/src/components/Aggregate/Aggregate_Callback.res.mjs +4 -4
  16. package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +3 -3
  17. package/src/components/Api/ApiNoApiHelpers.res.mjs +5 -5
  18. package/src/components/Api/ApiTargetStateHelpers.res.mjs +3 -3
  19. package/src/components/Api/GraphQL_FragmentGenerator.res +18 -12
  20. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +7 -13
  21. package/src/components/Api/GraphQL_SchemaInspector.res +1 -1
  22. package/src/components/Api/GraphQL_SchemaInspector.res.mjs +1 -1
  23. package/src/components/Api/MCP_SchemaGenerator.res +1 -1
  24. package/src/components/Api/MCP_SchemaGenerator.res.mjs +1 -1
  25. package/src/components/Api/SchemaType.res +6 -10
  26. package/src/components/Api/SchemaType.res.mjs +4 -4
  27. package/src/components/Api/StorageRefFields.res +1 -1
  28. package/src/components/Api/StorageRefFields.res.mjs +1 -1
  29. package/src/components/Api/SuryToJsonSchema.res +11 -0
  30. package/src/components/Api/SuryToJsonSchema.res.mjs +2 -1
  31. package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -4
  32. package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +22 -23
  33. package/src/components/CommandTopic/CommandTopic_Callback.res +1 -2
  34. package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +3 -4
  35. package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -1
  36. package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +3 -3
  37. package/src/components/Counter/Counter.res.mjs +2 -2
  38. package/src/components/Counter/Counter_Callback.res.mjs +4 -4
  39. package/src/components/Counter/Counter_Operations.res.mjs +4 -4
  40. package/src/components/Dcb/Dcb_Builder.res +1 -1
  41. package/src/components/Dcb/Dcb_Builder.res.mjs +8 -6
  42. package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +4 -3
  43. package/src/components/EventCollector/EventCollector_Builder.res +1 -1
  44. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +1 -2
  45. package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +11 -12
  46. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +3 -4
  47. package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +24 -25
  48. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +1 -1
  49. package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +3 -3
  50. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +2 -2
  51. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
  52. package/src/components/StateViewSlice/StateViewSlice_Builder.res +1 -1
  53. package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +3 -3
  54. package/src/plugin/api/PluginBaseFragment.res +12 -29
  55. package/src/plugin/api/PluginBaseFragment.res.mjs +3 -22
  56. package/src/plugin/component/Capability_Inference.res +118 -1
  57. package/src/plugin/component/Capability_Inference.res.mjs +128 -1
  58. package/src/plugin/component/Plugin_Builder.res +2 -2
  59. package/src/plugin/component/Plugin_Builder.res.mjs +2 -1
  60. package/src/plugin/component/Plugin_Helpers.res +11 -11
  61. package/src/plugin/component/Plugin_Helpers.res.mjs +11 -10
  62. package/src/plugin/component/Plugin_Structure.res +349 -274
  63. package/src/plugin/component/Plugin_Structure.res.mjs +212 -175
  64. package/src/plugin/component/Plugin_SubscriptionSchema.res +1 -1
  65. package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +1 -1
  66. package/src/plugin/component/SchemaWalker.res +11 -11
  67. package/src/plugin/component/SchemaWalker.res.mjs +8 -9
  68. package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +15 -15
  69. package/src/plugin/lifecycle/PluginBehavior.res.mjs +55 -55
  70. package/src/plugin/lifecycle/PluginSpec.res +22 -7
  71. package/src/plugin/lifecycle/PluginSpec.res.mjs +91 -36
  72. package/src/plugin/lifecycle/PluginsReadModelSpec.res +36 -9
  73. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +33 -22
  74. package/src/util/Interstack.res +3 -3
  75. package/src/util/LogFormat.res +1 -2
  76. package/src/util/LogFormat.res.mjs +2 -2
  77. package/tests/IdentityTest.res +6 -7
  78. package/tests/IdentityTest.res.mjs +7 -9
  79. package/tests/adapter/MonitoringTest.res +30 -3
  80. package/tests/adapter/MonitoringTest.res.mjs +31 -12
  81. package/tests/adapter/RuntimeExtensionHookReachTest.res +0 -1
  82. package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +5 -7
  83. package/tests/admin/Platform_Admin_StructureTest.res +254 -0
  84. package/tests/admin/Platform_Admin_StructureTest.res.mjs +219 -0
  85. package/tests/aggregate/AggregateCacheTest.res +0 -1
  86. package/tests/aggregate/AggregateCacheTest.res.mjs +13 -15
  87. package/tests/aggregate/AggregateConflictTest.res +0 -1
  88. package/tests/aggregate/AggregateConflictTest.res.mjs +7 -9
  89. package/tests/aggregate/AggregateFixtures.res +0 -1
  90. package/tests/aggregate/AggregateFixtures.res.mjs +19 -21
  91. package/tests/aggregate/AggregateSnapshotTest.res +1 -2
  92. package/tests/aggregate/AggregateSnapshotTest.res.mjs +15 -16
  93. package/tests/api/ApiNoApiTest.res.mjs +17 -9
  94. package/tests/api/GraphQL_FragmentGeneratorTest.res +62 -1
  95. package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +102 -58
  96. package/tests/api/PsInternalFieldsReadModel.res +21 -0
  97. package/tests/api/PsInternalFieldsReadModel.res.mjs +74 -0
  98. package/tests/api/StorageRefFieldsTest.res.mjs +13 -13
  99. package/tests/api/SuryToJsonSchemaTest.res +43 -0
  100. package/tests/api/SuryToJsonSchemaTest.res.mjs +352 -849
  101. package/tests/commandgenerator/CommandGeneratorFixtures.res +0 -1
  102. package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +19 -21
  103. package/tests/commandgenerator/OwnerStampingTest.res +0 -1
  104. package/tests/commandgenerator/OwnerStampingTest.res.mjs +9 -11
  105. package/tests/commandtopic/CommandTopicCallbackFixtures.res +0 -1
  106. package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +7 -9
  107. package/tests/counter/CounterFixtures.res +0 -1
  108. package/tests/counter/CounterFixtures.res.mjs +1 -4
  109. package/tests/dcb/DcbDecodeTest.res.mjs +24 -24
  110. package/tests/dcb/DcbEventLogOperationsTest.res +2 -2
  111. package/tests/dcb/DcbEventLogOperationsTest.res.mjs +3 -3
  112. package/tests/dcb/DcbEventLogSchemaTest.res.mjs +7 -7
  113. package/tests/dcb/DcbFixtures.res +0 -1
  114. package/tests/dcb/DcbFixtures.res.mjs +87 -89
  115. package/tests/dcb/DcbTagTest.res.mjs +6 -6
  116. package/tests/dcb/DcbValidationTest.res.mjs +52 -52
  117. package/tests/eventlog/EventLogFixtures.res +0 -1
  118. package/tests/eventlog/EventLogFixtures.res.mjs +7 -9
  119. package/tests/eventmapper/EventMapperFixtures.res +0 -1
  120. package/tests/eventmapper/EventMapperFixtures.res.mjs +24 -26
  121. package/tests/eventtopic/EventTopicFixtures.res +0 -1
  122. package/tests/eventtopic/EventTopicFixtures.res.mjs +7 -9
  123. package/tests/extensionpoint/ExtensionPointFixtures.res +0 -1
  124. package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +10 -12
  125. package/tests/extensionpoint/ExtensionPointOperationsTest.res +1 -2
  126. package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -10
  127. package/tests/logger/LogFormatTest.res +3 -2
  128. package/tests/logger/LogFormatTest.res.mjs +7 -9
  129. package/tests/message/MessageTest.res +2 -2
  130. package/tests/message/MessageTest.res.mjs +8 -7
  131. package/tests/message/MetaEnvelopeTest.res +5 -5
  132. package/tests/message/MetaEnvelopeTest.res.mjs +12 -11
  133. package/tests/plugin/ManifestVisibilityTest.res.mjs +7 -7
  134. package/tests/plugin/PluginDefinitionScalars.res +5 -3
  135. package/tests/plugin/PluginDefinitionScalars.res.mjs +2 -2
  136. package/tests/plugin/PluginLifecycleCorpusTest.res +4 -3
  137. package/tests/plugin/PluginLifecycleCorpusTest.res.mjs +3 -6
  138. package/tests/plugin/PluginSpecExperiment.res +0 -1
  139. package/tests/plugin/PluginSpecExperiment.res.mjs +12 -14
  140. package/tests/plugin/PluginStructureTest.res +188 -1
  141. package/tests/plugin/PluginStructureTest.res.mjs +293 -102
  142. package/tests/plugin/Plugin_EventQuerySchemaTest.res.mjs +3 -3
  143. package/tests/plugin/SchemaWalkerTest.res +0 -1
  144. package/tests/plugin/SchemaWalkerTest.res.mjs +17 -19
  145. package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +5 -5
  146. package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -8
  147. package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +5 -5
  148. package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +9 -9
  149. package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +5 -5
  150. package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -8
  151. package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +15 -15
  152. package/tests/plugin/StateChangeSlice/PsTypoStore.res +31 -0
  153. package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +62 -0
  154. package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -8
  155. package/tests/plugin/StateChangeSlice/PsUploadImages.res +40 -0
  156. package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +66 -0
  157. package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +13 -12
  158. package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +8 -8
  159. package/tests/plugin/StateViewSlice/PsCategoriesView.res.mjs +6 -6
  160. package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +10 -10
  161. package/tests/plugin/StateViewSlice/PsGatedView.res.mjs +6 -6
  162. package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +9 -9
  163. package/tests/plugin/StateViewSlice/PsShipmentsView.res.mjs +11 -10
  164. package/tests/plugin/pluginDefinitionRequiredScalars.txt +15 -0
  165. package/tests/querydb/QueryDbFixtures.res +0 -1
  166. package/tests/querydb/QueryDbFixtures.res.mjs +5 -7
  167. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +0 -1
  168. package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -6
  169. package/tests/util/CommandPublisherTest.res +0 -1
  170. package/tests/util/CommandPublisherTest.res.mjs +4 -6
@@ -1,107 +1,13 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as S from "sury/src/S.res.mjs";
4
- import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
5
- import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
6
- import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
7
- import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
8
- import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
9
3
  import * as Api_Naming$ReventlessCore from "../components/Api/Api_Naming.res.mjs";
10
4
  import * as PluginSpec$ReventlessCore from "../plugin/lifecycle/PluginSpec.res.mjs";
11
5
  import * as Plugin_Structure$ReventlessCore from "../plugin/component/Plugin_Structure.res.mjs";
12
- import * as SuryToJsonSchema$ReventlessCore from "../components/Api/SuryToJsonSchema.res.mjs";
13
- import * as PluginBaseFragment$ReventlessCore from "../plugin/api/PluginBaseFragment.res.mjs";
14
6
  import * as PluginsReadModelSpec$ReventlessCore from "../plugin/lifecycle/PluginsReadModelSpec.res.mjs";
15
7
 
16
8
  let pluginId = "Platform";
17
9
 
18
- function encodeSchema(schema) {
19
- return JSON.stringify(SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema));
20
- }
21
-
22
- function encodeSchemaExcluding(schema, excludeFields) {
23
- let derived = SuryToJsonSchema$ReventlessCore.deriveObjectSchema(schema);
24
- let obj = Stdlib_JSON.Decode.object(derived);
25
- if (obj === undefined) {
26
- return JSON.stringify(derived);
27
- }
28
- let props = Stdlib_Option.flatMap(obj["properties"], Stdlib_JSON.Decode.object);
29
- if (props === undefined) {
30
- return JSON.stringify(derived);
31
- }
32
- excludeFields.forEach(f => Stdlib_Dict.$$delete(props, f));
33
- obj["properties"] = props;
34
- let req = Stdlib_Option.flatMap(obj["required"], Stdlib_JSON.Decode.array);
35
- if (req !== undefined) {
36
- let filtered = Stdlib_Array.filterMap(req, Stdlib_JSON.Decode.string).filter(name => !excludeFields.includes(name)).map(prim => prim);
37
- obj["required"] = filtered;
38
- }
39
- return JSON.stringify(obj);
40
- }
41
-
42
- let idArgsSchema = S.schema(s => ({
43
- id: s.m(DcbTag$Reventless.string)
44
- }));
45
-
46
- let activateCommand_schema = encodeSchema(idArgsSchema);
47
-
48
- let activateCommand_aggregateIdField = "id";
49
-
50
- let activateCommand_mutationField = Api_Naming$ReventlessCore.adminField("Plugin_Activate");
51
-
52
- let activateCommand_references = [];
53
-
54
- let activateCommand_allowedStates = ["Inactive"];
55
-
56
- let activateCommand_apiExposed = true;
57
-
58
- let activateCommand = {
59
- name: "Activate",
60
- schema: activateCommand_schema,
61
- level: "Instance",
62
- aggregateIdField: activateCommand_aggregateIdField,
63
- mutationField: activateCommand_mutationField,
64
- references: activateCommand_references,
65
- allowedStates: activateCommand_allowedStates,
66
- targetState: undefined,
67
- apiExposed: activateCommand_apiExposed,
68
- requiredAccess: undefined,
69
- ownerField: undefined
70
- };
71
-
72
- let deactivateCommand_schema = encodeSchema(idArgsSchema);
73
-
74
- let deactivateCommand_aggregateIdField = "id";
75
-
76
- let deactivateCommand_mutationField = Api_Naming$ReventlessCore.adminField("Plugin_Deactivate");
77
-
78
- let deactivateCommand_references = [];
79
-
80
- let deactivateCommand_allowedStates = [
81
- "Connected",
82
- "Disconnected"
83
- ];
84
-
85
- let deactivateCommand_apiExposed = true;
86
-
87
- let deactivateCommand = {
88
- name: "Deactivate",
89
- schema: deactivateCommand_schema,
90
- level: "Instance",
91
- aggregateIdField: deactivateCommand_aggregateIdField,
92
- mutationField: deactivateCommand_mutationField,
93
- references: deactivateCommand_references,
94
- allowedStates: deactivateCommand_allowedStates,
95
- targetState: undefined,
96
- apiExposed: deactivateCommand_apiExposed,
97
- requiredAccess: undefined,
98
- ownerField: undefined
99
- };
100
-
101
- let pluginAggregate_commands = [
102
- activateCommand,
103
- deactivateCommand
104
- ];
10
+ let pluginCommands = Plugin_Structure$ReventlessCore.extractCommandDefs(true, variantName => Api_Naming$ReventlessCore.adminField(PluginSpec$ReventlessCore.name + "_" + variantName), PluginSpec$ReventlessCore.commandAuthorization, PluginSpec$ReventlessCore.commandSchema);
105
11
 
106
12
  let pluginAggregate_producedEventTypes = [];
107
13
 
@@ -115,7 +21,7 @@ let pluginAggregate_errors = Plugin_Structure$ReventlessCore.extractErrorDefs(Pl
115
21
 
116
22
  let pluginAggregate = {
117
23
  name: "Plugin",
118
- commands: pluginAggregate_commands,
24
+ commands: pluginCommands,
119
25
  producedEventTypes: pluginAggregate_producedEventTypes,
120
26
  consumedEventTypes: pluginAggregate_consumedEventTypes,
121
27
  linkedViews: pluginAggregate_linkedViews,
@@ -125,43 +31,7 @@ let pluginAggregate = {
125
31
  chapter: undefined
126
32
  };
127
33
 
128
- let pluginReadModel_queryField = Api_Naming$ReventlessCore.adminField("Plugins");
129
-
130
- let pluginReadModel_schema = encodeSchemaExcluding(PluginsReadModelSpec$ReventlessCore.stateSchema, PluginBaseFragment$ReventlessCore.pluginUIOnlyExcludeFields);
131
-
132
- let pluginReadModel_consumedEventTypes = [];
133
-
134
- let pluginReadModel_linkedWriteSide = ["Plugin"];
135
-
136
- let pluginReadModel_searchableFields = ["name"];
137
-
138
- let pluginReadModel_labelFieldSource = "convention";
139
-
140
- let pluginReadModel_lifecycleField = "status";
141
-
142
- let pluginReadModel_singleQueryField = Api_Naming$ReventlessCore.adminField("Plugin");
143
-
144
- let pluginReadModel = {
145
- name: "Plugins",
146
- queryField: pluginReadModel_queryField,
147
- schema: pluginReadModel_schema,
148
- consumedEventTypes: pluginReadModel_consumedEventTypes,
149
- linkedWriteSide: pluginReadModel_linkedWriteSide,
150
- labelField: "name",
151
- searchableFields: pluginReadModel_searchableFields,
152
- labelFieldSource: pluginReadModel_labelFieldSource,
153
- lifecycleField: pluginReadModel_lifecycleField,
154
- ownerField: undefined,
155
- retiredField: undefined,
156
- retiredValues: undefined,
157
- namedWhenRetired: undefined,
158
- visibility: undefined,
159
- chapter: undefined,
160
- singleQueryField: pluginReadModel_singleQueryField,
161
- idField: undefined,
162
- idFieldSource: undefined,
163
- requiredAccess: undefined
164
- };
34
+ let pluginReadModel = Plugin_Structure$ReventlessCore.queryableDefFromSpec(pluginId, PluginsReadModelSpec$ReventlessCore.name, PluginsReadModelSpec$ReventlessCore.stateSchema, PluginsReadModelSpec$ReventlessCore.authorization, undefined, undefined, ["Plugin"], undefined);
165
35
 
166
36
  let structure_readModels = [pluginReadModel];
167
37
 
@@ -195,16 +65,15 @@ let structure = {
195
65
 
196
66
  let pluginName = pluginId;
197
67
 
68
+ let commandSchema = PluginSpec$ReventlessCore.commandSchema;
69
+
198
70
  export {
199
71
  pluginId,
200
72
  pluginName,
201
- encodeSchema,
202
- encodeSchemaExcluding,
203
- idArgsSchema,
204
- activateCommand,
205
- deactivateCommand,
73
+ commandSchema,
74
+ pluginCommands,
206
75
  pluginAggregate,
207
76
  pluginReadModel,
208
77
  structure,
209
78
  }
210
- /* idArgsSchema Not a pure module */
79
+ /* pluginCommands Not a pure module */
@@ -1,40 +1,40 @@
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 DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
5
5
  import * as Plugin$Reventless from "@reventlessdev/reventless-spec/src/components/Plugin.res.mjs";
6
6
  import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
7
7
 
8
- let commandSchema = S.union([
9
- S.schema(s => ({
8
+ let commandSchema = Sury.union([
9
+ Sury.$schema(s => ({
10
10
  TAG: "RegisterUiFragment",
11
11
  pluginId: s.m(DcbTag$Reventless.string),
12
12
  manifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
13
- at: s.m(S.string)
13
+ at: s.m(Sury.string)
14
14
  })),
15
- S.schema(s => ({
15
+ Sury.$schema(s => ({
16
16
  TAG: "DeregisterUiFragment",
17
17
  pluginId: s.m(DcbTag$Reventless.string)
18
18
  }))
19
19
  ]);
20
20
 
21
- let errorSchema = S.literal("RegistryError");
21
+ let errorSchema = Sury.literal("RegistryError");
22
22
 
23
- let eventSchema = S.union([
24
- S.schema(s => ({
23
+ let eventSchema = Sury.union([
24
+ Sury.$schema(s => ({
25
25
  TAG: "UiFragmentRegistered",
26
26
  pluginId: s.m(DcbTag$Reventless.string),
27
27
  manifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
28
- at: s.m(S.string)
28
+ at: s.m(Sury.string)
29
29
  })),
30
- S.schema(s => ({
30
+ Sury.$schema(s => ({
31
31
  TAG: "UiFragmentUpdated",
32
32
  pluginId: s.m(DcbTag$Reventless.string),
33
33
  previousManifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
34
34
  newManifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
35
- at: s.m(S.string)
35
+ at: s.m(Sury.string)
36
36
  })),
37
- S.schema(s => ({
37
+ Sury.$schema(s => ({
38
38
  TAG: "UiFragmentDeregistered",
39
39
  pluginId: s.m(DcbTag$Reventless.string)
40
40
  }))
@@ -1,34 +1,34 @@
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 DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
5
5
  import * as Plugin$Reventless from "@reventlessdev/reventless-spec/src/components/Plugin.res.mjs";
6
6
  import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
7
7
 
8
- let stateSchema = S.schema(s => ({
9
- pluginId: s.m(S.string),
10
- remoteEntryUrl: s.m(S.string),
11
- panels: s.m(S.array(Plugin$Reventless.panelManifestEntrySchema)),
12
- pages: s.m(S.array(Plugin$Reventless.pageManifestEntrySchema)),
13
- registeredAt: s.m(S.string),
14
- updatedAt: s.m(S.string)
8
+ let stateSchema = Sury.$schema(s => ({
9
+ pluginId: s.m(Sury.string),
10
+ remoteEntryUrl: s.m(Sury.string),
11
+ panels: s.m(Sury.array(Plugin$Reventless.panelManifestEntrySchema)),
12
+ pages: s.m(Sury.array(Plugin$Reventless.pageManifestEntrySchema)),
13
+ registeredAt: s.m(Sury.string),
14
+ updatedAt: s.m(Sury.string)
15
15
  }));
16
16
 
17
- let consumedEventSchema = S.union([
18
- S.schema(s => ({
17
+ let consumedEventSchema = Sury.union([
18
+ Sury.$schema(s => ({
19
19
  TAG: "UiFragmentRegistered",
20
20
  pluginId: s.m(DcbTag$Reventless.string),
21
21
  manifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
22
- at: s.m(S.string)
22
+ at: s.m(Sury.string)
23
23
  })),
24
- S.schema(s => ({
24
+ Sury.$schema(s => ({
25
25
  TAG: "UiFragmentUpdated",
26
26
  pluginId: s.m(DcbTag$Reventless.string),
27
27
  previousManifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
28
28
  newManifest: s.m(Plugin$Reventless.uiFragmentManifestSchema),
29
- at: s.m(S.string)
29
+ at: s.m(Sury.string)
30
30
  })),
31
- S.schema(s => ({
31
+ Sury.$schema(s => ({
32
32
  TAG: "UiFragmentDeregistered",
33
33
  pluginId: s.m(DcbTag$Reventless.string)
34
34
  }))
@@ -153,7 +153,7 @@ module Make = (
153
153
  let encodeState = (state: Behavior.state): option<JSON.t> =>
154
154
  switch snapshotConfig {
155
155
  | Some({stateSchema}) =>
156
- switch state->S.reverseConvertToJsonOrThrow(stateSchema) {
156
+ switch state->Reventless.Util_Sury.toJson(stateSchema) {
157
157
  | json => Some(json)
158
158
  | exception _ => None
159
159
  }
@@ -163,7 +163,7 @@ module Make = (
163
163
  let decodeState = (json: JSON.t): option<Behavior.state> =>
164
164
  switch snapshotConfig {
165
165
  | Some({stateSchema}) =>
166
- switch json->S.parseJsonOrThrow(stateSchema) {
166
+ switch json->Reventless.Util_Sury.fromJson(stateSchema) {
167
167
  | state => Some(state)
168
168
  | exception _ => None
169
169
  }
@@ -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 HashObject from "hash-object";
5
4
  import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
6
5
  import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
@@ -11,6 +10,7 @@ import * as Stream from "effect/Stream";
11
10
  import * as Stdlib_Promise from "@rescript/runtime/lib/es6/Stdlib_Promise.js";
12
11
  import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
13
12
  import * as Lru$ReventlessCore from "../../util/Lru.res.mjs";
13
+ import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
14
14
  import * as Message$ReventlessCore from "../../Message.res.mjs";
15
15
  import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
16
16
  import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
@@ -87,7 +87,7 @@ function Make(Spec) {
87
87
  }
88
88
  let json;
89
89
  try {
90
- json = S.reverseConvertToJsonOrThrow(state, snapshotConfig.stateSchema);
90
+ json = Util_Sury$Reventless.toJson(state, snapshotConfig.stateSchema);
91
91
  } catch (exn) {
92
92
  return;
93
93
  }
@@ -99,7 +99,7 @@ function Make(Spec) {
99
99
  }
100
100
  let state;
101
101
  try {
102
- state = S.parseJsonOrThrow(json, snapshotConfig.stateSchema);
102
+ state = Util_Sury$Reventless.fromJson(json, snapshotConfig.stateSchema);
103
103
  } catch (exn) {
104
104
  return;
105
105
  }
@@ -356,4 +356,4 @@ function Make(Spec) {
356
356
  export {
357
357
  Make,
358
358
  }
359
- /* S Not a pure module */
359
+ /* hash-object Not a pure module */
@@ -1,10 +1,10 @@
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 Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
5
5
 
6
6
  function getAllowedStates(commandSchema, variantName) {
7
- let entries = S.Metadata.get(commandSchema, Api$ReventlessInfra.allowedStatesId);
7
+ let entries = Sury.$Metadata_get(commandSchema, Api$ReventlessInfra.allowedStatesId);
8
8
  if (entries !== undefined) {
9
9
  return entries[variantName];
10
10
  }
@@ -13,4 +13,4 @@ function getAllowedStates(commandSchema, variantName) {
13
13
  export {
14
14
  getAllowedStates,
15
15
  }
16
- /* S Not a pure module */
16
+ /* sury Not a pure module */
@@ -1,19 +1,19 @@
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 Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
6
6
 
7
7
  function isNoApi(commandSchema) {
8
- return Stdlib_Option.getOr(S.Metadata.get(commandSchema, Api$ReventlessInfra.noApiId), false);
8
+ return Stdlib_Option.getOr(Sury.$Metadata_get(commandSchema, Api$ReventlessInfra.noApiId), false);
9
9
  }
10
10
 
11
11
  function getExcludedVariants(commandSchema) {
12
- return S.Metadata.get(commandSchema, Api$ReventlessInfra.noApiVariantsId);
12
+ return Sury.$Metadata_get(commandSchema, Api$ReventlessInfra.noApiVariantsId);
13
13
  }
14
14
 
15
15
  function filterNoApiVariants(fieldNames, commandSchema) {
16
- let excluded = S.Metadata.get(commandSchema, Api$ReventlessInfra.noApiVariantsId);
16
+ let excluded = Sury.$Metadata_get(commandSchema, Api$ReventlessInfra.noApiVariantsId);
17
17
  if (excluded !== undefined) {
18
18
  return fieldNames.filter(name => !excluded.has(name));
19
19
  } else {
@@ -26,4 +26,4 @@ export {
26
26
  getExcludedVariants,
27
27
  filterNoApiVariants,
28
28
  }
29
- /* S Not a pure module */
29
+ /* sury Not a pure module */
@@ -1,10 +1,10 @@
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 Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
5
5
 
6
6
  function getTargetState(commandSchema, variantName) {
7
- let entries = S.Metadata.get(commandSchema, Api$ReventlessInfra.targetStateId);
7
+ let entries = Sury.$Metadata_get(commandSchema, Api$ReventlessInfra.targetStateId);
8
8
  if (entries !== undefined) {
9
9
  return entries[variantName];
10
10
  }
@@ -13,4 +13,4 @@ function getTargetState(commandSchema, variantName) {
13
13
  export {
14
14
  getTargetState,
15
15
  }
16
- /* S Not a pure module */
16
+ /* sury Not a pure module */
@@ -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]);