@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
@@ -7,9 +7,11 @@
7
7
  // never seeds them into pluginStructuresStore — so the host shell's Auto UI
8
8
  // has no metadata for the admin plugin and renders nothing for it.
9
9
  //
10
- // This module produces an equivalent structure by hand using the same field
11
- // naming conventions (Api_Naming.adminField) and the mutation arg schemas
12
- // from PluginBaseFragment.
10
+ // This module assembles the equivalent structure from `PluginSpec` /
11
+ // `PluginsReadModelSpec` directly, through the same module-level extractors
12
+ // `make` uses for every ordinary plugin. It cannot call `make` itself — the
13
+ // platform has no `module(Aggregate.T)` to hand it at structure-assembly time —
14
+ // but the extractors take schemas, which is all this needs.
13
15
 
14
16
  open Reventless.Plugin
15
17
 
@@ -17,86 +19,31 @@ let pluginId = "Platform"
17
19
 
18
20
  let pluginName = pluginId
19
21
 
20
- let encodeSchema = (schema: S.t<unknown>): string =>
21
- schema->SuryToJsonSchema.deriveObjectSchema->JSON.stringify
22
+ let commandSchema = PluginSpec.commandSchema->S.castToUnknown
22
23
 
23
- // Strip the named fields from a derived JSON schema's `properties` map and
24
- // `required` list. Used so Plugin read model metadata announced via
25
- // `Platform_ComponentDefinitions` matches the SDL — fields excluded from the GraphQL
26
- // schema in `PluginBaseFragment` must also disappear from the schema string
27
- // AutoUI consumes, or list-view queries will reference non-existent fields.
28
- let encodeSchemaExcluding = (schema: S.t<unknown>, ~excludeFields: array<string>): string => {
29
- let derived = schema->SuryToJsonSchema.deriveObjectSchema
30
- switch derived->JSON.Decode.object {
31
- | None => derived->JSON.stringify
32
- | Some(obj) =>
33
- switch obj->Dict.get("properties")->Option.flatMap(JSON.Decode.object) {
34
- | None => derived->JSON.stringify
35
- | Some(props) =>
36
- excludeFields->Array.forEach(f => props->Dict.delete(f))
37
- obj->Dict.set("properties", props->JSON.Encode.object)
38
- switch obj->Dict.get("required")->Option.flatMap(JSON.Decode.array) {
39
- | None => ()
40
- | Some(req) =>
41
- let filtered =
42
- req
43
- ->Array.filterMap(JSON.Decode.string)
44
- ->Array.filter(name => !(excludeFields->Array.includes(name)))
45
- ->Array.map(JSON.Encode.string)
46
- ->JSON.Encode.array
47
- obj->Dict.set("required", filtered)
48
- }
49
- obj->JSON.Encode.object->JSON.stringify
50
- }
51
- }
52
- }
53
-
54
- // Args schema for the synthetic Auto UI metadata. Activate/Deactivate are payload-less
55
- // `PluginSpec.command` variants on the wire — the auto-resolver flow injects `id: ID!`.
56
- // Keep a local schema here so Auto UI's command-form metadata stays accurate.
57
- @schema
58
- type idArgs = {id: @s.matches(Reventless.DcbTag.string) string}
59
-
60
- // `aggregateIdField: Some("id")` pre-fills the form's `id` input from the
61
- // selected list row. The auto-codegen path would emit this for any
62
- // Instance-level command whose schema has a DCB-tagged id field; the
63
- // hand-rolled definitions below have to mirror that.
64
-
65
- // `allowedStates` mirrors the PluginBehavior accept/reject branches: Activate
66
- // is meaningful only on Inactive plugins; Deactivate is meaningful on
67
- // Connected or Disconnected ones. Strings here must match the variant
68
- // constructor names that PluginsReadModelSpec.status serialises to.
69
- let activateCommand: commandDef = {
70
- name: "Activate",
71
- schema: idArgsSchema->S.castToUnknown->encodeSchema,
72
- level: Instance,
73
- aggregateIdField: Some("id"),
74
- mutationField: Api_Naming.adminField(~name="Plugin_Activate"),
75
- references: [],
76
- allowedStates: Some(["Inactive"]),
77
- targetState: None,
78
- apiExposed: Some(true),
79
- requiredAccess: None,
80
- ownerField: None,
81
- }
82
-
83
- let deactivateCommand: commandDef = {
84
- name: "Deactivate",
85
- schema: idArgsSchema->S.castToUnknown->encodeSchema,
86
- level: Instance,
87
- aggregateIdField: Some("id"),
88
- mutationField: Api_Naming.adminField(~name="Plugin_Deactivate"),
89
- references: [],
90
- allowedStates: Some(["Connected", "Disconnected"]),
91
- targetState: None,
92
- apiExposed: Some(true),
93
- requiredAccess: None,
94
- ownerField: None,
95
- }
24
+ // Every variant of `PluginSpec.command`, walked by the same `extractCommandDefs`
25
+ // an ordinary aggregate goes through. The hand-written alternative described the
26
+ // arguments with a local `{id}` schema while the generated SDL declared
27
+ // `Platform_Plugin_Activate(_0: String!, id: ID!)`, so AutoUI built a mutation
28
+ // missing a required argument and every admin row action was rejected before it
29
+ // reached the aggregate. Deriving from `commandSchema` — the same schema the SDL
30
+ // is generated from — cannot reproduce that class of fault.
31
+ //
32
+ // `mutationFieldFor` is composed the way `PluginBaseFragment` composes the field
33
+ // it generates, so the two cannot name it differently. The `@noApi` protocol
34
+ // variants come back too, carrying `apiExposed: false` and the empty
35
+ // `mutationField` sentinel: metadata about an edge, not a way to invoke it.
36
+ let pluginCommands: array<commandDef> = Plugin_Structure.extractCommandDefs(
37
+ ~isAggregate=true,
38
+ ~mutationFieldFor=variantName =>
39
+ Api_Naming.adminField(~name=PluginSpec.name ++ "_" ++ variantName),
40
+ ~commandAuthorization=PluginSpec.commandAuthorization->Obj.magic,
41
+ commandSchema,
42
+ )
96
43
 
