@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.
- package/CHANGELOG.md +11 -0
- package/package.json +8 -8
- package/src/Platform.res +17 -0
- package/src/Platform.res.mjs +7 -2
- package/src/ShellConfig.res +20 -2
- package/src/ShellConfig.res.mjs +9 -4
- package/src/UiSlots.res +191 -0
- package/src/UiSlots.res.mjs +91 -0
- package/src/adapter/Api/LocalEvents_Server.res +18 -0
- package/src/adapter/Api/LocalEvents_Server.res.mjs +11 -0
- package/src/adapter/EventHistory/EventHistoryResolvers_GraphQL.res +50 -3
- package/src/adapter/EventHistory/EventHistoryResolvers_GraphQL.res.mjs +62 -2
- package/tests/ShellConfigTest.res +41 -0
- package/tests/ShellConfigTest.res.mjs +40 -17
- package/tests/UiSlotsTest.res +197 -0
- package/tests/UiSlotsTest.res.mjs +196 -0
- package/tests/adapter/EventHistoryResolverTest.res +46 -0
- package/tests/adapter/EventHistoryResolverTest.res.mjs +41 -0
- package/tests/components/aggregate/AggregateFixtures.res.mjs +1 -1
- package/tests/components/automationslice/AutomationSliceFixtures.res.mjs +2 -2
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res.mjs +3 -3
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res.mjs +1 -1
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res.mjs +1 -1
- package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +1 -1
- package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +1 -1
- package/tests/components/dcb/DcbCrossPartitionFixtures.res.mjs +1 -1
- package/tests/components/dcb/DcbFixtures.res.mjs +1 -1
- package/tests/components/extensionpoint/ExtensionPointFixtures.res.mjs +2 -2
- package/tests/components/inboundtranslationslice/InboundTranslationSliceFixtures.res.mjs +1 -1
- package/tests/components/outboundtranslationslice/OutboundTranslationSlicePlatformFixtures.res.mjs +1 -1
- 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 {
|
|
@@ -64,7 +64,7 @@ function commandAuthorization(param) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function commandTransition(param) {
|
|
67
|
-
return "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
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 "
|
|
233
|
+
return "Undeclared";
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
let traits$2 = [];
|
|
@@ -30,7 +30,7 @@ function commandAuthorization(param) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function commandTransition(param) {
|
|
33
|
-
return "
|
|
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 "
|
|
70
|
+
return "Undeclared";
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
let traits$1 = [];
|