@reventlessdev/reventless-core 3.0.0-alpha.338 → 3.0.0-alpha.340
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 +17 -0
- package/package.json +7 -7
- package/src/ComponentType.res +38 -62
- package/src/ComponentType.res.mjs +34 -115
- package/src/ResourceAttribution.res +7 -33
- package/src/ResourceAttribution.res.mjs +2 -51
- package/src/ViewChange.res.mjs +2 -2
- package/src/admin/Platform_Admin.res +66 -58
- package/src/admin/Platform_Admin.res.mjs +4 -2
- package/src/admin/Platform_ComponentDefinitionsApi.res +10 -11
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +9 -8
- package/src/admin/Platform_PluginStructuresApi.res +1 -1
- package/src/admin/Platform_SelfRegistration.res.mjs +3 -3
- package/src/components/Dcb/Dcb_Builder.res +1 -0
- package/src/components/Dcb/Dcb_Builder.res.mjs +1 -1
- package/src/components/QueryDb/QueryDb.res.mjs +1 -1
- package/src/plugin/component/Plugin_Builder.res +13 -8
- package/src/plugin/component/Plugin_Builder.res.mjs +6 -4
- package/src/plugin/component/Plugin_BuiltHook.res +7 -2
- package/src/plugin/component/Plugin_Helpers.res +4 -0
- package/src/plugin/component/Plugin_Structure.res +8 -14
- package/src/plugin/component/Plugin_Structure.res.mjs +9 -18
- package/src/plugin/component/SchemaWalker.res +4 -4
- package/src/plugin/component/SchemaWalker.res.mjs +4 -4
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +4 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +7 -3
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +2 -2
- package/src/util/EffectLogger.res.mjs +8 -8
- package/src/util/Logger.res +21 -7
- package/src/util/Logger.res.mjs +44 -30
- package/tests/ClosedSetWordsTest.res +105 -0
- package/tests/ClosedSetWordsTest.res.mjs +145 -0
- package/tests/ResourceAttributionTest.res.mjs +4 -7
- package/tests/admin/AdminApiSchemaDriftTest.res +1 -1
- package/tests/admin/Platform_BakedManifestTest.res +1 -1
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +1 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res +3 -3
- package/tests/admin/Platform_SelfRegistrationTest.res +2 -2
- package/tests/commandgenerator/OwnerStampingTest.res.mjs +1 -1
- package/tests/dcb/DcbScopeInferenceTest.res +66 -0
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +166 -0
- package/tests/dcb/DcbValidationTest.res +21 -0
- package/tests/dcb/DcbValidationTest.res.mjs +26 -9
- package/tests/logger/LogFormatTest.res.mjs +2 -2
- package/tests/logger/LoggerLazyTest.res.mjs +2 -2
- package/tests/logger/LoggerSinkTest.res.mjs +26 -26
- package/tests/plugin/ManifestVisibilityTest.res +4 -2
- package/tests/plugin/ManifestVisibilityTest.res.mjs +5 -1
- package/tests/plugin/SchemaWalkerTest.res +3 -3
- package/tests/plugin/SchemaWalkerTest.res.mjs +3 -3
- package/tests/projection/ViewChangeTest.res.mjs +1 -1
|
@@ -64,15 +64,7 @@ let encodeCommandDef = (c: commandDef): JSON.t =>
|
|
|
64
64
|
Dict.fromArray([
|
|
65
65
|
("name", JSON.Encode.string(c.name)),
|
|
66
66
|
("schema", JSON.Encode.string(c.schema)),
|
|
67
|
-
(
|
|
68
|
-
"level",
|
|
69
|
-
JSON.Encode.string(
|
|
70
|
-
switch c.level {
|
|
71
|
-
| Collection => "Collection"
|
|
72
|
-
| Instance => "Instance"
|
|
73
|
-
},
|
|
74
|
-
),
|
|
75
|
-
),
|
|
67
|
+
("level", JSON.Encode.string((c.level :> string))),
|
|
76
68
|
("aggregateIdField", c.aggregateIdField->Option.mapOr(JSON.Encode.null, JSON.Encode.string)),
|
|
77
69
|
("mutationField", JSON.Encode.string(c.mutationField)),
|
|
78
70
|
("references", c.references->Array.map(encodeFieldReference)->JSON.Encode.array),
|
|
@@ -100,7 +92,11 @@ let encodeCommandDef = (c: commandDef): JSON.t =>
|
|
|
100
92
|
// (below) answers the second. Neither is a security boundary — an Internal view
|
|
101
93
|
// keeps its resolver and stays queryable, so naming it here publishes a fact the
|
|
102
94
|
// caller is already entitled to.
|
|
103
|
-
let isPublicReadSide = (q: readSideDef): bool =>
|
|
95
|
+
let isPublicReadSide = (q: readSideDef): bool =>
|
|
96
|
+
switch q.visibility {
|
|
97
|
+
| Some(Internal) => false
|
|
98
|
+
| _ => true
|
|
99
|
+
}
|
|
104
100
|
|
|
105
101
|
let encodeReadSideDef = (r: readSideDef): JSON.t =>
|
|
106
102
|
Dict.fromArray([
|
|
@@ -117,7 +113,10 @@ let encodeReadSideDef = (r: readSideDef): JSON.t =>
|
|
|
117
113
|
// unfiltered structure needs to know WHICH components are Internal, and a
|
|
118
114
|
// consumer of the filtered query reads null here because nothing Internal
|
|
119
115
|
// survives the filter anyway.
|
|
120
|
-
(
|
|
116
|
+
(
|
|
117
|
+
"visibility",
|
|
118
|
+
r.visibility->Option.mapOr(JSON.Encode.null, v => JSON.Encode.string((v :> string))),
|
|
119
|
+
),
|
|
121
120
|
("chapter", r.chapter->Option.mapOr(JSON.Encode.null, JSON.Encode.string)),
|
|
122
121
|
("singleQueryField", r.singleQueryField->Option.mapOr(JSON.Encode.null, JSON.Encode.string)),
|
|
123
122
|
("plural", r.plural->Option.mapOr(JSON.Encode.null, JSON.Encode.string)),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
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
4
|
import * as Plugin$ReventlessCore from "../plugin/component/Plugin.res.mjs";
|
|
6
5
|
|
|
7
6
|
let sdlTypes = [
|
|
@@ -42,9 +41,6 @@ function encodeFieldReference(r) {
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
function encodeCommandDef(c) {
|
|
45
|
-
let match = c.level;
|
|
46
|
-
let tmp;
|
|
47
|
-
tmp = match === "Collection" ? "Collection" : "Instance";
|
|
48
44
|
return Object.fromEntries([
|
|
49
45
|
[
|
|
50
46
|
"name",
|
|
@@ -56,7 +52,7 @@ function encodeCommandDef(c) {
|
|
|
56
52
|
],
|
|
57
53
|
[
|
|
58
54
|
"level",
|
|
59
|
-
|
|
55
|
+
c.level
|
|
60
56
|
],
|
|
61
57
|
[
|
|
62
58
|
"aggregateIdField",
|
|
@@ -98,7 +94,12 @@ function encodeCommandDef(c) {
|
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
function isPublicReadSide(q) {
|
|
101
|
-
|
|
97
|
+
let match = q.visibility;
|
|
98
|
+
if (match !== undefined && (match === "Public" || match === "Internal")) {
|
|
99
|
+
return match === "Public";
|
|
100
|
+
} else {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
function encodeReadSideDef(r) {
|
|
@@ -141,7 +142,7 @@ function encodeReadSideDef(r) {
|
|
|
141
142
|
],
|
|
142
143
|
[
|
|
143
144
|
"visibility",
|
|
144
|
-
Stdlib_Option.mapOr(r.visibility, null,
|
|
145
|
+
Stdlib_Option.mapOr(r.visibility, null, v => v)
|
|
145
146
|
],
|
|
146
147
|
[
|
|
147
148
|
"chapter",
|
|
@@ -415,7 +416,7 @@ function encodePluginStructureEntry(pluginId, derived, def) {
|
|
|
415
416
|
],
|
|
416
417
|
[
|
|
417
418
|
"internalQueryables",
|
|
418
|
-
def.readModels.concat(def.stateViewSlices).filter(q => !
|
|
419
|
+
def.readModels.concat(def.stateViewSlices).filter(q => !isPublicReadSide(q)).map(encodeReadSideDef)
|
|
419
420
|
],
|
|
420
421
|
[
|
|
421
422
|
"stateChangeSlices",
|
|
@@ -74,7 +74,7 @@ let encodeTraitDeclaration = (d: traitDeclaration): JSON.t =>
|
|
|
74
74
|
let encodeAdmissionDef = (d: Reventless.Admission.def): JSON.t =>
|
|
75
75
|
Dict.fromArray([
|
|
76
76
|
("role", JSON.Encode.string(d.role)),
|
|
77
|
-
("strategy", JSON.Encode.string(d.strategy)),
|
|
77
|
+
("strategy", JSON.Encode.string((d.strategy :> string))),
|
|
78
78
|
(
|
|
79
79
|
"invitedBy",
|
|
80
80
|
d.invitedBy->Option.mapOr(JSON.Encode.null, Platform_ComponentDefinitionsApi.encodeStrings),
|
|
@@ -23,7 +23,7 @@ function doorField(structures, part) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function openRolesField(structures) {
|
|
26
|
-
return Stdlib_Option.map(marked(structures, "
|
|
26
|
+
return Stdlib_Option.map(marked(structures, "openRoles"), param => {
|
|
27
27
|
let d = param[1];
|
|
28
28
|
let plugin = param[0];
|
|
29
29
|
return Stdlib_Option.mapOr(Stdlib_Option.flatMap(Stdlib_Array.findMap(structures, param => {
|
|
@@ -50,8 +50,8 @@ function selfServiceGroups(structures) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function fromStructures(structures) {
|
|
53
|
-
let match = doorField(structures, "
|
|
54
|
-
let match$1 = doorField(structures, "
|
|
53
|
+
let match = doorField(structures, "start");
|
|
54
|
+
let match$1 = doorField(structures, "complete");
|
|
55
55
|
if (match !== undefined && match$1 !== undefined) {
|
|
56
56
|
return {
|
|
57
57
|
start: match,
|
|
@@ -396,6 +396,7 @@ module Make = (
|
|
|
396
396
|
Sc.Spec.consumedEventSchema->S.castToUnknown,
|
|
397
397
|
)),
|
|
398
398
|
~producedTagKeys=tagKeysByEventType,
|
|
399
|
+
~crossPartitionTagKeys=effectiveCrossPartitionTagKeys,
|
|
399
400
|
~payloadTagKeysBySlice=sliceSchemas
|
|
400
401
|
->Array.map(slice => (
|
|
401
402
|
slice.name,
|
|
@@ -239,7 +239,7 @@ function Make(DcbEventLogStorage) {
|
|
|
239
239
|
]), tagKeysByEventType, Object.fromEntries(sliceSchemas.map(slice => [
|
|
240
240
|
slice.name,
|
|
241
241
|
DcbTag$Reventless.commandPayloadTagKeys(DcbTag$Reventless.sliceShape(slice), DcbTag$Reventless.slicePartitionTag(boundaryPartition, slice.name), effectiveCrossPartitionTagKeys)
|
|
242
|
-
]))).forEach(w => log.warn("Dcb_Builder", undefined, `DCB composite-read warning (` + w.sliceName + `): ` + w.message));
|
|
242
|
+
])), effectiveCrossPartitionTagKeys).forEach(w => log.warn("Dcb_Builder", undefined, `DCB composite-read warning (` + w.sliceName + `): ` + w.message));
|
|
243
243
|
if (effective.droppedCrossPartitionTagKeys.length !== 0) {
|
|
244
244
|
log.error("Dcb_Builder", undefined, `DCB scope degraded (` + name + `): cross-partition reads of [` + effective.droppedCrossPartitionTagKeys.join(", ") + `] were derived but dropped — an ambiguous slice forced the boundary onto @crossPartition annotations that do not carry them. Slices referencing another entity by these keys will decide against an empty history and reject valid commands. Resolve: ` + effective.ambiguities.map(param => param[0] + ` (` + param[1] + `)`).join(" | "));
|
|
245
245
|
}
|
|
@@ -679,14 +679,19 @@ module Make = (
|
|
|
679
679
|
toPayload(s, ~schema=Reventless.Plugin.pluginStructureSchema, ~store="pluginStructures")
|
|
680
680
|
)
|
|
681
681
|
|
|
682
|
-
|
|
683
|
-
(
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
682
|
+
let callbackInputs =
|
|
683
|
+
(
|
|
684
|
+
(interstackAdminExtensionPoints, localAdminResolvedEP, schemaPushed)->Pulumi.Output.all3,
|
|
685
|
+
aggregateResources->Pulumi.Output.allDict,
|
|
686
|
+
publishToAggregates->Pulumi.Output.allDict,
|
|
687
|
+
scheduler,
|
|
688
|
+
queryEngine,
|
|
689
|
+
)->Pulumi.Output.all5
|
|
690
|
+
Spec.hooks.onDcbRuntimeSetupGate->Option.forEach(hook =>
|
|
691
|
+
hook(callbackInputs->Pulumi.Output.apply(_ => ()))
|
|
688
692
|
)
|
|
689
|
-
|
|
693
|
+
|
|
694
|
+
callbackInputs
|
|
690
695
|
// `applyAttributed`, not `apply`: this callback provisions real resources —
|
|
691
696
|
// extension points, tasks, the heartbeat, resolvers — and it runs after
|
|
692
697
|
// this construct has returned, when the ambient attribution context is
|
|
@@ -1063,7 +1068,7 @@ module Make = (
|
|
|
1063
1068
|
// docs/plans/done/component-visibility-annotations.md
|
|
1064
1069
|
let isVisibleReadSide = (q: Reventless.Plugin.readSideDef) =>
|
|
1065
1070
|
switch q.visibility {
|
|
1066
|
-
| Some(
|
|
1071
|
+
| Some(Internal) => false
|
|
1067
1072
|
| _ => true
|
|
1068
1073
|
}
|
|
1069
1074
|
let visibleReadModels = pluginStructure.readModels->Array.filter(isVisibleReadSide)
|
|
@@ -49,8 +49,8 @@ function Make(Spec) {
|
|
|
49
49
|
let aggregatePositions = aggregatePositionsOpt !== undefined ? aggregatePositionsOpt : [];
|
|
50
50
|
let isVisibleReadSide = q => {
|
|
51
51
|
let match = q.visibility;
|
|
52
|
-
if (match !== undefined) {
|
|
53
|
-
return match
|
|
52
|
+
if (match !== undefined && (match === "Public" || match === "Internal")) {
|
|
53
|
+
return match === "Public";
|
|
54
54
|
} else {
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
@@ -437,7 +437,7 @@ function Make(Spec) {
|
|
|
437
437
|
let schemaPushed = pushSchema !== undefined ? pushSchema(extra$1, version, apiSchemaFragment) : Pulumi.output();
|
|
438
438
|
let apiSchemaFragmentPayload = Plugin_Helpers$ReventlessCore.offloadPayload(apiSchemaFragment, Plugin$Reventless.apiSchemaFragmentSchema, "pluginApiFragments");
|
|
439
439
|
let structurePayload = Stdlib_Option.map(pluginStructure, s => Plugin_Helpers$ReventlessCore.offloadPayload(s, Plugin$Reventless.pluginStructureSchema, "pluginStructures"));
|
|
440
|
-
let
|
|
440
|
+
let callbackInputs = Pulumi.all([
|
|
441
441
|
Pulumi.all([
|
|
442
442
|
interstackAdminExtensionPoints,
|
|
443
443
|
localAdminResolvedEP,
|
|
@@ -447,7 +447,9 @@ function Make(Spec) {
|
|
|
447
447
|
Pulumi.all(Plugin_Helpers$ReventlessCore.publishToAggregates),
|
|
448
448
|
scheduler,
|
|
449
449
|
queryEngine
|
|
450
|
-
])
|
|
450
|
+
]);
|
|
451
|
+
Stdlib_Option.forEach(Spec.hooks.onDcbRuntimeSetupGate, hook => hook(callbackInputs.apply(param => {})));
|
|
452
|
+
let builderOutputs = ResourceAttribution_Deploytime$ReventlessCore.applyAttributed(callbackInputs, param => {
|
|
451
453
|
let queryEngine = param[4];
|
|
452
454
|
let scheduler = param[3];
|
|
453
455
|
let publishToAggregates = param[2];
|
|
@@ -51,11 +51,16 @@ type constructorSchema = {
|
|
|
51
51
|
fields: array<fieldSchema>,
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** What shape a named type has; a published schema carries the case's name. */
|
|
55
|
+
type schemaKind =
|
|
56
|
+
| RecordSchema
|
|
57
|
+
| VariantSchema
|
|
58
|
+
| UnknownSchema
|
|
59
|
+
|
|
54
60
|
/** Schema for one named type (a command, event, or state type). */
|
|
55
61
|
type typeSchema = {
|
|
56
62
|
typeName: string,
|
|
57
|
-
|
|
58
|
-
kind: string,
|
|
63
|
+
kind: schemaKind,
|
|
59
64
|
fields: array<fieldSchema>,
|
|
60
65
|
constructors?: array<constructorSchema>,
|
|
61
66
|
/** SHA256 of sorted "name:typeDescription:isRequired" tuples — stable shape fingerprint. */
|
|
@@ -1026,6 +1026,10 @@ type platformHooks = {
|
|
|
1026
1026
|
onDcbEventLogCreated?: unknown => unit,
|
|
1027
1027
|
onDcbCommandTopicCreated?: unknown => unit,
|
|
1028
1028
|
onDcbSlicesCreated?: unknown => unit,
|
|
1029
|
+
// The outputs the callback that runs `dcbRuntimeSetup` waits for, handed over
|
|
1030
|
+
// before it is applied. A preview skips that callback where they are unknown, so
|
|
1031
|
+
// anything waiting for the DCB command Lambdas waits on these instead.
|
|
1032
|
+
onDcbRuntimeSetupGate?: Pulumi.Output.t<unit> => unit,
|
|
1029
1033
|
// heartbeatInterval carries the plugin's heartbeat cadence so the AWS bundled
|
|
1030
1034
|
// heartbeat Lambda emits Heartbeat(interval) matching its EventBridge schedule
|
|
1031
1035
|
// rate. Both derive from the same heartbeatInterval; threading it here prevents
|
|
@@ -522,18 +522,12 @@ let checkLifecycleTopology = (
|
|
|
522
522
|
// Which rung produced the label, published as `labelFieldSource`: a consumer with
|
|
523
523
|
// a name rule of its own has to rank a declaration (rung 1) against a guess.
|
|
524
524
|
type labelFieldSource =
|
|
525
|
-
| Annotation
|
|
526
|
-
| Convention
|
|
527
|
-
| Position
|
|
528
|
-
| Fallback
|
|
529
|
-
|
|
530
|
-
let labelFieldSourceToString = (s: labelFieldSource): string =>
|
|
531
|
-
switch s {
|
|
532
|
-
| Annotation => "annotation"
|
|
533
|
-
| Convention => "convention"
|
|
534
|
-
| Position => "position"
|
|
535
|
-
| Fallback => "fallback"
|
|
536
|
-
}
|
|
525
|
+
| @as("annotation") Annotation
|
|
526
|
+
| @as("convention") Convention
|
|
527
|
+
| @as("position") Position
|
|
528
|
+
| @as("fallback") Fallback
|
|
529
|
+
|
|
530
|
+
let labelFieldSourceToString = (s: labelFieldSource): string => (s :> string)
|
|
537
531
|
|
|
538
532
|
type labelResolution = {
|
|
539
533
|
field: string,
|
|
@@ -1131,10 +1125,10 @@ let extractCommandDefs = (
|
|
|
1131
1125
|
// Omitted for the default `Public` so a published def stays compact: absent and
|
|
1132
1126
|
// "public" are the same answer, and writing one would make every ordinary view
|
|
1133
1127
|
// carry a word that says nothing.
|
|
1134
|
-
let visibilityTag = (v: Reventless.Visibility.t): option<
|
|
1128
|
+
let visibilityTag = (v: Reventless.Visibility.t): option<Reventless.Visibility.t> =>
|
|
1135
1129
|
switch v {
|
|
1136
1130
|
| Public => None
|
|
1137
|
-
|
|
|
1131
|
+
| _ => Some(v)
|
|
1138
1132
|
}
|
|
1139
1133
|
|
|
1140
1134
|
/**
|
|
@@ -392,16 +392,7 @@ function checkLifecycleTopology(pluginName, writeSides, lifecycleStatesByView) {
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
function labelFieldSourceToString(s) {
|
|
395
|
-
|
|
396
|
-
case "Annotation" :
|
|
397
|
-
return "annotation";
|
|
398
|
-
case "Convention" :
|
|
399
|
-
return "convention";
|
|
400
|
-
case "Position" :
|
|
401
|
-
return "position";
|
|
402
|
-
case "Fallback" :
|
|
403
|
-
return "fallback";
|
|
404
|
-
}
|
|
395
|
+
return s;
|
|
405
396
|
}
|
|
406
397
|
|
|
407
398
|
function labelFieldsFromStateSchema(entityName, stateSchema) {
|
|
@@ -410,7 +401,7 @@ function labelFieldsFromStateSchema(entityName, stateSchema) {
|
|
|
410
401
|
return {
|
|
411
402
|
field: "displayName",
|
|
412
403
|
searchableFields: spec.fields,
|
|
413
|
-
source: "
|
|
404
|
+
source: "annotation"
|
|
414
405
|
};
|
|
415
406
|
}
|
|
416
407
|
let candidates;
|
|
@@ -428,10 +419,10 @@ function labelFieldsFromStateSchema(entityName, stateSchema) {
|
|
|
428
419
|
});
|
|
429
420
|
let picked = conventional !== undefined ? [
|
|
430
421
|
conventional[0],
|
|
431
|
-
"
|
|
422
|
+
"convention"
|
|
432
423
|
] : Stdlib_Option.map(candidates[0], param => [
|
|
433
424
|
param[0],
|
|
434
|
-
"
|
|
425
|
+
"position"
|
|
435
426
|
]);
|
|
436
427
|
if (picked !== undefined) {
|
|
437
428
|
let name = picked[0];
|
|
@@ -445,7 +436,7 @@ function labelFieldsFromStateSchema(entityName, stateSchema) {
|
|
|
445
436
|
return {
|
|
446
437
|
field: "id",
|
|
447
438
|
searchableFields: [],
|
|
448
|
-
source: "
|
|
439
|
+
source: "fallback"
|
|
449
440
|
};
|
|
450
441
|
}
|
|
451
442
|
|
|
@@ -842,7 +833,7 @@ function visibilityTag(v) {
|
|
|
842
833
|
if (v === "Public") {
|
|
843
834
|
return;
|
|
844
835
|
} else {
|
|
845
|
-
return
|
|
836
|
+
return v;
|
|
846
837
|
}
|
|
847
838
|
}
|
|
848
839
|
|
|
@@ -861,7 +852,7 @@ function readSideDefFromSpec(plugin, name, stateSchema, authorization, visibilit
|
|
|
861
852
|
linkedWriteSide: linkedWriteSide,
|
|
862
853
|
labelField: label.field,
|
|
863
854
|
searchableFields: label.searchableFields,
|
|
864
|
-
labelFieldSource:
|
|
855
|
+
labelFieldSource: label.source,
|
|
865
856
|
lifecycleField: Lifecycle$Reventless.fieldName(stateSchema),
|
|
866
857
|
ownerField: Owner$Reventless.fieldNames(stateSchema)[0],
|
|
867
858
|
retiredField: retiredFieldFromStateSchema(stateSchema),
|
|
@@ -1183,7 +1174,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1183
1174
|
linkedWriteSide: linkedWriteSideFor(consumed),
|
|
1184
1175
|
labelField: label.field,
|
|
1185
1176
|
searchableFields: label.searchableFields,
|
|
1186
|
-
labelFieldSource:
|
|
1177
|
+
labelFieldSource: label.source,
|
|
1187
1178
|
lifecycleField: Lifecycle$Reventless.fieldName(stateSchema),
|
|
1188
1179
|
ownerField: Owner$Reventless.fieldNames(stateSchema)[0],
|
|
1189
1180
|
retiredField: retiredFieldFromStateSchema(stateSchema),
|
|
@@ -1224,7 +1215,7 @@ function make(name, aggregatesOpt, readModelsOpt, stateViewSlicesOpt, stateChang
|
|
|
1224
1215
|
linkedWriteSide: linkedWriteSideFor(consumed),
|
|
1225
1216
|
labelField: label.field,
|
|
1226
1217
|
searchableFields: label.searchableFields,
|
|
1227
|
-
labelFieldSource:
|
|
1218
|
+
labelFieldSource: label.source,
|
|
1228
1219
|
lifecycleField: Lifecycle$Reventless.fieldName(stateSchema),
|
|
1229
1220
|
ownerField: Owner$Reventless.fieldNames(stateSchema)[0],
|
|
1230
1221
|
retiredField: retiredFieldFromStateSchema(stateSchema),
|
|
@@ -144,7 +144,7 @@ let walkSchema = (typeName: string, schema: S.t<unknown>): typeSchema =>
|
|
|
144
144
|
let fields = extractFields(properties)
|
|
145
145
|
{
|
|
146
146
|
typeName,
|
|
147
|
-
kind:
|
|
147
|
+
kind: RecordSchema,
|
|
148
148
|
fields,
|
|
149
149
|
structuralHash: hashFields(fields),
|
|
150
150
|
}
|
|
@@ -158,7 +158,7 @@ let walkSchema = (typeName: string, schema: S.t<unknown>): typeSchema =>
|
|
|
158
158
|
)
|
|
159
159
|
if hasNullLike {
|
|
160
160
|
// It's an optional/nullable scalar at the top level, treat as unknown.
|
|
161
|
-
{typeName, kind:
|
|
161
|
+
{typeName, kind: UnknownSchema, fields: [], structuralHash: ""}
|
|
162
162
|
} else {
|
|
163
163
|
let constructors = anyOf->Array.filterMap(variantSchema =>
|
|
164
164
|
switch variantSchema {
|
|
@@ -172,13 +172,13 @@ let walkSchema = (typeName: string, schema: S.t<unknown>): typeSchema =>
|
|
|
172
172
|
)
|
|
173
173
|
{
|
|
174
174
|
typeName,
|
|
175
|
-
kind:
|
|
175
|
+
kind: VariantSchema,
|
|
176
176
|
fields: [],
|
|
177
177
|
constructors,
|
|
178
178
|
structuralHash: hashConstructors(constructors),
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
| _ => {typeName, kind:
|
|
181
|
+
| _ => {typeName, kind: UnknownSchema, fields: [], structuralHash: ""}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
// ---------------------------------------------------------------------------
|
|
@@ -129,7 +129,7 @@ function walkSchema(typeName, schema) {
|
|
|
129
129
|
let fields = extractFields(schema.properties);
|
|
130
130
|
return {
|
|
131
131
|
typeName: typeName,
|
|
132
|
-
kind: "
|
|
132
|
+
kind: "RecordSchema",
|
|
133
133
|
fields: fields,
|
|
134
134
|
structuralHash: hashFields(fields)
|
|
135
135
|
};
|
|
@@ -147,7 +147,7 @@ function walkSchema(typeName, schema) {
|
|
|
147
147
|
if (hasNullLike) {
|
|
148
148
|
return {
|
|
149
149
|
typeName: typeName,
|
|
150
|
-
kind: "
|
|
150
|
+
kind: "UnknownSchema",
|
|
151
151
|
fields: [],
|
|
152
152
|
structuralHash: ""
|
|
153
153
|
};
|
|
@@ -164,7 +164,7 @@ function walkSchema(typeName, schema) {
|
|
|
164
164
|
});
|
|
165
165
|
return {
|
|
166
166
|
typeName: typeName,
|
|
167
|
-
kind: "
|
|
167
|
+
kind: "VariantSchema",
|
|
168
168
|
fields: [],
|
|
169
169
|
constructors: constructors,
|
|
170
170
|
structuralHash: hashConstructors(constructors)
|
|
@@ -172,7 +172,7 @@ function walkSchema(typeName, schema) {
|
|
|
172
172
|
default:
|
|
173
173
|
return {
|
|
174
174
|
typeName: typeName,
|
|
175
|
-
kind: "
|
|
175
|
+
kind: "UnknownSchema",
|
|
176
176
|
fields: [],
|
|
177
177
|
structuralHash: ""
|
|
178
178
|
};
|
|
@@ -5,7 +5,10 @@ module type Spec = {
|
|
|
5
5
|
let environment: string
|
|
6
6
|
let updateApiSchema: option<Reventless.QueryEngine.operations => promise<unit>>
|
|
7
7
|
let manageSubscriptions: option<
|
|
8
|
-
(
|
|
8
|
+
(
|
|
9
|
+
Reventless.Plugin.pluginDefinition,
|
|
10
|
+
PluginExtensionPoint_Plugin.subscriptionChange,
|
|
11
|
+
) => promise<unit>,
|
|
9
12
|
>
|
|
10
13
|
}
|
|
11
14
|
|
|
@@ -12,6 +12,10 @@ module PluginExtensionPointSpec = ReventlessInfra.PluginExtensionPointSpec
|
|
|
12
12
|
// small intervals and ≥ +50% for large ones (5→7, 10→15, 60→90).
|
|
13
13
|
let disconnectGrace = interval => interval + max(2, interval / 2)
|
|
14
14
|
|
|
15
|
+
/** What the admin does with a plugin's cross-plugin subscriptions: wires them
|
|
16
|
+
when the plugin connects, removes them when it disconnects. */
|
|
17
|
+
type subscriptionChange = ConnectSubscriptions | DisconnectSubscriptions
|
|
18
|
+
|
|
15
19
|
module type Spec = {
|
|
16
20
|
let runtimeOps: PluginRuntimeOperations.operations
|
|
17
21
|
let environment: string
|
|
@@ -23,7 +27,7 @@ module type Spec = {
|
|
|
23
27
|
// Lambda (which only handles incoming commands like Heartbeat). Some only
|
|
24
28
|
// on the admin EventCollector entry point.
|
|
25
29
|
let manageSubscriptions: option<
|
|
26
|
-
(Reventless.Plugin.pluginDefinition,
|
|
30
|
+
(Reventless.Plugin.pluginDefinition, subscriptionChange) => promise<unit>,
|
|
27
31
|
>
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -125,7 +129,7 @@ module Make = (Spec: Spec) => {
|
|
|
125
129
|
await forwardCommand(id, command, extensionPointName, queryEngine)
|
|
126
130
|
| DoConnectPlugin(pluginDef) =>
|
|
127
131
|
switch Spec.manageSubscriptions {
|
|
128
|
-
| Some(fn) => await fn(pluginDef,
|
|
132
|
+
| Some(fn) => await fn(pluginDef, ConnectSubscriptions)
|
|
129
133
|
| None => ()
|
|
130
134
|
}
|
|
131
135
|
switch Spec.updateApiSchema {
|
|
@@ -134,7 +138,7 @@ module Make = (Spec: Spec) => {
|
|
|
134
138
|
}
|
|
135
139
|
| DoDisconnectPlugin(pluginDef) =>
|
|
136
140
|
switch Spec.manageSubscriptions {
|
|
137
|
-
| Some(fn) => await fn(pluginDef,
|
|
141
|
+
| Some(fn) => await fn(pluginDef, DisconnectSubscriptions)
|
|
138
142
|
| None => ()
|
|
139
143
|
}
|
|
140
144
|
switch Spec.updateApiSchema {
|
|
@@ -82,7 +82,7 @@ function Make(Spec) {
|
|
|
82
82
|
case "DoConnectPlugin" :
|
|
83
83
|
let fn = Spec.manageSubscriptions;
|
|
84
84
|
if (fn !== undefined) {
|
|
85
|
-
await fn(directive._0, "
|
|
85
|
+
await fn(directive._0, "ConnectSubscriptions");
|
|
86
86
|
}
|
|
87
87
|
let fn$1 = Spec.updateApiSchema;
|
|
88
88
|
if (fn$1 !== undefined) {
|
|
@@ -93,7 +93,7 @@ function Make(Spec) {
|
|
|
93
93
|
case "DoDisconnectPlugin" :
|
|
94
94
|
let fn$2 = Spec.manageSubscriptions;
|
|
95
95
|
if (fn$2 !== undefined) {
|
|
96
|
-
await fn$2(directive._0, "
|
|
96
|
+
await fn$2(directive._0, "DisconnectSubscriptions");
|
|
97
97
|
}
|
|
98
98
|
let fn$3 = Spec.updateApiSchema;
|
|
99
99
|
if (fn$3 !== undefined) {
|
|
@@ -32,26 +32,26 @@ function _effectMin(comp, param) {
|
|
|
32
32
|
return "None";
|
|
33
33
|
}
|
|
34
34
|
switch (match) {
|
|
35
|
-
case "
|
|
35
|
+
case "DEBUG" :
|
|
36
36
|
return "Debug";
|
|
37
|
-
case "
|
|
37
|
+
case "INFO" :
|
|
38
38
|
return "Info";
|
|
39
|
-
case "
|
|
39
|
+
case "WARN" :
|
|
40
40
|
return "Warn";
|
|
41
|
-
case "
|
|
41
|
+
case "ERROR" :
|
|
42
42
|
return "Error";
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function levelOf(level) {
|
|
47
47
|
if (level === "Fatal" || level === "Error") {
|
|
48
|
-
return "
|
|
48
|
+
return "ERROR";
|
|
49
49
|
} else if (level === "Info") {
|
|
50
|
-
return "
|
|
50
|
+
return "INFO";
|
|
51
51
|
} else if (level === "Warn") {
|
|
52
|
-
return "
|
|
52
|
+
return "WARN";
|
|
53
53
|
} else {
|
|
54
|
-
return "
|
|
54
|
+
return "DEBUG";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
package/src/util/Logger.res
CHANGED
|
@@ -44,7 +44,15 @@ type t = {
|
|
|
44
44
|
debugLazy: (~comp: string=?, unit => string) => unit,
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
/** A log line's level. Its text is the upper-case word a JSON line, the platform
|
|
48
|
+
API and a level setting carry. */
|
|
49
|
+
type level =
|
|
50
|
+
| @as("DEBUG") Debug
|
|
51
|
+
| @as("INFO") Info
|
|
52
|
+
| @as("WARN") Warn
|
|
53
|
+
| @as("ERROR") Error
|
|
54
|
+
|
|
55
|
+
let levels = [Debug, Info, Warn, Error]
|
|
48
56
|
|
|
49
57
|
let levelToInt = l =>
|
|
50
58
|
switch l {
|
|
@@ -54,13 +62,19 @@ let levelToInt = l =>
|
|
|
54
62
|
| Error => 3
|
|
55
63
|
}
|
|
56
64
|
|
|
57
|
-
let levelLabel = l =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
let levelLabel = (l: level): string => (l :> string)
|
|
66
|
+
|
|
67
|
+
/** The level an upper-case word names (`WARN`); `None` for a word that names none. */
|
|
68
|
+
let levelOfLabel = (label: string): option<level> => levels->Array.find(l => levelLabel(l) == label)
|
|
69
|
+
|
|
70
|
+
/** The level a word names in any case (`warn`, `Warn`), `warning` included. */
|
|
71
|
+
let levelOfWord = (word: string): option<level> => {
|
|
72
|
+
let lower = word->String.toLowerCase
|
|
73
|
+
switch lower {
|
|
74
|
+
| "warning" => Some(Warn)
|
|
75
|
+
| _ => levels->Array.find(l => levelLabel(l)->String.toLowerCase == lower)
|
|
63
76
|
}
|
|
77
|
+
}
|
|
64
78
|
|
|
65
79
|
// ─── Shared format + output ──────────────────────────────────────────────────
|
|
66
80
|
// Single definition used by Logger.t AND EffectLogger.
|