@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
|
@@ -965,6 +965,172 @@ globalThis.describe("DcbScopeInference:", () => {
|
|
|
965
965
|
globalThis.expect(issues.overrides.map(e => e.sliceName)).toEqual([]);
|
|
966
966
|
globalThis.expect(issues.contradictions.map(e => e.sliceName)).toEqual(["ShipOrder"]);
|
|
967
967
|
});
|
|
968
|
+
let postMessage = slice("PostMessage", undefined, undefined, [{
|
|
969
|
+
eventType: "MessagePosted",
|
|
970
|
+
idFields: [
|
|
971
|
+
{
|
|
972
|
+
name: "messageId",
|
|
973
|
+
isList: false
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
name: "channelId",
|
|
977
|
+
isList: false
|
|
978
|
+
}
|
|
979
|
+
]
|
|
980
|
+
}], "messageId", "Messages");
|
|
981
|
+
let postReply = slice("PostReply", undefined, [{
|
|
982
|
+
eventType: "MessagePosted",
|
|
983
|
+
idFields: [
|
|
984
|
+
{
|
|
985
|
+
name: "messageId",
|
|
986
|
+
isList: false
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
name: "channelId",
|
|
990
|
+
isList: false
|
|
991
|
+
}
|
|
992
|
+
]
|
|
993
|
+
}], [{
|
|
994
|
+
eventType: "ReplyPosted",
|
|
995
|
+
idFields: [
|
|
996
|
+
{
|
|
997
|
+
name: "replyId",
|
|
998
|
+
isList: false
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
name: "messageId",
|
|
1002
|
+
isList: false
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
name: "channelId",
|
|
1006
|
+
isList: false
|
|
1007
|
+
}
|
|
1008
|
+
]
|
|
1009
|
+
}], undefined, "Messages");
|
|
1010
|
+
let questionState = slice("QuestionState", undefined, [
|
|
1011
|
+
{
|
|
1012
|
+
eventType: "AnswerMarked",
|
|
1013
|
+
idFields: [
|
|
1014
|
+
{
|
|
1015
|
+
name: "messageId",
|
|
1016
|
+
isList: false
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "replyId",
|
|
1020
|
+
isList: false
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
name: "channelId",
|
|
1024
|
+
isList: false
|
|
1025
|
+
}
|
|
1026
|
+
]
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
eventType: "QuestionReopened",
|
|
1030
|
+
idFields: [
|
|
1031
|
+
{
|
|
1032
|
+
name: "messageId",
|
|
1033
|
+
isList: false
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
name: "channelId",
|
|
1037
|
+
isList: false
|
|
1038
|
+
}
|
|
1039
|
+
]
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
eventType: "MessagePosted",
|
|
1043
|
+
idFields: [
|
|
1044
|
+
{
|
|
1045
|
+
name: "messageId",
|
|
1046
|
+
isList: false
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
name: "channelId",
|
|
1050
|
+
isList: false
|
|
1051
|
+
}
|
|
1052
|
+
]
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
eventType: "ReplyPosted",
|
|
1056
|
+
idFields: [
|
|
1057
|
+
{
|
|
1058
|
+
name: "replyId",
|
|
1059
|
+
isList: false
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
name: "messageId",
|
|
1063
|
+
isList: false
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
name: "channelId",
|
|
1067
|
+
isList: false
|
|
1068
|
+
}
|
|
1069
|
+
]
|
|
1070
|
+
}
|
|
1071
|
+
], [
|
|
1072
|
+
{
|
|
1073
|
+
eventType: "AnswerMarked",
|
|
1074
|
+
idFields: [
|
|
1075
|
+
{
|
|
1076
|
+
name: "messageId",
|
|
1077
|
+
isList: false
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
name: "replyId",
|
|
1081
|
+
isList: false
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
name: "channelId",
|
|
1085
|
+
isList: false
|
|
1086
|
+
}
|
|
1087
|
+
]
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
eventType: "QuestionReopened",
|
|
1091
|
+
idFields: [
|
|
1092
|
+
{
|
|
1093
|
+
name: "messageId",
|
|
1094
|
+
isList: false
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
name: "channelId",
|
|
1098
|
+
isList: false
|
|
1099
|
+
}
|
|
1100
|
+
]
|
|
1101
|
+
}
|
|
1102
|
+
], "messageId", "Questions");
|
|
1103
|
+
let questions = [
|
|
1104
|
+
postMessage,
|
|
1105
|
+
postReply,
|
|
1106
|
+
questionState
|
|
1107
|
+
];
|
|
1108
|
+
globalThis.test("inference never picks a key one of the slice's own events lacks", () => {
|
|
1109
|
+
let newrecord = {...questionState};
|
|
1110
|
+
newrecord.partitionHint = undefined;
|
|
1111
|
+
let r = DcbScopeInference$Reventless.resolvePartitions([
|
|
1112
|
+
postMessage,
|
|
1113
|
+
postReply,
|
|
1114
|
+
newrecord
|
|
1115
|
+
]);
|
|
1116
|
+
globalThis.expect(r.partitionBySlice["QuestionState"]).toEqual(undefined);
|
|
1117
|
+
globalThis.expect(r.candidatesBySlice["QuestionState"]).toEqual([]);
|
|
1118
|
+
});
|
|
1119
|
+
globalThis.test("a hint deciding a slice inference leaves unresolved is accepted", () => {
|
|
1120
|
+
let issues = DcbValidation$Reventless.validatePartitionHintsVsInference(questions);
|
|
1121
|
+
globalThis.expect(issues.contradictions).toEqual([]);
|
|
1122
|
+
globalThis.expect(issues.redundancies).toEqual([]);
|
|
1123
|
+
globalThis.expect(DcbScopeInference$Reventless.resolvePartitions(questions).partitionBySlice["QuestionState"]).toEqual("messageId");
|
|
1124
|
+
});
|
|
1125
|
+
globalThis.test("a hint naming a key one of the slice's events lacks is still a contradiction", () => {
|
|
1126
|
+
let newrecord = {...questionState};
|
|
1127
|
+
let issues = DcbValidation$Reventless.validatePartitionHintsVsInference([
|
|
1128
|
+
postMessage,
|
|
1129
|
+
postReply,
|
|
1130
|
+
(newrecord.partitionHint = "replyId", newrecord)
|
|
1131
|
+
]);
|
|
1132
|
+
globalThis.expect(issues.contradictions.map(e => e.sliceName)).toEqual(["QuestionState"]);
|
|
1133
|
+
});
|
|
968
1134
|
});
|
|
969
1135
|
globalThis.describe("ambiguity surfacing", () => {
|
|
970
1136
|
let aOwner = slice("A", undefined, undefined, [{
|
|
@@ -371,6 +371,27 @@ describe("DcbValidation:", () => {
|
|
|
371
371
|
},
|
|
372
372
|
)
|
|
373
373
|
|
|
374
|
+
testSync(
|
|
375
|
+
"ignores a command with a cross-partition key (single-tag clauses, not composite)",
|
|
376
|
+
() => {
|
|
377
|
+
let slices = [("RecordDemand", recordDemandCommandSchema->u, demandConsumedSchema->u)]
|
|
378
|
+
let fanned = Reventless.DcbValidation.validateCompositeReads(
|
|
379
|
+
~slices,
|
|
380
|
+
~producedTagKeys,
|
|
381
|
+
~crossPartitionTagKeys=["orderId"],
|
|
382
|
+
)
|
|
383
|
+
expect(fanned)->toEqual([])
|
|
384
|
+
// and the query the check now trusts is indeed single-tag clauses
|
|
385
|
+
let query = Reventless.DcbTag.buildQueryFromCommand(
|
|
386
|
+
~eventTypes=["ProductDemandRevoked"],
|
|
387
|
+
~schema=recordDemandCommandSchema,
|
|
388
|
+
~value=RecordDemand({productId: "p1", orderId: "o1"}),
|
|
389
|
+
~crossPartitionTagKeys=["orderId"],
|
|
390
|
+
)
|
|
391
|
+
expect(query->Array.every(qi => qi.tags->Option.mapOr(0, Array.length) == 1))->toBe(true)
|
|
392
|
+
},
|
|
393
|
+
)
|
|
394
|
+
|
|
374
395
|
testSync(
|
|
375
396
|
"no warnings when nothing reads compositely",
|
|
376
397
|
() => {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Sury from "sury";
|
|
4
4
|
import * as JestGlobals from "@reventlessdev/rescript-jest/src/JestGlobals.res.mjs";
|
|
5
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
6
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
6
7
|
import * as DcbValidation$Reventless from "@reventlessdev/reventless-spec/src/components/DcbValidation.res.mjs";
|
|
7
8
|
|
|
@@ -367,12 +368,13 @@ globalThis.describe("DcbValidation:", () => {
|
|
|
367
368
|
});
|
|
368
369
|
});
|
|
369
370
|
globalThis.describe("validateCompositeReads (Issue 5)", () => {
|
|
371
|
+
let check = slices => DcbValidation$Reventless.validateCompositeReads(slices, producedTagKeys, undefined, undefined);
|
|
370
372
|
globalThis.test("warns when a composite read's consumed type carries an extra tag", () => {
|
|
371
|
-
let warnings =
|
|
373
|
+
let warnings = check([[
|
|
372
374
|
"RecordDemand",
|
|
373
375
|
recordDemandCommandSchema,
|
|
374
376
|
demandConsumedSchema
|
|
375
|
-
]]
|
|
377
|
+
]]);
|
|
376
378
|
globalThis.expect(warnings.length).toBe(1);
|
|
377
379
|
let w = warnings[0];
|
|
378
380
|
globalThis.expect(w.sliceName).toBe("RecordDemand");
|
|
@@ -380,31 +382,46 @@ globalThis.describe("DcbValidation:", () => {
|
|
|
380
382
|
globalThis.expect(w.message.includes("customerId")).toBe(true);
|
|
381
383
|
});
|
|
382
384
|
globalThis.test("does not warn for an exact-match consumed type", () => {
|
|
383
|
-
let warnings =
|
|
385
|
+
let warnings = check([[
|
|
384
386
|
"RecordDemand",
|
|
385
387
|
recordDemandCommandSchema,
|
|
386
388
|
demandConsumedSchema
|
|
387
|
-
]]
|
|
389
|
+
]]);
|
|
388
390
|
globalThis.expect(warnings.some(w => w.message.includes("ProductDemandRecorded"))).toBe(false);
|
|
389
391
|
});
|
|
390
392
|
globalThis.test("ignores single-tag commands (partition read, not composite)", () => {
|
|
391
|
-
let warnings =
|
|
393
|
+
let warnings = check([[
|
|
392
394
|
"TouchDemand",
|
|
393
395
|
touchDemandCommandSchema,
|
|
394
396
|
demandConsumedSchema
|
|
395
|
-
]]
|
|
397
|
+
]]);
|
|
396
398
|
globalThis.expect(warnings).toEqual([]);
|
|
397
399
|
});
|
|
398
400
|
globalThis.test("ignores tagged-array commands (per-element OR, not composite)", () => {
|
|
399
|
-
let warnings =
|
|
401
|
+
let warnings = check([[
|
|
400
402
|
"PlaceOrder",
|
|
401
403
|
placeOrderCommandSchema,
|
|
402
404
|
demandConsumedSchema
|
|
403
|
-
]]
|
|
405
|
+
]]);
|
|
404
406
|
globalThis.expect(warnings).toEqual([]);
|
|
405
407
|
});
|
|
408
|
+
globalThis.test("ignores a command with a cross-partition key (single-tag clauses, not composite)", () => {
|
|
409
|
+
let slices = [[
|
|
410
|
+
"RecordDemand",
|
|
411
|
+
recordDemandCommandSchema,
|
|
412
|
+
demandConsumedSchema
|
|
413
|
+
]];
|
|
414
|
+
let fanned = DcbValidation$Reventless.validateCompositeReads(slices, producedTagKeys, undefined, ["orderId"]);
|
|
415
|
+
globalThis.expect(fanned).toEqual([]);
|
|
416
|
+
let query = DcbTag$Reventless.buildQueryFromCommand(["ProductDemandRevoked"], recordDemandCommandSchema, {
|
|
417
|
+
TAG: "RecordDemand",
|
|
418
|
+
productId: "p1",
|
|
419
|
+
orderId: "o1"
|
|
420
|
+
}, undefined, ["orderId"], undefined);
|
|
421
|
+
globalThis.expect(query.every(qi => Stdlib_Option.mapOr(qi.tags, 0, prim => prim.length) === 1)).toBe(true);
|
|
422
|
+
});
|
|
406
423
|
globalThis.test("no warnings when nothing reads compositely", () => {
|
|
407
|
-
globalThis.expect(
|
|
424
|
+
globalThis.expect(check([])).toEqual([]);
|
|
408
425
|
});
|
|
409
426
|
});
|
|
410
427
|
globalThis.describe("validateCrossPartitionScope (Issue 13)", () => {
|
|
@@ -234,7 +234,7 @@ globalThis.describe("JSON sink", () => {
|
|
|
234
234
|
process.env["REVENTLESS_LOG_FORMAT"] = "text";
|
|
235
235
|
AnsiStyle$Reventless.reload();
|
|
236
236
|
});
|
|
237
|
-
let log = Logger$ReventlessCore.makeLogger("
|
|
237
|
+
let log = Logger$ReventlessCore.makeLogger("DEBUG");
|
|
238
238
|
globalThis.test("Logger.info emits one clean JSON record with comp as a top-level field", () => {
|
|
239
239
|
let lines = captureLogs(() => log.info("Aggregate(Product)", undefined, "handling command"));
|
|
240
240
|
let line = lines.length === 1 ? lines[0] : "";
|
|
@@ -318,7 +318,7 @@ globalThis.describe("JSON sink", () => {
|
|
|
318
318
|
"blob",
|
|
319
319
|
big
|
|
320
320
|
]]);
|
|
321
|
-
let direct = captureLogs(() => Logger$ReventlessCore.emit("
|
|
321
|
+
let direct = captureLogs(() => Logger$ReventlessCore.emit("INFO", "Platform", undefined, detail, undefined, "big"));
|
|
322
322
|
let obj = Stdlib_Option.flatMap(direct[0], l => Stdlib_JSON.Decode.object(JSON.parse(l)));
|
|
323
323
|
let ok;
|
|
324
324
|
if (obj !== undefined) {
|
|
@@ -7,7 +7,7 @@ globalThis.describe("Logger.debugLazy", () => {
|
|
|
7
7
|
let called = {
|
|
8
8
|
contents: false
|
|
9
9
|
};
|
|
10
|
-
let log = Logger$ReventlessCore.makeLogger("
|
|
10
|
+
let log = Logger$ReventlessCore.makeLogger("INFO");
|
|
11
11
|
log.debugLazy("Test", () => {
|
|
12
12
|
called.contents = true;
|
|
13
13
|
return "should never be built";
|
|
@@ -18,7 +18,7 @@ globalThis.describe("Logger.debugLazy", () => {
|
|
|
18
18
|
let called = {
|
|
19
19
|
contents: false
|
|
20
20
|
};
|
|
21
|
-
let log = Logger$ReventlessCore.makeLogger("
|
|
21
|
+
let log = Logger$ReventlessCore.makeLogger("DEBUG");
|
|
22
22
|
log.debugLazy("Test", () => {
|
|
23
23
|
called.contents = true;
|
|
24
24
|
return "built";
|
|
@@ -71,7 +71,7 @@ globalThis.describe("Logger sinks", () => {
|
|
|
71
71
|
"orderId",
|
|
72
72
|
"o-1"
|
|
73
73
|
]]);
|
|
74
|
-
let match$1 = capture(() => Logger$ReventlessCore.emit("
|
|
74
|
+
let match$1 = capture(() => Logger$ReventlessCore.emit("WARN", "Aggregate(Order)", "Ordering", detail, Object.fromEntries([[
|
|
75
75
|
"correlationId",
|
|
76
76
|
"c-1"
|
|
77
77
|
]]), "refused"));
|
|
@@ -93,7 +93,7 @@ globalThis.describe("Logger sinks", () => {
|
|
|
93
93
|
"Ada Secret"
|
|
94
94
|
]])
|
|
95
95
|
]]);
|
|
96
|
-
capture(() => Logger$ReventlessCore.emit("
|
|
96
|
+
capture(() => Logger$ReventlessCore.emit("INFO", "Platform", undefined, detail, undefined, "joined"));
|
|
97
97
|
match[1]();
|
|
98
98
|
let printed = JSON.stringify(Logger$ReventlessCore.recordToJson(match[0][0]));
|
|
99
99
|
globalThis.expect(printed.includes("Ada Secret")).toBe(false);
|
|
@@ -108,8 +108,8 @@ globalThis.describe("Logger sinks", () => {
|
|
|
108
108
|
});
|
|
109
109
|
let match = collecting();
|
|
110
110
|
let match$1 = capture(() => {
|
|
111
|
-
Logger$ReventlessCore.emit("
|
|
112
|
-
Logger$ReventlessCore.emit("
|
|
111
|
+
Logger$ReventlessCore.emit("INFO", "Platform", undefined, undefined, undefined, "one");
|
|
112
|
+
Logger$ReventlessCore.emit("INFO", "Platform", undefined, undefined, undefined, "two");
|
|
113
113
|
});
|
|
114
114
|
removeBad();
|
|
115
115
|
match[1]();
|
|
@@ -122,7 +122,7 @@ globalThis.describe("Logger sinks", () => {
|
|
|
122
122
|
globalThis.test("a removed sink gets nothing more", () => {
|
|
123
123
|
let match = collecting();
|
|
124
124
|
match[1]();
|
|
125
|
-
capture(() => Logger$ReventlessCore.emit("
|
|
125
|
+
capture(() => Logger$ReventlessCore.emit("INFO", "Platform", undefined, undefined, undefined, "after"));
|
|
126
126
|
globalThis.expect(match[0].length).toBe(0);
|
|
127
127
|
});
|
|
128
128
|
});
|
|
@@ -143,32 +143,32 @@ globalThis.describe("Logger levels set while running", () => {
|
|
|
143
143
|
globalThis.test("the component's level wins over the plugin's, the plugin's over the default, the default over LOG_LEVEL", () => withLogLevel("error", () => {
|
|
144
144
|
LogPrefix$Reventless.registerComponentPlugin("Order", "Ordering");
|
|
145
145
|
let comp = "Aggregate(Order)";
|
|
146
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("
|
|
147
|
-
Logger$ReventlessCore.setLevel(undefined, undefined, "
|
|
148
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("
|
|
149
|
-
Logger$ReventlessCore.setLevel("Ordering", undefined, "
|
|
150
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("
|
|
151
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, "Aggregate(Unrelated)", undefined)).toEqual("
|
|
152
|
-
Logger$ReventlessCore.setLevel(undefined, comp, "
|
|
153
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("
|
|
146
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("ERROR");
|
|
147
|
+
Logger$ReventlessCore.setLevel(undefined, undefined, "WARN");
|
|
148
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("WARN");
|
|
149
|
+
Logger$ReventlessCore.setLevel("Ordering", undefined, "INFO");
|
|
150
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("INFO");
|
|
151
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, "Aggregate(Unrelated)", undefined)).toEqual("WARN");
|
|
152
|
+
Logger$ReventlessCore.setLevel(undefined, comp, "DEBUG");
|
|
153
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("DEBUG");
|
|
154
154
|
Logger$ReventlessCore.setLevel(undefined, comp, undefined);
|
|
155
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("
|
|
155
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor(undefined, comp, undefined)).toEqual("INFO");
|
|
156
156
|
}));
|
|
157
157
|
globalThis.test("a component of one plugin wins over the component everywhere", () => {
|
|
158
|
-
Logger$ReventlessCore.setLevel(undefined, "Projection", "
|
|
159
|
-
Logger$ReventlessCore.setLevel("Ordering", "Projection", "
|
|
160
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor("Ordering", "Projection", undefined)).toEqual("
|
|
161
|
-
globalThis.expect(Logger$ReventlessCore.minLevelFor("Catalog", "Projection", undefined)).toEqual("
|
|
158
|
+
Logger$ReventlessCore.setLevel(undefined, "Projection", "WARN");
|
|
159
|
+
Logger$ReventlessCore.setLevel("Ordering", "Projection", "DEBUG");
|
|
160
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor("Ordering", "Projection", undefined)).toEqual("DEBUG");
|
|
161
|
+
globalThis.expect(Logger$ReventlessCore.minLevelFor("Catalog", "Projection", undefined)).toEqual("WARN");
|
|
162
162
|
});
|
|
163
163
|
globalThis.test("a line below its level never reaches a sink; raised, it does", () => withLogLevel("info", () => {
|
|
164
164
|
let log = Logger$ReventlessCore.fromEnv();
|
|
165
165
|
let match = collecting();
|
|
166
166
|
capture(() => {
|
|
167
167
|
log.debug("Quiet", undefined, "not yet");
|
|
168
|
-
Logger$ReventlessCore.setLevel(undefined, "Quiet", "
|
|
168
|
+
Logger$ReventlessCore.setLevel(undefined, "Quiet", "DEBUG");
|
|
169
169
|
log.debug("Quiet", undefined, "now");
|
|
170
170
|
log.debug("Other", undefined, "still not");
|
|
171
|
-
Logger$ReventlessCore.setLevel(undefined, "Loud", "
|
|
171
|
+
Logger$ReventlessCore.setLevel(undefined, "Loud", "ERROR");
|
|
172
172
|
log.warn("Loud", undefined, "dropped");
|
|
173
173
|
});
|
|
174
174
|
match[1]();
|
|
@@ -178,25 +178,25 @@ globalThis.describe("Logger levels set while running", () => {
|
|
|
178
178
|
let match = collecting();
|
|
179
179
|
capture(() => {
|
|
180
180
|
Effect.runSync(EffectLogger$ReventlessCore.logDebug("Quiet", undefined, undefined, "not yet"));
|
|
181
|
-
Logger$ReventlessCore.setLevel(undefined, "Quiet", "
|
|
181
|
+
Logger$ReventlessCore.setLevel(undefined, "Quiet", "DEBUG");
|
|
182
182
|
Effect.runSync(EffectLogger$ReventlessCore.logDebug("Quiet", undefined, undefined, "now"));
|
|
183
|
-
Logger$ReventlessCore.setLevel(undefined, "Loud", "
|
|
183
|
+
Logger$ReventlessCore.setLevel(undefined, "Loud", "ERROR");
|
|
184
184
|
Effect.runSync(EffectLogger$ReventlessCore.logWarn("Loud", undefined, undefined, "dropped"));
|
|
185
185
|
});
|
|
186
186
|
match[1]();
|
|
187
187
|
globalThis.expect(match[0].map(r => r.message)).toEqual(["now"]);
|
|
188
188
|
}));
|
|
189
189
|
globalThis.test("levelSettings lists what was set", () => {
|
|
190
|
-
Logger$ReventlessCore.setLevel(undefined, undefined, "
|
|
191
|
-
Logger$ReventlessCore.setLevel("Ordering", "Projection", "
|
|
190
|
+
Logger$ReventlessCore.setLevel(undefined, undefined, "WARN");
|
|
191
|
+
Logger$ReventlessCore.setLevel("Ordering", "Projection", "DEBUG");
|
|
192
192
|
globalThis.expect(Logger$ReventlessCore.levelSettings()).toEqual([
|
|
193
193
|
{
|
|
194
|
-
level: "
|
|
194
|
+
level: "WARN"
|
|
195
195
|
},
|
|
196
196
|
{
|
|
197
197
|
plugin: "Ordering",
|
|
198
198
|
comp: "Projection",
|
|
199
|
-
level: "
|
|
199
|
+
level: "DEBUG"
|
|
200
200
|
}
|
|
201
201
|
]);
|
|
202
202
|
});
|
|
@@ -84,8 +84,8 @@ let isVisible = (
|
|
|
84
84
|
module(R: ReventlessInfra.ReadModel.T with type api = unit and type role = unit),
|
|
85
85
|
): bool =>
|
|
86
86
|
switch R.Spec.visibility {
|
|
87
|
-
| Public => true
|
|
88
87
|
| Internal => false
|
|
88
|
+
| _ => true
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
let readModels: array<
|
|
@@ -137,7 +137,9 @@ describe("Plugin_Structure.make — visibility tagging", () => {
|
|
|
137
137
|
|
|
138
138
|
testSync("the Internal entry is carried and tagged visibility = Some(\"Internal\")", () => {
|
|
139
139
|
let internal = structure.readModels->Array.find(d => d.name == "InternalView")
|
|
140
|
-
expect(internal->Option.map(d => d.visibility))->toEqual(
|
|
140
|
+
expect(internal->Option.map(d => d.visibility))->toEqual(
|
|
141
|
+
Some(Some(Reventless.Visibility.Internal)),
|
|
142
|
+
)
|
|
141
143
|
})
|
|
142
144
|
|
|
143
145
|
testSync("a read model's mapping-consumed events surface as qualified consumedEventTypes", () => {
|
|
@@ -147,7 +147,11 @@ let InternalReadModel = {
|
|
|
147
147
|
|
|
148
148
|
function isVisible(R) {
|
|
149
149
|
let match = R.Spec.visibility;
|
|
150
|
-
|
|
150
|
+
if (match === "Public" || match === "Internal") {
|
|
151
|
+
return match === "Public";
|
|
152
|
+
} else {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
let readModels = [
|
|
@@ -17,7 +17,7 @@ describe("SchemaWalker:", () => {
|
|
|
17
17
|
describe("record schema", () => {
|
|
18
18
|
let result = SchemaWalker.walk("SimpleRecord", simpleRecordSchema)
|
|
19
19
|
|
|
20
|
-
testSync("kind is record", () => expect(result.kind)->toBe("
|
|
20
|
+
testSync("kind is record", () => expect((result.kind :> string))->toBe("RecordSchema"))
|
|
21
21
|
testSync("constructors is absent", () => expect(result.constructors)->toEqual(None))
|
|
22
22
|
|
|
23
23
|
testSync(
|
|
@@ -61,7 +61,7 @@ describe("SchemaWalker:", () => {
|
|
|
61
61
|
describe("variant schema", () => {
|
|
62
62
|
let result = SchemaWalker.walk("SimpleVariant", simpleVariantSchema)
|
|
63
63
|
|
|
64
|
-
testSync("kind is variant", () => expect(result.kind)->toBe("
|
|
64
|
+
testSync("kind is variant", () => expect((result.kind :> string))->toBe("VariantSchema"))
|
|
65
65
|
testSync("fields array is empty", () => expect(result.fields)->toEqual([]))
|
|
66
66
|
|
|
67
67
|
testSync(
|
|
@@ -137,7 +137,7 @@ describe("SchemaWalker:", () => {
|
|
|
137
137
|
"plain string schema → kind unknown",
|
|
138
138
|
() => {
|
|
139
139
|
let result = SchemaWalker.walk("Scalar", S.string)
|
|
140
|
-
expect(result.kind)->toBe("
|
|
140
|
+
expect((result.kind :> string))->toBe("UnknownSchema")
|
|
141
141
|
},
|
|
142
142
|
)
|
|
143
143
|
|
|
@@ -29,7 +29,7 @@ globalThis.describe("SchemaWalker:", () => {
|
|
|
29
29
|
globalThis.describe("record schema", () => {
|
|
30
30
|
let result = SchemaWalker$ReventlessCore.walk("SimpleRecord", simpleRecordSchema);
|
|
31
31
|
globalThis.test("kind is record", () => {
|
|
32
|
-
globalThis.expect(result.kind).toBe("
|
|
32
|
+
globalThis.expect(result.kind).toBe("RecordSchema");
|
|
33
33
|
});
|
|
34
34
|
globalThis.test("constructors is absent", () => {
|
|
35
35
|
globalThis.expect(result.constructors).toEqual(undefined);
|
|
@@ -79,7 +79,7 @@ globalThis.describe("SchemaWalker:", () => {
|
|
|
79
79
|
globalThis.describe("variant schema", () => {
|
|
80
80
|
let result = SchemaWalker$ReventlessCore.walk("SimpleVariant", simpleVariantSchema);
|
|
81
81
|
globalThis.test("kind is variant", () => {
|
|
82
|
-
globalThis.expect(result.kind).toBe("
|
|
82
|
+
globalThis.expect(result.kind).toBe("VariantSchema");
|
|
83
83
|
});
|
|
84
84
|
globalThis.test("fields array is empty", () => {
|
|
85
85
|
globalThis.expect(result.fields).toEqual([]);
|
|
@@ -138,7 +138,7 @@ globalThis.describe("SchemaWalker:", () => {
|
|
|
138
138
|
globalThis.describe("scalar / unsupported schema", () => {
|
|
139
139
|
globalThis.test("plain string schema → kind unknown", () => {
|
|
140
140
|
let result = SchemaWalker$ReventlessCore.walk("Scalar", Sury.string);
|
|
141
|
-
globalThis.expect(result.kind).toBe("
|
|
141
|
+
globalThis.expect(result.kind).toBe("UnknownSchema");
|
|
142
142
|
});
|
|
143
143
|
globalThis.test("plain string schema → empty fields", () => {
|
|
144
144
|
let result = SchemaWalker$ReventlessCore.walk("Scalar", Sury.string);
|
|
@@ -269,7 +269,7 @@ globalThis.describe("ViewChange", () => {
|
|
|
269
269
|
globalThis.expect(viewLines.length).toBe(1);
|
|
270
270
|
let line = viewLines[0];
|
|
271
271
|
let printed = JSON.stringify(Logger$ReventlessCore.recordToJson(line));
|
|
272
|
-
globalThis.expect(line.level).toEqual("
|
|
272
|
+
globalThis.expect(line.level).toEqual("INFO");
|
|
273
273
|
globalThis.expect(line.comp).toEqual("ReadModel(Totals)");
|
|
274
274
|
globalThis.expect(line.annotations["correlationId"]).toEqual("flow-1");
|
|
275
275
|
globalThis.expect(printed.includes(`"fields":["total","token"]`)).toBe(true);
|