@reventlessdev/reventless-core 3.0.0-alpha.331 → 3.0.0-alpha.332
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 +7 -0
- package/package.json +7 -7
- package/src/CommandSent.res.mjs +2 -2
- package/src/Projection.res.mjs +7 -7
- package/src/RequestContext.res.mjs +1 -1
- package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res.mjs +2 -2
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res.mjs +2 -2
- package/src/adapter/Runtime/Runtime.res.mjs +8 -7
- package/src/admin/Platform_Admin_Callback.res.mjs +4 -3
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +23 -22
- package/src/components/AutomationSlice/AutomationSlice_Builder.res.mjs +5 -4
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +1 -1
- package/src/components/CommandGenerator/CommandGenerator_Callback.res.mjs +9 -8
- package/src/components/CommandTopic/CommandTopic_Builder.res.mjs +5 -4
- package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +9 -7
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +2 -2
- package/src/components/CommandTopic/CommandTopic_Operations.res.mjs +2 -2
- package/src/components/Counter/Counter_Callback.res.mjs +4 -3
- package/src/components/Counter/Counter_Operations.res.mjs +1 -1
- package/src/components/DcbEventLog/DcbEventLog_Operations.res.mjs +5 -4
- package/src/components/EventCollector/EventCollector_Builder.res.mjs +1 -1
- package/src/components/EventLog/EventLog_Operations.res +1 -1
- package/src/components/EventLog/EventLog_Operations.res.mjs +9 -8
- package/src/components/EventMapper/EventMapper_Callback.res.mjs +11 -10
- package/src/components/EventTopic/EventTopic_Operations.res.mjs +2 -2
- package/src/components/Extension/Extension_Operations.res.mjs +2 -2
- package/src/components/ExtensionPoint/ExtensionPoint_Callback.res.mjs +3 -3
- package/src/components/ExtensionPoint/ExtensionPoint_Operations.res.mjs +2 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +1 -1
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Webhook.res.mjs +2 -2
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +5 -4
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +1 -1
- package/src/components/QueryDb/QueryDb_Operations.res.mjs +1 -1
- package/src/components/ReadModel/ReadModel_Callback.res.mjs +7 -6
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +7 -6
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res.mjs +5 -4
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +19 -18
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +9 -8
- package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +2 -2
- package/src/plugin/component/Plugin_Callback.res.mjs +5 -4
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +1 -1
- package/src/plugin/lifecycle/PluginSpec.res +8 -3
- package/src/plugin/lifecycle/PluginSpec.res.mjs +8 -4
- package/src/util/CommandPublisher.res.mjs +2 -2
- package/src/util/CsvStream.res +8 -4
- package/src/util/CsvStream.res.mjs +7 -6
- package/src/util/EffectLogger.res +26 -46
- package/src/util/EffectLogger.res.mjs +24 -21
- package/src/util/FTPHandler.res.mjs +1 -1
- package/src/util/ScheduleOps.res.mjs +2 -2
- package/src/util/ScheduleTime.res.mjs +5 -5
- package/src/util/Util_AdapterRuntime.res.mjs +2 -2
- package/src/util/Util_Promise.res.mjs +2 -2
- package/src/util/Util_QueryDbRuntime.res.mjs +2 -2
- package/src/util/Validation.res.mjs +2 -2
- package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +1 -1
- package/tests/aggregate/AggregateCacheTest.res.mjs +1 -1
- package/tests/aggregate/AggregateCallbackTest.res.mjs +1 -1
- package/tests/aggregate/AggregateCausationTest.res.mjs +1 -1
- package/tests/aggregate/AggregateConflictTest.res.mjs +1 -1
- package/tests/aggregate/AggregateRejectionTest.res.mjs +1 -1
- package/tests/aggregate/AggregateRepeatTest.res.mjs +1 -1
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +10 -11
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +1 -1
- package/tests/commandgenerator/OwnerActingTest.res.mjs +1 -1
- package/tests/commandgenerator/OwnerStampingTest.res.mjs +1 -1
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +1 -1
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +1 -1
- package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +1 -1
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +1 -1
- package/tests/counter/CounterFixtures.res.mjs +1 -1
- package/tests/dcb/DcbPiiSliceTest.res.mjs +1 -1
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +1 -1
- package/tests/eventmapper/EventMapperCallbackTest.res.mjs +1 -1
- package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +1 -1
- package/tests/logger/ComponentLineIdsTest.res.mjs +1 -1
- package/tests/logger/LogFormatTest.res.mjs +4 -3
- package/tests/logger/LoggerSinkTest.res.mjs +1 -1
- package/tests/querydb/QueryDbOperationsTest.res.mjs +2 -2
- package/tests/querydb/RowChangeTest.res.mjs +2 -2
- package/tests/querydb/TaggedUnionStampTest.res.mjs +2 -2
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +1 -1
- package/tests/util/CsvStreamTest.res.mjs +4 -4
- package/tests/util/ScheduleTimeTest.res.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.332 (2026-11-06)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **core:** a plugin lifecycle command picks its version from the other connected versions ([0d1403b](https://github.com/ReventlessDev/reventless-core/commit/0d1403b13292a22e8e469ead92cc67710de616fe))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
# 3.0.0-alpha.331 (2026-11-06)
|
|
7
14
|
|
|
8
15
|
### 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.332",
|
|
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.1.0",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
|
-
"@reventlessdev/rescript-effect": "1.0.0-alpha.
|
|
31
|
+
"@reventlessdev/rescript-effect": "1.0.0-alpha.2",
|
|
32
32
|
"@reventlessdev/rescript-fast-csv": "2.0.0-alpha.26",
|
|
33
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
33
34
|
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.15",
|
|
34
35
|
"@reventlessdev/rescript-node": "2.0.0-alpha.26",
|
|
35
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
36
|
-
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.27",
|
|
37
36
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
38
|
-
"@reventlessdev/
|
|
39
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.195",
|
|
37
|
+
"@reventlessdev/rescript-ssh2": "2.0.0-alpha.27",
|
|
40
38
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
41
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.
|
|
39
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.225",
|
|
40
|
+
"@reventlessdev/reventless-interop": "3.0.0-alpha.43",
|
|
41
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.195"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"rescript": "12.3.1",
|
package/src/CommandSent.res.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
4
|
import * as LogFormat$ReventlessCore from "./util/LogFormat.res.mjs";
|
|
5
5
|
import * as EffectLogger$ReventlessCore from "./util/EffectLogger.res.mjs";
|
|
6
6
|
|
|
@@ -19,4 +19,4 @@ export {
|
|
|
19
19
|
log,
|
|
20
20
|
announcing,
|
|
21
21
|
}
|
|
22
|
-
/*
|
|
22
|
+
/* Effect Not a pure module */
|
package/src/Projection.res.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
5
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
6
6
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
7
7
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import * as Stream
|
|
8
|
+
import * as Effect$1 from "effect/Effect";
|
|
9
|
+
import * as Stream from "effect/Stream";
|
|
10
10
|
import * as Belt_SetString from "@rescript/runtime/lib/es6/Belt_SetString.js";
|
|
11
11
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
12
12
|
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
@@ -321,17 +321,17 @@ async function applyAction($staropt$star, $staropt$star$1, onChange, action, ope
|
|
|
321
321
|
return result;
|
|
322
322
|
};
|
|
323
323
|
let logAction = makeStr => log.debugLazy(comp, () => `handling action: ` + makeStr());
|
|
324
|
-
let loadAtMost = (n, id) => Effect.runPromise(Effect.
|
|
324
|
+
let loadAtMost = (n, id) => Effect.runPromise(Effect$1.catch(Effect$1.map(Stream.runCollect(Stream.take(loadStream(id), n)), states => ({
|
|
325
325
|
TAG: "Ok",
|
|
326
326
|
_0: states
|
|
327
|
-
})), e => Effect.succeed({
|
|
327
|
+
})), e => Effect$1.succeed({
|
|
328
328
|
TAG: "Error",
|
|
329
329
|
_0: e
|
|
330
330
|
})));
|
|
331
|
-
let loadAll = id => Effect.runPromise(Effect.
|
|
331
|
+
let loadAll = id => Effect.runPromise(Effect$1.catch(Effect$1.map(Stream.runCollect(loadStream(id)), states => ({
|
|
332
332
|
TAG: "Ok",
|
|
333
333
|
_0: states
|
|
334
|
-
})), e => Effect.succeed({
|
|
334
|
+
})), e => Effect$1.succeed({
|
|
335
335
|
TAG: "Error",
|
|
336
336
|
_0: e
|
|
337
337
|
})));
|
|
@@ -4,7 +4,7 @@ import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
|
4
4
|
import * as Context from "effect/Context";
|
|
5
5
|
import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
|
|
6
6
|
|
|
7
|
-
let tag = Context.
|
|
7
|
+
let tag = Context.Service("reventless/RequestContext");
|
|
8
8
|
|
|
9
9
|
function make(correlationId, causationId, component, pluginName, timestamp, retryCount, identityOpt, claimsOpt) {
|
|
10
10
|
let identity = identityOpt !== undefined ? identityOpt : Identity$Reventless.anonymous;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
3
4
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Pulumi from "@pulumi/pulumi";
|
|
7
7
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
8
8
|
import * as Logger$ReventlessCore from "../../util/Logger.res.mjs";
|
|
@@ -190,4 +190,4 @@ function Make(RuntimeEnvironment) {
|
|
|
190
190
|
export {
|
|
191
191
|
Make,
|
|
192
192
|
}
|
|
193
|
-
/*
|
|
193
|
+
/* Effect Not a pure module */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
3
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Pulumi from "@pulumi/pulumi";
|
|
6
6
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
7
7
|
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
@@ -150,4 +150,4 @@ function Make(RuntimeEnvironment) {
|
|
|
150
150
|
export {
|
|
151
151
|
Make,
|
|
152
152
|
}
|
|
153
|
-
/*
|
|
153
|
+
/* Effect Not a pure module */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
3
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Effect$1 from "effect/Effect";
|
|
5
6
|
import * as LogPrefix$Reventless from "@reventlessdev/reventless-spec/src/LogPrefix.res.mjs";
|
|
6
7
|
import * as RequestContext$ReventlessCore from "../../RequestContext.res.mjs";
|
|
7
8
|
|
|
@@ -10,32 +11,32 @@ function annotateInvocation(effect, correlationId, causationId, comp, pluginName
|
|
|
10
11
|
let resolvedPlugin = pluginName !== undefined ? pluginName : LogPrefix$Reventless.resolvePlugin(comp, undefined);
|
|
11
12
|
let annotateOpt = (eff, key, value) => {
|
|
12
13
|
if (value !== undefined) {
|
|
13
|
-
return Effect.annotateLogs(eff, key, value);
|
|
14
|
+
return Effect$1.annotateLogs(eff, key, value);
|
|
14
15
|
} else {
|
|
15
16
|
return eff;
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
let annotateRetry = eff => {
|
|
19
20
|
if (retryCount !== undefined && retryCount > 1) {
|
|
20
|
-
return Effect.annotateLogs(eff, "retryCount", retryCount.toString());
|
|
21
|
+
return Effect$1.annotateLogs(eff, "retryCount", retryCount.toString());
|
|
21
22
|
} else {
|
|
22
23
|
return eff;
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
let withAmbientPlugin = eff => {
|
|
26
27
|
if (resolvedPlugin !== undefined) {
|
|
27
|
-
return Effect.flatMap(Effect.sync(() => {
|
|
28
|
+
return Effect$1.flatMap(Effect$1.sync(() => {
|
|
28
29
|
let before = LogPrefix$Reventless.currentPluginName.contents;
|
|
29
30
|
LogPrefix$Reventless.currentPluginName.contents = resolvedPlugin;
|
|
30
31
|
return before;
|
|
31
|
-
}), before => Effect.ensuring(eff, Effect.sync(() => {
|
|
32
|
+
}), before => Effect$1.ensuring(eff, Effect$1.sync(() => {
|
|
32
33
|
LogPrefix$Reventless.currentPluginName.contents = before;
|
|
33
34
|
})));
|
|
34
35
|
} else {
|
|
35
36
|
return eff;
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
return Effect.provideService(annotateRetry(annotateOpt(annotateOpt(Effect.annotateLogs(withAmbientPlugin(effect), "correlationId", cid), "comp", comp), "causationId", causationId)), RequestContext$ReventlessCore.tag, RequestContext$ReventlessCore.make(cid, causationId, comp, resolvedPlugin, timestamp, retryCount, identity, claims));
|
|
39
|
+
return Effect$1.provideService(annotateRetry(annotateOpt(annotateOpt(Effect$1.annotateLogs(withAmbientPlugin(effect), "correlationId", cid), "comp", comp), "causationId", causationId)), RequestContext$ReventlessCore.tag, RequestContext$ReventlessCore.make(cid, causationId, comp, resolvedPlugin, timestamp, retryCount, identity, claims));
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
function runEffect(correlationId, causationId, comp, pluginName, timestamp, retryCount, identity, claims, effect) {
|
|
@@ -70,4 +71,4 @@ export {
|
|
|
70
71
|
runEffectHandler,
|
|
71
72
|
CommandHandlerDefaults,
|
|
72
73
|
}
|
|
73
|
-
/*
|
|
74
|
+
/* Effect Not a pure module */
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
3
4
|
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Stream from "effect/Stream";
|
|
5
|
+
import * as Stream$1 from "effect/Stream";
|
|
5
6
|
import * as LogFormat$ReventlessCore from "../util/LogFormat.res.mjs";
|
|
6
7
|
import * as EffectLogger$ReventlessCore from "../util/EffectLogger.res.mjs";
|
|
7
8
|
import * as Platform_Admin_Structure$ReventlessCore from "./Platform_Admin_Structure.res.mjs";
|
|
8
9
|
|
|
9
10
|
function Make(Spec) {
|
|
10
|
-
let handleJsonEvents = stream => Stream.runDrain(Stream.mapEffect(stream, eventJson$p => Effect.
|
|
11
|
+
let handleJsonEvents = stream => Stream$1.runDrain(Stream.mapEffect(stream, eventJson$p => Effect.andThen(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
12
|
concurrency: "unbounded"
|
|
12
13
|
}), param => {}))));
|
|
13
14
|
return {
|
|
@@ -18,4 +19,4 @@ function Make(Spec) {
|
|
|
18
19
|
export {
|
|
19
20
|
Make,
|
|
20
21
|
}
|
|
21
|
-
/*
|
|
22
|
+
/* Stream Not a pure module */
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
|
+
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
3
5
|
import HashObject from "hash-object";
|
|
4
6
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
7
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
8
|
import * as Primitive_int from "@rescript/runtime/lib/es6/Primitive_int.js";
|
|
7
9
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import * as Stream from "effect/Stream";
|
|
10
|
+
import * as Effect$1 from "effect/Effect";
|
|
10
11
|
import * as Stdlib_Promise from "@rescript/runtime/lib/es6/Stdlib_Promise.js";
|
|
11
12
|
import * as Owner$Reventless from "@reventlessdev/reventless-spec/src/components/Owner.res.mjs";
|
|
12
13
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
@@ -23,7 +24,7 @@ import * as CommandTopic_Helpers$ReventlessCore from "../CommandTopic/CommandTop
|
|
|
23
24
|
function Make(Spec) {
|
|
24
25
|
return Decision => (Ops => {
|
|
25
26
|
let comp = `Aggregate(` + Spec.name + `)`;
|
|
26
|
-
let groupTopicItemsByIdStream = stream => Effect.map(Stream.runFold(stream, {}, (dict, item) => {
|
|
27
|
+
let groupTopicItemsByIdStream = stream => Effect$1.map(Stream.runFold(stream, {}, (dict, item) => {
|
|
27
28
|
let id = Spec.Id.toString(item.command.id);
|
|
28
29
|
let existing = Stdlib_Option.getOr(dict[id], []);
|
|
29
30
|
dict[id] = existing.concat([item]);
|
|
@@ -188,7 +189,7 @@ function Make(Spec) {
|
|
|
188
189
|
};
|
|
189
190
|
let coldReadState = id => {
|
|
190
191
|
let idStr = Spec.Id.toString(id);
|
|
191
|
-
let seedEffect = snapshotConfig !== undefined ? Effect.map(Effect.promise(() => Ops.eventLog.latestSnapshot(id)), snapResult => {
|
|
192
|
+
let seedEffect = snapshotConfig !== undefined ? Effect$1.map(Effect$1.promise(() => Ops.eventLog.latestSnapshot(id)), snapResult => {
|
|
192
193
|
if (snapResult.TAG === "Ok") {
|
|
193
194
|
let snap = snapResult._0;
|
|
194
195
|
if (snap === undefined) {
|
|
@@ -223,13 +224,13 @@ function Make(Spec) {
|
|
|
223
224
|
Decision.initialState,
|
|
224
225
|
0
|
|
225
226
|
];
|
|
226
|
-
}) : Effect.succeed([
|
|
227
|
+
}) : Effect$1.succeed([
|
|
227
228
|
Decision.initialState,
|
|
228
229
|
0
|
|
229
230
|
]);
|
|
230
|
-
return Effect.flatMap(seedEffect, param => {
|
|
231
|
+
return Effect$1.flatMap(seedEffect, param => {
|
|
231
232
|
let seedSeq = param[1];
|
|
232
|
-
return Effect.tap(Stream.runFold(Ops.eventLog.replayStream(id, seedSeq), [
|
|
233
|
+
return Effect$1.tap(Stream.runFold(Ops.eventLog.replayStream(id, seedSeq), [
|
|
233
234
|
param[0],
|
|
234
235
|
seedSeq,
|
|
235
236
|
[]
|
|
@@ -246,7 +247,7 @@ function Make(Spec) {
|
|
|
246
247
|
};
|
|
247
248
|
let coldReadCauses = id => {
|
|
248
249
|
let idStr = Spec.Id.toString(id);
|
|
249
|
-
return Effect.tap(Stream.runFold(Ops.eventLog.replayEnvelopes(id, 0), [
|
|
250
|
+
return Effect$1.tap(Stream.runFold(Ops.eventLog.replayEnvelopes(id, 0), [
|
|
250
251
|
Decision.initialState,
|
|
251
252
|
0,
|
|
252
253
|
[],
|
|
@@ -362,14 +363,14 @@ function Make(Spec) {
|
|
|
362
363
|
let owners = match[2];
|
|
363
364
|
let seqNr = match[1];
|
|
364
365
|
let state = match[0];
|
|
365
|
-
readState = Effect.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, batchIds(idStr, topicItemsForId), `replay skipped (cached): id=` + idStr + `, seq=` + seqNr.toString()), () => [
|
|
366
|
+
readState = Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, batchIds(idStr, topicItemsForId), `replay skipped (cached): id=` + idStr + `, seq=` + seqNr.toString()), () => [
|
|
366
367
|
state,
|
|
367
368
|
seqNr,
|
|
368
369
|
owners,
|
|
369
370
|
[]
|
|
370
371
|
]);
|
|
371
372
|
} else {
|
|
372
|
-
readState = Effect.map(coldReadState(id), param => [
|
|
373
|
+
readState = Effect$1.map(coldReadState(id), param => [
|
|
373
374
|
param[0],
|
|
374
375
|
param[1],
|
|
375
376
|
param[2],
|
|
@@ -377,7 +378,7 @@ function Make(Spec) {
|
|
|
377
378
|
]);
|
|
378
379
|
}
|
|
379
380
|
}
|
|
380
|
-
return Effect.flatMap(readState, param => {
|
|
381
|
+
return Effect$1.flatMap(readState, param => {
|
|
381
382
|
let initialOwners = param[2];
|
|
382
383
|
let sequenceNr = param[1];
|
|
383
384
|
let initialState = param[0];
|
|
@@ -414,7 +415,7 @@ function Make(Spec) {
|
|
|
414
415
|
return name + `(` + id + LogFormat$ReventlessCore.variantFields(json) + `)`;
|
|
415
416
|
}).join(", ");
|
|
416
417
|
let eventJsons = eventsToAppend.map(event$p => Message$ReventlessCore.encode(event$p.event, Spec.eventSchema));
|
|
417
|
-
return Effect.flatMap(Effect.flatMap(EffectLogger$ReventlessCore.logInfo(comp, eventJsons, batchIds(idStr, topicItemsForId), `produced ` + eventCount + ` event(s): [` + eventDetails + `]`), () => Effect.promise(() => Ops.eventLog.append(sequenceNr, id, eventsToAppend))), appendResult => {
|
|
418
|
+
return Effect$1.flatMap(Effect$1.flatMap(EffectLogger$ReventlessCore.logInfo(comp, eventJsons, batchIds(idStr, topicItemsForId), `produced ` + eventCount + ` event(s): [` + eventDetails + `]`), () => Effect$1.promise(() => Ops.eventLog.append(sequenceNr, id, eventsToAppend))), appendResult => {
|
|
418
419
|
if (appendResult.TAG === "Ok") {
|
|
419
420
|
let newSeq = sequenceNr + eventsToAppend.length | 0;
|
|
420
421
|
Lru$ReventlessCore.put(replayCache, idStr, [
|
|
@@ -424,7 +425,7 @@ function Make(Spec) {
|
|
|
424
425
|
]);
|
|
425
426
|
maybeWriteSnapshot(id, idStr, sequenceNr, newSeq, finalState);
|
|
426
427
|
let perRef = reportFinalOutcomes(outcomes, idStr, true, eventsToAppend.length, undefined);
|
|
427
|
-
return Effect.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, batchIds(idStr, topicItemsForId), `append: id=` + idStr), () => ({
|
|
428
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, batchIds(idStr, topicItemsForId), `append: id=` + idStr), () => ({
|
|
428
429
|
TAG: "Ok",
|
|
429
430
|
_0: perRef
|
|
430
431
|
}));
|
|
@@ -432,7 +433,7 @@ function Make(Spec) {
|
|
|
432
433
|
let msg = appendResult._0;
|
|
433
434
|
if (typeof msg !== "object") {
|
|
434
435
|
Lru$ReventlessCore.invalidate(replayCache, idStr);
|
|
435
|
-
return Effect.map(EffectLogger$ReventlessCore.logWarn(comp, undefined, batchIds(idStr, topicItemsForId), `conflict: id=` + idStr + `, will retry`), () => ({
|
|
436
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logWarn(comp, undefined, batchIds(idStr, topicItemsForId), `conflict: id=` + idStr + `, will retry`), () => ({
|
|
436
437
|
TAG: "Error",
|
|
437
438
|
_0: "conflict"
|
|
438
439
|
}));
|
|
@@ -440,7 +441,7 @@ function Make(Spec) {
|
|
|
440
441
|
let msg$1 = msg._0;
|
|
441
442
|
Lru$ReventlessCore.invalidate(replayCache, idStr);
|
|
442
443
|
let perRef$1 = reportFinalOutcomes(outcomes, idStr, false, 0, msg$1);
|
|
443
|
-
return Effect.map(EffectLogger$ReventlessCore.logError(comp, undefined, batchIds(idStr, topicItemsForId), `append failed: id=` + idStr + `: ` + msg$1), () => ({
|
|
444
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, batchIds(idStr, topicItemsForId), `append failed: id=` + idStr + `: ` + msg$1), () => ({
|
|
444
445
|
TAG: "Ok",
|
|
445
446
|
_0: perRef$1
|
|
446
447
|
}));
|
|
@@ -452,13 +453,13 @@ function Make(Spec) {
|
|
|
452
453
|
initialOwners
|
|
453
454
|
]);
|
|
454
455
|
let perRef = reportFinalOutcomes(outcomes, idStr, true, 0, undefined);
|
|
455
|
-
return Effect.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, batchIds(idStr, topicItemsForId), `no events produced: id=` + idStr), () => ({
|
|
456
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, batchIds(idStr, topicItemsForId), `no events produced: id=` + idStr), () => ({
|
|
456
457
|
TAG: "Ok",
|
|
457
458
|
_0: perRef
|
|
458
459
|
}));
|
|
459
460
|
});
|
|
460
461
|
};
|
|
461
|
-
let handleCommands = stream => Effect.flatMap(groupTopicItemsByIdStream(stream), groups => Effect.map(Effect.all(groups.map(param => {
|
|
462
|
+
let handleCommands = stream => Effect$1.flatMap(groupTopicItemsByIdStream(stream), groups => Effect$1.map(Effect$1.all(groups.map(param => {
|
|
462
463
|
let topicItemsForId = param[1];
|
|
463
464
|
let id = param[0];
|
|
464
465
|
let idStr = Spec.Id.toString(id);
|
|
@@ -469,16 +470,16 @@ function Make(Spec) {
|
|
|
469
470
|
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, cmdJson.commandJson, EffectLogger$ReventlessCore.idsOf(idStr, Spec.name, cmdJson.meta), `handling command ` + idxStr + `/` + count + `: ` + LogFormat$ReventlessCore.cmdDetail(cmdJson)));
|
|
470
471
|
});
|
|
471
472
|
let references = topicItemsForId.map(item => item.reference);
|
|
472
|
-
let attempt = retryCount => Effect.flatMap(replayProcessAppend(id, topicItemsForId), result => {
|
|
473
|
+
let attempt = retryCount => Effect$1.flatMap(replayProcessAppend(id, topicItemsForId), result => {
|
|
473
474
|
if (result.TAG === "Ok") {
|
|
474
|
-
return Effect.succeed(result._0);
|
|
475
|
+
return Effect$1.succeed(result._0);
|
|
475
476
|
}
|
|
476
477
|
let msg = result._0;
|
|
477
478
|
if (retryCount < 3) {
|
|
478
|
-
return Effect.flatMap(EffectLogger$ReventlessCore.logWarn(comp, undefined, batchIds(idStr, topicItemsForId), `conflict retry id=` + idStr + ` ` + (retryCount + 1 | 0).toString() + `/` + (3).toString()), () => attempt(retryCount + 1 | 0));
|
|
479
|
+
return Effect$1.flatMap(EffectLogger$ReventlessCore.logWarn(comp, undefined, batchIds(idStr, topicItemsForId), `conflict retry id=` + idStr + ` ` + (retryCount + 1 | 0).toString() + `/` + (3).toString()), () => attempt(retryCount + 1 | 0));
|
|
479
480
|
}
|
|
480
481
|
let detail = `concurrent modification (` + (3).toString() + ` retries exhausted): ` + msg;
|
|
481
|
-
return Effect.map(EffectLogger$ReventlessCore.logError(comp, undefined, batchIds(idStr, topicItemsForId), `max conflict retries exhausted id=` + idStr + `: ` + msg), () => references.map(param => ({
|
|
482
|
+
return Effect$1.map(EffectLogger$ReventlessCore.logError(comp, undefined, batchIds(idStr, topicItemsForId), `max conflict retries exhausted id=` + idStr + `: ` + msg), () => references.map(param => ({
|
|
482
483
|
TAG: "Error",
|
|
483
484
|
_0: detail
|
|
484
485
|
})));
|
|
@@ -498,4 +499,4 @@ function Make(Spec) {
|
|
|
498
499
|
export {
|
|
499
500
|
Make,
|
|
500
501
|
}
|
|
501
|
-
/*
|
|
502
|
+
/* Effect Not a pure module */
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
4
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
5
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
6
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
7
7
|
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
8
8
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Effect$1 from "effect/Effect";
|
|
10
|
+
import * as Stream from "effect/Stream";
|
|
10
11
|
import * as Pulumi from "@pulumi/pulumi";
|
|
11
12
|
import * as Belt_SetString from "@rescript/runtime/lib/es6/Belt_SetString.js";
|
|
12
13
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
@@ -130,7 +131,7 @@ function Make(RuntimeEnvironment) {
|
|
|
130
131
|
kind: "AutomationSlice",
|
|
131
132
|
name: Spec.name
|
|
132
133
|
}, opts);
|
|
133
|
-
let jsonEventsHandler = stream => Effect.flatMap(Stream.runCollect(stream), jsons => Effect.promise(async () => {
|
|
134
|
+
let jsonEventsHandler = stream => Effect$1.flatMap(Stream.runCollect(stream), jsons => Effect$1.promise(async () => {
|
|
134
135
|
await Callback.phase1(jsons, context, Capabilities.capabilities());
|
|
135
136
|
await syncToQueryDb(queryDbOps);
|
|
136
137
|
let changes = Callback.takeScheduleChanges();
|
|
@@ -214,4 +215,4 @@ function Make(RuntimeEnvironment) {
|
|
|
214
215
|
export {
|
|
215
216
|
Make,
|
|
216
217
|
}
|
|
217
|
-
/*
|
|
218
|
+
/* Effect Not a pure module */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Sury from "sury";
|
|
4
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
5
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
5
6
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
7
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
7
8
|
import * as Clock from "effect/Clock";
|
|
8
9
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
9
10
|
import * as Stdlib_Result from "@rescript/runtime/lib/es6/Stdlib_Result.js";
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Pii$Reventless from "@reventlessdev/reventless-spec/src/components/Pii.res.mjs";
|
|
12
12
|
import * as Clock$Reventless from "@reventlessdev/reventless-spec/src/components/Clock.res.mjs";
|
|
13
13
|
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
3
4
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
4
5
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
6
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
7
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Effect$1 from "effect/Effect";
|
|
8
9
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
9
10
|
import * as Owner$Reventless from "@reventlessdev/reventless-spec/src/components/Owner.res.mjs";
|
|
10
11
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
@@ -73,7 +74,7 @@ function makeGenerateCommand(publishJsons, publishJsonsAndWait, serviceName, com
|
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
|
-
return payload => Effect.flatMap(Effect.tap(Effect.sync(() => {
|
|
77
|
+
return payload => Effect$1.flatMap(Effect$1.tap(Effect$1.sync(() => {
|
|
77
78
|
let msgId = Message$ReventlessCore.uuid();
|
|
78
79
|
let scope = OwnerScope$Reventless.resolve(payload.identity, undefined);
|
|
79
80
|
let meta_time = Message$ReventlessCore.nowAsISOString();
|
|
@@ -127,7 +128,7 @@ function makeGenerateCommand(publishJsons, publishJsonsAndWait, serviceName, com
|
|
|
127
128
|
];
|
|
128
129
|
}), param => {
|
|
129
130
|
let commandJson = param[1];
|
|
130
|
-
return Effect.annotateLogs(EffectLogger$ReventlessCore.logInfo(`CommandGenerator(` + serviceName + `)`, commandJson, EffectLogger$ReventlessCore.idsOf(undefined, undefined, param[0]), `generated command: ` + LogFormat$ReventlessCore.cmdLabelOfJson(commandJson)), "via", payload.meta.info);
|
|
131
|
+
return Effect$1.annotateLogs(EffectLogger$ReventlessCore.logInfo(`CommandGenerator(` + serviceName + `)`, commandJson, EffectLogger$ReventlessCore.idsOf(undefined, undefined, param[0]), `generated command: ` + LogFormat$ReventlessCore.cmdLabelOfJson(commandJson)), "via", payload.meta.info);
|
|
131
132
|
}), param => {
|
|
132
133
|
let id = param[2];
|
|
133
134
|
let commandJson = param[1];
|
|
@@ -152,11 +153,11 @@ function makeGenerateCommand(publishJsons, publishJsonsAndWait, serviceName, com
|
|
|
152
153
|
return Plugin_ResolverError$ReventlessCore.throwCallerFault(`Error: Couldn't decode ` + JSON.stringify(commandJson) + `: ` + reason);
|
|
153
154
|
}
|
|
154
155
|
let interceptor = commandInterceptorHook.contents;
|
|
155
|
-
let interceptEffect = interceptor !== undefined ? Effect.promise(() => interceptor(payload.identity, serviceName, componentKind, payload.command, payload.arguments)) : Effect.succeed("Allow");
|
|
156
|
-
return Effect.flatMap(interceptEffect, interceptResult => {
|
|
156
|
+
let interceptEffect = interceptor !== undefined ? Effect$1.promise(() => interceptor(payload.identity, serviceName, componentKind, payload.command, payload.arguments)) : Effect$1.succeed("Allow");
|
|
157
|
+
return Effect$1.flatMap(interceptEffect, interceptResult => {
|
|
157
158
|
if (typeof interceptResult !== "object") {
|
|
158
159
|
if (publishJsonsAndWait !== undefined) {
|
|
159
|
-
return Effect.map(Effect.promise(() => publishJsonsAndWait([{
|
|
160
|
+
return Effect$1.map(Effect$1.promise(() => publishJsonsAndWait([{
|
|
160
161
|
id: id,
|
|
161
162
|
meta: meta,
|
|
162
163
|
commandJson: commandJson
|
|
@@ -176,7 +177,7 @@ function makeGenerateCommand(publishJsons, publishJsonsAndWait, serviceName, com
|
|
|
176
177
|
}
|
|
177
178
|
});
|
|
178
179
|
} else {
|
|
179
|
-
return Effect.map(Effect.promise(() => publishJsons([{
|
|
180
|
+
return Effect$1.map(Effect$1.promise(() => publishJsons([{
|
|
180
181
|
id: id,
|
|
181
182
|
meta: meta,
|
|
182
183
|
commandJson: commandJson
|
|
@@ -211,4 +212,4 @@ export {
|
|
|
211
212
|
makeGenerateCommand,
|
|
212
213
|
Make,
|
|
213
214
|
}
|
|
214
|
-
/*
|
|
215
|
+
/* Effect Not a pure module */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
3
4
|
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
4
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Effect$1 from "effect/Effect";
|
|
6
7
|
import * as Stream$1 from "effect/Stream";
|
|
7
8
|
import * as Pulumi from "@pulumi/pulumi";
|
|
8
9
|
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
@@ -35,12 +36,12 @@ function Make(Spec) {
|
|
|
35
36
|
return "";
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
|
-
let filteringHandler = stream => Effect.map(Stream.runCollect(Stream
|
|
39
|
+
let filteringHandler = stream => Effect$1.map(Stream$1.runCollect(Stream.mapEffect(stream, item => {
|
|
39
40
|
let reference = item.reference;
|
|
40
41
|
let json = item.command;
|
|
41
42
|
let typeName = extractTypeNameFromJson(json);
|
|
42
43
|
let handlers = CommandTopic$ReventlessCore.getHandlers(typeName);
|
|
43
|
-
return Effect.promise(async () => {
|
|
44
|
+
return Effect$1.promise(async () => {
|
|
44
45
|
let allResults = [];
|
|
45
46
|
await Promise.all(handlers.map(async handlerEntry => {
|
|
46
47
|
try {
|
|
@@ -123,4 +124,4 @@ function Make(Spec) {
|
|
|
123
124
|
export {
|
|
124
125
|
Make,
|
|
125
126
|
}
|
|
126
|
-
/*
|
|
127
|
+
/* Effect Not a pure module */
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Stream from "effect/Stream";
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
|
+
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
5
|
+
import * as Effect$1 from "effect/Effect";
|
|
6
|
+
import * as Stream$1 from "effect/Stream";
|
|
5
7
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
6
8
|
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
7
9
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
@@ -11,10 +13,10 @@ import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
|
11
13
|
function Make(Spec) {
|
|
12
14
|
return Ops => {
|
|
13
15
|
let comp = `CommandTopic(` + Spec.name + `)`;
|
|
14
|
-
let handleJsonCommands = stream => Ops.commandsHandler(Stream.flatMap(Stream.mapEffect(stream, param => {
|
|
16
|
+
let handleJsonCommands = stream => Ops.commandsHandler(Stream$1.flatMap(Stream.mapEffect(stream, param => {
|
|
15
17
|
let reference = param.reference;
|
|
16
18
|
let json = param.command;
|
|
17
|
-
return Effect.sync(() => {
|
|
19
|
+
return Effect$1.sync(() => {
|
|
18
20
|
let command$p;
|
|
19
21
|
try {
|
|
20
22
|
command$p = Message$ReventlessCore.decodeCommand$p(json, Spec.Id.schema, Spec.commandSchema);
|
|
@@ -32,9 +34,9 @@ function Make(Spec) {
|
|
|
32
34
|
});
|
|
33
35
|
}), opt => {
|
|
34
36
|
if (opt !== undefined) {
|
|
35
|
-
return Stream.fromIterable([opt]);
|
|
37
|
+
return Stream$1.fromIterable([opt]);
|
|
36
38
|
} else {
|
|
37
|
-
return Stream.empty;
|
|
39
|
+
return Stream$1.empty;
|
|
38
40
|
}
|
|
39
41
|
}));
|
|
40
42
|
return {
|
|
@@ -46,4 +48,4 @@ function Make(Spec) {
|
|
|
46
48
|
export {
|
|
47
49
|
Make,
|
|
48
50
|
}
|
|
49
|
-
/*
|
|
51
|
+
/* Effect Not a pure module */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
3
4
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
4
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Stream from "effect/Stream";
|
|
7
7
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
8
8
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
@@ -368,4 +368,4 @@ export {
|
|
|
368
368
|
registerHandler,
|
|
369
369
|
getHandlers,
|
|
370
370
|
}
|
|
371
|
-
/*
|
|
371
|
+
/* Effect Not a pure module */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
4
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
5
5
|
import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
|
|
6
6
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
@@ -46,4 +46,4 @@ function Make(Spec) {
|
|
|
46
46
|
export {
|
|
47
47
|
Make,
|
|
48
48
|
}
|
|
49
|
-
/*
|
|
49
|
+
/* Effect Not a pure module */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Sury from "sury";
|
|
4
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
5
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
6
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Effect$1 from "effect/Effect";
|
|
7
8
|
import * as Stream from "effect/Stream";
|
|
8
9
|
import * as Counter$ReventlessCore from "./Counter.res.mjs";
|
|
9
10
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
@@ -26,10 +27,10 @@ function groupByCounterId(references) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
function Make(Spec) {
|
|
29
|
-
let counterHandler = (references, counts) => Effect.runPromise(Effect.
|
|
30
|
+
let counterHandler = (references, counts) => Effect.runPromise(Effect$1.andThen(Effect$1.andThen(Effect$1.andThen(EffectLogger$ReventlessCore.logInfo("Counter", undefined, undefined, `counterHandler: references: ` + references.length.toString()), EffectLogger$ReventlessCore.logInfo("Counter", undefined, undefined, `counterHandler: counts: ` + Stdlib_Option.getOr(JSON.stringify(counts), "[]"))), Effect$1.map(Effect$1.all(groupByCounterId(references).map(param => {
|
|
30
31
|
let dec = param[1];
|
|
31
32
|
let counterId = param[0];
|
|
32
|
-
return Effect.promise(() => Spec.countsDbCount(counterId, "count", -dec | 0));
|
|
33
|
+
return Effect$1.promise(() => Spec.countsDbCount(counterId, "count", -dec | 0));
|
|
33
34
|
}), {
|
|
34
35
|
concurrency: "unbounded"
|
|
35
36
|
}), param => {})), Spec.jsonEventsHandler(Stream.fromIterable(Stdlib_Array.filterMap(counts, state => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Sury from "sury";
|
|
4
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
4
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
6
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
7
7
|
import * as Counter$ReventlessCore from "./Counter.res.mjs";
|
|
8
8
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|