@reventlessdev/reventless-core 3.0.0-alpha.326 → 3.0.0-alpha.328
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 +18 -0
- package/package.json +6 -6
- package/src/CommandSent.res +22 -0
- package/src/CommandSent.res.mjs +22 -0
- package/src/Projection.res +26 -1
- package/src/Projection.res.mjs +19 -1
- package/src/RowChange.res +37 -0
- package/src/RowChange.res.mjs +62 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res.mjs +5 -5
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res.mjs +2 -2
- package/src/admin/Platform_Admin_Callback.res.mjs +1 -1
- package/src/components/Aggregate/Aggregate_Callback.res +88 -18
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +53 -32
- package/src/components/Api/GraphQL_FragmentGenerator.res +22 -0
- package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +20 -4
- package/src/components/Api/GraphQL_SchemaInspector.res.mjs +2 -2
- package/src/components/AutomationSlice/AutomationSlice_Builder.res.mjs +1 -1
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +9 -0
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +20 -14
- package/src/components/CommandGenerator/CommandGenerator_Callback.res +47 -6
- package/src/components/CommandGenerator/CommandGenerator_Callback.res.mjs +41 -4
- package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +1 -1
- package/src/components/CommandTopic/CommandTopic_Helpers.res +9 -1
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +7 -6
- package/src/components/CommandTopic/CommandTopic_Operations.res +2 -0
- package/src/components/CommandTopic/CommandTopic_Operations.res.mjs +2 -2
- package/src/components/Counter/Counter_Callback.res.mjs +3 -3
- package/src/components/Counter/Counter_Operations.res.mjs +4 -4
- package/src/components/DcbEventLog/DcbEventLog_Operations.res.mjs +3 -3
- package/src/components/EventLog/EventLog_Operations.res +1 -0
- package/src/components/EventLog/EventLog_Operations.res.mjs +3 -3
- package/src/components/EventMapper/EventMapper_Callback.res +12 -2
- package/src/components/EventMapper/EventMapper_Callback.res.mjs +16 -14
- package/src/components/EventTopic/EventTopic_Operations.res +2 -0
- package/src/components/EventTopic/EventTopic_Operations.res.mjs +2 -2
- package/src/components/Extension/Extension_Operations.res +4 -0
- package/src/components/Extension/Extension_Operations.res.mjs +8 -8
- package/src/components/ExtensionPoint/ExtensionPoint_Callback.res +5 -1
- package/src/components/ExtensionPoint/ExtensionPoint_Callback.res.mjs +4 -3
- package/src/components/ExtensionPoint/ExtensionPoint_Operations.res +2 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Operations.res.mjs +9 -8
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +4 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +4 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Webhook.res.mjs +1 -1
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +1 -1
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +12 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +14 -12
- package/src/components/QueryDb/QueryDb_Operations.res +2 -0
- package/src/components/QueryDb/QueryDb_Operations.res.mjs +3 -0
- package/src/components/ReadModel/ReadModel_Callback.res +1 -0
- package/src/components/ReadModel/ReadModel_Callback.res.mjs +1 -1
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +2 -0
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +6 -6
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +36 -7
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +38 -20
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +2 -0
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +2 -2
- package/src/components/StateViewSlice/StateViewSlice_Callback.res +6 -0
- package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +3 -2
- package/src/components/Task/Task_Builder.res +5 -3
- package/src/components/Task/Task_Builder.res.mjs +2 -1
- package/src/plugin/component/Plugin_Callback.res +6 -2
- package/src/plugin/component/Plugin_Callback.res.mjs +3 -2
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +6 -6
- package/src/util/CommandPublisher.res.mjs +9 -9
- package/src/util/EffectLogger.res +85 -17
- package/src/util/EffectLogger.res.mjs +63 -12
- package/src/util/FTPHandler.res.mjs +6 -6
- package/src/util/Metrics.res +151 -16
- package/src/util/Metrics.res.mjs +123 -3
- package/src/util/ScheduleOps.res.mjs +4 -4
- package/src/util/Util_AdapterRuntime.res.mjs +2 -2
- package/src/util/Util_Promise.res.mjs +1 -1
- package/src/util/Util_QueryDbRuntime.res.mjs +1 -1
- package/src/util/Validation.res.mjs +1 -1
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +2 -2
- package/tests/api/IdentitySemanticTest.res.mjs +1 -1
- package/tests/commandgenerator/OwnerStampingTest.res +65 -0
- package/tests/commandgenerator/OwnerStampingTest.res.mjs +62 -0
- package/tests/commandtopic/CommandOutcomeHookTest.res +25 -0
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +28 -0
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +4 -4
- package/tests/logger/ComponentLineIdsTest.res +97 -0
- package/tests/logger/ComponentLineIdsTest.res.mjs +118 -0
- package/tests/logger/LogFormatTest.res.mjs +5 -5
- package/tests/logger/LoggerSinkTest.res.mjs +3 -3
- package/tests/querydb/RowChangeTest.res +87 -0
- package/tests/querydb/RowChangeTest.res.mjs +157 -0
- package/tests/util/MetricsTest.res +72 -0
- package/tests/util/MetricsTest.res.mjs +108 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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.328 (2026-11-02)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* a view row knows its last change, and the local platform keeps every change ([1a1fd71](https://github.com/ReventlessDev/reventless-core/commit/1a1fd7117d9837696a7c0080dcd6f0983e57780c))
|
|
11
|
+
* every component that sends a command names it in a line of its own ([84d5742](https://github.com/ReventlessDev/reventless-core/commit/84d57420fe58d47f483e726d1748b1a98da7f1b8))
|
|
12
|
+
* **local:** the app's API logs each request and subscription it answers ([31a163c](https://github.com/ReventlessDev/reventless-core/commit/31a163c945d8929e9a604cc0dc8a74939320f85e))
|
|
13
|
+
* **local:** the local platform counts its metrics instead of logging them ([76c6094](https://github.com/ReventlessDev/reventless-core/commit/76c60946fa74520519dccb4ae39fae5880817832))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# 3.0.0-alpha.327 (2026-11-01)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **core:** a component's log line carries the ids of the message it is about ([9c26267](https://github.com/ReventlessDev/reventless-core/commit/9c26267ca6d03ff66b8406caa32243e205e29b5a))
|
|
21
|
+
* **local:** the registry entry names the platform API, and a command's outcome names its cause ([51717c4](https://github.com/ReventlessDev/reventless-core/commit/51717c441820c19dc59e595559b037b808ca716a))
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
# 3.0.0-alpha.326 (2026-11-01)
|
|
7
25
|
|
|
8
26
|
### Features
|
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.328",
|
|
4
4
|
"description": "Core package for Reventless framework",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"sury": "11.0.0",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
31
|
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
32
|
-
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.25",
|
|
33
32
|
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
34
|
-
"@reventlessdev/rescript-
|
|
33
|
+
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.26",
|
|
35
34
|
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
35
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.26",
|
|
36
36
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
37
|
-
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.26",
|
|
38
37
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
39
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.221",
|
|
40
38
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.42",
|
|
41
|
-
"@reventlessdev/reventless-
|
|
39
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.222",
|
|
40
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.193",
|
|
41
|
+
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.27"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"rescript": "12.3.1",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The line a component writes when it sends a command, under its own name and with the
|
|
2
|
+
// command's ids: `AutomationSlice(NotificationIntake) sending command: RequestNotification({…})`.
|
|
3
|
+
// The plugin's command topic publishes for every sender alike and cannot say whose a command
|
|
4
|
+
// is; this line does, as the API's `generated command` and a contract's `EP→` line do.
|
|
5
|
+
|
|
6
|
+
let log = (~comp: string, cmdJson: Message.commandJson) =>
|
|
7
|
+
EffectLogger.logInfo(
|
|
8
|
+
~comp,
|
|
9
|
+
~ids=EffectLogger.idsOf(cmdJson.meta),
|
|
10
|
+
~detail=cmdJson.commandJson,
|
|
11
|
+
`sending command: ${LogFormat.cmdDetailNoId(cmdJson)}`,
|
|
12
|
+
)->Effect.runSync
|
|
13
|
+
|
|
14
|
+
/** The same publishing, each command announced first under `comp`. */
|
|
15
|
+
let announcing = (
|
|
16
|
+
~comp: string,
|
|
17
|
+
publishJsons: ReventlessInfra.CommandTopic.publishJsons,
|
|
18
|
+
): ReventlessInfra.CommandTopic.publishJsons =>
|
|
19
|
+
cmdJsons => {
|
|
20
|
+
cmdJsons->Array.forEach(cmdJson => log(~comp, cmdJson))
|
|
21
|
+
publishJsons(cmdJsons)
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as LogFormat$ReventlessCore from "./util/LogFormat.res.mjs";
|
|
5
|
+
import * as EffectLogger$ReventlessCore from "./util/EffectLogger.res.mjs";
|
|
6
|
+
|
|
7
|
+
function log(comp, cmdJson) {
|
|
8
|
+
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, cmdJson.commandJson, EffectLogger$ReventlessCore.idsOf(undefined, undefined, cmdJson.meta), `sending command: ` + LogFormat$ReventlessCore.cmdDetailNoId(cmdJson)));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function announcing(comp, publishJsons) {
|
|
12
|
+
return cmdJsons => {
|
|
13
|
+
cmdJsons.forEach(cmdJson => log(comp, cmdJson));
|
|
14
|
+
return publishJsons(cmdJsons);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
log,
|
|
20
|
+
announcing,
|
|
21
|
+
}
|
|
22
|
+
/* effect/Effect Not a pure module */
|
package/src/Projection.res
CHANGED
|
@@ -303,7 +303,7 @@ let stateToString: 'a => string = state =>
|
|
|
303
303
|
let statesToString: array<'a> => string = states =>
|
|
304
304
|
states->Array.map(stateToString)->Array.joinUnsafe(", ")
|
|
305
305
|
|
|
306
|
-
let
|
|
306
|
+
let applyAction = async (
|
|
307
307
|
~comp="Projection",
|
|
308
308
|
~sources: array<changeSource>=[],
|
|
309
309
|
~onChange: option<rowChange<'state> => unit>=?,
|
|
@@ -491,6 +491,31 @@ let handleAction = async (
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
+
/** Applies one action to the store, its rows stamped with the last of its sources as their
|
|
495
|
+
`_change` ([RowChange]). Without a source the rows are written unstamped. */
|
|
496
|
+
let handleAction = (
|
|
497
|
+
~comp="Projection",
|
|
498
|
+
~sources: array<changeSource>=[],
|
|
499
|
+
~onChange: option<rowChange<'state> => unit>=?,
|
|
500
|
+
action,
|
|
501
|
+
operations,
|
|
502
|
+
subIdConfig,
|
|
503
|
+
) => {
|
|
504
|
+
let apply = () => applyAction(~comp, ~sources, ~onChange?, action, operations, subIdConfig)
|
|
505
|
+
switch sources->Array.at(-1) {
|
|
506
|
+
| Some(s) =>
|
|
507
|
+
RowChange.during(
|
|
508
|
+
{
|
|
509
|
+
flow: ?s.correlationId,
|
|
510
|
+
msgId: s.msgId,
|
|
511
|
+
at: Date.make()->Date.toISOString,
|
|
512
|
+
},
|
|
513
|
+
apply,
|
|
514
|
+
)
|
|
515
|
+
| None => apply()
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
494
519
|
let actionsWithId = action =>
|
|
495
520
|
switch action {
|
|
496
521
|
| Ignore => []
|
package/src/Projection.res.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import * as Message$ReventlessCore from "./Message.res.mjs";
|
|
|
20
20
|
import * as QueryDb$ReventlessCore from "./components/QueryDb/QueryDb.res.mjs";
|
|
21
21
|
import * as QueryDb$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/QueryDb.res.mjs";
|
|
22
22
|
import * as LogFormat$ReventlessCore from "./util/LogFormat.res.mjs";
|
|
23
|
+
import * as RowChange$ReventlessCore from "./RowChange.res.mjs";
|
|
23
24
|
|
|
24
25
|
let log = Logger$ReventlessCore.fromEnv();
|
|
25
26
|
|
|
@@ -289,7 +290,7 @@ function statesToString(states) {
|
|
|
289
290
|
return states.map(stateToString).join(", ");
|
|
290
291
|
}
|
|
291
292
|
|
|
292
|
-
async function
|
|
293
|
+
async function applyAction($staropt$star, $staropt$star$1, onChange, action, operations, subIdConfig) {
|
|
293
294
|
let saveBatch = operations.saveBatch;
|
|
294
295
|
let save = operations.save;
|
|
295
296
|
let loadStream = operations.loadStream;
|
|
@@ -512,6 +513,22 @@ async function handleAction($staropt$star, $staropt$star$1, onChange, action, op
|
|
|
512
513
|
}
|
|
513
514
|
}
|
|
514
515
|
|
|
516
|
+
function handleAction(compOpt, sourcesOpt, onChange, action, operations, subIdConfig) {
|
|
517
|
+
let comp = compOpt !== undefined ? compOpt : "Projection";
|
|
518
|
+
let sources = sourcesOpt !== undefined ? sourcesOpt : [];
|
|
519
|
+
let apply = () => applyAction(comp, sources, onChange, action, operations, subIdConfig);
|
|
520
|
+
let s = sources.at(-1);
|
|
521
|
+
if (s !== undefined) {
|
|
522
|
+
return RowChange$ReventlessCore.during({
|
|
523
|
+
flow: s.correlationId,
|
|
524
|
+
msgId: s.msgId,
|
|
525
|
+
at: new Date().toISOString()
|
|
526
|
+
}, apply);
|
|
527
|
+
} else {
|
|
528
|
+
return apply();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
515
532
|
function actionsWithId(action) {
|
|
516
533
|
if (typeof action !== "object") {
|
|
517
534
|
return [];
|
|
@@ -896,6 +913,7 @@ export {
|
|
|
896
913
|
applyChanges,
|
|
897
914
|
stateToString,
|
|
898
915
|
statesToString,
|
|
916
|
+
applyAction,
|
|
899
917
|
handleAction,
|
|
900
918
|
actionsWithId,
|
|
901
919
|
groupSourcedById,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The change a projection is writing, stamped on the rows it writes as `_change`: the flow,
|
|
2
|
+
// the event and the time. A projection runs each action `during` its change; the encoder
|
|
3
|
+
// that turns a row into JSON reads it back with `stampInto`. The value follows the call
|
|
4
|
+
// and what it awaits, so rows written at the same time each get their own.
|
|
5
|
+
|
|
6
|
+
/** The last change of a row: its flow, the event behind it, and when it was written. */
|
|
7
|
+
type t = {flow?: string, msgId: string, at: string}
|
|
8
|
+
|
|
9
|
+
/** The key a row carries it under; no state field may use it. */
|
|
10
|
+
let key = "_change"
|
|
11
|
+
|
|
12
|
+
let storage: NodeAsyncHooks.asyncLocalStorage<t> = NodeAsyncHooks.makeAsyncLocalStorage()
|
|
13
|
+
|
|
14
|
+
/** Runs `f` with `change` as the change its writes stamp. */
|
|
15
|
+
let during = (change: t, f: unit => 'a): 'a => storage->NodeAsyncHooks.run(change, f)
|
|
16
|
+
|
|
17
|
+
/** The change being written, outside a projection none. */
|
|
18
|
+
let current = (): option<t> => storage->NodeAsyncHooks.getStore
|
|
19
|
+
|
|
20
|
+
let toJson = (c: t): JSON.t =>
|
|
21
|
+
[("msgId", JSON.Encode.string(c.msgId)), ("at", JSON.Encode.string(c.at))]
|
|
22
|
+
->Array.concat(c.flow->Option.mapOr([], f => [("flow", JSON.Encode.string(f))]))
|
|
23
|
+
->Dict.fromArray
|
|
24
|
+
->JSON.Encode.object
|
|
25
|
+
|
|
26
|
+
/** Adds the current change to a row about to be stored. */
|
|
27
|
+
let stampInto = (row: dict<JSON.t>) => current()->Option.forEach(c => row->Dict.set(key, toJson(c)))
|
|
28
|
+
|
|
29
|
+
/** The same for a row as JSON; a value that is not an object is left as it is. */
|
|
30
|
+
let stamp = (row: JSON.t): JSON.t =>
|
|
31
|
+
switch (current(), row) {
|
|
32
|
+
| (Some(c), JSON.Object(d)) =>
|
|
33
|
+
let d = d->Dict.copy
|
|
34
|
+
d->Dict.set(key, toJson(c))
|
|
35
|
+
JSON.Object(d)
|
|
36
|
+
| _ => row
|
|
37
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 Nodeasync_hooks from "node:async_hooks";
|
|
5
|
+
|
|
6
|
+
let key = "_change";
|
|
7
|
+
|
|
8
|
+
let storage = new Nodeasync_hooks.AsyncLocalStorage();
|
|
9
|
+
|
|
10
|
+
function during(change, f) {
|
|
11
|
+
return storage.run(change, f);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function current() {
|
|
15
|
+
return storage.getStore();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function toJson(c) {
|
|
19
|
+
return Object.fromEntries([
|
|
20
|
+
[
|
|
21
|
+
"msgId",
|
|
22
|
+
c.msgId
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
"at",
|
|
26
|
+
c.at
|
|
27
|
+
]
|
|
28
|
+
].concat(Stdlib_Option.mapOr(c.flow, [], f => [[
|
|
29
|
+
"flow",
|
|
30
|
+
f
|
|
31
|
+
]])));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function stampInto(row) {
|
|
35
|
+
Stdlib_Option.forEach(storage.getStore(), c => {
|
|
36
|
+
row[key] = toJson(c);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function stamp(row) {
|
|
41
|
+
let match = storage.getStore();
|
|
42
|
+
if (match === undefined) {
|
|
43
|
+
return row;
|
|
44
|
+
}
|
|
45
|
+
if (typeof row !== "object" || row === null || Array.isArray(row)) {
|
|
46
|
+
return row;
|
|
47
|
+
}
|
|
48
|
+
let d = Object.assign({}, row);
|
|
49
|
+
d[key] = toJson(match);
|
|
50
|
+
return d;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
key,
|
|
55
|
+
storage,
|
|
56
|
+
during,
|
|
57
|
+
current,
|
|
58
|
+
toJson,
|
|
59
|
+
stampInto,
|
|
60
|
+
stamp,
|
|
61
|
+
}
|
|
62
|
+
/* storage Not a pure module */
|
|
@@ -29,30 +29,30 @@ function Make(RuntimeEnvironment) {
|
|
|
29
29
|
if (info !== undefined) {
|
|
30
30
|
let handler = commandGeneratorHandlers[info];
|
|
31
31
|
if (handler !== undefined) {
|
|
32
|
-
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, `found CommandGenerator handler for ` + info));
|
|
32
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, undefined, `found CommandGenerator handler for ` + info));
|
|
33
33
|
await runEffect(handler(event, context));
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
let available = Object.keys(commandGeneratorHandlers).join(",");
|
|
37
|
-
return Effect.runSync(EffectLogger$ReventlessCore.logWarn(comp, undefined, `no handler found: ` + info + ` available=[` + available + `]`));
|
|
37
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logWarn(comp, undefined, undefined, `no handler found: ` + info + ` available=[` + available + `]`));
|
|
38
38
|
}
|
|
39
39
|
await Promise.all(Object.entries(RuntimeEnvironment.groupBySource(event)).map(async param => {
|
|
40
40
|
let event = param[1];
|
|
41
41
|
let urn = param[0];
|
|
42
42
|
let handler = commandTopicHandlers[urn];
|
|
43
43
|
if (handler !== undefined) {
|
|
44
|
-
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, `found CommandTopic handler for ` + urn));
|
|
44
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, undefined, `found CommandTopic handler for ` + urn));
|
|
45
45
|
return await runEffect(handler(event, context));
|
|
46
46
|
}
|
|
47
47
|
let handlers = eventCollectorHandlers[urn];
|
|
48
48
|
if (handlers !== undefined) {
|
|
49
49
|
let count = handlers.length.toString();
|
|
50
|
-
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, `found ` + count + ` EventCollector handler(s) for ` + urn));
|
|
50
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, undefined, `found ` + count + ` EventCollector handler(s) for ` + urn));
|
|
51
51
|
await Promise.all(handlers.map(param => Runtime$ReventlessCore.runEffect(correlationId, causationId, param.comp, undefined, timestamp, retryCount, undefined, undefined, param.handler(event, context))));
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
let available = Object.keys(commandTopicHandlers).concat(Object.keys(eventCollectorHandlers)).join(",");
|
|
55
|
-
return Effect.runSync(EffectLogger$ReventlessCore.logWarn(comp, undefined, `no handler found: ` + urn + ` available=[` + available + `]`));
|
|
55
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logWarn(comp, undefined, undefined, `no handler found: ` + urn + ` available=[` + available + `]`));
|
|
56
56
|
}));
|
|
57
57
|
});
|
|
58
58
|
let getRuntimeSpec = aggregate => Stdlib_Option.getOr(runtimeSpecs[Stdlib_Option.getOr(aggregate.__name, "Unnamed")], {
|
|
@@ -38,10 +38,10 @@ function Make(RuntimeEnvironment) {
|
|
|
38
38
|
let urn = param[0];
|
|
39
39
|
let handlers = eventCollectorHandlers[urn];
|
|
40
40
|
if (handlers === undefined) {
|
|
41
|
-
return Effect.runSync(EffectLogger$ReventlessCore.logWarn(groupComp, undefined, `no handler found: ` + urn));
|
|
41
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logWarn(groupComp, undefined, undefined, `no handler found: ` + urn));
|
|
42
42
|
}
|
|
43
43
|
let count = handlers.length.toString();
|
|
44
|
-
Effect.runSync(EffectLogger$ReventlessCore.logDebug(groupComp, undefined, `found ` + count + ` handler(s) for ` + urn));
|
|
44
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug(groupComp, undefined, undefined, `found ` + count + ` handler(s) for ` + urn));
|
|
45
45
|
await Promise.all(handlers.map(param => Runtime$ReventlessCore.runEffect(correlationId, causationId, param.comp, undefined, timestamp, retryCount, undefined, undefined, param.handler(event, context))));
|
|
46
46
|
}));
|
|
47
47
|
});
|
|
@@ -7,7 +7,7 @@ import * as EffectLogger$ReventlessCore from "../util/EffectLogger.res.mjs";
|
|
|
7
7
|
import * as Platform_Admin_Structure$ReventlessCore from "./Platform_Admin_Structure.res.mjs";
|
|
8
8
|
|
|
9
9
|
function Make(Spec) {
|
|
10
|
-
let handleJsonEvents = stream => Stream.runDrain(Stream.mapEffect(stream, eventJson$p => Effect.zipRight(EffectLogger$ReventlessCore.logInfo(Platform_Admin_Structure$ReventlessCore.pluginId, undefined, `handleJsonEvents: outgoing event: ` + LogFormat$ReventlessCore.event$pJsonToLogMessage(eventJson$p)), Effect.map(Effect.all(Spec.outgoingExtensionPointJsonEventsHandlers.map(handleEvent => Effect.promise(() => handleEvent(eventJson$p, Spec.pluginDefinition))), {
|
|
10
|
+
let handleJsonEvents = stream => Stream.runDrain(Stream.mapEffect(stream, eventJson$p => Effect.zipRight(EffectLogger$ReventlessCore.logInfo(Platform_Admin_Structure$ReventlessCore.pluginId, undefined, undefined, `handleJsonEvents: outgoing event: ` + LogFormat$ReventlessCore.event$pJsonToLogMessage(eventJson$p)), Effect.map(Effect.all(Spec.outgoingExtensionPointJsonEventsHandlers.map(handleEvent => Effect.promise(() => handleEvent(eventJson$p, Spec.pluginDefinition))), {
|
|
11
11
|
concurrency: "unbounded"
|
|
12
12
|
}), param => {}))));
|
|
13
13
|
return {
|