@reventlessdev/reventless-core 3.0.0-alpha.324 → 3.0.0-alpha.326
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 +15 -0
- package/package.json +7 -7
- package/src/Message.res +46 -0
- package/src/Message.res.mjs +45 -0
- package/src/Projection.res +269 -131
- package/src/Projection.res.mjs +338 -224
- package/src/ViewChange.res +194 -0
- package/src/ViewChange.res.mjs +235 -0
- package/src/components/Aggregate/Aggregate_Callback.res +11 -3
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +8 -6
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +21 -9
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +19 -8
- package/src/components/CommandTopic/CommandTopic.res.mjs +5 -2
- package/src/components/CommandTopic/CommandTopic_Helpers.res +56 -26
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +35 -16
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +6 -2
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +6 -2
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +25 -12
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +20 -7
- package/src/components/ReadModel/ReadModel_Callback.res +23 -3
- package/src/components/ReadModel/ReadModel_Callback.res.mjs +14 -2
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +7 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +7 -7
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +14 -2
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +13 -2
- package/src/components/StateViewSlice/StateViewSlice_Callback.res +29 -4
- package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +9 -2
- package/src/util/EffectLogger.res +30 -29
- package/src/util/EffectLogger.res.mjs +13 -22
- package/src/util/Logger.res +231 -35
- package/src/util/Logger.res.mjs +263 -42
- package/tests/commandgenerator/OwnerActingTest.res +205 -1
- package/tests/commandgenerator/OwnerActingTest.res.mjs +361 -0
- package/tests/commandtopic/CommandOutcomeHookTest.res +74 -2
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +92 -0
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +4 -4
- package/tests/logger/LoggerSinkTest.res +205 -0
- package/tests/logger/LoggerSinkTest.res.mjs +209 -0
- package/tests/projection/ViewChangeTest.res +173 -0
- package/tests/projection/ViewChangeTest.res.mjs +292 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.326 (2026-11-01)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **core:** a command's outcome, the flow through automations, and each view change are told ([dcaeed2](https://github.com/ReventlessDev/reventless-core/commit/dcaeed2fabe2047a21797b459f2931618474dec3))
|
|
11
|
+
* **local:** the local platform serves its logs and events to whoever watches it ([0c29b0d](https://github.com/ReventlessDev/reventless-core/commit/0c29b0d08c668ad5b948a8017178dad8692647d0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 3.0.0-alpha.325 (2026-10-30)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **spec:** an aggregate keyed by its owner's id refuses other callers ([e05f287](https://github.com/ReventlessDev/reventless-core/commit/e05f287eee959d26190af494691c4fa472797cad))
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# 3.0.0-alpha.324 (2026-10-30)
|
|
7
22
|
|
|
8
23
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.326",
|
|
4
4
|
"description": "Core package for Reventless framework",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"sury": "11.0.0",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
|
-
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
32
|
-
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.24",
|
|
33
31
|
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
34
|
-
"@reventlessdev/rescript-
|
|
32
|
+
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.25",
|
|
33
|
+
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
34
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.25",
|
|
35
35
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
36
36
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
37
|
+
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.26",
|
|
37
38
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
38
|
-
"@reventlessdev/
|
|
39
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.190",
|
|
39
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.221",
|
|
40
40
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.42",
|
|
41
|
-
"@reventlessdev/reventless-
|
|
41
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.192"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"rescript": "12.3.1",
|
package/src/Message.res
CHANGED
|
@@ -265,6 +265,52 @@ let deriveMeta = (~parent: meta, ~service=?) => {
|
|
|
265
265
|
headers: ?ReventlessInfra.Message.withoutStableIdHeader(parent.headers),
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
/**
|
|
269
|
+
What a message sent later, from stored work, keeps of the event that caused it:
|
|
270
|
+
enough for `deriveMeta`, and nothing else. `user` is an id.
|
|
271
|
+
*/
|
|
272
|
+
@schema
|
|
273
|
+
type flowSource = {
|
|
274
|
+
msgId: string,
|
|
275
|
+
correlationId: string,
|
|
276
|
+
user?: string,
|
|
277
|
+
traceparent?: string,
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let flowSourceOf = (meta: meta): flowSource => {
|
|
281
|
+
msgId: meta.msgId,
|
|
282
|
+
correlationId: meta.correlationId,
|
|
283
|
+
user: ?meta.user,
|
|
284
|
+
traceparent: ?meta.traceparent,
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** A meta derived from a kept source: the flow's correlation id, the source's
|
|
288
|
+
message id as causation, its user and trace parent. */
|
|
289
|
+
let deriveMetaFromSource = (source: flowSource, ~service: string): meta =>
|
|
290
|
+
deriveMeta(
|
|
291
|
+
~parent={
|
|
292
|
+
service,
|
|
293
|
+
time: nowAsISOString(),
|
|
294
|
+
msgId: source.msgId,
|
|
295
|
+
correlationId: source.correlationId,
|
|
296
|
+
user: ?source.user,
|
|
297
|
+
traceparent: ?source.traceparent,
|
|
298
|
+
},
|
|
299
|
+
~service,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
/** The meta of an event envelope (`{id, meta, event}`), or `None` where it has
|
|
303
|
+
none that decodes. */
|
|
304
|
+
let metaOfEnvelope = (envelope: option<dict<JSON.t>>): option<meta> =>
|
|
305
|
+
switch envelope->Option.flatMap(d => d->Dict.get("meta")) {
|
|
306
|
+
| Some(json) =>
|
|
307
|
+
switch json->Reventless.Util_Sury.fromJson(metaSchema) {
|
|
308
|
+
| meta => Some(meta)
|
|
309
|
+
| exception _ => None
|
|
310
|
+
}
|
|
311
|
+
| None => None
|
|
312
|
+
}
|
|
313
|
+
|
|
268
314
|
// The same envelope with a `msgId` that is a function of its input, for a message
|
|
269
315
|
// a mapping derives from another; defined beside the mappings in infra. A handler
|
|
270
316
|
// asks `hasStableMsgId` whether a repeat of the command can be recognized.
|
package/src/Message.res.mjs
CHANGED
|
@@ -207,6 +207,47 @@ function deriveMeta(parent, service) {
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
let flowSourceSchema = Sury.$schema(s => ({
|
|
211
|
+
msgId: s.m(Sury.string),
|
|
212
|
+
correlationId: s.m(Sury.string),
|
|
213
|
+
user: s.m(Sury.$option(Sury.string)),
|
|
214
|
+
traceparent: s.m(Sury.$option(Sury.string))
|
|
215
|
+
}));
|
|
216
|
+
|
|
217
|
+
function flowSourceOf(meta) {
|
|
218
|
+
return {
|
|
219
|
+
msgId: meta.msgId,
|
|
220
|
+
correlationId: meta.correlationId,
|
|
221
|
+
user: meta.user,
|
|
222
|
+
traceparent: meta.traceparent
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function deriveMetaFromSource(source, service) {
|
|
227
|
+
return deriveMeta({
|
|
228
|
+
service: service,
|
|
229
|
+
time: new Date().toISOString(),
|
|
230
|
+
user: source.user,
|
|
231
|
+
msgId: source.msgId,
|
|
232
|
+
correlationId: source.correlationId,
|
|
233
|
+
traceparent: source.traceparent
|
|
234
|
+
}, service);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function metaOfEnvelope(envelope) {
|
|
238
|
+
let json = Stdlib_Option.flatMap(envelope, d => d["meta"]);
|
|
239
|
+
if (json === undefined) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
let meta;
|
|
243
|
+
try {
|
|
244
|
+
meta = Util_Sury$Reventless.fromJson(json, Message$Reventless.metaSchema);
|
|
245
|
+
} catch (exn) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
return meta;
|
|
249
|
+
}
|
|
250
|
+
|
|
210
251
|
function decomposeMeta(meta) {
|
|
211
252
|
return Object.entries(Stdlib_Option.getOrThrow(Stdlib_JSON.Decode.object(Util_Sury$Reventless.toJson(meta, Message$Reventless.metaSchema)), undefined));
|
|
212
253
|
}
|
|
@@ -454,6 +495,10 @@ export {
|
|
|
454
495
|
hrtimeToString,
|
|
455
496
|
generateMeta,
|
|
456
497
|
deriveMeta,
|
|
498
|
+
flowSourceSchema,
|
|
499
|
+
flowSourceOf,
|
|
500
|
+
deriveMetaFromSource,
|
|
501
|
+
metaOfEnvelope,
|
|
457
502
|
deriveStableMeta,
|
|
458
503
|
hasStableMsgId,
|
|
459
504
|
decomposeMeta,
|