@reventlessdev/reventless-local 3.0.0-alpha.245 → 3.0.0-alpha.246

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 (31) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/package.json +8 -8
  3. package/src/Platform.res +17 -0
  4. package/src/Platform.res.mjs +7 -2
  5. package/src/ShellConfig.res +20 -2
  6. package/src/ShellConfig.res.mjs +9 -4
  7. package/src/UiSlots.res +191 -0
  8. package/src/UiSlots.res.mjs +91 -0
  9. package/src/adapter/Api/LocalEvents_Server.res +18 -0
  10. package/src/adapter/Api/LocalEvents_Server.res.mjs +11 -0
  11. package/src/adapter/EventHistory/EventHistoryResolvers_GraphQL.res +50 -3
  12. package/src/adapter/EventHistory/EventHistoryResolvers_GraphQL.res.mjs +62 -2
  13. package/tests/ShellConfigTest.res +41 -0
  14. package/tests/ShellConfigTest.res.mjs +40 -17
  15. package/tests/UiSlotsTest.res +197 -0
  16. package/tests/UiSlotsTest.res.mjs +196 -0
  17. package/tests/adapter/EventHistoryResolverTest.res +46 -0
  18. package/tests/adapter/EventHistoryResolverTest.res.mjs +41 -0
  19. package/tests/components/aggregate/AggregateFixtures.res.mjs +1 -1
  20. package/tests/components/automationslice/AutomationSliceFixtures.res.mjs +2 -2
  21. package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res.mjs +3 -3
  22. package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res.mjs +1 -1
  23. package/tests/components/commandgenerator/CommandGeneratorFixtures.res.mjs +1 -1
  24. package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +1 -1
  25. package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +1 -1
  26. package/tests/components/dcb/DcbCrossPartitionFixtures.res.mjs +1 -1
  27. package/tests/components/dcb/DcbFixtures.res.mjs +1 -1
  28. package/tests/components/extensionpoint/ExtensionPointFixtures.res.mjs +2 -2
  29. package/tests/components/inboundtranslationslice/InboundTranslationSliceFixtures.res.mjs +1 -1
  30. package/tests/components/outboundtranslationslice/OutboundTranslationSlicePlatformFixtures.res.mjs +1 -1
  31. package/tests/components/readmodel/DcbReadModelE2EFixtures.res.mjs +1 -1
@@ -206,3 +206,49 @@ describe("EventHistoryResolvers_GraphQL — pagination", () => {
206
206
  expect(page->hasNextPageOf)->toBe(false)
207
207
  })
208
208
  })
209
+
210
+ // The clause the "supply filter.entityId" warning ends with. A caller that
211
+ // cannot be named is the case that matters: the warning has to survive it.
212
+ describe("EventHistoryResolvers_GraphQL — naming the caller", () => {
213
+ let ctxOf = (~operationName=?, ~userId=?, ()) => {
214
+ let d = Dict.make()
215
+ operationName->Option.forEach(name =>
216
+ d->Dict.set(
217
+ "params",
218
+ Dict.fromArray([("operationName", JSON.Encode.string(name))])->JSON.Encode.object,
219
+ )
220
+ )
221
+ userId->Option.forEach(id =>
222
+ d->Dict.set(
223
+ "identity",
224
+ Dict.fromArray([
225
+ ("userId", JSON.Encode.string(id)),
226
+ ("username", JSON.Encode.string(id)),
227
+ ("groups", []->JSON.Encode.array),
228
+ ])->JSON.Encode.object,
229
+ )
230
+ )
231
+ JSON.Encode.object(d)
232
+ }
233
+
234
+ testSync("name the operation, the user and the filter keys that did arrive", () =>
235
+ expect(
236
+ EH.describeCaller(
237
+ ~ctx=ctxOf(~operationName="AuditTrail", ~userId="local-admin", ()),
238
+ ~filter={eventTypes: ["OrderPlaced"], user: "alice"},
239
+ ),
240
+ )->toBe(`operation "AuditTrail" as local-admin, with filter [eventTypes, user]`)
241
+ )
242
+
243
+ testSync("say so when the caller sent no filter at all", () =>
244
+ expect(
245
+ EH.describeCaller(~ctx=ctxOf(~operationName="AuditTrail", ~userId="local-admin", ()), ~filter={}),
246
+ )->toBe(`operation "AuditTrail" as local-admin, with no filter`)
247
+ )
248
+
249
+ testSync("still describe a context carrying neither operation nor identity", () =>
250
+ expect(EH.describeCaller(~ctx=ctxOf(), ~filter={}))->toBe(
251
+ "an unnamed operation as anonymous, with no filter",
252
+ )
253
+ )
254
+ })
@@ -271,6 +271,47 @@ globalThis.describe("EventHistoryResolvers_GraphQL — pagination", () => {
271
271
  });
272
272
  });
273
273
 