97
44
  let pluginAggregate: writableDef = {
98
45
  name: "Plugin",
99
- commands: [activateCommand, deactivateCommand],
46
+ commands: pluginCommands,
100
47
  producedEventTypes: [],
101
48
  consumedEventTypes: [],
102
49
  linkedViews: ["Plugins"],
@@ -109,40 +56,13 @@ let pluginAggregate: writableDef = {
109
56
  chapter: None,
110
57
  }
111
58
 
112
- let pluginReadModel: queryableDef = {
113
- name: "Plugins",
114
- queryField: Api_Naming.adminField(~name="Plugins"),
115
- schema: PluginsReadModelSpec.stateSchema
116
- ->S.castToUnknown
117
- ->encodeSchemaExcluding(~excludeFields=PluginBaseFragment.pluginUIOnlyExcludeFields),
118
- consumedEventTypes: [],
119
- linkedWriteSide: ["Plugin"],
120
- labelField: "name",
121
- searchableFields: ["name"],
122
- // Hand-rolled rather than resolved, but the rung is the same one
123
- // `labelFieldsFromStateSchema` would report for a field literally named `name`.
124
- labelFieldSource: Some("convention"),
125
- // The published wire name stays `status` — it is what the SDL declares and what
126
- // stored rows carry. Only the key naming it moved.
127
- lifecycleField: Some("status"),
128
- visibility: None,
129
- chapter: None,
130
- // The admin fragment hand-declares its query names rather than deriving them from
131
- // the read-model name, so the singular is taken from the same call
132
- // `PluginBaseFragment.queryNames.singleFieldName` makes — not singularised here.
133
- singleQueryField: Some(Api_Naming.adminField(~name="Plugin")),
134
- // No key field to name: the row id is `name@version` (`Plugin.makeId`), and the
135
- // state carries the two halves separately rather than the composed key. `None`
136
- // is the honest answer — the same one the resolver ladder reaches for a state
137
- // with no `*Id` field.
138
- idField: None,
139
- idFieldSource: None,
140
- requiredAccess: None,
141
- ownerField: None,
142
- retiredField: None,
143
- retiredValues: None,
144
- namedWhenRetired: None,
145
- }
59
+ let pluginReadModel: queryableDef = Plugin_Structure.queryableDefFromSpec(
60
+ ~plugin=pluginId,
61
+ ~name=PluginsReadModelSpec.name,
62
+ ~stateSchema=PluginsReadModelSpec.stateSchema->S.castToUnknown,
63
+ ~authorization=PluginsReadModelSpec.authorization,
64
+ ~linkedWriteSide=["Plugin"],
65
+ )
146
66
 
147
67
  let structure: pluginStructure = {
148
68
  readModels: [pluginReadModel],
@@ -157,3 +77,28 @@ let structure: pluginStructure = {
157
77
  requiredStores: None,
158
78
  requiredStoreDeclarations: None,
159
79
  }
80
+
81
+ /** The definition the platform's own EventCollector ships as its
82
+ `pluginDefinition.json` asset, and hands to `Platform_Admin_Callback`.
83
+
84
+ The admin IS the Plugin extension point, so it never travels the connect
85
+ handshake and every field here is a placeholder. The asset is still read back
86
+ on the same path as every other plugin's, so it is declared as a value and
87
+ encoded through `pluginDefinitionSchema` at both sites rather than written out
88
+ as JSON: the hand-written twin that used to live in the AWS builder predated
89
+ `dcbEventLog` and `kind` and silently stopped matching the schema, which only
90
+ surfaced once the read side decoded instead of casting. */
91
+ let internalPluginDefinition: pluginDefinition = {
92
+ id: pluginId ++ "@INTERNAL",
93
+ name: pluginId,
94
+ version: "INTERNAL",
95
+ extensionPoints: [],
96
+ extensions: [],
97
+ eventCollector: "NOT-SET",
98
+ extensionProtocols: [],
99
+ apiSchemaFragment: None,
100
+ apiTarget: None,
101
+ structure: None,
102
+ dcbEventLog: None,
103
+ kind: Domain,
104
+ }
@@ -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
 
@@ -193,18 +63,33 @@ let structure = {
193
63
  requiredStoreDeclarations: undefined
194
64
  };
195
65
 
66
+ let internalPluginDefinition = {
67
+ id: pluginId + "@INTERNAL",
68
+ name: pluginId,
69
+ version: "INTERNAL",
70
+ extensionPoints: [],
71
+ extensions: [],
72
+ eventCollector: "NOT-SET",
73
+ extensionProtocols: [],
74
+ apiSchemaFragment: undefined,
75
+ apiTarget: undefined,
76
+ structure: undefined,
77
+ dcbEventLog: undefined,
78
+ kind: "Domain"
79
+ };
80
+
196
81
  let pluginName = pluginId;
197
82
 
83
+ let commandSchema = PluginSpec$ReventlessCore.commandSchema;
84
+
198
85
  export {
199
86
  pluginId,
200
87
  pluginName,
201
- encodeSchema,
202
- encodeSchemaExcluding,
203
- idArgsSchema,
204
- activateCommand,
205
- deactivateCommand,
88
+ commandSchema,
89
+ pluginCommands,
206
90
  pluginAggregate,
207
91
  pluginReadModel,
208
92
  structure,
93
+ internalPluginDefinition,
209
94
  }
210
- /* idArgsSchema Not a pure module */
95
+ /* 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 */