@reventlessdev/reventless-core 3.0.0-alpha.156 → 3.0.0-alpha.158

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 (74) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +6 -6
  3. package/src/admin/AdminApi.res +80 -10
  4. package/src/admin/AdminApi.res.mjs +45 -7
  5. package/src/admin/ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry.res +65 -0
  6. package/src/admin/ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry.res.mjs +87 -0
  7. package/src/admin/ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry_Behavior.res +58 -0
  8. package/src/admin/ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry_Behavior.res.mjs +135 -0
  9. package/src/admin/ApiFragmentRegistry/StateViewSlice/ApiFragments.res +44 -0
  10. package/src/admin/ApiFragmentRegistry/StateViewSlice/ApiFragments.res.mjs +74 -0
  11. package/src/admin/ApiFragmentRegistry/StateViewSlice/ApiFragments_Projection.res +50 -0
  12. package/src/admin/ApiFragmentRegistry/StateViewSlice/ApiFragments_Projection.res.mjs +80 -0
  13. package/src/admin/Platform_Admin.res +46 -1
  14. package/src/admin/Platform_Admin.res.mjs +20 -6
  15. package/src/admin/Platform_ApiFragmentsApi.res +32 -0
  16. package/src/admin/Platform_ApiFragmentsApi.res.mjs +52 -0
  17. package/src/admin/Platform_UIFragmentsApi.res +1 -1
  18. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res +50 -0
  19. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +70 -0
  20. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry_Behavior.res +33 -0
  21. package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry_Behavior.res.mjs +80 -0
  22. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res +33 -0
  23. package/src/admin/{UIFragmentRegistryReadModelSpec.res.mjs → UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs} +24 -2
  24. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments_Projection.res +34 -0
  25. package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments_Projection.res.mjs +54 -0
  26. package/src/components/Api/Api_Naming.res +1 -1
  27. package/src/components/Api/GraphQL_FragmentGenerator.res +7 -11
  28. package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +8 -22
  29. package/src/components/Api/GraphQL_PushPlanner.res +65 -0
  30. package/src/components/Api/GraphQL_PushPlanner.res.mjs +46 -0
  31. package/src/components/Api/GraphQL_Stitcher.res +72 -1
  32. package/src/components/Api/GraphQL_Stitcher.res.mjs +53 -2
  33. package/src/components/Dcb/Dcb_Builder.res +16 -6
  34. package/src/components/Dcb/Dcb_Builder.res.mjs +10 -7
  35. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +6 -1
  36. package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +1 -1
  37. package/src/plugin/api/PluginBaseFragment.res +5 -6
  38. package/src/plugin/api/PluginBaseFragment.res.mjs +0 -1
  39. package/src/plugin/component/Plugin_Builder.res +4 -1
  40. package/src/plugin/component/Plugin_Builder.res.mjs +7 -6
  41. package/src/plugin/component/Plugin_Helpers.res +30 -0
  42. package/src/plugin/component/Plugin_Helpers.res.mjs +13 -3
  43. package/src/plugin/component/Plugin_SubscriptionSchema.res +19 -9
  44. package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +23 -14
  45. package/src/plugin/connect/PluginConnectExtension_Mapping.res +28 -6
  46. package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +34 -14
  47. package/src/plugin/connect/PluginExtensionPoint_Builder.res +7 -1
  48. package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +5 -1
  49. package/src/plugin/connect/PluginExtensionPoint_Plugin.res +3 -1
  50. package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +4 -2
  51. package/src/plugin/connect/PluginExtensionPoint_UiFragment.res +52 -0
  52. package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +74 -0
  53. package/src/plugin/lifecycle/PluginBehavior.res +9 -51
  54. package/src/plugin/lifecycle/PluginBehavior.res.mjs +39 -68
  55. package/src/plugin/lifecycle/PluginSpec.res +0 -18
  56. package/src/plugin/lifecycle/PluginSpec.res.mjs +0 -30
  57. package/src/plugin/lifecycle/PluginsProjection.res +2 -6
  58. package/src/plugin/lifecycle/PluginsProjection.res.mjs +0 -2
  59. package/src/plugin/lifecycle/PluginsReadModelSpec.res +0 -2
  60. package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +0 -1
  61. package/tests/admin/Platform_ApiFragmentsApiTest.res +66 -0
  62. package/tests/admin/Platform_ApiFragmentsApiTest.res.mjs +68 -0
  63. package/tests/admin/Platform_UIFragmentsApiTest.res +1 -1
  64. package/tests/api/GraphQL_PushPlannerTest.res +62 -0
  65. package/tests/api/GraphQL_PushPlannerTest.res.mjs +80 -0
  66. package/tests/api/GraphQL_StitcherTest.res +63 -0
  67. package/tests/api/GraphQL_StitcherTest.res.mjs +75 -0
  68. package/tests/logger/LogFormatTest.res +1 -2
  69. package/tests/logger/LogFormatTest.res.mjs +1 -2
  70. package/tests/message/MessageTest.res +0 -3
  71. package/tests/message/MessageTest.res.mjs +0 -3
  72. package/src/admin/UIFragmentRegistryProjection.res +0 -43
  73. package/src/admin/UIFragmentRegistryProjection.res.mjs +0 -81
  74. package/src/admin/UIFragmentRegistryReadModelSpec.res +0 -13
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.158 (2026-07-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **deploy:** gate admin status-query resolvers on the schema push ([2634694](https://github.com/ReventlessDev/reventless-core/commit/2634694b3a122bc1db44d129769f5442e124d9b7))
11
+
12
+
13
+ # 3.0.0-alpha.157 (2026-07-12)
14
+
15
+ ### Features
16
+
17
+ * **admin:** event-source the API fragment registry as admin DCB slices (Phase 2b) ([3fc40d2](https://github.com/ReventlessDev/reventless-core/commit/3fc40d247c54bf66ed84d625959f08299aa04a98))
18
+ * **admin:** event-source the UI fragment registry as admin DCB slices ([711581e](https://github.com/ReventlessDev/reventless-core/commit/711581e77c626e7d0fc35db8ec351f62a70bd8f2))
19
+ * **admin:** expose the API fragment registry as system-callable mutations (Phase 2d) ([8b1ec49](https://github.com/ReventlessDev/reventless-core/commit/8b1ec49813e67f303bc86d60470c9b95d2a8408e))
20
+ * **admin:** make the API fragment registry per-target (Domain | Platform) ([30491a9](https://github.com/ReventlessDev/reventless-core/commit/30491a9e14b4236c98cc756efb6de68ede1e77d7))
21
+ * **admin:** populate the API fragment registry on connect + status query (Phase 2c) ([106d96c](https://github.com/ReventlessDev/reventless-core/commit/106d96c904e135f8360d53e582f395c107db704a))
22
+ * **admin:** react to ApiFragment* events with a schema single writer (Phase 2e) ([59f9e46](https://github.com/ReventlessDev/reventless-core/commit/59f9e46c154d8ca2a34537974722014fc279de3e))
23
+ * **admin:** retire the Plugin-aggregate UI-fragment path in favour of the registry slices ([1dbc708](https://github.com/ReventlessDev/reventless-core/commit/1dbc708e7439b34ff970cc3d963d7835a8c6fd48))
24
+ * **admin:** serve Platform_UIFragments from the new UiFragmentRegistry slices ([7a47533](https://github.com/ReventlessDev/reventless-core/commit/7a47533acc95977fbeeb6375e94449056b655abc))
25
+ * **api:** neutralize core-emitted SDL — [@aws](https://github.com/aws)_subscribe moves to the AWS adapter (Phase 2a) ([9b27ec8](https://github.com/ReventlessDev/reventless-core/commit/9b27ec8f6ab2b7453b1c50b9891e89781ec3b31a))
26
+
27
+
6
28
  # 3.0.0-alpha.156 (2026-07-11)
7
29
 
8
30
  **Note:** Version bump only for package @reventlessdev/reventless-core
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-core",
3
- "version": "3.0.0-alpha.156",
3
+ "version": "3.0.0-alpha.158",
4
4
  "description": "Core package for Reventless framework",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -31,14 +31,14 @@
31
31
  "@reventlessdev/rescript-effect": "0.1.0-alpha.27",
32
32
  "@reventlessdev/rescript-fast-csv": "1.2.0-alpha.12",
33
33
  "@reventlessdev/rescript-hash-object": "1.2.0-alpha.11",
34
- "@reventlessdev/rescript-node-streams": "1.1.0-alpha.11",
35
34
  "@reventlessdev/rescript-jest": "1.0.0-alpha.7",
36
- "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.15",
35
+ "@reventlessdev/rescript-node-streams": "1.1.0-alpha.11",
37
36
  "@reventlessdev/rescript-ssh2": "1.1.0-alpha.12",
38
37
  "@reventlessdev/rescript-uuid": "1.1.0-alpha.15",
39
- "@reventlessdev/reventless-infra": "3.0.0-alpha.97",
40
- "@reventlessdev/reventless-spec": "3.0.0-alpha.75",
41
- "@reventlessdev/reventless-interop": "3.0.0-alpha.26"
38
+ "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.15",
39
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.98",
40
+ "@reventlessdev/reventless-interop": "3.0.0-alpha.26",
41
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.76"
42
42
  },
43
43
  "devDependencies": {
44
44
  "rescript": "^12.3.0",
@@ -25,9 +25,55 @@ let mutationEntries = (~cloner: bool) => {
25
25
 
26
26
  let queryEntries = PluginBaseFragment.queryEntries
27
27
 
28
+ // ApiFragmentRegistry admin mutations — the real GraphQL surface of the ApiFragmentRegistry
29
+ // StateChangeSlice: the plugin / standalone-service deploy calls `Platform_RegisterApiFragment` /
30
+ // `Platform_DeregisterApiFragment` as a SigV4 system caller. Field names + arg SDL + the nested
31
+ // `fragment` input type are derived from the slice's `commandSchema` via the SAME
32
+ // `Api_Naming.sliceMutationFields` (admin "Platform" prefix) + `GraphQL_FragmentGenerator` path
33
+ // that the DCB builder uses, so the field declared here in the STATIC admin base is byte-identical
34
+ // to the one the DCB resolver binds to (`RecordApiFragmentPush` is `@noApi`, filtered out).
35
+ //
36
+ // These live in `baseFragment` ONLY, never in the shared `mutationEntries`: only the static base is
37
+ // pushed to AppSync (`Platform.res` preAdminResolversSchemaHook), whereas the constructed admin
38
+ // fragment (`Platform_Admin.construct`) already carries them via `dcbResult.mutationEntries`. Adding
39
+ // them to `mutationEntries` — which feeds both — would duplicate the fields in the constructed
40
+ // fragment. They are folded into `baseFragment`'s own `generate` call (not a separate one) so its
41
+ // shared `seenTypes` dedups the shared `CommandResult` type family instead of re-emitting it.
42
+ let apiFragmentRegistryMutationEntries: array<mutationSchemaEntry> = {
43
+ let commandSchema = ApiFragmentRegistry.commandSchema->S.castToUnknown
44
+ let fieldSpecs = Api_Naming.sliceMutationFields(
45
+ ~plugin="Platform",
46
+ ~slice=ApiFragmentRegistry.name,
47
+ ~commandSchema,
48
+ )
49
+ if fieldSpecs->Array.length === 0 {
50
+ []
51
+ } else {
52
+ [
53
+ {
54
+ ReventlessInfra.Api.fieldNames: fieldSpecs->Array.map(((f, _)) => f),
55
+ commandSchema,
56
+ },
57
+ ]
58
+ }
59
+ }
60
+
61
+ // Admin fields a deploy-time system caller (machine credentials — SigV4/IAM on AWS) invokes: the
62
+ // two ApiFragmentRegistry mutations (the deploy's register/deregister write path) and
63
+ // `Platform_ApiFragments` (the deploy waiter's push-status poll). Provider-neutral by design — the
64
+ // AWS adapter threads these into `injectAwsAuthAll`'s `~iamFieldNames` so only these fields carry
65
+ // the dual-auth (`@aws_cognito_user_pools @aws_iam`) directive; every other admin field stays
66
+ // Cognito-only. Derived from the same mutation entries so the names never drift from the SDL.
67
+ let systemCallerFieldNames =
68
+ apiFragmentRegistryMutationEntries
69
+ ->Array.flatMap(e => e.fieldNames)
70
+ ->Array.concat([Platform_ApiFragmentsApi.queryFieldName])
71
+
28
72
  // UIFragment lifecycle Source C subscriptions.
29
- // Mutations are called by the backend when UIFragment events occur;
30
- // AppSync routes via @aws_subscribe to onUIFragmentChange subscribers.
73
+ // Mutations are called by the backend when UIFragment events occur; the
74
+ // subscription→mutation fan-in is carried as neutral `subscriptionSource`
75
+ // metadata (providers add their own routing — AppSync via `@aws_subscribe`
76
+ // appended at push time, the local platform via its PubSub bridge).
31
77
  // manifest is serialised as a JSON string (String scalar, not AWSJSON).
32
78
 
33
79
  let uiFragmentSubscriptionTypes = [
@@ -41,12 +87,21 @@ let uiFragmentMutationFields = [
41
87
  ` Platform_UIFragmentDeregistered(pluginId: ID!): UIFragmentChangeEvent`,
42
88
  ]
43
89
 
44
- let uiFragmentSubscriptionField = ` onUIFragmentChange: UIFragmentChangeEvent\n @aws_subscribe(mutations: ["Platform_UIFragmentRegistered", "Platform_UIFragmentUpdated", "Platform_UIFragmentDeregistered"])`
90
+ let uiFragmentSubscriptionField = ` onUIFragmentChange: UIFragmentChangeEvent`
91
+
92
+ let uiFragmentSubscriptionSource: GraphQL_Stitcher.subscriptionSource = {
93
+ field: "onUIFragmentChange",
94
+ mutations: [
95
+ "Platform_UIFragmentRegistered",
96
+ "Platform_UIFragmentUpdated",
97
+ "Platform_UIFragmentDeregistered",
98
+ ],
99
+ }
45
100
 
46
101
  // Plugin lifecycle Source C subscription. Mirrors the UIFragment pattern: the
47
102
  // platform invokes `Platform_PluginStatusChanged` after writing the new status
48
- // to the Plugin read model; AppSync routes that mutation via `@aws_subscribe`
49
- // to live `onPluginStatusChange` subscribers (host shell). The status enum
103
+ // to the Plugin read model; the provider routes that mutation to live
104
+ // `onPluginStatusChange` subscribers (host shell). The status enum
50
105
  // matches `PluginsReadModelSpec.status` so consumers can mirror tier 1 / tier 2
51
106
  // transitions exactly.
52
107
  let pluginStatusSubscriptionTypes = [
@@ -58,31 +113,46 @@ let pluginStatusMutationFields = [
58
113
  ` Platform_PluginStatusChanged(pluginId: ID!, status: PluginStatus!): PluginStatusChangeEvent`,
59
114
  ]
60
115
 
61
- let pluginStatusSubscriptionField = ` onPluginStatusChange: PluginStatusChangeEvent\n @aws_subscribe(mutations: ["Platform_PluginStatusChanged"])`
116
+ let pluginStatusSubscriptionField = ` onPluginStatusChange: PluginStatusChangeEvent`
117
+
118
+ let pluginStatusSubscriptionSource: GraphQL_Stitcher.subscriptionSource = {
119
+ field: "onPluginStatusChange",
120
+ mutations: ["Platform_PluginStatusChanged"],
121
+ }
62
122
 
63
123
  let baseFragment = (~cloner: bool) => {
64
- let base = GraphQL_FragmentGenerator.generate(~mutationEntries=mutationEntries(~cloner), ~queryEntries)
124
+ let base = GraphQL_FragmentGenerator.generate(
125
+ ~mutationEntries=Array.concat(mutationEntries(~cloner), apiFragmentRegistryMutationEntries),
126
+ ~queryEntries,
127
+ )
65
128
  let parts = GraphQL_Stitcher.decode(base)
66
129
  // Source C subscriptions for the admin Plugin aggregate mutations.
67
130
  // The standard auto-resolver flow (CommandGeneratorResolvers_AppSync.make)
68
131
  // always creates a Subscription.onX resolver per mutation field; without the
69
132
  // matching SDL fields, AppSync's CreateResolver fails with "Type not found".
70
- let pluginAggregateSubscriptionFields =
133
+ let (pluginAggregateSubscriptionFields, pluginAggregateSubscriptionSources) =
71
134
  Plugin_SubscriptionSchema.sourceCFields(~mutationEntries=PluginBaseFragment.pluginAggregateMutationEntries)
72
135
  GraphQL_Stitcher.encode({
73
136
  types: parts.types
74
137
  ->Array.concat(uiFragmentSubscriptionTypes)
75
138
  ->Array.concat(pluginStatusSubscriptionTypes)
76
139
  ->Array.concat(Platform_ComponentDefinitionsApi.sdlTypes)
77
- ->Array.concat(Platform_UIFragmentsApi.sdlTypes),
140
+ ->Array.concat(Platform_UIFragmentsApi.sdlTypes)
141
+ ->Array.concat(Platform_ApiFragmentsApi.sdlTypes),
78
142
  queries: Array.concat(
79
143
  parts.queries,
80
- [Platform_ComponentDefinitionsApi.sdlQueryField, Platform_UIFragmentsApi.sdlQueryField],
144
+ [
145
+ Platform_ComponentDefinitionsApi.sdlQueryField,
146
+ Platform_UIFragmentsApi.sdlQueryField,
147
+ Platform_ApiFragmentsApi.sdlQueryField,
148
+ ],
81
149
  ),
82
150
  mutations: parts.mutations
83
151
  ->Array.concat(uiFragmentMutationFields)
84
152
  ->Array.concat(pluginStatusMutationFields),
85
153
  subscriptions: [uiFragmentSubscriptionField, pluginStatusSubscriptionField]
86
154
  ->Array.concat(pluginAggregateSubscriptionFields),
155
+ subscriptionSources: [uiFragmentSubscriptionSource, pluginStatusSubscriptionSource]
156
+ ->Array.concat(pluginAggregateSubscriptionSources),
87
157
  })
88
158
  }
@@ -4,7 +4,9 @@ import * as S from "sury/src/S.res.mjs";
4
4
  import * as Api_Naming$ReventlessCore from "../components/Api/Api_Naming.res.mjs";
5
5
  import * as GraphQL_Stitcher$ReventlessCore from "../components/Api/GraphQL_Stitcher.res.mjs";
6
6
  import * as PluginBaseFragment$ReventlessCore from "../plugin/api/PluginBaseFragment.res.mjs";
7
+ import * as ApiFragmentRegistry$ReventlessCore from "./ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry.res.mjs";
7
8
  import * as Platform_UIFragmentsApi$ReventlessCore from "./Platform_UIFragmentsApi.res.mjs";
9
+ import * as Platform_ApiFragmentsApi$ReventlessCore from "./Platform_ApiFragmentsApi.res.mjs";
8
10
  import * as GraphQL_FragmentGenerator$ReventlessCore from "../components/Api/GraphQL_FragmentGenerator.res.mjs";
9
11
  import * as Plugin_SubscriptionSchema$ReventlessCore from "../plugin/component/Plugin_SubscriptionSchema.res.mjs";
10
12
  import * as Platform_ComponentDefinitionsApi$ReventlessCore from "./Platform_ComponentDefinitionsApi.res.mjs";
@@ -31,6 +33,15 @@ function mutationEntries(cloner) {
31
33
  }
32
34
  }
33
35
 
36
+ let fieldSpecs = Api_Naming$ReventlessCore.sliceMutationFields("Platform", ApiFragmentRegistry$ReventlessCore.name, ApiFragmentRegistry$ReventlessCore.commandSchema);
37
+
38
+ let apiFragmentRegistryMutationEntries = fieldSpecs.length === 0 ? [] : [{
39
+ fieldNames: fieldSpecs.map(param => param[0]),
40
+ commandSchema: ApiFragmentRegistry$ReventlessCore.commandSchema
41
+ }];
42
+
43
+ let systemCallerFieldNames = apiFragmentRegistryMutationEntries.flatMap(e => e.fieldNames).concat([Platform_ApiFragmentsApi$ReventlessCore.queryFieldName]);
44
+
34
45
  let uiFragmentSubscriptionTypes = [
35
46
  `enum UIFragmentChangeKind {\n Registered\n Updated\n Deregistered\n}`,
36
47
  `type UIFragmentChangeEvent {\n pluginId: ID!\n changeKind: UIFragmentChangeKind!\n manifest: String\n}`
@@ -42,7 +53,18 @@ let uiFragmentMutationFields = [
42
53
  ` Platform_UIFragmentDeregistered(pluginId: ID!): UIFragmentChangeEvent`
43
54
  ];
44
55
 
45
- let uiFragmentSubscriptionField = ` onUIFragmentChange: UIFragmentChangeEvent\n @aws_subscribe(mutations: ["Platform_UIFragmentRegistered", "Platform_UIFragmentUpdated", "Platform_UIFragmentDeregistered"])`;
56
+ let uiFragmentSubscriptionField = ` onUIFragmentChange: UIFragmentChangeEvent`;
57
+
58
+ let uiFragmentSubscriptionSource_mutations = [
59
+ "Platform_UIFragmentRegistered",
60
+ "Platform_UIFragmentUpdated",
61
+ "Platform_UIFragmentDeregistered"
62
+ ];
63
+
64
+ let uiFragmentSubscriptionSource = {
65
+ field: "onUIFragmentChange",
66
+ mutations: uiFragmentSubscriptionSource_mutations
67
+ };
46
68
 
47
69
  let pluginStatusSubscriptionTypes = [
48
70
  `enum PluginStatus {\n Connected\n Disconnected\n Inactive\n Retired\n}`,
@@ -51,23 +73,35 @@ let pluginStatusSubscriptionTypes = [
51
73
 
52
74
  let pluginStatusMutationFields = [` Platform_PluginStatusChanged(pluginId: ID!, status: PluginStatus!): PluginStatusChangeEvent`];
53
75
 
54
- let pluginStatusSubscriptionField = ` onPluginStatusChange: PluginStatusChangeEvent\n @aws_subscribe(mutations: ["Platform_PluginStatusChanged"])`;
76
+ let pluginStatusSubscriptionField = ` onPluginStatusChange: PluginStatusChangeEvent`;
77
+
78
+ let pluginStatusSubscriptionSource_mutations = ["Platform_PluginStatusChanged"];
79
+
80
+ let pluginStatusSubscriptionSource = {
81
+ field: "onPluginStatusChange",
82
+ mutations: pluginStatusSubscriptionSource_mutations
83
+ };
55
84
 
56
85
  function baseFragment(cloner) {
57
- let base = GraphQL_FragmentGenerator$ReventlessCore.generate(mutationEntries(cloner), PluginBaseFragment$ReventlessCore.queryEntries);
86
+ let base = GraphQL_FragmentGenerator$ReventlessCore.generate(mutationEntries(cloner).concat(apiFragmentRegistryMutationEntries), PluginBaseFragment$ReventlessCore.queryEntries);
58
87
  let parts = GraphQL_Stitcher$ReventlessCore.decode(base);
59
- let pluginAggregateSubscriptionFields = Plugin_SubscriptionSchema$ReventlessCore.sourceCFields(PluginBaseFragment$ReventlessCore.pluginAggregateMutationEntries);
88
+ let match = Plugin_SubscriptionSchema$ReventlessCore.sourceCFields(PluginBaseFragment$ReventlessCore.pluginAggregateMutationEntries);
60
89
  return GraphQL_Stitcher$ReventlessCore.encode({
61
- types: parts.types.concat(uiFragmentSubscriptionTypes).concat(pluginStatusSubscriptionTypes).concat(Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes).concat(Platform_UIFragmentsApi$ReventlessCore.sdlTypes),
90
+ types: parts.types.concat(uiFragmentSubscriptionTypes).concat(pluginStatusSubscriptionTypes).concat(Platform_ComponentDefinitionsApi$ReventlessCore.sdlTypes).concat(Platform_UIFragmentsApi$ReventlessCore.sdlTypes).concat(Platform_ApiFragmentsApi$ReventlessCore.sdlTypes),
62
91
  mutations: parts.mutations.concat(uiFragmentMutationFields).concat(pluginStatusMutationFields),
63
92
  queries: parts.queries.concat([
64
93
  Platform_ComponentDefinitionsApi$ReventlessCore.sdlQueryField,
65
- Platform_UIFragmentsApi$ReventlessCore.sdlQueryField
94
+ Platform_UIFragmentsApi$ReventlessCore.sdlQueryField,
95
+ Platform_ApiFragmentsApi$ReventlessCore.sdlQueryField
66
96
  ]),
67
97
  subscriptions: [
68
98
  uiFragmentSubscriptionField,
69
99
  pluginStatusSubscriptionField
70
- ].concat(pluginAggregateSubscriptionFields)
100
+ ].concat(match[0]),
101
+ subscriptionSources: [
102
+ uiFragmentSubscriptionSource,
103
+ pluginStatusSubscriptionSource
104
+ ].concat(match[1])
71
105
  });
72
106
  }
73
107
 
@@ -78,12 +112,16 @@ export {
78
112
  cloneMutationEntry,
79
113
  mutationEntries,
80
114
  queryEntries,
115
+ apiFragmentRegistryMutationEntries,
116
+ systemCallerFieldNames,
81
117
  uiFragmentSubscriptionTypes,
82
118
  uiFragmentMutationFields,
83
119
  uiFragmentSubscriptionField,
120
+ uiFragmentSubscriptionSource,
84
121
  pluginStatusSubscriptionTypes,
85
122
  pluginStatusMutationFields,
86
123
  pluginStatusSubscriptionField,
124
+ pluginStatusSubscriptionSource,
87
125
  baseFragment,
88
126
  }
89
127
  /* cloneArgsSchema Not a pure module */
@@ -0,0 +1,65 @@
1
+ // ApiFragmentRegistry StateChangeSlice — the write side of the platform API-schema
2
+ // fragment registry, replacing the raw `deploy-schema:*` keyspace (see
3
+ // docs/plans/event-sourced-fragment-registries.md).
4
+ //
5
+ // Unlike the UiFragmentRegistry (connect/disconnect-driven), this registry's transitions
6
+ // are driven by the DEPLOY / DESTROY of a plugin stack: the deploy registers its fragment
7
+ // as a SigV4 system caller against the Platform API, and only final retirement
8
+ // (`pulumi destroy`, resolvers gone) deregisters. Version supersession must NOT
9
+ // deregister — the registry is keyed by plugin NAME, so a successor's deploy overwrites
10
+ // its predecessor's fragment in place.
11
+ //
12
+ // The registry is idempotent: re-registering an identical fragment is a no-op,
13
+ // deregistering an absent fragment is a no-op — it never rejects a command.
14
+ //
15
+ // `RecordApiFragmentPush` is the write-back of the single-writer schema-push automation:
16
+ // after stitching and pushing the composed schema it records the outcome (ok / error +
17
+ // message) on the row of the plugin whose fragment change triggered the push, so a
18
+ // deploy waiter can poll the push status instead of timing out on introspection.
19
+ @@reventless.spec
20
+
21
+ open Reventless.Plugin
22
+
23
+ // `at` is the registration timestamp, stamped from the incoming command meta by the
24
+ // dispatching mapping — the StateViewSlice projection has no event meta, so time must
25
+ // ride the payload. Inline records let the ppx auto-tag `pluginId` (scoping the decision
26
+ // read to one plugin name). `message` is a plain string ("" = none) — option fields in
27
+ // variant payloads don't survive the T|null wire contract cleanly.
28
+ //
29
+ // `apiTarget` is the API this plugin's fields belong to — Domain (the default) or Platform.
30
+ // A plugin assigned to the Platform API (e.g. a platform inspector) stitches into the
31
+ // Platform-API schema, not the Domain-API one; the single-writer push automation groups
32
+ // fragments by this target and maintains one cumulative schema per API.
33
+ // `RegisterApiFragment` / `DeregisterApiFragment` ARE the GraphQL surface — the deploy calls them
34
+ // as a SigV4 system caller against the Platform API (exposed as `Platform_RegisterApiFragment` /
35
+ // `Platform_DeregisterApiFragment`). `RecordApiFragmentPush` is `@noApi`: it is the internal
36
+ // write-back of the single-writer schema-push automation, dispatched platform-side, never by a
37
+ // GraphQL caller.
38
+ @schema
39
+ type command =
40
+ | RegisterApiFragment({pluginId: string, fragment: apiSchemaFragment, apiTarget: apiTarget, at: string})
41
+ | DeregisterApiFragment({pluginId: string})
42
+ | @noApi RecordApiFragmentPush({pluginId: string, ok: bool, message: string, at: string})
43
+
44
+ // The registry never rejects (idempotent register/deregister/record); this variant is
45
+ // never returned.
46
+ @schema
47
+ type error = | RegistryError
48
+
49
+ @schema
50
+ type event =
51
+ | ApiFragmentRegistered({pluginId: string, fragment: apiSchemaFragment, apiTarget: apiTarget, at: string})
52
+ | ApiFragmentUpdated({
53
+ pluginId: string,
54
+ previousFragment: apiSchemaFragment,
55
+ newFragment: apiSchemaFragment,
56
+ apiTarget: apiTarget,
57
+ at: string,
58
+ })
59
+ | ApiFragmentDeregistered({pluginId: string})
60
+ | ApiFragmentPushRecorded({pluginId: string, ok: bool, message: string, at: string})
61
+
62
+ // This slice reads exactly the events it writes, so consumedEvent IS event — one inline
63
+ // event type, no duplicate-constructor collision, ppx auto-tags `pluginId` on both roles.
64
+ @schema
65
+ type consumedEvent = event
@@ -0,0 +1,87 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as S from "sury/src/S.res.mjs";
4
+ import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
5
+ import * as Plugin$Reventless from "@reventlessdev/reventless-spec/src/components/Plugin.res.mjs";
6
+ import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
7
+
8
+ let commandSchema = S.union([
9
+ S.schema(s => ({
10
+ TAG: "RegisterApiFragment",
11
+ pluginId: s.m(DcbTag$Reventless.string),
12
+ fragment: s.m(Plugin$Reventless.apiSchemaFragmentSchema),
13
+ apiTarget: s.m(Plugin$Reventless.apiTargetSchema),
14
+ at: s.m(S.string)
15
+ })),
16
+ S.schema(s => ({
17
+ TAG: "DeregisterApiFragment",
18
+ pluginId: s.m(DcbTag$Reventless.string)
19
+ })),
20
+ S.schema(s => ({
21
+ TAG: "RecordApiFragmentPush",
22
+ pluginId: s.m(DcbTag$Reventless.string),
23
+ ok: s.m(S.bool),
24
+ message: s.m(S.string),
25
+ at: s.m(S.string)
26
+ }))
27
+ ]);
28
+
29
+ let errorSchema = S.literal("RegistryError");
30
+
31
+ let eventSchema = S.union([
32
+ S.schema(s => ({
33
+ TAG: "ApiFragmentRegistered",
34
+ pluginId: s.m(DcbTag$Reventless.string),
35
+ fragment: s.m(Plugin$Reventless.apiSchemaFragmentSchema),
36
+ apiTarget: s.m(Plugin$Reventless.apiTargetSchema),
37
+ at: s.m(S.string)
38
+ })),
39
+ S.schema(s => ({
40
+ TAG: "ApiFragmentUpdated",
41
+ pluginId: s.m(DcbTag$Reventless.string),
42
+ previousFragment: s.m(Plugin$Reventless.apiSchemaFragmentSchema),
43
+ newFragment: s.m(Plugin$Reventless.apiSchemaFragmentSchema),
44
+ apiTarget: s.m(Plugin$Reventless.apiTargetSchema),
45
+ at: s.m(S.string)
46
+ })),
47
+ S.schema(s => ({
48
+ TAG: "ApiFragmentDeregistered",
49
+ pluginId: s.m(DcbTag$Reventless.string)
50
+ })),
51
+ S.schema(s => ({
52
+ TAG: "ApiFragmentPushRecorded",
53
+ pluginId: s.m(DcbTag$Reventless.string),
54
+ ok: s.m(S.bool),
55
+ message: s.m(S.string),
56
+ at: s.m(S.string)
57
+ }))
58
+ ]);
59
+
60
+ let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, ["RecordApiFragmentPush"]);
61
+
62
+ function commandAuthorization(param) {
63
+ return "AllowAuthenticated";
64
+ }
65
+
66
+ let name = "ApiFragmentRegistry";
67
+
68
+ let Id;
69
+
70
+ let consumedEventSchema = eventSchema;
71
+
72
+ let moduleUrl = "@reventlessdev/reventless-core/src/admin/ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry.res.mjs";
73
+
74
+ let readConsistency = "EscalateOnRetry";
75
+
76
+ export {
77
+ name,
78
+ Id,
79
+ errorSchema,
80
+ eventSchema,
81
+ consumedEventSchema,
82
+ commandSchema$1 as commandSchema,
83
+ moduleUrl,
84
+ commandAuthorization,
85
+ readConsistency,
86
+ }
87
+ /* commandSchema Not a pure module */
@@ -0,0 +1,58 @@
1
+ @@reventless.behavior
2
+
3
+ open Reventless.Plugin
4
+
5
+ // The current fragment for this plugin name plus its target API and the last recorded push
6
+ // outcome (kept only to dedupe at-least-once redelivery of RecordApiFragmentPush), or None
7
+ // when no fragment is registered.
8
+ type registryEntry = {
9
+ fragment: apiSchemaFragment,
10
+ apiTarget: apiTarget,
11
+ lastPush: option<(bool, string, string)>, // (ok, message, at)
12
+ }
13
+ type state = option<registryEntry>
14
+
15
+ let initialState = None
16
+
17
+ let evolve = (state, event) =>
18
+ switch event {
19
+ | ApiFragmentRegistered({fragment, apiTarget}) => Some({fragment, apiTarget, lastPush: None})
20
+ | ApiFragmentUpdated({newFragment, apiTarget}) =>
21
+ Some({fragment: newFragment, apiTarget, lastPush: None})
22
+ | ApiFragmentDeregistered(_) => None
23
+ | ApiFragmentPushRecorded({ok, message, at}) =>
24
+ state->Option.map(entry => {...entry, lastPush: Some((ok, message, at))})
25
+ }
26
+
27
+ let decide = (state, command) =>
28
+ switch command {
29
+ | RegisterApiFragment({pluginId, fragment, apiTarget, at}) =>
30
+ switch state {
31
+ | None => Ok([ApiFragmentRegistered({pluginId, fragment, apiTarget, at})])
32
+ // Idempotent: an unchanged re-registration (same fragment AND same target — e.g. a
33
+ // redeploy carrying the same schema, or a version supersession that didn't change the
34
+ // SDL) emits nothing. A target change with an identical fragment IS meaningful (the
35
+ // fields move between the Domain and Platform APIs), so it is not a no-op.
36
+ | Some({fragment: current, apiTarget: currentTarget})
37
+ if current == fragment && currentTarget == apiTarget =>
38
+ Ok([])
39
+ | Some({fragment: current}) =>
40
+ Ok([
41
+ ApiFragmentUpdated({pluginId, previousFragment: current, newFragment: fragment, apiTarget, at}),
42
+ ])
43
+ }
44
+ | DeregisterApiFragment({pluginId}) =>
45
+ switch state {
46
+ | None => Ok([]) // idempotent — nothing registered
47
+ | Some(_) => Ok([ApiFragmentDeregistered({pluginId: pluginId})])
48
+ }
49
+ | RecordApiFragmentPush({pluginId, ok, message, at}) =>
50
+ switch state {
51
+ | None => Ok([]) // fragment deregistered in the meantime — nowhere to record
52
+ // Idempotent: an at-least-once redelivery carries the identical payload.
53
+ | Some({lastPush: Some((lastOk, lastMessage, lastAt))})
54
+ if lastOk == ok && lastMessage == message && lastAt == at =>
55
+ Ok([])
56
+ | Some(_) => Ok([ApiFragmentPushRecorded({pluginId, ok, message, at})])
57
+ }
58
+ }
@@ -0,0 +1,135 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
4
+ import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
5
+
6
+ function evolve(state, event) {
7
+ switch (event.TAG) {
8
+ case "ApiFragmentRegistered" :
9
+ return {
10
+ fragment: event.fragment,
11
+ apiTarget: event.apiTarget,
12
+ lastPush: undefined
13
+ };
14
+ case "ApiFragmentUpdated" :
15
+ return {
16
+ fragment: event.newFragment,
17
+ apiTarget: event.apiTarget,
18
+ lastPush: undefined
19
+ };
20
+ case "ApiFragmentDeregistered" :
21
+ return;
22
+ case "ApiFragmentPushRecorded" :
23
+ let at = event.at;
24
+ let message = event.message;
25
+ let ok = event.ok;
26
+ return Stdlib_Option.map(state, entry => ({
27
+ fragment: entry.fragment,
28
+ apiTarget: entry.apiTarget,
29
+ lastPush: [
30
+ ok,
31
+ message,
32
+ at
33
+ ]
34
+ }));
35
+ }
36
+ }
37
+
38
+ function decide(state, command) {
39
+ switch (command.TAG) {
40
+ case "RegisterApiFragment" :
41
+ let at = command.at;
42
+ let apiTarget = command.apiTarget;
43
+ let fragment = command.fragment;
44
+ let pluginId = command.pluginId;
45
+ if (state === undefined) {
46
+ return {
47
+ TAG: "Ok",
48
+ _0: [{
49
+ TAG: "ApiFragmentRegistered",
50
+ pluginId: pluginId,
51
+ fragment: fragment,
52
+ apiTarget: apiTarget,
53
+ at: at
54
+ }]
55
+ };
56
+ }
57
+ let current = state.fragment;
58
+ if (Primitive_object.equal(current, fragment) && state.apiTarget === apiTarget) {
59
+ return {
60
+ TAG: "Ok",
61
+ _0: []
62
+ };
63
+ } else {
64
+ return {
65
+ TAG: "Ok",
66
+ _0: [{
67
+ TAG: "ApiFragmentUpdated",
68
+ pluginId: pluginId,
69
+ previousFragment: current,
70
+ newFragment: fragment,
71
+ apiTarget: apiTarget,
72
+ at: at
73
+ }]
74
+ };
75
+ }
76
+ case "DeregisterApiFragment" :
77
+ if (state !== undefined) {
78
+ return {
79
+ TAG: "Ok",
80
+ _0: [{
81
+ TAG: "ApiFragmentDeregistered",
82
+ pluginId: command.pluginId
83
+ }]
84
+ };
85
+ } else {
86
+ return {
87
+ TAG: "Ok",
88
+ _0: []
89
+ };
90
+ }
91
+ case "RecordApiFragmentPush" :
92
+ if (state === undefined) {
93
+ return {
94
+ TAG: "Ok",
95
+ _0: []
96
+ };
97
+ }
98
+ let match = state.lastPush;
99
+ let at$1 = command.at;
100
+ let message = command.message;
101
+ let ok = command.ok;
102
+ if (match !== undefined && match[0] === ok && match[1] === message && match[2] === at$1) {
103
+ return {
104
+ TAG: "Ok",
105
+ _0: []
106
+ };
107
+ }
108
+ return {
109
+ TAG: "Ok",
110
+ _0: [{
111
+ TAG: "ApiFragmentPushRecorded",
112
+ pluginId: command.pluginId,
113
+ ok: ok,
114
+ message: message,
115
+ at: at$1
116
+ }]
117
+ };
118
+ break;
119
+ }
120
+ }
121
+
122
+ let Spec;
123
+
124
+ let initialState;
125
+
126
+ let moduleUrl = "@reventlessdev/reventless-core/src/admin/ApiFragmentRegistry/StateChangeSlice/ApiFragmentRegistry_Behavior.res.mjs";
127
+
128
+ export {
129
+ Spec,
130
+ initialState,
131
+ evolve,
132
+ decide,
133
+ moduleUrl,
134
+ }
135
+ /* No side effect */