@reventlessdev/reventless-core 3.0.0-alpha.249 → 3.0.0-alpha.251
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 +32 -0
- package/package.json +9 -9
- package/src/admin/Platform_ComponentDefinitionsApi.res +31 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +29 -1
- package/src/admin/Platform_PluginStructuresApi.res +37 -1
- package/src/admin/Platform_PluginStructuresApi.res.mjs +29 -1
- package/src/components/Api/QueryDbListQuery.res +26 -6
- package/src/components/Api/QueryDbListQuery.res.mjs +12 -5
- package/src/plugin/component/Plugin_Structure.res +620 -370
- package/src/plugin/component/Plugin_Structure.res.mjs +341 -3
- package/src/plugin/connect/PluginConnectExtension_Mapping.res +3 -6
- package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +11 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +0 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +60 -2
- package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +19 -2
- package/tests/admin/AdminApiSchemaDriftTest.res +460 -0
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +599 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +6 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +9 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res +12 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +10 -2
- package/tests/plugin/PluginStructureTest.res +109 -0
- package/tests/plugin/PluginStructureTest.res.mjs +127 -0
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +8 -0
|
@@ -10,7 +10,9 @@ import * as Owner$Reventless from "@reventlessdev/reventless-spec/src/components
|
|
|
10
10
|
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
11
11
|
import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
|
|
12
12
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
13
|
+
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
13
14
|
import * as Reference$Reventless from "@reventlessdev/reventless-spec/src/components/Reference.res.mjs";
|
|
15
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
14
16
|
import * as Logger$ReventlessCore from "../../util/Logger.res.mjs";
|
|
15
17
|
import * as StorageRef$Reventless from "@reventlessdev/reventless-spec/src/semantic/StorageRef.res.mjs";
|
|
16
18
|
import * as DisplayName$Reventless from "@reventlessdev/reventless-spec/src/components/DisplayName.res.mjs";
|
|
@@ -191,6 +193,132 @@ function lifecycleStatesFromStateSchema(entityName, stateSchema) {
|
|
|
191
193
|
});
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
function translationTableFailures(label, declared, publishedNames, sourceNames) {
|
|
197
|
+
let failures = [];
|
|
198
|
+
let push = msg => {
|
|
199
|
+
failures.push(msg);
|
|
200
|
+
};
|
|
201
|
+
declared.forEach(param => {
|
|
202
|
+
let name = param.name;
|
|
203
|
+
if (!publishedNames.includes(name)) {
|
|
204
|
+
push(label + `: publishedEvents names "` + name + `", which the extension point does not ` + (`publish — it declares ` + publishedNames.join(", ") + `.`));
|
|
205
|
+
}
|
|
206
|
+
param.fromEventTypes.forEach(src => {
|
|
207
|
+
if (!sourceNames.includes(src)) {
|
|
208
|
+
return push(label + `: publishedEvents says "` + name + `" comes from "` + src + `", which is not an ` + (`event of ` + sourceNames.join(", ") + `.`));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
return failures;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function translationTableDrift(label, declared, observed, followed) {
|
|
216
|
+
let declaredEdges = Stdlib_Array.reduce(declared, [], (acc, param) => {
|
|
217
|
+
let name = param.name;
|
|
218
|
+
return acc.concat(param.fromEventTypes.map(src => [
|
|
219
|
+
src,
|
|
220
|
+
name
|
|
221
|
+
]));
|
|
222
|
+
});
|
|
223
|
+
let has = (edges, param) => {
|
|
224
|
+
let pub = param[1];
|
|
225
|
+
let src = param[0];
|
|
226
|
+
return edges.some(param => {
|
|
227
|
+
if (Primitive_object.equal(param[0], src)) {
|
|
228
|
+
return Primitive_object.equal(param[1], pub);
|
|
229
|
+
} else {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
let failures = observed.filter(edge => !has(declaredEdges, edge)).map(param => label + `: "` + param[0] + `" publishes "` + param[1] + `", which publishedEvents does not declare.`);
|
|
235
|
+
let warnings = declaredEdges.filter(param => {
|
|
236
|
+
let src = param[0];
|
|
237
|
+
if (followed.includes(src)) {
|
|
238
|
+
return !has(observed, [
|
|
239
|
+
src,
|
|
240
|
+
param[1]
|
|
241
|
+
]);
|
|
242
|
+
} else {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
}).map(param => {
|
|
246
|
+
let src = param[0];
|
|
247
|
+
return label + `: publishedEvents declares "` + src + `" → "` + param[1] + `", which the mapping did not ` + (`produce for a synthesised "` + src + `".`);
|
|
248
|
+
});
|
|
249
|
+
return [
|
|
250
|
+
failures,
|
|
251
|
+
warnings
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function handledTableFailures(label, declared, eventNames, commandNames) {
|
|
256
|
+
let failures = [];
|
|
257
|
+
declared.forEach(param => {
|
|
258
|
+
let name = param.name;
|
|
259
|
+
if (!eventNames.includes(name)) {
|
|
260
|
+
failures.push(label + `: handledEvents names "` + name + `", which the extension point does not ` + (`publish — it declares ` + eventNames.join(", ") + `.`));
|
|
261
|
+
}
|
|
262
|
+
param.toCommandTypes.forEach(cmd => {
|
|
263
|
+
if (!commandNames.includes(cmd)) {
|
|
264
|
+
failures.push(label + `: handledEvents says "` + name + `" routes to "` + cmd + `", which is neither a ` + (`delegate command nor an extension point command — ` + commandNames.join(", ") + `.`));
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
return failures;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function commandTableFailures(label, keyed, valueKind, rows, keyNames, valueNames) {
|
|
273
|
+
let failures = [];
|
|
274
|
+
let push = msg => {
|
|
275
|
+
failures.push(msg);
|
|
276
|
+
};
|
|
277
|
+
rows.forEach(param => {
|
|
278
|
+
let name = param[0];
|
|
279
|
+
if (!keyNames.includes(name)) {
|
|
280
|
+
push(label + `: ` + keyed + ` names "` + name + `", which is not a command of the extension ` + (`point — it declares ` + keyNames.join(", ") + `.`));
|
|
281
|
+
}
|
|
282
|
+
param[1].forEach(v => {
|
|
283
|
+
if (!valueNames.includes(v)) {
|
|
284
|
+
return push(label + `: ` + keyed + ` says "` + name + `" ` + valueKind + ` "` + v + `", which the delegate does ` + (`not declare — ` + valueNames.join(", ") + `.`));
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
return failures;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
let probeId = "probe";
|
|
292
|
+
|
|
293
|
+
let probeMeta = {
|
|
294
|
+
service: "Plugin_Structure",
|
|
295
|
+
time: "",
|
|
296
|
+
msgId: "",
|
|
297
|
+
correlationId: ""
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
async function probeQueryEngine_scan(param, param$1, param$2) {
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
async function probeQueryEngine_query(param, param$1, param$2, param$3, param$4, param$5, param$6) {
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
let probeQueryEngine = {
|
|
309
|
+
scan: probeQueryEngine_scan,
|
|
310
|
+
query: probeQueryEngine_query
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
function reportTranslationTables(pluginName, failures, warnings) {
|
|
314
|
+
if (warnings.length !== 0) {
|
|
315
|
+
log.warn("Plugin_Structure", undefined, pluginName + `:\n` + warnings.join("\n"));
|
|
316
|
+
}
|
|
317
|
+
if (failures.length !== 0) {
|
|
318
|
+
return Stdlib_JsError.throwWithMessage(pluginName + `: the declared translation table does not match the mapping.\n` + failures.join("\n"));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
194
322
|
function checkDeclaredTransitions(pluginName, writables, lifecycleStatesByView) {
|
|
195
323
|
let unvalidated = {
|
|
196
324
|
contents: 0
|
|
@@ -890,16 +1018,60 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
890
1018
|
externalSystem: ITS.Spec.externalSystem,
|
|
891
1019
|
chapter: componentChapters[ITS.Spec.name]
|
|
892
1020
|
}));
|
|
1021
|
+
let tableFailures = [];
|
|
1022
|
+
let tableWarnings = [];
|
|
1023
|
+
let pushAll = (into, xs) => {
|
|
1024
|
+
xs.forEach(x => {
|
|
1025
|
+
into.push(x);
|
|
1026
|
+
});
|
|
1027
|
+
};
|
|
893
1028
|
let extensionDefs = extensions.map(E => {
|
|
894
1029
|
let delegateNames = E.mappings.map(M => M.delegateName);
|
|
1030
|
+
let epEventNames = DcbTag$Reventless.extractAllVariantNames(E.Spec.eventSchema);
|
|
1031
|
+
let epCommandNames = DcbTag$Reventless.extractAllVariantNames(E.Spec.commandSchema);
|
|
1032
|
+
let commandsByEvent = {};
|
|
1033
|
+
let eventsByCommand = {};
|
|
1034
|
+
E.mappings.forEach(M => {
|
|
1035
|
+
let label = E.Spec.name + ` → ` + M.delegateName;
|
|
1036
|
+
pushAll(tableFailures, handledTableFailures(label, M.handledEvents, epEventNames, M.delegateCommandNames.concat(epCommandNames)));
|
|
1037
|
+
pushAll(tableFailures, commandTableFailures(label, "issuedCommands", "comes from", M.issuedCommands.map(param => [
|
|
1038
|
+
param.name,
|
|
1039
|
+
param.fromEventTypes
|
|
1040
|
+
]), epCommandNames, M.delegateEventNames));
|
|
1041
|
+
M.issuedCommands.forEach(param => {
|
|
1042
|
+
let key = E.Spec.name + `.` + param.name;
|
|
1043
|
+
eventsByCommand[key] = Stdlib_Option.getOr(eventsByCommand[key], []).concat(qualify(name, param.fromEventTypes));
|
|
1044
|
+
});
|
|
1045
|
+
M.handledEvents.forEach(param => {
|
|
1046
|
+
let qualified = param.toCommandTypes.map(cmd => {
|
|
1047
|
+
if (M.delegateCommandNames.includes(cmd)) {
|
|
1048
|
+
return name + `.` + cmd;
|
|
1049
|
+
} else {
|
|
1050
|
+
return E.Spec.name + `.` + cmd;
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
let key = E.Spec.name + `.` + param.name;
|
|
1054
|
+
commandsByEvent[key] = Stdlib_Option.getOr(commandsByEvent[key], []).concat(qualified);
|
|
1055
|
+
});
|
|
1056
|
+
});
|
|
895
1057
|
return {
|
|
896
1058
|
name: E.Spec.name,
|
|
897
1059
|
delegateNames: delegateNames,
|
|
898
1060
|
eventTypes: qualify(E.Spec.name, DcbTag$Reventless.extractVariantNames(E.Spec.eventSchema)),
|
|
899
|
-
commandTypes: qualify(E.Spec.name, DcbTag$Reventless.extractAllVariantNames(E.Spec.commandSchema))
|
|
1061
|
+
commandTypes: qualify(E.Spec.name, DcbTag$Reventless.extractAllVariantNames(E.Spec.commandSchema)),
|
|
1062
|
+
handledEvents: Object.entries(commandsByEvent).map(param => ({
|
|
1063
|
+
name: param[0],
|
|
1064
|
+
toCommandTypes: Belt_SetString.toArray(Belt_SetString.fromArray(param[1]))
|
|
1065
|
+
})),
|
|
1066
|
+
issuedCommands: Object.entries(eventsByCommand).map(param => ({
|
|
1067
|
+
name: param[0],
|
|
1068
|
+
fromEventTypes: Belt_SetString.toArray(Belt_SetString.fromArray(param[1]))
|
|
1069
|
+
}))
|
|
900
1070
|
};
|
|
901
1071
|
});
|
|
902
1072
|
let epByName = {};
|
|
1073
|
+
let epPublished = {};
|
|
1074
|
+
let epAccepted = {};
|
|
903
1075
|
extensionPoints.forEach(M => {
|
|
904
1076
|
let epName = M.ExtensionPoint.name;
|
|
905
1077
|
let sourceEvents = qualify(name, DcbTag$Reventless.extractVariantNames(M.Delegate.eventSchema));
|
|
@@ -914,16 +1086,174 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
914
1086
|
match[1].concat(sourceEvents),
|
|
915
1087
|
match[2].concat(commands)
|
|
916
1088
|
];
|
|
1089
|
+
let label = epName + ` ← ` + M.Delegate.name;
|
|
1090
|
+
let publishedNames = DcbTag$Reventless.extractAllVariantNames(M.ExtensionPoint.eventSchema);
|
|
1091
|
+
let sourceNames = DcbTag$Reventless.extractAllVariantNames(M.Delegate.eventSchema);
|
|
1092
|
+
pushAll(tableFailures, translationTableFailures(label, M.publishedEvents, publishedNames, sourceNames));
|
|
1093
|
+
let acceptedNames = DcbTag$Reventless.extractAllVariantNames(M.ExtensionPoint.commandSchema);
|
|
1094
|
+
let delegateCommandNames = DcbTag$Reventless.extractAllVariantNames(M.Delegate.commandSchema);
|
|
1095
|
+
pushAll(tableFailures, commandTableFailures(label, "acceptedCommands", "routes to", M.acceptedCommands.map(param => [
|
|
1096
|
+
param.name,
|
|
1097
|
+
param.toCommandTypes
|
|
1098
|
+
]), acceptedNames, delegateCommandNames));
|
|
1099
|
+
let acceptedObserved = [];
|
|
1100
|
+
acceptedNames.forEach(cmd => {
|
|
1101
|
+
let synthesised = DcbTag$Reventless.isVariantPayloadBearing(M.ExtensionPoint.commandSchema, cmd) ? Object.fromEntries([[
|
|
1102
|
+
"TAG",
|
|
1103
|
+
cmd
|
|
1104
|
+
]]) : cmd;
|
|
1105
|
+
let actions;
|
|
1106
|
+
try {
|
|
1107
|
+
let command = Util_Sury$Reventless.fromJson(Message$Reventless.fillMissingDefaults(M.ExtensionPoint.commandSchema, synthesised, []), M.ExtensionPoint.commandSchema);
|
|
1108
|
+
let decodedAs = Message$Reventless.variantNameOfJson(Message$Reventless.encode(command, M.ExtensionPoint.commandSchema));
|
|
1109
|
+
actions = decodedAs !== cmd ? ({
|
|
1110
|
+
TAG: "Error",
|
|
1111
|
+
_0: `a synthesised "` + cmd + `" decoded as "` + decodedAs + `"`
|
|
1112
|
+
}) : ({
|
|
1113
|
+
TAG: "Ok",
|
|
1114
|
+
_0: M.mapIncomingCommand(probeId, command, probeMeta)
|
|
1115
|
+
});
|
|
1116
|
+
} catch (exn) {
|
|
1117
|
+
actions = {
|
|
1118
|
+
TAG: "Error",
|
|
1119
|
+
_0: `the mapping raised on a synthesised "` + cmd + `"`
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
if (actions.TAG === "Ok") {
|
|
1123
|
+
actions._0.forEach(action => {
|
|
1124
|
+
if (action.TAG !== "PublishCommand") {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
acceptedObserved.push([
|
|
1128
|
+
cmd,
|
|
1129
|
+
Message$Reventless.variantNameOfJson(Message$Reventless.encode(action._1, M.Delegate.commandSchema))
|
|
1130
|
+
]);
|
|
1131
|
+
});
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
tableWarnings.push(label + `: not checked against the arms — ` + actions._0 + `.`);
|
|
1135
|
+
});
|
|
1136
|
+
acceptedObserved.forEach(param => {
|
|
1137
|
+
let routed = param[1];
|
|
1138
|
+
let cmd = param[0];
|
|
1139
|
+
if (!M.acceptedCommands.some(param => param.name === cmd ? param.toCommandTypes.includes(routed) : false)) {
|
|
1140
|
+
tableFailures.push(label + `: "` + cmd + `" routes to "` + routed + `", which acceptedCommands does not declare.`);
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
let acceptedTable = Stdlib_Option.getOr(epAccepted[epName], {});
|
|
1145
|
+
M.acceptedCommands.forEach(param => {
|
|
1146
|
+
let key = epName + `.` + param.name;
|
|
1147
|
+
acceptedTable[key] = Stdlib_Option.getOr(acceptedTable[key], []).concat(qualify(name, param.toCommandTypes));
|
|
1148
|
+
});
|
|
1149
|
+
epAccepted[epName] = acceptedTable;
|
|
1150
|
+
let mapOutgoing = M.mapOutgoingEvent;
|
|
1151
|
+
if (mapOutgoing !== undefined) {
|
|
1152
|
+
let observed = [];
|
|
1153
|
+
let followed = [];
|
|
1154
|
+
sourceNames.forEach(src => {
|
|
1155
|
+
let synthesised = DcbTag$Reventless.isVariantPayloadBearing(M.Delegate.eventSchema, src) ? Object.fromEntries([[
|
|
1156
|
+
"TAG",
|
|
1157
|
+
src
|
|
1158
|
+
]]) : src;
|
|
1159
|
+
let outcome;
|
|
1160
|
+
try {
|
|
1161
|
+
let event = Util_Sury$Reventless.fromJson(Message$Reventless.fillMissingDefaults(M.Delegate.eventSchema, synthesised, []), M.Delegate.eventSchema);
|
|
1162
|
+
let decodedAs = Message$Reventless.variantNameOfJson(Message$Reventless.encode(event, M.Delegate.eventSchema));
|
|
1163
|
+
if (decodedAs !== src) {
|
|
1164
|
+
outcome = {
|
|
1165
|
+
TAG: "Error",
|
|
1166
|
+
_0: `a synthesised "` + src + `" decoded as "` + decodedAs + `"`
|
|
1167
|
+
};
|
|
1168
|
+
} else {
|
|
1169
|
+
let actions = mapOutgoing(probeId, event, probeMeta, probeQueryEngine);
|
|
1170
|
+
actions.forEach(action => {
|
|
1171
|
+
switch (action.TAG) {
|
|
1172
|
+
case "PublishEvent" :
|
|
1173
|
+
observed.push([
|
|
1174
|
+
src,
|
|
1175
|
+
Message$Reventless.variantNameOfJson(Message$Reventless.encode(action._1, M.ExtensionPoint.eventSchema))
|
|
1176
|
+
]);
|
|
1177
|
+
return;
|
|
1178
|
+
case "PublishEventAsync" :
|
|
1179
|
+
case "HandleDirective" :
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
outcome = actions.some(action => {
|
|
1184
|
+
switch (action.TAG) {
|
|
1185
|
+
case "PublishEventAsync" :
|
|
1186
|
+
return true;
|
|
1187
|
+
case "PublishEvent" :
|
|
1188
|
+
case "HandleDirective" :
|
|
1189
|
+
return false;
|
|
1190
|
+
}
|
|
1191
|
+
}) ? ({
|
|
1192
|
+
TAG: "Error",
|
|
1193
|
+
_0: `"` + src + `" publishes behind a promise`
|
|
1194
|
+
}) : ({
|
|
1195
|
+
TAG: "Ok",
|
|
1196
|
+
_0: undefined
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
} catch (exn) {
|
|
1200
|
+
outcome = {
|
|
1201
|
+
TAG: "Error",
|
|
1202
|
+
_0: `the mapping raised on a synthesised "` + src + `"`
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
if (outcome.TAG === "Ok") {
|
|
1206
|
+
followed.push(src);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
tableWarnings.push(label + `: not checked against the arms — ` + outcome._0 + `.`);
|
|
1210
|
+
});
|
|
1211
|
+
let match$1 = translationTableDrift(label, M.publishedEvents, observed, followed);
|
|
1212
|
+
pushAll(tableFailures, match$1[0]);
|
|
1213
|
+
pushAll(tableWarnings, match$1[1]);
|
|
1214
|
+
} else if (M.publishedEvents.length !== 0) {
|
|
1215
|
+
tableFailures.push(label + `: publishedEvents declares ` + M.publishedEvents.length.toString() + ` event(s), but the mapping has no mapOutgoingEvent and publishes nothing.`);
|
|
1216
|
+
}
|
|
1217
|
+
let declaredNames = M.publishedEvents.map(p => p.name);
|
|
1218
|
+
publishedNames.filter(p => !declaredNames.includes(p)).forEach(p => {
|
|
1219
|
+
tableWarnings.push(label + `: the extension point publishes "` + p + `", which no arm produces.`);
|
|
1220
|
+
});
|
|
1221
|
+
let table = Stdlib_Option.getOr(epPublished[epName], {});
|
|
1222
|
+
M.publishedEvents.forEach(param => {
|
|
1223
|
+
let key = epName + `.` + param.name;
|
|
1224
|
+
table[key] = Stdlib_Option.getOr(table[key], []).concat(qualify(name, param.fromEventTypes));
|
|
1225
|
+
});
|
|
1226
|
+
epPublished[epName] = table;
|
|
917
1227
|
});
|
|
918
1228
|
let extensionPointDefs = Object.entries(epByName).map(param => {
|
|
919
1229
|
let match = param[1];
|
|
1230
|
+
let epName = param[0];
|
|
920
1231
|
return {
|
|
921
|
-
name:
|
|
1232
|
+
name: epName,
|
|
922
1233
|
delegateNames: Belt_SetString.toArray(Belt_SetString.fromArray(match[0])),
|
|
923
1234
|
sourceEventTypes: Belt_SetString.toArray(Belt_SetString.fromArray(match[1])),
|
|
924
|
-
commandTypes: Belt_SetString.toArray(Belt_SetString.fromArray(match[2]))
|
|
1235
|
+
commandTypes: Belt_SetString.toArray(Belt_SetString.fromArray(match[2])),
|
|
1236
|
+
publishedEvents: Object.entries(Stdlib_Option.getOr(epPublished[epName], {})).map(param => ({
|
|
1237
|
+
name: param[0],
|
|
1238
|
+
fromEventTypes: Belt_SetString.toArray(Belt_SetString.fromArray(param[1]))
|
|
1239
|
+
})),
|
|
1240
|
+
acceptedCommands: Object.entries(Stdlib_Option.getOr(epAccepted[epName], {})).map(param => ({
|
|
1241
|
+
name: param[0],
|
|
1242
|
+
toCommandTypes: Belt_SetString.toArray(Belt_SetString.fromArray(param[1]))
|
|
1243
|
+
}))
|
|
925
1244
|
};
|
|
926
1245
|
});
|
|
1246
|
+
Object.entries(epByName).forEach(param => {
|
|
1247
|
+
let epName = param[0];
|
|
1248
|
+
let handled = Object.keys(Stdlib_Option.getOr(epAccepted[epName], {}));
|
|
1249
|
+
Belt_SetString.toArray(Belt_SetString.fromArray(param[1][2])).forEach(cmd => {
|
|
1250
|
+
if (!handled.includes(cmd)) {
|
|
1251
|
+
tableWarnings.push(epName + `: the extension point accepts "` + cmd + `", which no arm handles — a sender gets no error and nothing happens.`);
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
});
|
|
1256
|
+
reportTranslationTables(name, tableFailures, tableWarnings);
|
|
927
1257
|
checkDeclaredTransitions(name, stateChangeDefs.concat(aggregateDefs), lifecycleStatesByView);
|
|
928
1258
|
checkLifecycleTopology(name, stateChangeDefs.concat(aggregateDefs), lifecycleStatesByView);
|
|
929
1259
|
reportRetiredStates(name, retiredFailures, retiredUnchecked);
|
|
@@ -956,6 +1286,14 @@ export {
|
|
|
956
1286
|
checkRetiredValue,
|
|
957
1287
|
reportRetiredStates,
|
|
958
1288
|
lifecycleStatesFromStateSchema,
|
|
1289
|
+
translationTableFailures,
|
|
1290
|
+
translationTableDrift,
|
|
1291
|
+
handledTableFailures,
|
|
1292
|
+
commandTableFailures,
|
|
1293
|
+
probeId,
|
|
1294
|
+
probeMeta,
|
|
1295
|
+
probeQueryEngine,
|
|
1296
|
+
reportTranslationTables,
|
|
959
1297
|
checkDeclaredTransitions,
|
|
960
1298
|
lifecycleTopologyFindings,
|
|
961
1299
|
checkLifecycleTopology,
|
|
@@ -74,12 +74,9 @@ module Make = (Spec: Spec) => {
|
|
|
74
74
|
),
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
// queue to peer EP topics. Admin owns that work now
|
|
81
|
-
// (manageSubscriptions in EventCollectorEntryPoint.mjs) — these
|
|
82
|
-
// cases drop to no-ops.
|
|
77
|
+
// A peer's PluginConnected / PluginDeactivated used to subscribe or
|
|
78
|
+
// unsubscribe this plugin's own queue to peer EP topics. Admin owns that
|
|
79
|
+
// now (manageSubscriptions), so these drop to no-ops.
|
|
83
80
|
| _ => []
|
|
84
81
|
}
|
|
85
82
|
}
|
|
@@ -45,6 +45,14 @@ function Make(Spec) {
|
|
|
45
45
|
}];
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
let handledEvents = [{
|
|
49
|
+
name: "UnknownPluginDetected",
|
|
50
|
+
toCommandTypes: [
|
|
51
|
+
"ConnectPlugin",
|
|
52
|
+
"RegisterUiFragment"
|
|
53
|
+
]
|
|
54
|
+
}];
|
|
55
|
+
let issuedCommands = [];
|
|
48
56
|
let $$let = ExtensionMapping$ReventlessInfra.NoDelegate.Id;
|
|
49
57
|
let ConnectPluginMapping = ExtensionMapping$ReventlessInfra.Make({
|
|
50
58
|
ExtensionPoint: {
|
|
@@ -72,7 +80,9 @@ function Make(Spec) {
|
|
|
72
80
|
moduleUrl: PluginExtensionPointSpec$ReventlessInfra.moduleUrl,
|
|
73
81
|
delegateModuleUrl: delegateModuleUrl,
|
|
74
82
|
mapIncomingEvent: mapIncomingEvent,
|
|
75
|
-
mapOutgoingEvent: undefined
|
|
83
|
+
mapOutgoingEvent: undefined,
|
|
84
|
+
handledEvents: handledEvents,
|
|
85
|
+
issuedCommands: issuedCommands
|
|
76
86
|
});
|
|
77
87
|
let moduleUrl = import.meta.url;
|
|
78
88
|
let mappings = [ConnectPluginMapping];
|
|
@@ -327,12 +327,68 @@ function Make(Spec) {
|
|
|
327
327
|
}
|
|
328
328
|
];
|
|
329
329
|
};
|
|
330
|
+
let publishedEvents = [
|
|
331
|
+
{
|
|
332
|
+
name: "UnknownPluginDetected",
|
|
333
|
+
fromEventTypes: ["VersionDetected"]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: "PluginConnected",
|
|
337
|
+
fromEventTypes: [
|
|
338
|
+
"VersionConnected",
|
|
339
|
+
"VersionPromoted"
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "PluginDisconnected",
|
|
344
|
+
fromEventTypes: ["VersionDisconnected"]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "PluginDeactivated",
|
|
348
|
+
fromEventTypes: ["VersionDeactivated"]
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: "PluginActivated",
|
|
352
|
+
fromEventTypes: ["VersionActivated"]
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: "PluginRetired",
|
|
356
|
+
fromEventTypes: ["VersionRetired"]
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: "IncompatiblePlugin",
|
|
360
|
+
fromEventTypes: ["IncompatiblePluginDetected"]
|
|
361
|
+
}
|
|
362
|
+
];
|
|
363
|
+
let acceptedCommands = [
|
|
364
|
+
{
|
|
365
|
+
name: "Heartbeat",
|
|
366
|
+
toCommandTypes: ["Heartbeat"]
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: "RedetectPlugin",
|
|
370
|
+
toCommandTypes: ["Redetect"]
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: "ConnectPlugin",
|
|
374
|
+
toCommandTypes: [
|
|
375
|
+
"Connect",
|
|
376
|
+
"ReportIncompatibility"
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "DisconnectPlugin",
|
|
381
|
+
toCommandTypes: ["Disconnect"]
|
|
382
|
+
}
|
|
383
|
+
];
|
|
330
384
|
let PluginMapping = {
|
|
331
385
|
ExtensionPoint: undefined,
|
|
332
386
|
Delegate: undefined,
|
|
333
387
|
moduleUrl: PluginExtensionPointSpec$ReventlessInfra.moduleUrl,
|
|
334
388
|
mapIncomingCommand: mapIncomingCommand,
|
|
335
|
-
mapOutgoingEvent: mapOutgoingEvent
|
|
389
|
+
mapOutgoingEvent: mapOutgoingEvent,
|
|
390
|
+
publishedEvents: publishedEvents,
|
|
391
|
+
acceptedCommands: acceptedCommands
|
|
336
392
|
};
|
|
337
393
|
let Mapping = ExtensionPointMapping$ReventlessInfra.Make({
|
|
338
394
|
ExtensionPoint: {
|
|
@@ -353,7 +409,9 @@ function Make(Spec) {
|
|
|
353
409
|
},
|
|
354
410
|
moduleUrl: PluginExtensionPointSpec$ReventlessInfra.moduleUrl,
|
|
355
411
|
mapIncomingCommand: mapIncomingCommand,
|
|
356
|
-
mapOutgoingEvent: mapOutgoingEvent
|
|
412
|
+
mapOutgoingEvent: mapOutgoingEvent,
|
|
413
|
+
publishedEvents: publishedEvents,
|
|
414
|
+
acceptedCommands: acceptedCommands
|
|
357
415
|
});
|
|
358
416
|
return {
|
|
359
417
|
disconnectScheduleName: disconnectScheduleName,
|
|
@@ -34,12 +34,27 @@ function mapIncomingCommand(id, cmd, meta) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
let publishedEvents = [];
|
|
38
|
+
|
|
39
|
+
let acceptedCommands = [
|
|
40
|
+
{
|
|
41
|
+
name: "RegisterUiFragment",
|
|
42
|
+
toCommandTypes: ["RegisterUiFragment"]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "DisconnectPlugin",
|
|
46
|
+
toCommandTypes: ["DeregisterUiFragment"]
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
|
|
37
50
|
let UiFragmentMapping = {
|
|
38
51
|
ExtensionPoint: undefined,
|
|
39
52
|
Delegate: undefined,
|
|
40
53
|
moduleUrl: moduleUrl,
|
|
41
54
|
mapIncomingCommand: mapIncomingCommand,
|
|
42
|
-
mapOutgoingEvent: undefined
|
|
55
|
+
mapOutgoingEvent: undefined,
|
|
56
|
+
publishedEvents: publishedEvents,
|
|
57
|
+
acceptedCommands: acceptedCommands
|
|
43
58
|
};
|
|
44
59
|
|
|
45
60
|
let Mapping = ExtensionPointMapping$ReventlessInfra.Make({
|
|
@@ -61,7 +76,9 @@ let Mapping = ExtensionPointMapping$ReventlessInfra.Make({
|
|
|
61
76
|
},
|
|
62
77
|
moduleUrl: moduleUrl,
|
|
63
78
|
mapIncomingCommand: mapIncomingCommand,
|
|
64
|
-
mapOutgoingEvent: undefined
|
|
79
|
+
mapOutgoingEvent: undefined,
|
|
80
|
+
publishedEvents: publishedEvents,
|
|
81
|
+
acceptedCommands: acceptedCommands
|
|
65
82
|
});
|
|
66
83
|
|
|
67
84
|
let PluginExtensionPointSpec;
|