@reventlessdev/reventless-core 3.0.0-alpha.169 → 3.0.0-alpha.171
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 +16 -0
- package/package.json +16 -16
- package/src/admin/Platform_Admin.res +5 -2
- package/src/admin/Platform_Admin.res.mjs +4 -4
- package/src/components/Aggregate/Aggregate.res +5 -1
- package/src/components/Aggregate/Aggregate_Builder.res +21 -6
- package/src/components/Aggregate/Aggregate_Builder.res.mjs +10 -7
- package/src/components/AutomationSlice/AutomationSlice.res +1 -0
- package/src/components/AutomationSlice/AutomationSlice_Builder.res +13 -2
- package/src/components/AutomationSlice/AutomationSlice_Builder.res.mjs +5 -2
- package/src/components/Builder_Helpers.res +16 -2
- package/src/components/Builder_Helpers.res.mjs +6 -6
- package/src/components/Dcb/Dcb_Builder.res +46 -4
- package/src/components/Dcb/Dcb_Builder.res.mjs +13 -9
- package/src/components/ExtensionPoint/ExtensionPoint.res +2 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +10 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res.mjs +6 -4
- package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +1 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +8 -1
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res.mjs +1 -1
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice.res +1 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +12 -3
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +5 -2
- package/src/components/ReadModel/ReadModel.res +1 -0
- package/src/components/ReadModel/ReadModel_Builder.res +9 -1
- package/src/components/ReadModel/ReadModel_Builder.res.mjs +5 -2
- package/src/components/StateChangeSlice/StateChangeSlice.res +1 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +6 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res.mjs +1 -1
- package/src/components/StateViewSlice/StateViewSlice.res +1 -0
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +11 -3
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +5 -2
- package/src/components/Task/Task.res +1 -0
- package/src/components/Task/Task_Builder.res +11 -2
- package/src/components/Task/Task_Builder.res.mjs +7 -4
- package/src/plugin/component/Plugin.res +5 -0
- package/src/plugin/component/Plugin_Builder.res +10 -2
- package/src/plugin/component/Plugin_Builder.res.mjs +7 -6
- package/src/plugin/component/Plugin_Helpers.res +2 -0
- package/src/plugin/component/Plugin_Helpers.res.mjs +2 -2
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +2 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +3 -3
- package/tests/plugin/ManifestVisibilityTest.res +2 -2
- package/tests/plugin/PluginStructureTest.res +6 -6
- package/tests/IdentityTest.res.mjs +0 -174
- package/tests/adapter/MonitoringTest.res.mjs +0 -82
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +0 -356
- package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +0 -101
- package/tests/aggregate/AggregateCacheTest.res.mjs +0 -433
- package/tests/aggregate/AggregateCallbackTest.res.mjs +0 -143
- package/tests/aggregate/AggregateCausationTest.res.mjs +0 -47
- package/tests/aggregate/AggregateConflictTest.res.mjs +0 -386
- package/tests/aggregate/AggregateFixtures.res.mjs +0 -308
- package/tests/aggregate/AggregateRejectionTest.res.mjs +0 -166
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +0 -645
- package/tests/api/ApiNoApiTest.res.mjs +0 -90
- package/tests/api/GraphQL_StitcherTest.res.mjs +0 -112
- package/tests/api/SimpleTest.res.mjs +0 -10
- package/tests/api/SuryToJsonSchemaTest.res.mjs +0 -674
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +0 -160
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +0 -197
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +0 -152
- package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +0 -106
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +0 -109
- package/tests/counter/CounterCallbackTest.res.mjs +0 -140
- package/tests/counter/CounterFixtures.res.mjs +0 -67
- package/tests/dcb/DcbDecodeTest.res.mjs +0 -194
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +0 -268
- package/tests/dcb/DcbFixtures.res.mjs +0 -534
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +0 -480
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +0 -540
- package/tests/dcb/DcbTagTest.res.mjs +0 -867
- package/tests/dcb/DcbValidationTest.res.mjs +0 -476
- package/tests/eventlog/EventLogFixtures.res.mjs +0 -196
- package/tests/eventlog/EventLogOperationsTest.res.mjs +0 -192
- package/tests/eventlog/EventLogRetryTest.res.mjs +0 -195
- package/tests/eventmapper/EventMapperCallbackTest.res.mjs +0 -141
- package/tests/eventmapper/EventMapperFixtures.res.mjs +0 -440
- package/tests/eventmapper/EventMapperTest.res.mjs +0 -83
- package/tests/eventtopic/EventTopicFixtures.res.mjs +0 -65
- package/tests/eventtopic/EventTopicOperationsTest.res.mjs +0 -71
- package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +0 -94
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +0 -205
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +0 -304
- package/tests/ftp/FTPTest.res.mjs +0 -88
- package/tests/logger/LogFormatTest.res.mjs +0 -309
- package/tests/logger/LoggerLazyTest.res.mjs +0 -40
- package/tests/message/MessageTest.res.mjs +0 -218
- package/tests/message/MetaEnvelopeTest.res.mjs +0 -188
- package/tests/plugin/ManifestVisibilityTest.res.mjs +0 -215
- package/tests/plugin/PluginSpecExperiment.res.mjs +0 -31
- package/tests/plugin/PluginStructureTest.res.mjs +0 -419
- package/tests/plugin/PluginVersionTest.res.mjs +0 -30
- package/tests/plugin/SchemaWalkerTest.res.mjs +0 -160
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +0 -62
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +0 -95
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +0 -81
- package/tests/poc/StructuralSubtypingPoc.res.mjs +0 -61
- package/tests/projection/ProjectionOptimizeTest.res.mjs +0 -75
- package/tests/querydb/QueryDbFixtures.res.mjs +0 -135
- package/tests/querydb/QueryDbOperationsTest.res.mjs +0 -168
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +0 -77
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +0 -139
- package/tests/util/CommandPublisherTest.res.mjs +0 -78
- package/tests/util/CsvStreamTest.res.mjs +0 -51
- package/tests/util/LruTest.res.mjs +0 -105
- package/tests/util/MetricsTest.res.mjs +0 -53
|
@@ -56,6 +56,7 @@ module Make = (
|
|
|
56
56
|
~outboundTranslationSlices: array<module(ReventlessInfra.OutboundTranslationSlice.T)>,
|
|
57
57
|
~inboundTranslationSlices: array<module(ReventlessInfra.InboundTranslationSlice.T)>,
|
|
58
58
|
~systemCallableComponents: array<string>,
|
|
59
|
+
~componentRuntime: dict<ReventlessInfra.RuntimeHints.t>,
|
|
59
60
|
~uiFragments: option<Reventless.Plugin.uiFragmentManifest>,
|
|
60
61
|
~pluginStructure: option<Reventless.Plugin.pluginStructure>,
|
|
61
62
|
self,
|
|
@@ -133,7 +134,8 @@ module Make = (
|
|
|
133
134
|
// AutomationSlices created inside DcbBuilder. The same `aggregateEventTopics`
|
|
134
135
|
// dict (after merging in the DCB EventLog topic) is reused later as
|
|
135
136
|
// `allEventTopics` for ReadModels.
|
|
136
|
-
let aggregatesWithoutEventMappers =
|
|
137
|
+
let aggregatesWithoutEventMappers =
|
|
138
|
+
aggregates->createAggregatesWithoutEventMappers(~api, ~componentRuntime, opts)
|
|
137
139
|
let aggregateEventTopics = Aggregate.allEventTopics(aggregatesWithoutEventMappers)
|
|
138
140
|
|
|
139
141
|
// Construct DCB components and derive DCB-specific API schema entries
|
|
@@ -157,6 +159,7 @@ module Make = (
|
|
|
157
159
|
~outboundTranslationSlices,
|
|
158
160
|
~inboundTranslationSlices,
|
|
159
161
|
~systemCallableComponents,
|
|
162
|
+
~componentRuntime,
|
|
160
163
|
~pluginStructure?,
|
|
161
164
|
~opts,
|
|
162
165
|
)
|
|
@@ -335,7 +338,8 @@ module Make = (
|
|
|
335
338
|
| None => ()
|
|
336
339
|
}
|
|
337
340
|
|
|
338
|
-
let readModelsOutputs =
|
|
341
|
+
let readModelsOutputs =
|
|
342
|
+
readModels->createReadModels(~api, ~apiRole, ~componentRuntime, allEventTopics, opts)
|
|
339
343
|
let allQueryDbs = readModelsOutputs->ReadModel.allQueryDbs
|
|
340
344
|
// Merge DCB StateViewSlice, InboundTranslation, AutomationSlice, and
|
|
341
345
|
// OutboundTranslation QueryDbs into allQueryDbs so createResolvers builds
|
|
@@ -613,6 +617,7 @@ module Make = (
|
|
|
613
617
|
~scheduler,
|
|
614
618
|
~queryEngine,
|
|
615
619
|
~resourceNaming=Spec.resourceNaming,
|
|
620
|
+
~componentRuntime,
|
|
616
621
|
~opts,
|
|
617
622
|
)
|
|
618
623
|
|
|
@@ -858,6 +863,7 @@ module Make = (
|
|
|
858
863
|
~publishToAggregates,
|
|
859
864
|
~queryEngine,
|
|
860
865
|
~resourceNaming=Spec.resourceNaming,
|
|
866
|
+
~componentRuntime,
|
|
861
867
|
~opts,
|
|
862
868
|
)
|
|
863
869
|
|
|
@@ -1063,6 +1069,7 @@ module Make = (
|
|
|
1063
1069
|
~outboundTranslationSlices=[],
|
|
1064
1070
|
~inboundTranslationSlices=[],
|
|
1065
1071
|
~systemCallableComponents=[],
|
|
1072
|
+
~componentRuntime=Dict.make(),
|
|
1066
1073
|
~uiFragments: option<Reventless.Plugin.uiFragmentManifest>=?,
|
|
1067
1074
|
~pluginStructure: option<Reventless.Plugin.pluginStructure>=?,
|
|
1068
1075
|
~opts=?,
|
|
@@ -1086,6 +1093,7 @@ module Make = (
|
|
|
1086
1093
|
~outboundTranslationSlices,
|
|
1087
1094
|
~inboundTranslationSlices,
|
|
1088
1095
|
~systemCallableComponents,
|
|
1096
|
+
~componentRuntime,
|
|
1089
1097
|
~uiFragments,
|
|
1090
1098
|
~pluginStructure,
|
|
1091
1099
|
...
|
|
@@ -103,7 +103,7 @@ function Make(Spec) {
|
|
|
103
103
|
let componentChapters = componentChaptersOpt !== undefined ? componentChaptersOpt : ({});
|
|
104
104
|
return Plugin_Structure$ReventlessCore.make(name, aggregates, readModels, stateViewSlices, stateChangeSlices, automationSlices, outboundTranslationSlices, inboundTranslationSlices, extensions, extensionPoints, componentChapters);
|
|
105
105
|
};
|
|
106
|
-
let make = (name, heartbeatInterval, extensionPointsOpt, extensionsOpt, aggregatesOpt, readModelsOpt, tasksOpt, stateChangeSlicesOpt, stateViewSlicesOpt, automationSlicesOpt, outboundTranslationSlicesOpt, inboundTranslationSlicesOpt, systemCallableComponentsOpt, uiFragments, pluginStructure, opts) => {
|
|
106
|
+
let make = (name, heartbeatInterval, extensionPointsOpt, extensionsOpt, aggregatesOpt, readModelsOpt, tasksOpt, stateChangeSlicesOpt, stateViewSlicesOpt, automationSlicesOpt, outboundTranslationSlicesOpt, inboundTranslationSlicesOpt, systemCallableComponentsOpt, componentRuntimeOpt, uiFragments, pluginStructure, opts) => {
|
|
107
107
|
let extensionPoints = extensionPointsOpt !== undefined ? extensionPointsOpt : [];
|
|
108
108
|
let extensions = extensionsOpt !== undefined ? extensionsOpt : [];
|
|
109
109
|
let aggregates = aggregatesOpt !== undefined ? aggregatesOpt : [];
|
|
@@ -115,6 +115,7 @@ function Make(Spec) {
|
|
|
115
115
|
let outboundTranslationSlices = outboundTranslationSlicesOpt !== undefined ? outboundTranslationSlicesOpt : [];
|
|
116
116
|
let inboundTranslationSlices = inboundTranslationSlicesOpt !== undefined ? inboundTranslationSlicesOpt : [];
|
|
117
117
|
let systemCallableComponents = systemCallableComponentsOpt !== undefined ? systemCallableComponentsOpt : [];
|
|
118
|
+
let componentRuntime = componentRuntimeOpt !== undefined ? componentRuntimeOpt : ({});
|
|
118
119
|
PluginRuntimeBuilder.registerPluginName(name);
|
|
119
120
|
let version = PackageVersion$Reventless.fromCaller();
|
|
120
121
|
return Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(Plugin$ReventlessCore.componentType), name, (extra, extra$1) => {
|
|
@@ -142,12 +143,12 @@ function Make(Spec) {
|
|
|
142
143
|
parent: opts_parent
|
|
143
144
|
};
|
|
144
145
|
let childName = ComponentType$ReventlessCore.name(extra$1, Plugin$ReventlessCore.componentType);
|
|
145
|
-
let aggregatesWithoutEventMappers = Plugin_Helpers$ReventlessCore.createAggregatesWithoutEventMappers(aggregates, api, opts);
|
|
146
|
+
let aggregatesWithoutEventMappers = Plugin_Helpers$ReventlessCore.createAggregatesWithoutEventMappers(aggregates, api, componentRuntime, opts);
|
|
146
147
|
let aggregateEventTopics = Aggregate$ReventlessCore.allEventTopics(aggregatesWithoutEventMappers);
|
|
147
148
|
let DcbBuilder = Dcb_Builder$ReventlessCore.Make(DcbEventLogStorage)(DcbEventTopicPublisher)(DcbCommandTopicChannel)(DcbCommandTopicChannelAsync)(PluginRuntimeBuilder)({
|
|
148
149
|
hooks: Spec.hooks
|
|
149
150
|
});
|
|
150
|
-
let dcbResult = DcbBuilder.construct(extra$1, childName, undefined, undefined, Spec.environment, Spec.platformName, aggregateEventTopics, stateChangeSlices, stateViewSlices, automationSlices, outboundTranslationSlices, inboundTranslationSlices, systemCallableComponents, pluginStructure, opts);
|
|
151
|
+
let dcbResult = DcbBuilder.construct(extra$1, childName, undefined, undefined, Spec.environment, Spec.platformName, aggregateEventTopics, stateChangeSlices, stateViewSlices, automationSlices, outboundTranslationSlices, inboundTranslationSlices, systemCallableComponents, componentRuntime, pluginStructure, opts);
|
|
151
152
|
let mutationEntriesFromAggregates = aggregates.flatMap(M => {
|
|
152
153
|
let commandSchema = M.Spec.commandSchema;
|
|
153
154
|
if (ApiNoApiHelpers$ReventlessCore.isNoApi(commandSchema)) {
|
|
@@ -252,7 +253,7 @@ function Make(Spec) {
|
|
|
252
253
|
if (dcbOutputs !== undefined) {
|
|
253
254
|
aggregateEventTopics[extra$1 + "DcbEventLog"] = dcbOutputs.eventTopic;
|
|
254
255
|
}
|
|
255
|
-
let readModelsOutputs = Plugin_Helpers$ReventlessCore.createReadModels(readModels, api, apiRole, aggregateEventTopics, opts);
|
|
256
|
+
let readModelsOutputs = Plugin_Helpers$ReventlessCore.createReadModels(readModels, api, apiRole, componentRuntime, aggregateEventTopics, opts);
|
|
256
257
|
let allQueryDbs = ReadModel$ReventlessCore.allQueryDbs(readModelsOutputs);
|
|
257
258
|
Object.entries(dcbResult.stateViewSlicesOutputs).forEach(param => {
|
|
258
259
|
allQueryDbs[param[0]] = param[1].queryDb;
|
|
@@ -428,7 +429,7 @@ function Make(Spec) {
|
|
|
428
429
|
let localAdminResolvedEP = match[1];
|
|
429
430
|
let interstackAdminExtensionPoints = match[0];
|
|
430
431
|
let aggregatesOutputs = Plugin_Helpers$ReventlessCore.addEventMappers(aggregateEventTopics, queryEngine);
|
|
431
|
-
let match$1 = Plugin_Helpers$ReventlessCore.createExtensionPoints(extensionPoints, aggregateResources, publishToAggregates, scheduler, queryEngine, Spec.resourceNaming, opts);
|
|
432
|
+
let match$1 = Plugin_Helpers$ReventlessCore.createExtensionPoints(extensionPoints, aggregateResources, publishToAggregates, scheduler, queryEngine, Spec.resourceNaming, componentRuntime, opts);
|
|
432
433
|
let extensionPointsHandlers = match$1[1];
|
|
433
434
|
let extensionPointsOutputs = match$1[0];
|
|
434
435
|
let coreSetup;
|
|
@@ -531,7 +532,7 @@ function Make(Spec) {
|
|
|
531
532
|
} else {
|
|
532
533
|
EventCollectorHelper.connect(eventCollector, eventTopics, extensionPointsOutputs, extensionsOutputs, undefined, pluginDefinition, Primitive_option.some(uiFragments), undefined, extensionsHandlers, extensionPointsHandlers, undefined, extensionRegistryInfos, undefined, aggregateQueueUrls, readModelQueueUrls, Plugin_Helpers$ReventlessCore.readModelNamesForSourceName);
|
|
533
534
|
}
|
|
534
|
-
let tasksOutputs = Plugin_Helpers$ReventlessCore.createTasks(tasks, aggregatesOutputs, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, Spec.resourceNaming, opts);
|
|
535
|
+
let tasksOutputs = Plugin_Helpers$ReventlessCore.createTasks(tasks, aggregatesOutputs, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, Spec.resourceNaming, componentRuntime, opts);
|
|
535
536
|
let resolvers = Plugin_Helpers$ReventlessCore.createResolvers(allQueryDbs);
|
|
536
537
|
Stdlib_Option.forEach(Spec.hooks.subscriptionInfraHook, hook => hook({
|
|
537
538
|
allQueryDbs: allQueryDbs,
|
|
@@ -416,6 +416,7 @@ let createTasks = (
|
|
|
416
416
|
~publishToAggregates,
|
|
417
417
|
~queryEngine,
|
|
418
418
|
~resourceNaming,
|
|
419
|
+
~componentRuntime: dict<ReventlessInfra.RuntimeHints.t>,
|
|
419
420
|
~opts,
|
|
420
421
|
) => {
|
|
421
422
|
tasksOutputs :=
|
|
@@ -429,6 +430,7 @@ let createTasks = (
|
|
|
429
430
|
~queryEngine,
|
|
430
431
|
~resourceNaming,
|
|
431
432
|
~allAggregates=aggregatesOutputs,
|
|
433
|
+
~runtime=?componentRuntime->Dict.get(SpecificTask.Spec.name),
|
|
432
434
|
~opts=Some(opts),
|
|
433
435
|
))
|
|
434
436
|
)
|
|
@@ -243,11 +243,11 @@ let tasksOutputs = {
|
|
|
243
243
|
contents: []
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
-
function createTasks(tasks, aggregatesOutputs, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, resourceNaming, opts) {
|
|
246
|
+
function createTasks(tasks, aggregatesOutputs, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, resourceNaming, componentRuntime, opts) {
|
|
247
247
|
tasksOutputs.contents = tasks.map(SpecificTask => SpecificTask.outputs(SpecificTask.make((taskName, bucketNameOpt) => {
|
|
248
248
|
let bucketName = bucketNameOpt !== undefined ? bucketNameOpt : "Bucket";
|
|
249
249
|
return ResourceQueryRuntime$ReventlessCore.bucketNameOfTaskExn(tasksOutputs.contents, taskName, bucketName);
|
|
250
|
-
}, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, resourceNaming, aggregatesOutputs, opts)));
|
|
250
|
+
}, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, resourceNaming, aggregatesOutputs, componentRuntime[SpecificTask.Spec.name], opts)));
|
|
251
251
|
return tasksOutputs.contents;
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -17,6 +17,7 @@ module Make = (
|
|
|
17
17
|
EventTopicAdapter: EventTopic_Adapter.Publisher,
|
|
18
18
|
ExtensionPointRuntimeBuilder: ExtensionPointRuntime_Builder.T
|
|
19
19
|
with module CommandTopicChannel := CommandTopicChannel,
|
|
20
|
+
Defaults: ReventlessInfra.RuntimeDefaults.T,
|
|
20
21
|
): ExtensionPoint.T => {
|
|
21
22
|
module PluginMappingInstance = PluginExtensionPoint_Plugin.Make(Spec)
|
|
22
23
|
|
|
@@ -41,5 +42,6 @@ module Make = (
|
|
|
41
42
|
CommandTopicChannel,
|
|
42
43
|
EventTopicAdapter,
|
|
43
44
|
ExtensionPointRuntimeBuilder,
|
|
45
|
+
Defaults,
|
|
44
46
|
)
|
|
45
47
|
}
|
|
@@ -6,7 +6,7 @@ import * as PluginExtensionPoint_Plugin$ReventlessCore from "./PluginExtensionPo
|
|
|
6
6
|
import * as PluginExtensionPoint_UiFragment$ReventlessCore from "./PluginExtensionPoint_UiFragment.res.mjs";
|
|
7
7
|
|
|
8
8
|
function Make(Spec) {
|
|
9
|
-
return RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => {
|
|
9
|
+
return RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => (Defaults => {
|
|
10
10
|
let PluginMappingInstance = PluginExtensionPoint_Plugin$ReventlessCore.Make(Spec);
|
|
11
11
|
let name = PluginMappingInstance.Mapping.delegateName;
|
|
12
12
|
let mappings = [
|
|
@@ -24,8 +24,8 @@ function Make(Spec) {
|
|
|
24
24
|
commandSchema: PluginExtensionPointSpec$ReventlessInfra.commandSchema,
|
|
25
25
|
eventSchema: PluginExtensionPointSpec$ReventlessInfra.eventSchema,
|
|
26
26
|
directiveSchema: PluginExtensionPointSpec$ReventlessInfra.directiveSchema
|
|
27
|
-
})(Mappings)(RuntimeEnvironment)(CommandTopicChannel)(EventTopicAdapter)(ExtensionPointRuntimeBuilder);
|
|
28
|
-
})));
|
|
27
|
+
})(Mappings)(RuntimeEnvironment)(CommandTopicChannel)(EventTopicAdapter)(ExtensionPointRuntimeBuilder)(Defaults);
|
|
28
|
+
}))));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
let PluginExtensionPointSpec;
|
|
@@ -48,7 +48,7 @@ module PublicReadModel: ReventlessInfra.ReadModel.T
|
|
|
48
48
|
// A read model that projects an event reaching it via a (DCB-log-sourced) mapping — the
|
|
49
49
|
// case Plugin_Structure must surface as a qualified `consumedEventTypes` entry.
|
|
50
50
|
let consumedEventNames: array<string> = ["OrderPlaced"]
|
|
51
|
-
let make = (~api as _, ~apiRole as _, ~allEventTopics as _, ~opts as _=?): component =>
|
|
51
|
+
let make = (~api as _, ~apiRole as _, ~allEventTopics as _, ~runtime as _=?, ~opts as _=?): component =>
|
|
52
52
|
Obj.magic(0)
|
|
53
53
|
let outputs = (_: component): ReventlessInfra.ReadModel.outputs => Obj.magic(0)
|
|
54
54
|
let operations = (_: component): Pulumi.Output.t<ReventlessInfra.ReadModel.operations> =>
|
|
@@ -64,7 +64,7 @@ module InternalReadModel: ReventlessInfra.ReadModel.T
|
|
|
64
64
|
type component
|
|
65
65
|
let sourceNames: array<string> = []
|
|
66
66
|
let consumedEventNames: array<string> = []
|
|
67
|
-
let make = (~api as _, ~apiRole as _, ~allEventTopics as _, ~opts as _=?): component =>
|
|
67
|
+
let make = (~api as _, ~apiRole as _, ~allEventTopics as _, ~runtime as _=?, ~opts as _=?): component =>
|
|
68
68
|
Obj.magic(0)
|
|
69
69
|
let outputs = (_: component): ReventlessInfra.ReadModel.outputs => Obj.magic(0)
|
|
70
70
|
let operations = (_: component): Pulumi.Output.t<ReventlessInfra.ReadModel.operations> =>
|
|
@@ -27,7 +27,7 @@ module PsPlaceOrderSlice: ReventlessInfra.StateChangeSlice.T = {
|
|
|
27
27
|
}
|
|
28
28
|
let isAsync = false
|
|
29
29
|
type component = scsComponent
|
|
30
|
-
let make = (~dcbEventLog as _, ~publishJsons as _, ~tagKeysByEventType as _=?, ~crossPartitionTagKeys as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
30
|
+
let make = (~dcbEventLog as _, ~publishJsons as _, ~tagKeysByEventType as _=?, ~crossPartitionTagKeys as _=?, ~runtime as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
31
31
|
}
|
|
32
32
|
module PsShipOrderSlice: ReventlessInfra.StateChangeSlice.T = {
|
|
33
33
|
module Spec = PsShipOrder
|
|
@@ -40,7 +40,7 @@ module PsShipOrderSlice: ReventlessInfra.StateChangeSlice.T = {
|
|
|
40
40
|
}
|
|
41
41
|
let isAsync = false
|
|
42
42
|
type component = scsComponent
|
|
43
|
-
let make = (~dcbEventLog as _, ~publishJsons as _, ~tagKeysByEventType as _=?, ~crossPartitionTagKeys as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
43
|
+
let make = (~dcbEventLog as _, ~publishJsons as _, ~tagKeysByEventType as _=?, ~crossPartitionTagKeys as _=?, ~runtime as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
44
44
|
}
|
|
45
45
|
module PsOrdersViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
46
46
|
module Spec = PsOrdersView
|
|
@@ -49,7 +49,7 @@ module PsOrdersViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
|
49
49
|
let moduleUrl = PsOrdersView.moduleUrl
|
|
50
50
|
}
|
|
51
51
|
type component = svsComponent
|
|
52
|
-
let make = (~dcbEventLog as _, ~opts as _=?): component => Obj.magic(0)
|
|
52
|
+
let make = (~dcbEventLog as _, ~runtime as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
53
53
|
}
|
|
54
54
|
module PsAvailableProductsViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
55
55
|
module Spec = PsAvailableProductsView
|
|
@@ -58,7 +58,7 @@ module PsAvailableProductsViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
|
58
58
|
let moduleUrl = PsAvailableProductsView.moduleUrl
|
|
59
59
|
}
|
|
60
60
|
type component = svsComponent
|
|
61
|
-
let make = (~dcbEventLog as _, ~opts as _=?): component => Obj.magic(0)
|
|
61
|
+
let make = (~dcbEventLog as _, ~runtime as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
62
62
|
}
|
|
63
63
|
module PsCustomersViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
64
64
|
module Spec = PsCustomersView
|
|
@@ -67,7 +67,7 @@ module PsCustomersViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
|
67
67
|
let moduleUrl = PsCustomersView.moduleUrl
|
|
68
68
|
}
|
|
69
69
|
type component = svsComponent
|
|
70
|
-
let make = (~dcbEventLog as _, ~opts as _=?): component => Obj.magic(0)
|
|
70
|
+
let make = (~dcbEventLog as _, ~runtime as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
71
71
|
}
|
|
72
72
|
module PsAnnotatedViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
73
73
|
module Spec = PsAnnotatedView
|
|
@@ -76,7 +76,7 @@ module PsAnnotatedViewSlice: ReventlessInfra.StateViewSlice.T = {
|
|
|
76
76
|
let moduleUrl = PsAnnotatedView.moduleUrl
|
|
77
77
|
}
|
|
78
78
|
type component = svsComponent
|
|
79
|
-
let make = (~dcbEventLog as _, ~opts as _=?): component => Obj.magic(0)
|
|
79
|
+
let make = (~dcbEventLog as _, ~runtime as _=?, ~opts as _=?): component => Obj.magic(0)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
let structure = Plugin_Structure.make(
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
|
|
5
|
-
import * as RequestContext$ReventlessCore from "../src/RequestContext.res.mjs";
|
|
6
|
-
|
|
7
|
-
S.enableJson();
|
|
8
|
-
|
|
9
|
-
globalThis.describe("Identity", () => {
|
|
10
|
-
globalThis.describe("anonymous", () => {
|
|
11
|
-
globalThis.test("has userId 'anonymous'", () => {
|
|
12
|
-
globalThis.expect(Identity$Reventless.anonymous.userId).toBe("anonymous");
|
|
13
|
-
});
|
|
14
|
-
globalThis.test("has empty groups", () => {
|
|
15
|
-
globalThis.expect(Identity$Reventless.anonymous.groups).toEqual([]);
|
|
16
|
-
});
|
|
17
|
-
globalThis.test("has InMemory provider", () => {
|
|
18
|
-
globalThis.expect(Identity$Reventless.anonymous.provider).toEqual("InMemory");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
globalThis.describe("hasGroup", () => {
|
|
22
|
-
let identity_groups = [
|
|
23
|
-
"admin",
|
|
24
|
-
"editors"
|
|
25
|
-
];
|
|
26
|
-
let identity = {
|
|
27
|
-
userId: "user-1",
|
|
28
|
-
username: "alice",
|
|
29
|
-
groups: identity_groups,
|
|
30
|
-
provider: "Cognito"
|
|
31
|
-
};
|
|
32
|
-
globalThis.test("returns true when group is present", () => {
|
|
33
|
-
globalThis.expect(Identity$Reventless.hasGroup(identity, "admin")).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
globalThis.test("returns false when group is absent", () => {
|
|
36
|
-
globalThis.expect(Identity$Reventless.hasGroup(identity, "viewers")).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
globalThis.describe("getClaim", () => {
|
|
40
|
-
let identity_groups = [];
|
|
41
|
-
let identity_claims = Object.fromEntries([
|
|
42
|
-
[
|
|
43
|
-
"tenant",
|
|
44
|
-
"acme"
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
"role",
|
|
48
|
-
"manager"
|
|
49
|
-
]
|
|
50
|
-
]);
|
|
51
|
-
let identity = {
|
|
52
|
-
userId: "user-1",
|
|
53
|
-
username: "alice",
|
|
54
|
-
groups: identity_groups,
|
|
55
|
-
claims: identity_claims,
|
|
56
|
-
provider: "InMemory"
|
|
57
|
-
};
|
|
58
|
-
globalThis.test("returns Some for existing claim", () => {
|
|
59
|
-
globalThis.expect(Identity$Reventless.getClaim(identity, "tenant")).toEqual("acme");
|
|
60
|
-
});
|
|
61
|
-
globalThis.test("returns None for missing claim", () => {
|
|
62
|
-
globalThis.expect(Identity$Reventless.getClaim(identity, "missing")).toEqual(undefined);
|
|
63
|
-
});
|
|
64
|
-
globalThis.test("returns None when claims are absent", () => {
|
|
65
|
-
let noClaims_groups = [];
|
|
66
|
-
let noClaims = {
|
|
67
|
-
userId: "user-2",
|
|
68
|
-
username: "bob",
|
|
69
|
-
groups: noClaims_groups,
|
|
70
|
-
provider: "InMemory"
|
|
71
|
-
};
|
|
72
|
-
globalThis.expect(Identity$Reventless.getClaim(noClaims, "tenant")).toEqual(undefined);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
globalThis.describe("schema roundtrip", () => {
|
|
76
|
-
globalThis.test("encode then decode preserves identity", () => {
|
|
77
|
-
let identity_groups = ["admin"];
|
|
78
|
-
let identity_claims = Object.fromEntries([[
|
|
79
|
-
"tenant",
|
|
80
|
-
"acme"
|
|
81
|
-
]]);
|
|
82
|
-
let identity = {
|
|
83
|
-
userId: "user-1",
|
|
84
|
-
username: "alice",
|
|
85
|
-
groups: identity_groups,
|
|
86
|
-
claims: identity_claims,
|
|
87
|
-
provider: "Cognito"
|
|
88
|
-
};
|
|
89
|
-
let json = S.reverseConvertToJsonOrThrow(identity, Identity$Reventless.schema);
|
|
90
|
-
let decoded = S.parseJsonOrThrow(json, Identity$Reventless.schema);
|
|
91
|
-
globalThis.expect(decoded).toEqual(identity);
|
|
92
|
-
});
|
|
93
|
-
globalThis.test("roundtrip with Custom provider", () => {
|
|
94
|
-
let identity_groups = [];
|
|
95
|
-
let identity_provider = {
|
|
96
|
-
TAG: "Custom",
|
|
97
|
-
_0: "oauth2"
|
|
98
|
-
};
|
|
99
|
-
let identity = {
|
|
100
|
-
userId: "ext-1",
|
|
101
|
-
username: "external",
|
|
102
|
-
groups: identity_groups,
|
|
103
|
-
provider: identity_provider
|
|
104
|
-
};
|
|
105
|
-
let json = S.reverseConvertToJsonOrThrow(identity, Identity$Reventless.schema);
|
|
106
|
-
let decoded = S.parseJsonOrThrow(json, Identity$Reventless.schema);
|
|
107
|
-
globalThis.expect(decoded).toEqual(identity);
|
|
108
|
-
});
|
|
109
|
-
globalThis.test("roundtrip without optional claims", () => {
|
|
110
|
-
let identity_groups = [];
|
|
111
|
-
let identity = {
|
|
112
|
-
userId: "user-3",
|
|
113
|
-
username: "charlie",
|
|
114
|
-
groups: identity_groups,
|
|
115
|
-
provider: "InMemory"
|
|
116
|
-
};
|
|
117
|
-
let json = S.reverseConvertToJsonOrThrow(identity, Identity$Reventless.schema);
|
|
118
|
-
let decoded = S.parseJsonOrThrow(json, Identity$Reventless.schema);
|
|
119
|
-
globalThis.expect(decoded.userId).toBe("user-3");
|
|
120
|
-
globalThis.expect(decoded.provider).toEqual("InMemory");
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
globalThis.describe("RequestContext", () => {
|
|
126
|
-
globalThis.describe("test() constructor", () => {
|
|
127
|
-
globalThis.test("defaults to anonymous identity", () => {
|
|
128
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
129
|
-
globalThis.expect(ctx.identity.userId).toBe("anonymous");
|
|
130
|
-
});
|
|
131
|
-
globalThis.test("accepts custom identity", () => {
|
|
132
|
-
let identity_groups = ["admin"];
|
|
133
|
-
let identity = {
|
|
134
|
-
userId: "user-1",
|
|
135
|
-
username: "alice",
|
|
136
|
-
groups: identity_groups,
|
|
137
|
-
provider: "Cognito"
|
|
138
|
-
};
|
|
139
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, identity, undefined);
|
|
140
|
-
globalThis.expect(ctx.identity.userId).toBe("user-1");
|
|
141
|
-
});
|
|
142
|
-
globalThis.test("defaults to empty claims", () => {
|
|
143
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
144
|
-
globalThis.expect(Object.keys(ctx.claims)).toEqual([]);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
globalThis.describe("getClaim", () => {
|
|
148
|
-
globalThis.test("returns claim value when present", () => {
|
|
149
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, Object.fromEntries([[
|
|
150
|
-
"tenant",
|
|
151
|
-
"acme"
|
|
152
|
-
]]));
|
|
153
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(ctx, "tenant")).toEqual("acme");
|
|
154
|
-
});
|
|
155
|
-
globalThis.test("returns None when absent", () => {
|
|
156
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
157
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(ctx, "missing")).toEqual(undefined);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
globalThis.describe("withClaim", () => {
|
|
161
|
-
globalThis.test("adds a claim to the context", () => {
|
|
162
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
163
|
-
let updated = RequestContext$ReventlessCore.withClaim(ctx, "tenant", "acme");
|
|
164
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(updated, "tenant")).toEqual("acme");
|
|
165
|
-
});
|
|
166
|
-
globalThis.test("does not mutate the original context", () => {
|
|
167
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
168
|
-
RequestContext$ReventlessCore.withClaim(ctx, "tenant", "acme");
|
|
169
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(ctx, "tenant")).toEqual(undefined);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
/* Not a pure module */
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as Monitoring$ReventlessCore from "../../src/adapter/Monitoring/Monitoring.res.mjs";
|
|
4
|
-
|
|
5
|
-
let stubResource = {};
|
|
6
|
-
|
|
7
|
-
globalThis.describe("Monitoring", () => {
|
|
8
|
-
globalThis.test("Noop default: notify is silent and does not throw", () => {
|
|
9
|
-
Monitoring$ReventlessCore.notify("CommandHandler", "before", stubResource);
|
|
10
|
-
globalThis.expect(true).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
globalThis.test("use registers a backend that receives every notify, role and name", () => {
|
|
13
|
-
let recorded = [];
|
|
14
|
-
let onProvisioned = (kind, name, param) => {
|
|
15
|
-
recorded.push([
|
|
16
|
-
kind,
|
|
17
|
-
name
|
|
18
|
-
]);
|
|
19
|
-
};
|
|
20
|
-
let Recorder = {
|
|
21
|
-
onProvisioned: onProvisioned
|
|
22
|
-
};
|
|
23
|
-
Monitoring$ReventlessCore.use(Recorder);
|
|
24
|
-
Monitoring$ReventlessCore.notify("CommandHandler", "AllAggregatesCmdHandler", stubResource);
|
|
25
|
-
Monitoring$ReventlessCore.notify("Projection", "AllStateViewSlices", stubResource);
|
|
26
|
-
Monitoring$ReventlessCore.notify("DeadLetterSink", "DeadLetterQueue", stubResource);
|
|
27
|
-
Monitoring$ReventlessCore.notify({
|
|
28
|
-
TAG: "Other",
|
|
29
|
-
_0: "Counter"
|
|
30
|
-
}, "ProductCounter", stubResource);
|
|
31
|
-
globalThis.expect(recorded).toEqual([
|
|
32
|
-
[
|
|
33
|
-
"CommandHandler",
|
|
34
|
-
"AllAggregatesCmdHandler"
|
|
35
|
-
],
|
|
36
|
-
[
|
|
37
|
-
"Projection",
|
|
38
|
-
"AllStateViewSlices"
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"DeadLetterSink",
|
|
42
|
-
"DeadLetterQueue"
|
|
43
|
-
],
|
|
44
|
-
[
|
|
45
|
-
{
|
|
46
|
-
TAG: "Other",
|
|
47
|
-
_0: "Counter"
|
|
48
|
-
},
|
|
49
|
-
"ProductCounter"
|
|
50
|
-
]
|
|
51
|
-
]);
|
|
52
|
-
Monitoring$ReventlessCore.use(Monitoring$ReventlessCore.Noop);
|
|
53
|
-
});
|
|
54
|
-
globalThis.test("notify forwards the static name and component resource to the backend", () => {
|
|
55
|
-
let seen = {
|
|
56
|
-
contents: undefined
|
|
57
|
-
};
|
|
58
|
-
let onProvisioned = (param, name, component) => {
|
|
59
|
-
seen.contents = [
|
|
60
|
-
name,
|
|
61
|
-
component
|
|
62
|
-
];
|
|
63
|
-
};
|
|
64
|
-
let Capture = {
|
|
65
|
-
onProvisioned: onProvisioned
|
|
66
|
-
};
|
|
67
|
-
Monitoring$ReventlessCore.use(Capture);
|
|
68
|
-
Monitoring$ReventlessCore.notify("Scheduler", "HeartbeatUnit", stubResource);
|
|
69
|
-
let match = seen.contents;
|
|
70
|
-
if (match !== undefined) {
|
|
71
|
-
globalThis.expect(match[0]).toBe("HeartbeatUnit");
|
|
72
|
-
} else {
|
|
73
|
-
globalThis.expect("no notify received").toBe("a notify");
|
|
74
|
-
}
|
|
75
|
-
Monitoring$ReventlessCore.use(Monitoring$ReventlessCore.Noop);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export {
|
|
80
|
-
stubResource,
|
|
81
|
-
}
|
|
82
|
-
/* Not a pure module */
|