@reventlessdev/reventless-core 3.0.0-alpha.337 → 3.0.0-alpha.339

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +7 -7
  3. package/src/ComponentType.res +38 -62
  4. package/src/ComponentType.res.mjs +34 -115
  5. package/src/ResourceAttribution.res +7 -33
  6. package/src/ResourceAttribution.res.mjs +2 -51
  7. package/src/ViewChange.res.mjs +2 -2
  8. package/src/admin/Platform_ComponentDefinitionsApi.res +10 -11
  9. package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +9 -8
  10. package/src/admin/Platform_PluginStructuresApi.res +1 -1
  11. package/src/admin/Platform_SelfRegistration.res.mjs +3 -3
  12. package/src/components/QueryDb/QueryDb.res.mjs +1 -1
  13. package/src/plugin/component/Plugin_Builder.res +1 -1
  14. package/src/plugin/component/Plugin_Builder.res.mjs +2 -2
  15. package/src/plugin/component/Plugin_BuiltHook.res +7 -2
  16. package/src/plugin/component/Plugin_Structure.res +8 -14
  17. package/src/plugin/component/Plugin_Structure.res.mjs +9 -18
  18. package/src/plugin/component/SchemaWalker.res +4 -4
  19. package/src/plugin/component/SchemaWalker.res.mjs +4 -4
  20. package/src/plugin/connect/PluginExtensionPoint_Builder.res +4 -1
  21. package/src/plugin/connect/PluginExtensionPoint_Plugin.res +7 -3
  22. package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +2 -2
  23. package/src/util/EffectLogger.res.mjs +8 -8
  24. package/src/util/Logger.res +21 -7
  25. package/src/util/Logger.res.mjs +44 -30
  26. package/tests/ClosedSetWordsTest.res +105 -0
  27. package/tests/ClosedSetWordsTest.res.mjs +145 -0
  28. package/tests/ResourceAttributionTest.res.mjs +4 -7
  29. package/tests/admin/AdminApiSchemaDriftTest.res +1 -1
  30. package/tests/admin/Platform_BakedManifestTest.res +1 -1
  31. package/tests/admin/Platform_ComponentDefinitionsApiTest.res +1 -1
  32. package/tests/admin/Platform_PluginStructuresApiTest.res +3 -3
  33. package/tests/admin/Platform_SelfRegistrationTest.res +2 -2
  34. package/tests/commandgenerator/OwnerStampingTest.res.mjs +1 -1
  35. package/tests/logger/LogFormatTest.res.mjs +2 -2
  36. package/tests/logger/LoggerLazyTest.res.mjs +2 -2
  37. package/tests/logger/LoggerSinkTest.res.mjs +26 -26
  38. package/tests/plugin/ManifestVisibilityTest.res +4 -2
  39. package/tests/plugin/ManifestVisibilityTest.res.mjs +5 -1
  40. package/tests/plugin/SchemaWalkerTest.res +3 -3
  41. package/tests/plugin/SchemaWalkerTest.res.mjs +3 -3
  42. package/tests/projection/ViewChangeTest.res.mjs +1 -1