274
+ globalThis.describe("EventHistoryResolvers_GraphQL — naming the caller", () => {
275
+ let ctxOf = (operationName, userId, param) => {
276
+ let d = {};
277
+ Stdlib_Option.forEach(operationName, name => {
278
+ d["params"] = Object.fromEntries([[
279
+ "operationName",
280
+ name
281
+ ]]);
282
+ });
283
+ Stdlib_Option.forEach(userId, id => {
284
+ d["identity"] = Object.fromEntries([
285
+ [
286
+ "userId",
287
+ id
288
+ ],
289
+ [
290
+ "username",
291
+ id
292
+ ],
293
+ [
294
+ "groups",
295
+ []
296
+ ]
297
+ ]);
298
+ });
299
+ return d;
300
+ };
301
+ globalThis.test("name the operation, the user and the filter keys that did arrive", () => {
302
+ globalThis.expect(EventHistoryResolvers_GraphQL$ReventlessLocal.describeCaller(ctxOf("AuditTrail", "local-admin", undefined), {
303
+ eventTypes: ["OrderPlaced"],
304
+ user: "alice"
305
+ })).toBe(`operation "AuditTrail" as local-admin, with filter [eventTypes, user]`);
306
+ });
307
+ globalThis.test("say so when the caller sent no filter at all", () => {
308
+ globalThis.expect(EventHistoryResolvers_GraphQL$ReventlessLocal.describeCaller(ctxOf("AuditTrail", "local-admin", undefined), {})).toBe(`operation "AuditTrail" as local-admin, with no filter`);
309
+ });
310
+ globalThis.test("still describe a context carrying neither operation nor identity", () => {
311
+ globalThis.expect(EventHistoryResolvers_GraphQL$ReventlessLocal.describeCaller(ctxOf(undefined, undefined, undefined), {})).toBe("an unnamed operation as anonymous, with no filter");
312
+ });
313
+ });
314
+
274
315
  let EH;
275
316
 
276
317
  export {
@@ -28,7 +28,7 @@ function commandAuthorization(param) {
28
28
  }
29
29
 
30
30
  function commandTransition(param) {
31
- return "Unrestricted";
31
+ return "Undeclared";
32
32
  }
33
33
 
34
34
  let traits = [];
@@ -64,7 +64,7 @@ function commandAuthorization(param) {
64
64
  }
65
65
 
66
66
  function commandTransition(param) {
67
- return "Unrestricted";
67
+ return "Undeclared";
68
68
  }
69
69
 
70
70
  let traits = [];
@@ -95,7 +95,7 @@ function commandAuthorization$1(param) {
95
95
  }
96
96
 
97
97
  function commandTransition$1(param) {
98
- return "Unrestricted";
98
+ return "Undeclared";
99
99
  }
100
100
 
101
101
  let traits$1 = [];
@@ -42,7 +42,7 @@ function commandAuthorization(param) {
42
42
  }
43
43
 
44
44
  function commandTransition(param) {
45
- return "Unrestricted";
45
+ return "Undeclared";
46
46
  }
47
47
 
48
48
  let traits = [];
@@ -121,7 +121,7 @@ function commandAuthorization$1(param) {
121
121
  }
122
122
 
123
123
  function commandTransition$1(param) {
124
- return "Unrestricted";
124
+ return "Undeclared";
125
125
  }
126
126
 
127
127
  let traits$1 = [];
@@ -230,7 +230,7 @@ function commandAuthorization$2(param) {
230
230
  }
231
231
 
232
232
  function commandTransition$2(param) {
233
- return "Unrestricted";
233
+ return "Undeclared";
234
234
  }
235
235
 
236
236
  let traits$2 = [];
@@ -69,7 +69,7 @@ function commandAuthorization(param) {
69
69
  }
70
70
 
71
71
  function commandTransition(param) {
72
- return "Unrestricted";
72
+ return "Undeclared";
73
73
  }
74
74
 
75
75
  let traits = [];
@@ -29,7 +29,7 @@ function commandAuthorization(param) {
29
29
  }
30
30
 
31
31
  function commandTransition(param) {
32
- return "Unrestricted";
32
+ return "Undeclared";
33
33
  }
34
34
 
35
35
  let traits = [];
@@ -34,7 +34,7 @@ function commandAuthorization(param) {
34
34
  }
35
35
 
36
36
  function commandTransition(param) {
37
- return "Unrestricted";
37
+ return "Undeclared";
38
38
  }
39
39
 
40
40
  let traits = [];
@@ -36,7 +36,7 @@ function commandAuthorization(param) {
36
36
  }
37
37
 
38
38
  function commandTransition(param) {
39
- return "Unrestricted";
39
+ return "Undeclared";
40
40
  }
41
41
 
42
42
  let traits = [];
@@ -74,7 +74,7 @@ function commandAuthorization(param) {
74
74
  }
75
75
 
76
76
  function commandTransition(param) {
77
- return "Unrestricted";
77
+ return "Undeclared";
78
78
  }
79
79
 
80
80
  let traits = [];
@@ -51,7 +51,7 @@ function commandAuthorization(param) {
51
51
  }
52
52
 
53
53
  function commandTransition(param) {
54
- return "Unrestricted";
54
+ return "Undeclared";
55
55
  }
56
56
 
57
57
  let traits = [];
@@ -30,7 +30,7 @@ function commandAuthorization(param) {
30
30
  }
31
31
 
32
32
  function commandTransition(param) {
33
- return "Unrestricted";
33
+ return "Undeclared";
34
34
  }
35
35
 
36
36
  let traits = [];
@@ -67,7 +67,7 @@ function commandAuthorization$1(param) {
67
67
  }
68
68
 
69
69
  function commandTransition$1(param) {
70
- return "Unrestricted";
70
+ return "Undeclared";
71
71
  }
72
72
 
73
73
  let traits$1 = [];
@@ -57,7 +57,7 @@ function commandAuthorization(param) {
57
57
  }
58
58
 
59
59
  function commandTransition(param) {
60
- return "Unrestricted";
60
+ return "Undeclared";
61
61
  }
62
62
 
63
63
  let traits = [];
@@ -43,7 +43,7 @@ function commandAuthorization(param) {
43
43
  }
44
44
 
45
45
  function commandTransition(param) {
46
- return "Unrestricted";
46
+ return "Undeclared";
47
47
  }
48
48
 
49
49
  let traits = [];
@@ -46,7 +46,7 @@ function commandAuthorization(param) {
46
46
  }
47
47
 
48
48
  function commandTransition(param) {
49
- return "Unrestricted";
49
+ return "Undeclared";
50
50
  }
51
51
 
52
52
  let traits = [];