@reventlessdev/reventless-core 3.0.0-alpha.260 → 3.0.0-alpha.261
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +9 -9
- package/src/Behavior.res +1 -4
- package/src/Message.res +17 -14
- package/src/Projection.res +51 -25
- package/src/RequestContext.res +8 -9
- package/src/ResourceAttribution.res +28 -14
- package/src/adapter/Adapter.res +48 -4
- package/src/adapter/EventLogProvisioning/EventLogProvisioning.res +5 -5
- package/src/adapter/Messaging/Messaging_Log_Backend.res +10 -7
- package/src/adapter/Messaging/Messaging_Log_Backend.res.mjs +2 -4
- package/src/adapter/Monitoring/Monitoring.res +16 -17
- package/src/adapter/QueryInterception/QueryInterception.res +0 -1
- package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res +12 -5
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +11 -7
- package/src/adapter/Runtime/PluginRuntime_Builder_Micro.res +1 -7
- package/src/adapter/Runtime/PluginRuntime_Builder_Single.res +1 -7
- package/src/adapter/RuntimeExtension/RuntimeExtension.res +0 -1
- package/src/admin/Platform_Admin.res +17 -6
- package/src/admin/Platform_AdminApi.res +14 -9
- package/src/admin/Platform_Admin_Callback.res +1 -1
- package/src/admin/Platform_BakedManifest.res +34 -34
- package/src/admin/Platform_ComponentDefinitionsApi.res +9 -21
- package/src/admin/Platform_PluginStructuresApi.res +15 -12
- package/src/admin/UiFragmentRegistry/StateChange/UiFragmentRegistry.res +1 -1
- package/src/components/Aggregate/Aggregate.res +13 -12
- package/src/components/Aggregate/Aggregate_Builder.res +22 -21
- package/src/components/Aggregate/Aggregate_Callback.res +91 -86
- package/src/components/Api/ApiNoApiHelpers.res +1 -3
- package/src/components/Api/Api_Ids.res +0 -1
- package/src/components/Api/Api_Naming.res +41 -18
- package/src/components/Api/GraphQL_FragmentGenerator.res +38 -51
- package/src/components/Api/GraphQL_SchemaInspector.res +5 -3
- package/src/components/Api/GraphQL_Stitcher.res +9 -10
- package/src/components/Api/MCP_SchemaGenerator.res +8 -12
- package/src/components/Api/OwnerScopeDiagnostics.res +1 -2
- package/src/components/Api/QueryDbListQuery.res +13 -6
- package/src/components/Api/SchemaType.res +28 -23
- package/src/components/Api/SuryToJsonSchema.res +9 -10
- package/src/components/AutomationSlice/AutomationSlice.res +4 -4
- package/src/components/AutomationSlice/AutomationSlice_Builder.res +15 -14
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -3
- package/src/components/Builder_Helpers.res +12 -23
- package/src/components/CommandGenerator/CommandGenerator.res +6 -1
- package/src/components/CommandGenerator/CommandGenerator_Builder.res +29 -21
- package/src/components/CommandGenerator/CommandGenerator_Callback.res +17 -21
- package/src/components/CommandTopic/CommandTopic.res +3 -3
- package/src/components/CommandTopic/CommandTopic_Builder.res +10 -10
- package/src/components/CommandTopic/CommandTopic_Callback.res +1 -4
- package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -2
- package/src/components/Counter/Counter_Builder.res +1 -6
- package/src/components/Counter/Counter_Callback.res +3 -3
- package/src/components/Dcb/Dcb_Builder.res +970 -956
- package/src/components/DcbEventLog/DcbEventLog.res +4 -4
- package/src/components/DcbEventLog/DcbEventLog_Builder.res +0 -1
- package/src/components/DcbEventLog/DcbEventLog_Operations.res +17 -18
- package/src/components/EventCollector/EventCollector_Builder.res +2 -1
- package/src/components/EventLog/EventLog.res +5 -1
- package/src/components/EventLog/EventLog_Operations.res +12 -8
- package/src/components/EventMapper/EventMapper.res +8 -10
- package/src/components/EventMapper/EventMapper_Builder.res +4 -1
- package/src/components/EventMapper/EventMapper_Callback.res +46 -31
- package/src/components/EventTopic/EventTopic.res +3 -3
- package/src/components/EventTopic/EventTopic_Builder.res +1 -1
- package/src/components/Extension/Extension.res +4 -1
- package/src/components/Extension/Extension_Operations.res +11 -3
- package/src/components/ExtensionPoint/ExtensionPoint.res +3 -3
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +9 -10
- package/src/components/ExtensionPoint/ExtensionPoint_Callback.res +2 -6
- package/src/components/ExtensionPoint/ExtensionPoint_Operations.res +13 -5
- package/src/components/Heartbeat/Heartbeat_Callback.res +3 -3
- package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +4 -4
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +7 -10
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice.res +4 -4
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +15 -14
- package/src/components/QueryDb/QueryDb_Adapter.res +1 -3
- package/src/components/QueryDb/QueryDb_Operations.res +10 -10
- package/src/components/ReadModel/ReadModel.res +3 -3
- package/src/components/ReadModel/ReadModel_Builder.res +1 -2
- package/src/components/ReadModel/ReadModel_Callback.res +2 -1
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +5 -2
- package/src/components/StateChangeSlice/StateChangeSlice.res +3 -3
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +23 -4
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +22 -6
- package/src/components/StateTopic.res +1 -3
- package/src/components/StateViewSlice/StateViewSlice.res +4 -4
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +79 -68
- package/src/components/StateViewSlice/StateViewSlice_Callback.res +3 -1
- package/src/components/Task/Task.res +3 -3
- package/src/components/Task/Task_Adapter.res +4 -1
- package/src/components/Task/Task_Builder.res +24 -21
- package/src/plugin/api/PluginBaseFragment.res +9 -3
- package/src/plugin/component/Capability_Inference.res +8 -10
- package/src/plugin/component/Plugin.res +6 -6
- package/src/plugin/component/Plugin_Builder.res +54 -50
- package/src/plugin/component/Plugin_Callback.res +10 -6
- package/src/plugin/component/Plugin_Helpers.res +264 -230
- package/src/plugin/component/Plugin_Structure.res +370 -324
- package/src/plugin/component/Plugin_SubscriptionSchema.res +8 -6
- package/src/plugin/component/SchemaWalker.res +11 -12
- package/src/plugin/connect/PluginConnectExtension_Mapping.res +45 -50
- package/src/plugin/lifecycle/PluginBehavior.res +3 -4
- package/src/plugin/lifecycle/PluginSpec.res +1 -2
- package/src/plugin/lifecycle/PluginsProjection.res +16 -5
- package/src/plugin/lifecycle/PluginsReadModelSpec.res +0 -2
- package/src/util/CommandPublisher.res +9 -2
- package/src/util/CsvStream.res +3 -3
- package/src/util/Interstack.res +7 -15
- package/src/util/Interstack.resi +3 -3
- package/src/util/LogFormat.res +5 -9
- package/src/util/Logger.res +1 -2
- package/src/util/Lru.res +2 -1
- package/src/util/Lru.resi +2 -3
- package/src/util/ScheduleOps.res +24 -27
- package/src/util/StorePrefixCollision.res +6 -9
- package/src/util/Util_Promise.res +4 -1
- package/src/util/Util_Promise.res.mjs +1 -1
- package/tests/IdentityTest.res +166 -113
- package/tests/ResourceAttributionTest.res +28 -25
- package/tests/StorePrefixCollisionTest.res +2 -1
- package/tests/TaskBucketNamingTest.res +3 -2
- package/tests/adapter/EventLogProvisioningTest.res +51 -48
- package/tests/adapter/MonitoringTest.res +81 -38
- package/tests/adapter/QueryInterceptionTest.res +2 -2
- package/tests/adapter/RefusalVocabularyTest.res +31 -23
- package/tests/adapter/RuntimeExtensionHookReachTest.res +9 -8
- package/tests/adapter/RuntimeExtensionTest.res +5 -3
- package/tests/admin/AdminApiSchemaDriftTest.res +22 -16
- package/tests/admin/Platform_Admin_StructureTest.res +10 -11
- package/tests/admin/Platform_BakedManifestTest.res +31 -35
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +18 -15
- package/tests/admin/Platform_PluginStructuresApiTest.res +5 -3
- package/tests/admin/Platform_UIFragmentsApiTest.res +6 -3
- package/tests/aggregate/AggregateCacheTest.res +10 -12
- package/tests/aggregate/AggregateCallbackTest.res +75 -46
- package/tests/aggregate/AggregateCausationTest.res +19 -20
- package/tests/aggregate/AggregateConflictTest.res +41 -19
- package/tests/aggregate/AggregateFixtures.res +15 -5
- package/tests/aggregate/AggregateRejectionTest.res +97 -80
- package/tests/aggregate/AggregateSnapshotTest.res +44 -16
- package/tests/api/Api_IdsTest.res +10 -4
- package/tests/api/BrandedMarkerCompositionTest.res +48 -36
- package/tests/api/GeolocationSemanticTest.res +3 -3
- package/tests/api/GraphQL_FragmentGeneratorTest.res +66 -54
- package/tests/api/OwnerScopeDiagnosticsTest.res +31 -27
- package/tests/api/StorageRefFieldsTest.res +30 -18
- package/tests/api/SuryToJsonSchemaTest.res +1315 -1014
- package/tests/api/TaggedUnionSchemaTest.res +17 -24
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res +235 -179
- package/tests/commandgenerator/CommandGeneratorFixtures.res +8 -13
- package/tests/commandgenerator/OwnerStampingTest.res +91 -76
- package/tests/commandtopic/CommandOutcomeHookTest.res +198 -155
- package/tests/commandtopic/CommandTopicCallbackFixtures.res +5 -4
- package/tests/commandtopic/CommandTopicCallbackTest.res +61 -43
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res +70 -55
- package/tests/counter/CounterCallbackTest.res +40 -34
- package/tests/counter/CounterFixtures.res +4 -4
- package/tests/dcb/DcbDecodeTest.res +115 -84
- package/tests/dcb/DcbEventLogOperationsTest.res +194 -143
- package/tests/dcb/DcbEventLogSchemaTest.res +13 -13
- package/tests/dcb/DcbFixtures.res +4 -5
- package/tests/dcb/DcbScopeInferenceTest.res +173 -114
- package/tests/dcb/DcbStateChangeSliceTest.res +391 -262
- package/tests/dcb/DcbTagTest.res +22 -11
- package/tests/dcb/DcbValidationTest.res +288 -218
- package/tests/eventlog/EventLogFixtures.res +4 -4
- package/tests/eventlog/EventLogOperationsTest.res +102 -67
- package/tests/eventlog/EventLogRetryTest.res +104 -65
- package/tests/eventmapper/EventMapperCallbackTest.res +118 -83
- package/tests/eventmapper/EventMapperFixtures.res +15 -23
- package/tests/eventmapper/EventMapperTest.res +54 -38
- package/tests/eventtopic/EventTopicFixtures.res +3 -4
- package/tests/eventtopic/EventTopicOperationsTest.res +41 -29
- package/tests/extensionpoint/ExtensionPointCallbackTest.res +58 -45
- package/tests/extensionpoint/ExtensionPointFixtures.res +16 -20
- package/tests/extensionpoint/ExtensionPointOperationsTest.res +70 -49
- package/tests/extensionpoint/PluginDisconnectScheduleTest.res +2 -1
- package/tests/logger/LogFormatTest.res +104 -82
- package/tests/logger/LoggerLazyTest.res +21 -12
- package/tests/message/MessageTest.res +96 -93
- package/tests/message/MetaEnvelopeTest.res +26 -30
- package/tests/plugin/HeartbeatDisconnectGraceTest.res +31 -25
- package/tests/plugin/ManifestVisibilityTest.res +20 -12
- package/tests/plugin/PluginDefinitionScalars.res +1 -2
- package/tests/plugin/PluginLifecycleCorpusTest.res +15 -12
- package/tests/plugin/PluginSpecExperiment.res +0 -1
- package/tests/plugin/PluginStructureTest.res +1529 -1045
- package/tests/plugin/Plugin_EventQuerySchemaTest.res +21 -10
- package/tests/plugin/SchemaWalkerTest.res +116 -70
- package/tests/plugin/StateChange/PsReserveStock.res +4 -4
- package/tests/plugin/StateView/PsAnnotatedView.res +4 -4
- package/tests/plugin/StateView/PsCustomersView.res +4 -4
- package/tests/plugin/StateView/PsShipmentsView.res +3 -2
- package/tests/projection/LifecycleTrailTest.res +1 -4
- package/tests/projection/ProjectionOptimizeTest.res +13 -9
- package/tests/querydb/QueryDbFixtures.res +0 -1
- package/tests/querydb/QueryDbOperationsTest.res +99 -64
- package/tests/querydb/TaggedUnionStampTest.res +10 -8
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res +50 -35
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +4 -10
- package/tests/util/CommandPublisherTest.res +0 -1
- package/tests/util/CsvStreamTest.res +3 -3
- package/tests/util/LruTest.res +84 -56
|
@@ -42,7 +42,11 @@ let queryEntries: array<querySchemaEntry> = [
|
|
|
42
42
|
// No `excludeFields`: the three fields this entry used to name are declared
|
|
43
43
|
// `@internal` on the spec, and `deriveObjectTypeWithNested` reads that off the
|
|
44
44
|
// schema itself.
|
|
45
|
-
subIdField: ?
|
|
45
|
+
subIdField: ?(
|
|
46
|
+
PluginsReadModelSpec.subIdConfig->Option.map((c: Reventless.ReadModel.subIdConfig<_>) =>
|
|
47
|
+
c.subIdField
|
|
48
|
+
)
|
|
49
|
+
),
|
|
46
50
|
indexQueries: ?indexQueriesOfConfig(PluginsReadModelSpec.config),
|
|
47
51
|
},
|
|
48
52
|
]
|
|
@@ -67,8 +71,10 @@ let queryEntries: array<querySchemaEntry> = [
|
|
|
67
71
|
let pluginAggregateMutationEntries: array<mutationSchemaEntry> = {
|
|
68
72
|
let commandSchema = PluginSpec.commandSchema->S.castToUnknown
|
|
69
73
|
let constructorNames = Reventless.DcbTag.extractAllVariantNames(PluginSpec.commandSchema)
|
|
70
|
-
let filteredConstructorNames =
|
|
71
|
-
|
|
74
|
+
let filteredConstructorNames = ApiNoApiHelpers.filterNoApiVariants(
|
|
75
|
+
constructorNames,
|
|
76
|
+
commandSchema,
|
|
77
|
+
)
|
|
72
78
|
let fieldNames =
|
|
73
79
|
filteredConstructorNames->Array.map(cname =>
|
|
74
80
|
Api_Naming.adminField(~name=PluginSpec.name ++ "_" ++ cname)
|
|
@@ -36,7 +36,8 @@ let warningsFromProperties = (~component, properties: dict<S.t<unknown>>): array
|
|
|
36
36
|
->Dict.toArray
|
|
37
37
|
->Array.filterMap(((field, fieldSchema)) =>
|
|
38
38
|
switch fieldSchema {
|
|
39
|
-
| String(_)
|
|
39
|
+
| String(_)
|
|
40
|
+
if field != "TAG" &&
|
|
40
41
|
nameMatches(field) &&
|
|
41
42
|
Reventless.StorageRef.getStore(fieldSchema)->Option.isNone =>
|
|
42
43
|
Some({component, field})
|
|
@@ -64,8 +65,7 @@ let scanSchema = (~component: string, schema: S.t<unknown>): array<warning> => {
|
|
|
64
65
|
and say what to do when the heuristic is wrong. */
|
|
65
66
|
let message = (w: warning): string =>
|
|
66
67
|
`${w.component}.${w.field} looks like a stored-object reference but declares no store — ` ++
|
|
67
|
-
`annotate it \`@storageRef("<store>")\` so the deployment provisions the store it needs, ` ++
|
|
68
|
-
`or rename the field if it holds an external URL. Heuristic matches are never provisioned.`
|
|
68
|
+
`annotate it \`@storageRef("<store>")\` so the deployment provisions the store it needs, ` ++ `or rename the field if it holds an external URL. Heuristic matches are never provisioned.`
|
|
69
69
|
|
|
70
70
|
// ── Near-duplicate stores ──────────────────────────────────────────────────
|
|
71
71
|
//
|
|
@@ -103,8 +103,7 @@ let withinOneEdit = (a: string, b: string): bool => {
|
|
|
103
103
|
switch diffs {
|
|
104
104
|
| [] => true
|
|
105
105
|
| [_] => true
|
|
106
|
-
| [i, j] if j == i + 1 =>
|
|
107
|
-
charAt(a, i) == charAt(b, j) && charAt(a, j) == charAt(b, i)
|
|
106
|
+
| [i, j] if j == i + 1 => charAt(a, i) == charAt(b, j) && charAt(a, j) == charAt(b, i)
|
|
108
107
|
| _ => false
|
|
109
108
|
}
|
|
110
109
|
} else if la - lb == 1 || lb - la == 1 {
|
|
@@ -147,9 +146,9 @@ Pairs of declared stores that are probably one store misspelled twice.
|
|
|
147
146
|
Compared within an owning plugin only: two plugins may legitimately hold stores
|
|
148
147
|
whose names are one edit apart, and neither can be a typo for the other.
|
|
149
148
|
*/
|
|
150
|
-
let collisions = (
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
let collisions = (declarations: array<Reventless.Plugin.requiredStoreDeclaration>): array<
|
|
150
|
+
collision,
|
|
151
|
+
> => {
|
|
153
152
|
// One entry per store, keeping the first declaration site as the one the
|
|
154
153
|
// message names — several fields naming one store is ordinary, not a clash.
|
|
155
154
|
let byStore: dict<Reventless.Plugin.requiredStoreDeclaration> = Dict.make()
|
|
@@ -181,5 +180,4 @@ let collisionMessage = (c: collision): string =>
|
|
|
181
180
|
`${c.a.store} (${c.a.component}.${c.a.field}) and ${c.b.store} ` ++
|
|
182
181
|
`(${c.b.component}.${c.b.field}) differ by one edit — one is probably a typo for ` ++
|
|
183
182
|
`the other, and both would be provisioned, splitting objects across two stores. ` ++
|
|
184
|
-
`Fix the field name, or name the store explicitly with \`@storageRef("<store>")\` ` ++
|
|
185
|
-
`if the two really are separate stores.`
|
|
183
|
+
`Fix the field name, or name the store explicitly with \`@storageRef("<store>")\` ` ++ `if the two really are separate stores.`
|
|
@@ -43,7 +43,9 @@ module type T = {
|
|
|
43
43
|
let makePluginDefinition: (
|
|
44
44
|
~name: string,
|
|
45
45
|
~aggregates: array<module(ReventlessInfra.Aggregate.T with type api = api)>=?,
|
|
46
|
-
~readModels: array<
|
|
46
|
+
~readModels: array<
|
|
47
|
+
module(ReventlessInfra.ReadModel.T with type api = api and type role = role),
|
|
48
|
+
>=?,
|
|
47
49
|
~stateViewSlices: array<module(ReventlessInfra.StateViewSlice.T)>=?,
|
|
48
50
|
~stateChangeSlices: array<module(ReventlessInfra.StateChangeSlice.T)>=?,
|
|
49
51
|
~automationSlices: array<module(ReventlessInfra.AutomationSlice.T)>=?,
|
|
@@ -63,13 +65,11 @@ let makeId = (name, version) => `${name}@${version}`
|
|
|
63
65
|
// the platform invariant is one version per plugin at a time — so anything
|
|
64
66
|
// crossing into the UI (routes, federation remote name, subscription
|
|
65
67
|
// payloads) gets the bare name. If the input has no `@`, returns it as-is.
|
|
66
|
-
let name = (id: string): string =>
|
|
67
|
-
id->String.split("@")->Array.get(0)->Option.getOr(id)
|
|
68
|
+
let name = (id: string): string => id->String.split("@")->Array.get(0)->Option.getOr(id)
|
|
68
69
|
|
|
69
70
|
// Version segment of a plugin id (`name@version`). Empty string when the id
|
|
70
71
|
// carries no `@` (e.g. the synthetic admin plugin id).
|
|
71
|
-
let version = (id: string): string =>
|
|
72
|
-
id->String.split("@")->Array.get(1)->Option.getOr("")
|
|
72
|
+
let version = (id: string): string => id->String.split("@")->Array.get(1)->Option.getOr("")
|
|
73
73
|
|
|
74
74
|
// Compare two plugin version strings (e.g. "0.10.0-alpha.73"), newest-first:
|
|
75
75
|
// returns 1 when `a` is newer than `b`, -1 when older, 0 when equal. Separators
|
|
@@ -79,7 +79,7 @@ let version = (id: string): string =>
|
|
|
79
79
|
// the admin manifest resolvers to enforce the one-version-per-plugin invariant
|
|
80
80
|
// when more than one version lingers in `Connected` state.
|
|
81
81
|
let compareVersions = (a: string, b: string): int => {
|
|
82
|
-
let parts = s => s->String.replaceRegExp(
|
|
82
|
+
let parts = s => s->String.replaceRegExp(/[-+]/g, ".")->String.split(".")
|
|
83
83
|
let pa = parts(a)
|
|
84
84
|
let pb = parts(b)
|
|
85
85
|
let len = pa->Array.length > pb->Array.length ? pa->Array.length : pb->Array.length
|
|
@@ -190,10 +190,17 @@ module Make = (
|
|
|
190
190
|
[]
|
|
191
191
|
} else {
|
|
192
192
|
let constructorNames = Reventless.DcbTag.extractAllVariantNames(M.Spec.commandSchema)
|
|
193
|
-
let filteredConstructorNames = ApiNoApiHelpers.filterNoApiVariants(
|
|
193
|
+
let filteredConstructorNames = ApiNoApiHelpers.filterNoApiVariants(
|
|
194
|
+
constructorNames,
|
|
195
|
+
commandSchema,
|
|
196
|
+
)
|
|
194
197
|
let fieldNames =
|
|
195
198
|
filteredConstructorNames->Array.map(cname =>
|
|
196
|
-
Api_Naming.aggregateMutationField(
|
|
199
|
+
Api_Naming.aggregateMutationField(
|
|
200
|
+
~plugin=name,
|
|
201
|
+
~aggregate=M.Spec.name,
|
|
202
|
+
~command=cname,
|
|
203
|
+
)
|
|
197
204
|
)
|
|
198
205
|
// Register plugin-prefixed field names for CommandGenerator_Builder.
|
|
199
206
|
Plugin_Helpers.aggregateMutationFieldsRegistry->Dict.set(M.Spec.name, fieldNames)
|
|
@@ -223,20 +230,23 @@ module Make = (
|
|
|
223
230
|
let fieldPermissions = Dict.make()
|
|
224
231
|
filteredConstructorNames->Array.forEachWithIndex((cname, idx) => {
|
|
225
232
|
let fieldName = fieldNames->Array.getUnsafe(idx)
|
|
226
|
-
let hasPayload =
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
233
|
+
let hasPayload = Reventless.DcbTag.isVariantPayloadBearing(
|
|
234
|
+
M.Spec.commandSchema->Obj.magic,
|
|
235
|
+
cname,
|
|
236
|
+
)
|
|
237
|
+
let syntheticCmd: unknown = hasPayload ? {"TAG": cname}->Obj.magic : cname->Obj.magic
|
|
230
238
|
let rule = M.Spec.commandAuthorization(syntheticCmd->Obj.magic)
|
|
231
239
|
fieldPermissions->Dict.set(fieldName, rule)
|
|
232
240
|
})
|
|
233
|
-
[
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
241
|
+
[
|
|
242
|
+
{
|
|
243
|
+
ReventlessInfra.Api.fieldNames,
|
|
244
|
+
commandSchema,
|
|
245
|
+
fieldPermissions,
|
|
246
|
+
linkedViews: ?(aggDef->Option.map(d => d.linkedViews)),
|
|
247
|
+
consistencyRead: ?(aggDef->Option.flatMap(d => d.consistencyRead)),
|
|
248
|
+
},
|
|
249
|
+
]
|
|
240
250
|
}
|
|
241
251
|
}
|
|
242
252
|
})
|
|
@@ -264,7 +274,7 @@ module Make = (
|
|
|
264
274
|
authorization: None,
|
|
265
275
|
permission: R.Spec.authorization,
|
|
266
276
|
connectionSpec: true,
|
|
267
|
-
|
|
277
|
+
?subIdField,
|
|
268
278
|
indexQueries: ?(indexes->Array.length > 0 ? Some(indexes) : None),
|
|
269
279
|
resolvedFields: ?(resolvedFields->Array.length > 0 ? Some(resolvedFields) : None),
|
|
270
280
|
}
|
|
@@ -299,8 +309,7 @@ module Make = (
|
|
|
299
309
|
connectionFilterTypeName: qn.returnTypeName ++ "Filter",
|
|
300
310
|
}
|
|
301
311
|
let qn = switch R.Spec.subIdConfig {
|
|
302
|
-
| Some(_) =>
|
|
303
|
-
{
|
|
312
|
+
| Some(_) => {
|
|
304
313
|
...qn,
|
|
305
314
|
itemsFieldName: qn.singleFieldName ++ "Items",
|
|
306
315
|
itemsFilterTypeName: qn.returnTypeName ++ "ItemsFilter",
|
|
@@ -308,18 +317,12 @@ module Make = (
|
|
|
308
317
|
| None => qn
|
|
309
318
|
}
|
|
310
319
|
Plugin_Helpers.queryFieldNamesRegistry->Dict.set(R.Spec.name, qn)
|
|
311
|
-
Plugin_Helpers.stateSchemaRegistry->Dict.set(
|
|
312
|
-
R.Spec.name,
|
|
313
|
-
R.Spec.stateSchema->S.castToUnknown,
|
|
314
|
-
)
|
|
320
|
+
Plugin_Helpers.stateSchemaRegistry->Dict.set(R.Spec.name, R.Spec.stateSchema->S.castToUnknown)
|
|
315
321
|
})
|
|
316
322
|
|
|
317
323
|
let apiSchemaFragment = {
|
|
318
324
|
let baseFragment = FragmentProvider.generateFragment(~mutationEntries, ~queryEntries)
|
|
319
|
-
let subResult = Plugin_SubscriptionSchema.generate(
|
|
320
|
-
~mutationEntries,
|
|
321
|
-
~eventLogEntries,
|
|
322
|
-
)
|
|
325
|
+
let subResult = Plugin_SubscriptionSchema.generate(~mutationEntries, ~eventLogEntries)
|
|
323
326
|
// The historical read counterpart of the Source A subscription — same
|
|
324
327
|
// event logs, same generation point, so the two cannot disagree about
|
|
325
328
|
// which streams exist.
|
|
@@ -442,12 +445,8 @@ module Make = (
|
|
|
442
445
|
commandTypes: extractTypes(M.Spec.commandSchema),
|
|
443
446
|
eventTypes: extractTypes(M.Spec.eventSchema),
|
|
444
447
|
errorTypes: extractTypes(M.Spec.errorSchema),
|
|
445
|
-
commandSchemas: [
|
|
446
|
-
|
|
447
|
-
],
|
|
448
|
-
eventSchemas: [
|
|
449
|
-
SchemaWalker.walk(M.Spec.name ++ ".event", M.Spec.eventSchema),
|
|
450
|
-
],
|
|
448
|
+
commandSchemas: [SchemaWalker.walk(M.Spec.name ++ ".command", M.Spec.commandSchema)],
|
|
449
|
+
eventSchemas: [SchemaWalker.walk(M.Spec.name ++ ".event", M.Spec.eventSchema)],
|
|
451
450
|
chapter: ?chapterFor(M.Spec.name),
|
|
452
451
|
}
|
|
453
452
|
Plugin_Helpers.componentSchemaRegistry->Dict.set(M.Spec.name, schema)
|
|
@@ -595,10 +594,10 @@ module Make = (
|
|
|
595
594
|
hook({
|
|
596
595
|
name,
|
|
597
596
|
version,
|
|
598
|
-
kind: ?meta->Option.flatMap(m => m.kind),
|
|
599
|
-
displayName: ?meta->Option.flatMap(m => m.displayName),
|
|
600
|
-
vendor: ?meta->Option.flatMap(m => m.vendor),
|
|
601
|
-
architectureType: ?meta->Option.flatMap(m => m.architectureType),
|
|
597
|
+
kind: ?(meta->Option.flatMap(m => m.kind)),
|
|
598
|
+
displayName: ?(meta->Option.flatMap(m => m.displayName)),
|
|
599
|
+
vendor: ?(meta->Option.flatMap(m => m.vendor)),
|
|
600
|
+
architectureType: ?(meta->Option.flatMap(m => m.architectureType)),
|
|
602
601
|
components,
|
|
603
602
|
})
|
|
604
603
|
| None => ()
|
|
@@ -790,24 +789,29 @@ module Make = (
|
|
|
790
789
|
// topics → this plugin's EventCollector, and vice-versa. The eventTopic
|
|
791
790
|
// resource's `id` is the SNS topic ARN (same convention as
|
|
792
791
|
// extensionPointDefinition.eventTopic).
|
|
793
|
-
let dcbEventLogDef: Pulumi.Output.t<
|
|
794
|
-
|
|
792
|
+
let dcbEventLogDef: Pulumi.Output.t<
|
|
793
|
+
option<Reventless.Plugin.dcbEventLogDefinition>,
|
|
794
|
+
> = switch dcbResult.dcbEventLogOutputs {
|
|
795
|
+
| None => Pulumi.Output.make(None)
|
|
796
|
+
| Some(dcbOutputs) =>
|
|
797
|
+
switch dcbOutputs.eventTopic.resources->Array.get(0) {
|
|
798
|
+
| Some(r) =>
|
|
799
|
+
r.id->Pulumi.Output.apply(arn => Some({
|
|
800
|
+
Reventless.Plugin.name: name ++ "DcbEventLog",
|
|
801
|
+
eventTopicArn: arn,
|
|
802
|
+
}))
|
|
795
803
|
| None => Pulumi.Output.make(None)
|
|
796
|
-
| Some(dcbOutputs) =>
|
|
797
|
-
switch dcbOutputs.eventTopic.resources->Array.get(0) {
|
|
798
|
-
| Some(r) =>
|
|
799
|
-
r.id->Pulumi.Output.apply(arn => Some({
|
|
800
|
-
Reventless.Plugin.name: name ++ "DcbEventLog",
|
|
801
|
-
eventTopicArn: arn,
|
|
802
|
-
}))
|
|
803
|
-
| None => Pulumi.Output.make(None)
|
|
804
|
-
}
|
|
805
804
|
}
|
|
805
|
+
}
|
|
806
806
|
|
|
807
807
|
let pluginDefinition =
|
|
808
808
|
(extensionPointsDefinitions, eventCollectorUrn, dcbEventLogDef)
|
|
809
809
|
->Pulumi.Output.all3
|
|
810
|
-
->Pulumi.Output.apply(((
|
|
810
|
+
->Pulumi.Output.apply(((
|
|
811
|
+
extensionPointsDefinitions,
|
|
812
|
+
eventCollectorUrn,
|
|
813
|
+
dcbEventLogDef,
|
|
814
|
+
)) => {
|
|
811
815
|
Reventless.Plugin.id,
|
|
812
816
|
name,
|
|
813
817
|
version,
|
|
@@ -854,13 +858,13 @@ module Make = (
|
|
|
854
858
|
readModelsOutputs
|
|
855
859
|
->Dict.toArray
|
|
856
860
|
->Array.forEach(((rmName, rmOut)) => {
|
|
857
|
-
let urlOutput =
|
|
858
|
-
|
|
861
|
+
let urlOutput = rmOut.eventCollector->Pulumi.Output.flatMap(
|
|
862
|
+
ecOutputs =>
|
|
859
863
|
switch ecOutputs.resources->Array.get(0) {
|
|
860
864
|
| Some(r) => r.id
|
|
861
865
|
| None => Pulumi.Output.make("")
|
|
862
|
-
}
|
|
863
|
-
|
|
866
|
+
},
|
|
867
|
+
)
|
|
864
868
|
readModelQueueUrls->Dict.set(rmName, urlOutput)
|
|
865
869
|
})
|
|
866
870
|
|
|
@@ -75,10 +75,14 @@ module Make = (Spec: Spec): T => {
|
|
|
75
75
|
Spec.outgoingExtensionEventHandlers->Dict.get(serviceName)->Option.isSome ||
|
|
76
76
|
Spec.incomingExtensionEventHandlers->Dict.get(serviceName)->Option.isSome
|
|
77
77
|
if isHandled {
|
|
78
|
-
EffectLogger.logInfo(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
EffectLogger.logInfo(
|
|
79
|
+
~comp=`Plugin(${id})`,
|
|
80
|
+
`incoming event: ${LogFormat.eventSummary(eventJson')}`,
|
|
81
|
+
)->Effect.zipRight(
|
|
82
|
+
handleEventEffect(
|
|
83
|
+
eventJson',
|
|
84
|
+
Spec.incomingConnectExtensionEventHandlers,
|
|
85
|
+
)->Effect.zipRight(
|
|
82
86
|
Effect.all(
|
|
83
87
|
[
|
|
84
88
|
handleEventEffect(eventJson', Spec.outgoingExtensionPointEventHandlers),
|
|
@@ -86,8 +90,8 @@ module Make = (Spec: Spec): T => {
|
|
|
86
90
|
handleEventEffect(eventJson', Spec.incomingExtensionEventHandlers),
|
|
87
91
|
],
|
|
88
92
|
{"concurrency": "unbounded"},
|
|
89
|
-
)->Effect.map(_ => ())
|
|
90
|
-
)
|
|
93
|
+
)->Effect.map(_ => ()),
|
|
94
|
+
),
|
|
91
95
|
)
|
|
92
96
|
} else {
|
|
93
97
|
warnUnmatchedServiceOnce(~id, ~serviceName)
|