@@ -0,0 +1,145 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
4
+ import * as Logger$ReventlessCore from "../src/util/Logger.res.mjs";
5
+ import * as ComponentType$ReventlessCore from "../src/ComponentType.res.mjs";
6
+ import * as Plugin_Structure$ReventlessCore from "../src/plugin/component/Plugin_Structure.res.mjs";
7
+ import * as ResourceAttribution$ReventlessCore from "../src/ResourceAttribution.res.mjs";
8
+
9
+ globalThis.describe("ComponentType", () => {
10
+ let words = [
11
+ "Aggregate",
12
+ "Counter",
13
+ "Plugin",
14
+ "Platform",
15
+ "CommandGenerator",
16
+ "CommandTopic",
17
+ "EventCollector",
18
+ "EventLog",
19
+ "EventMapper",
20
+ "EventTopic",
21
+ "ExtensionPoint",
22
+ "Extension",
23
+ "QueryDB",
24
+ "ReadModel",
25
+ "Scheduler",
26
+ "Service",
27
+ "SideEffectHandler",
28
+ "Task",
29
+ "Vpc",
30
+ "Heartbeat",
31
+ "Cloner",
32
+ "DcbEventLog",
33
+ "StateChangeSlice",
34
+ "StateViewSlice",
35
+ "AutomationSlice",
36
+ "OutboundTranslationSlice",
37
+ "InboundTranslationSlice"
38
+ ];
39
+ globalThis.test("prints each kind as the word a deployment carries", () => {
40
+ globalThis.expect(ComponentType$ReventlessCore.all.map(ComponentType$ReventlessCore.toString)).toEqual(words);
41
+ });
42
+ globalThis.test("reads each word back, and no other", () => {
43
+ globalThis.expect(words.concat([
44
+ "QueryDb",
45
+ "Runtime"
46
+ ]).map(w => Stdlib_Option.map(ComponentType$ReventlessCore.ofString(w), ComponentType$ReventlessCore.toString))).toEqual(words.map(w => w).concat([
47
+ undefined,
48
+ undefined
49
+ ]));
50
+ });
51
+ globalThis.test("the query store's short name stays QueryDb", () => {
52
+ globalThis.expect(ComponentType$ReventlessCore.toName("QueryDB")).toBe("QueryDb");
53
+ });
54
+ });
55
+
56
+ globalThis.describe("ResourceAttribution", () => {
57
+ globalThis.test("a role's text is its name, and an other role is its own word", () => {
58
+ globalThis.expect([
59
+ "QueryDb",
60
+ "Runtime",
61
+ "EventSourceMapping",
62
+ "ChangeFeed"
63
+ ].map(ResourceAttribution$ReventlessCore.Role.toString)).toEqual([
64
+ "QueryDb",
65
+ "Runtime",
66
+ "EventSourceMapping",
67
+ "ChangeFeed"
68
+ ]);
69
+ });
70
+ });
71
+
72
+ globalThis.describe("Plugin_Structure.labelFieldSource", () => {
73
+ globalThis.test("prints each source in lower case", () => {
74
+ globalThis.expect([
75
+ "annotation",
76
+ "convention",
77
+ "position",
78
+ "fallback"
79
+ ].map(Plugin_Structure$ReventlessCore.labelFieldSourceToString)).toEqual([
80
+ "annotation",
81
+ "convention",
82
+ "position",
83
+ "fallback"
84
+ ]);
85
+ });
86
+ });
87
+
88
+ globalThis.describe("Plugin_BuiltHook.schemaKind", () => {
89
+ globalThis.test("prints each kind as a published schema carries it", () => {
90
+ globalThis.expect([
91
+ "RecordSchema",
92
+ "VariantSchema",
93
+ "UnknownSchema"
94
+ ].map(k => k)).toEqual([
95
+ "RecordSchema",
96
+ "VariantSchema",
97
+ "UnknownSchema"
98
+ ]);
99
+ });
100
+ });
101
+
102
+ globalThis.describe("Logger levels", () => {
103
+ globalThis.test("a level's label is its upper-case word, and reads back exactly", () => {
104
+ globalThis.expect(Logger$ReventlessCore.levels.map(Logger$ReventlessCore.levelLabel)).toEqual([
105
+ "DEBUG",
106
+ "INFO",
107
+ "WARN",
108
+ "ERROR"
109
+ ]);
110
+ globalThis.expect([
111
+ "DEBUG",
112
+ "INFO",
113
+ "WARN",
114
+ "ERROR",
115
+ "warn",
116
+ "WARNING"
117
+ ].map(w => Stdlib_Option.map(Logger$ReventlessCore.levelOfLabel(w), Logger$ReventlessCore.levelLabel))).toEqual([
118
+ "DEBUG",
119
+ "INFO",
120
+ "WARN",
121
+ "ERROR",
122
+ undefined,
123
+ undefined
124
+ ]);
125
+ });
126
+ globalThis.test("a word reads in any case, warning included", () => {
127
+ globalThis.expect([
128
+ "debug",
129
+ "Info",
130
+ "WARN",
131
+ "warning",
132
+ "Error",
133
+ "trace"
134
+ ].map(w => Stdlib_Option.map(Logger$ReventlessCore.levelOfWord(w), Logger$ReventlessCore.levelLabel))).toEqual([
135
+ "DEBUG",
136
+ "INFO",
137
+ "WARN",
138
+ "WARN",
139
+ "ERROR",
140
+ undefined
141
+ ]);
142
+ });
143
+ });
144
+
145
+ /* Not a pure module */
@@ -9,9 +9,9 @@ import * as ResourceAttribution$ReventlessCore from "../src/ResourceAttribution.
9
9
  globalThis.describe("ResourceAttribution.Scope — wire spellings", () => {
10
10
  globalThis.test("scopes render lower-case", () => {
11
11
  globalThis.expect([
12
- "Component",
13
- "Plugin",
14
- "Platform"
12
+ "component",
13
+ "plugin",
14
+ "platform"
15
15
  ].map(ResourceAttribution$ReventlessCore.Scope.toString)).toEqual([
16
16
  "component",
17
17
  "plugin",
@@ -35,10 +35,7 @@ globalThis.describe("ResourceAttribution.Role — wire spellings", () => {
35
35
  ]);
36
36
  });
37
37
  globalThis.test("Other carries the caller's name verbatim", () => {
38
- globalThis.expect(ResourceAttribution$ReventlessCore.Role.toString({
39
- TAG: "Other",
40
- _0: "ChangeFeed"
41
- })).toBe("ChangeFeed");
38
+ globalThis.expect(ResourceAttribution$ReventlessCore.Role.toString("ChangeFeed")).toBe("ChangeFeed");
42
39
  });
43
40
  globalThis.test("platform-level things are Platform, not Core", () => {
44
41
  globalThis.expect(ComponentType$ReventlessCore.toString("Platform")).toBe("Platform");
@@ -174,7 +174,7 @@ let capabilityDecl: requiredCapabilityDeclaration = {
174
174
 
175
175
  let admissionDef: Reventless.Admission.def = {
176
176
  role: "Clerk",
177
- strategy: "Invitation",
177
+ strategy: InvitationWord,
178
178
  invitedBy: ["Admin"],
179
179
  }
180
180
 
@@ -48,7 +48,7 @@ let structure: pluginStructure = {
48
48
  readModels: [readSide(~name="Customers", ())],
49
49
  stateViewSlices: [
50
50
  readSide(~name="Orders", ~ownerField="customerId", ()),
51
- readSide(~name="AvailableProducts", ~visibility="Internal", ()),
51
+ readSide(~name="AvailableProducts", ~visibility=Internal, ()),
52
52
  ],
53
53
  stateChangeSlices: [
54
54
  writeSide(
@@ -232,7 +232,7 @@ describe("visibility filtering (deployed AutoUI hides Internal)", () => {
232
232
  labelField: "name",
233
233
  searchableFields: ["name"],
234
234
  labelFieldSource: "convention",
235
- visibility: "Internal",
235
+ visibility: Internal,
236
236
  singleQueryField: "Ordering_AvailableProduct",
237
237
  idField: "productId",
238
238
  idFieldSource: "sole",
@@ -27,7 +27,7 @@ let internalRm: readSideDef = {
27
27
  ...publicRm,
28
28
  name: "ProductAudit",
29
29
  queryField: "Catalog_ProductAudit",
30
- visibility: "Internal",
30
+ visibility: Internal,
31
31
  }
32
32
 
33
33
  let structure: pluginStructure = {
@@ -61,8 +61,8 @@ let structure: pluginStructure = {
61
61
  ],
62
62
  requiredCapabilities: [{capability: "Geocoding", component: "GeocodeAddress"}],
63
63
  admission: [
64
- {role: "Shopper", strategy: "SelfService"},
65
- {role: "Clerk", strategy: "Invitation", invitedBy: ["Admin"]},
64
+ {role: "Shopper", strategy: SelfServiceWord},
65
+ {role: "Clerk", strategy: InvitationWord, invitedBy: ["Admin"]},
66
66
  ],
67
67
  admissionDoors: [{component: "SignUp", part: "start"}],
68
68
  }
@@ -17,8 +17,8 @@ let empty: Reventless.Plugin.pluginStructure = {
17
17
  let registration: Reventless.Plugin.pluginStructure = {
18
18
  ...empty,
19
19
  admission: [
20
- {Reventless.Admission.role: "Shopper", strategy: "SelfService"},
21
- {Reventless.Admission.role: "Admin", strategy: "Provisioned"},
20
+ {Reventless.Admission.role: "Shopper", strategy: SelfServiceWord},
21
+ {Reventless.Admission.role: "Admin", strategy: ProvisionedWord},
22
22
  ],
23
23
  admissionDoors: [
24
24
  {Reventless.Admission.component: "SignUp", part: "start"},
@@ -333,7 +333,7 @@ globalThis.describe("the command's entry names the command on its lines", () =>
333
333
  });
334
334
  remove();
335
335
  let line = Stdlib_Option.getOrThrow(lines.find(r => r.message.startsWith("refused before its handler")), undefined);
336
- globalThis.expect(line.level).toEqual("Warn");
336
+ globalThis.expect(line.level).toEqual("WARN");
337
337
  globalThis.expect(Stdlib_Option.isSome(line.annotations["msgId"])).toBe(true);
338
338
  globalThis.expect(heard.map(r => [
339
339
  r.component,
@@ -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("Debug");
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("Info", "Platform", undefined, detail, undefined, "big"));
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("Info");
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("Debug");
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("Warn", "Aggregate(Order)", "Ordering", detail, Object.fromEntries([[
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("Info", "Platform", undefined, detail, undefined, "joined"));
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("Info", "Platform", undefined, undefined, undefined, "one");
112
- Logger$ReventlessCore.emit("Info", "Platform", undefined, undefined, undefined, "two");
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("Info", "Platform", undefined, undefined, undefined, "after"));
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("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");
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("Info");
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", "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");
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", "Debug");
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", "Error");
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", "Debug");
181
+ Logger$ReventlessCore.setLevel(undefined, "Quiet", "DEBUG");
182
182
  Effect.runSync(EffectLogger$ReventlessCore.logDebug("Quiet", undefined, undefined, "now"));
183
- Logger$ReventlessCore.setLevel(undefined, "Loud", "Error");
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, "Warn");
191
- Logger$ReventlessCore.setLevel("Ordering", "Projection", "Debug");
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: "Warn"
194
+ level: "WARN"
195
195
  },
196
196
  {
197
197
  plugin: "Ordering",
198
198
  comp: "Projection",
199
- level: "Debug"
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(Some(Some("Internal")))
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
- return match === "Public";
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("record"))
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("variant"))
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("unknown")
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("record");
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("variant");
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("unknown");
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("Info");
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);