@reventlessdev/reventless-core 3.0.0-alpha.238 → 3.0.0-alpha.240
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 +40 -0
- package/package.json +12 -12
- package/src/Message.res +11 -11
- package/src/Message.res.mjs +15 -14
- package/src/Projection.res +2 -2
- package/src/Projection.res.mjs +5 -4
- package/src/adapter/Monitoring/Monitoring.res +24 -2
- package/src/adapter/Monitoring/Monitoring.res.mjs +3 -3
- package/src/admin/Platform_AdminApi.res.mjs +3 -3
- package/src/admin/Platform_Admin_Structure.res +33 -112
- package/src/admin/Platform_Admin_Structure.res.mjs +8 -138
- package/src/admin/Platform_ComponentDefinitionsApi.res +2 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +5 -1
- package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +12 -12
- package/src/admin/UiFragmentRegistry/StateViewSlice/UiFragments.res.mjs +14 -14
- package/src/components/Aggregate/Aggregate_Callback.res +2 -2
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +4 -4
- package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +3 -3
- package/src/components/Api/ApiNoApiHelpers.res.mjs +5 -5
- package/src/components/Api/ApiTargetStateHelpers.res.mjs +3 -3
- package/src/components/Api/GraphQL_FragmentGenerator.res +140 -24
- package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +48 -21
- package/src/components/Api/GraphQL_SchemaInspector.res +1 -1
- package/src/components/Api/GraphQL_SchemaInspector.res.mjs +1 -1
- package/src/components/Api/MCP_SchemaGenerator.res +1 -1
- package/src/components/Api/MCP_SchemaGenerator.res.mjs +1 -1
- package/src/components/Api/SchemaType.res +6 -10
- package/src/components/Api/SchemaType.res.mjs +4 -4
- package/src/components/Api/StorageRefFields.res +1 -1
- package/src/components/Api/StorageRefFields.res.mjs +1 -1
- package/src/components/Api/SuryToJsonSchema.res +19 -0
- package/src/components/Api/SuryToJsonSchema.res.mjs +10 -5
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +3 -4
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +22 -23
- package/src/components/CommandTopic/CommandTopic_Callback.res +1 -2
- package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +3 -4
- package/src/components/CommandTopic/CommandTopic_Helpers.res +1 -1
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +3 -3
- package/src/components/Counter/Counter.res.mjs +2 -2
- package/src/components/Counter/Counter_Callback.res.mjs +4 -4
- package/src/components/Counter/Counter_Operations.res.mjs +4 -4
- package/src/components/Dcb/Dcb_Builder.res +1 -1
- package/src/components/Dcb/Dcb_Builder.res.mjs +8 -6
- package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +4 -3
- package/src/components/EventCollector/EventCollector_Builder.res +1 -1
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +1 -2
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +11 -12
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +3 -4
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +24 -25
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +1 -1
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +3 -3
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +2 -2
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +1 -1
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +3 -3
- package/src/plugin/api/PluginBaseFragment.res +12 -29
- package/src/plugin/api/PluginBaseFragment.res.mjs +3 -22
- package/src/plugin/component/Capability_Inference.res +118 -1
- package/src/plugin/component/Capability_Inference.res.mjs +128 -1
- package/src/plugin/component/Plugin_Builder.res +9 -2
- package/src/plugin/component/Plugin_Builder.res.mjs +5 -2
- package/src/plugin/component/Plugin_Helpers.res +11 -11
- package/src/plugin/component/Plugin_Helpers.res.mjs +11 -10
- package/src/plugin/component/Plugin_Structure.res +458 -296
- package/src/plugin/component/Plugin_Structure.res.mjs +259 -182
- package/src/plugin/component/Plugin_SubscriptionSchema.res +1 -1
- package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +1 -1
- package/src/plugin/component/SchemaWalker.res +11 -11
- package/src/plugin/component/SchemaWalker.res.mjs +8 -9
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +15 -15
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +55 -55
- package/src/plugin/lifecycle/PluginSpec.res +22 -7
- package/src/plugin/lifecycle/PluginSpec.res.mjs +91 -36
- package/src/plugin/lifecycle/PluginsReadModelSpec.res +36 -9
- package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +33 -22
- package/src/util/Interstack.res +3 -3
- package/src/util/LogFormat.res +1 -2
- package/src/util/LogFormat.res.mjs +2 -2
- package/tests/IdentityTest.res +6 -7
- package/tests/IdentityTest.res.mjs +7 -9
- package/tests/adapter/MonitoringTest.res +30 -3
- package/tests/adapter/MonitoringTest.res.mjs +31 -12
- package/tests/adapter/RuntimeExtensionHookReachTest.res +0 -1
- package/tests/adapter/RuntimeExtensionHookReachTest.res.mjs +5 -7
- package/tests/admin/Platform_Admin_StructureTest.res +254 -0
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +219 -0
- package/tests/admin/Platform_BakedManifestTest.res +1 -0
- package/tests/admin/Platform_BakedManifestTest.res.mjs +1 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +3 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +6 -0
- package/tests/admin/Platform_PluginStructuresApiTest.res +1 -0
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +2 -0
- package/tests/aggregate/AggregateCacheTest.res +0 -1
- package/tests/aggregate/AggregateCacheTest.res.mjs +13 -15
- package/tests/aggregate/AggregateConflictTest.res +0 -1
- package/tests/aggregate/AggregateConflictTest.res.mjs +7 -9
- package/tests/aggregate/AggregateFixtures.res +0 -1
- package/tests/aggregate/AggregateFixtures.res.mjs +19 -21
- package/tests/aggregate/AggregateSnapshotTest.res +1 -2
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +15 -16
- package/tests/api/ApiNoApiTest.res.mjs +17 -9
- package/tests/api/GraphQL_FragmentGeneratorTest.res +232 -0
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +207 -55
- package/tests/api/PsInternalFieldsReadModel.res +21 -0
- package/tests/api/PsInternalFieldsReadModel.res.mjs +74 -0
- package/tests/api/StorageRefFieldsTest.res.mjs +13 -13
- package/tests/api/SuryToJsonSchemaTest.res +73 -3
- package/tests/api/SuryToJsonSchemaTest.res.mjs +364 -816
- package/tests/commandgenerator/CommandGeneratorFixtures.res +0 -1
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +19 -21
- package/tests/commandgenerator/OwnerStampingTest.res +0 -1
- package/tests/commandgenerator/OwnerStampingTest.res.mjs +9 -11
- package/tests/commandtopic/CommandTopicCallbackFixtures.res +0 -1
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +7 -9
- package/tests/counter/CounterFixtures.res +0 -1
- package/tests/counter/CounterFixtures.res.mjs +1 -4
- package/tests/dcb/DcbDecodeTest.res.mjs +24 -24
- package/tests/dcb/DcbEventLogOperationsTest.res +2 -2
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +3 -3
- package/tests/dcb/DcbEventLogSchemaTest.res.mjs +7 -7
- package/tests/dcb/DcbFixtures.res +0 -1
- package/tests/dcb/DcbFixtures.res.mjs +87 -89
- package/tests/dcb/DcbTagTest.res.mjs +6 -6
- package/tests/dcb/DcbValidationTest.res.mjs +52 -52
- package/tests/eventlog/EventLogFixtures.res +0 -1
- package/tests/eventlog/EventLogFixtures.res.mjs +7 -9
- package/tests/eventmapper/EventMapperFixtures.res +0 -1
- package/tests/eventmapper/EventMapperFixtures.res.mjs +24 -26
- package/tests/eventtopic/EventTopicFixtures.res +0 -1
- package/tests/eventtopic/EventTopicFixtures.res.mjs +7 -9
- package/tests/extensionpoint/ExtensionPointFixtures.res +0 -1
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +10 -12
- package/tests/extensionpoint/ExtensionPointOperationsTest.res +1 -2
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -10
- package/tests/logger/LogFormatTest.res +3 -2
- package/tests/logger/LogFormatTest.res.mjs +7 -9
- package/tests/message/MessageTest.res +2 -2
- package/tests/message/MessageTest.res.mjs +8 -7
- package/tests/message/MetaEnvelopeTest.res +5 -5
- package/tests/message/MetaEnvelopeTest.res.mjs +12 -11
- package/tests/plugin/ManifestVisibilityTest.res.mjs +7 -7
- package/tests/plugin/PluginDefinitionScalars.res +5 -3
- package/tests/plugin/PluginDefinitionScalars.res.mjs +2 -2
- package/tests/plugin/PluginLifecycleCorpusTest.res +4 -3
- package/tests/plugin/PluginLifecycleCorpusTest.res.mjs +3 -6
- package/tests/plugin/PluginSpecExperiment.res +0 -1
- package/tests/plugin/PluginSpecExperiment.res.mjs +12 -14
- package/tests/plugin/PluginStructureTest.res +292 -2
- package/tests/plugin/PluginStructureTest.res.mjs +391 -88
- package/tests/plugin/Plugin_EventQuerySchemaTest.res.mjs +3 -3
- package/tests/plugin/SchemaWalkerTest.res +0 -1
- package/tests/plugin/SchemaWalkerTest.res.mjs +17 -19
- package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +9 -9
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +5 -5
- package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +15 -15
- package/tests/plugin/StateChangeSlice/PsTypoStore.res +31 -0
- package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +62 -0
- package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -8
- package/tests/plugin/StateChangeSlice/PsUploadImages.res +40 -0
- package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +66 -0
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +13 -12
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +8 -8
- package/tests/plugin/StateViewSlice/PsCategoriesView.res.mjs +6 -6
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +10 -10
- package/tests/plugin/StateViewSlice/PsGatedView.res.mjs +6 -6
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +9 -9
- package/tests/plugin/StateViewSlice/PsShipmentsView.res.mjs +11 -10
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +15 -0
- package/tests/querydb/QueryDbFixtures.res +0 -1
- package/tests/querydb/QueryDbFixtures.res.mjs +5 -7
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +0 -1
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +4 -6
- package/tests/util/CommandPublisherTest.res +0 -1
- package/tests/util/CommandPublisherTest.res.mjs +4 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
5
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
6
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
@@ -9,35 +9,34 @@ import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js
|
|
|
9
9
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
10
10
|
import * as DcbDecode$Reventless from "@reventlessdev/reventless-spec/src/components/DcbDecode.res.mjs";
|
|
11
11
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
12
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
12
13
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
13
14
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
S.literal("Completed"),
|
|
21
|
-
S.literal("Failed")
|
|
16
|
+
let todoStatusSchema = Sury.union([
|
|
17
|
+
Sury.literal("Pending"),
|
|
18
|
+
Sury.literal("Processing"),
|
|
19
|
+
Sury.literal("Completed"),
|
|
20
|
+
Sury.literal("Failed")
|
|
22
21
|
]);
|
|
23
22
|
|
|
24
|
-
let todoRowSchema =
|
|
25
|
-
item: s.m(
|
|
23
|
+
let todoRowSchema = Sury.$schema(s => ({
|
|
24
|
+
item: s.m(Sury.json),
|
|
26
25
|
status: s.m(todoStatusSchema),
|
|
27
|
-
createdAt: s.m(
|
|
28
|
-
processedAt: s.m(
|
|
29
|
-
completedAt: s.m(
|
|
30
|
-
retryCount: s.m(
|
|
26
|
+
createdAt: s.m(Sury.string),
|
|
27
|
+
processedAt: s.m(Sury.$option(Sury.string)),
|
|
28
|
+
completedAt: s.m(Sury.$option(Sury.string)),
|
|
29
|
+
retryCount: s.m(Sury.int)
|
|
31
30
|
}));
|
|
32
31
|
|
|
33
32
|
function todoRowSchemaFor(itemSchema) {
|
|
34
|
-
return
|
|
33
|
+
return Sury.$schema(s => ({
|
|
35
34
|
item: s.m(itemSchema),
|
|
36
35
|
status: s.m(todoStatusSchema),
|
|
37
|
-
createdAt: s.m(
|
|
38
|
-
processedAt: s.m(
|
|
39
|
-
completedAt: s.m(
|
|
40
|
-
retryCount: s.m(
|
|
36
|
+
createdAt: s.m(Sury.string),
|
|
37
|
+
processedAt: s.m(Sury.$option(Sury.string)),
|
|
38
|
+
completedAt: s.m(Sury.$option(Sury.string)),
|
|
39
|
+
retryCount: s.m(Sury.int)
|
|
41
40
|
}));
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -60,7 +59,7 @@ function Make(Spec) {
|
|
|
60
59
|
if (match !== undefined) {
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
|
-
let row_item =
|
|
62
|
+
let row_item = Util_Sury$Reventless.toJson(param[1], Spec.todoItemSchema);
|
|
64
63
|
let row_createdAt = new Date().toISOString();
|
|
65
64
|
let row = {
|
|
66
65
|
item: row_item,
|
|
@@ -115,7 +114,7 @@ function Make(Spec) {
|
|
|
115
114
|
let id = param[0];
|
|
116
115
|
let item;
|
|
117
116
|
try {
|
|
118
|
-
item = Primitive_option.some(
|
|
117
|
+
item = Primitive_option.some(Util_Sury$Reventless.fromJson(row.item, Spec.todoItemSchema));
|
|
119
118
|
} catch (raw_exn) {
|
|
120
119
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
121
120
|
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "unknown");
|
|
@@ -134,7 +133,7 @@ function Make(Spec) {
|
|
|
134
133
|
todoItems[id] = newrecord;
|
|
135
134
|
let commandJson;
|
|
136
135
|
try {
|
|
137
|
-
commandJson =
|
|
136
|
+
commandJson = Util_Sury$Reventless.toJson(match[1], Spec.commandSchema);
|
|
138
137
|
} catch (raw_exn) {
|
|
139
138
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
140
139
|
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "unknown");
|
|
@@ -198,4 +197,4 @@ export {
|
|
|
198
197
|
todoRowSchemaFor,
|
|
199
198
|
Make,
|
|
200
199
|
}
|
|
201
|
-
/*
|
|
200
|
+
/* todoStatusSchema Not a pure module */
|
|
@@ -18,8 +18,7 @@ module Make = (Spec: ReventlessInfra.CommandTopic.T, Ops: Ops with module Spec =
|
|
|
18
18
|
| command' => Some({ReventlessInfra.CommandTopic.reference, command: command'})
|
|
19
19
|
| exception err =>
|
|
20
20
|
let commandStr = json->JSON.stringify
|
|
21
|
-
let errMsg =
|
|
22
|
-
err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
21
|
+
let errMsg = err->Reventless.Util_Sury.exnMessage
|
|
23
22
|
EffectLogger.logError(
|
|
24
23
|
~comp,
|
|
25
24
|
`decode failed: ${commandStr} err=${errMsg}`,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
4
|
-
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
3
|
import * as Effect from "effect/Effect";
|
|
6
4
|
import * as Stream from "effect/Stream";
|
|
7
5
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
6
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
8
7
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
9
8
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
10
9
|
|
|
@@ -21,7 +20,7 @@ function Make(Spec) {
|
|
|
21
20
|
} catch (raw_err) {
|
|
22
21
|
let err = Primitive_exceptions.internalToException(raw_err);
|
|
23
22
|
let commandStr = JSON.stringify(json);
|
|
24
|
-
let errMsg =
|
|
23
|
+
let errMsg = Util_Sury$Reventless.exnMessage(err, undefined);
|
|
25
24
|
Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `decode failed: ` + commandStr + ` err=` + errMsg));
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
@@ -46,4 +45,4 @@ function Make(Spec) {
|
|
|
46
45
|
export {
|
|
47
46
|
Make,
|
|
48
47
|
}
|
|
49
|
-
/*
|
|
48
|
+
/* effect/Effect Not a pure module */
|
|
@@ -169,7 +169,7 @@ let encodeCommandJson = (cmdJson: Reventless.Message.commandJson): JSON.t =>
|
|
|
169
169
|
JSON.Encode.object(
|
|
170
170
|
Dict.fromArray([
|
|
171
171
|
("id", JSON.Encode.string(cmdJson.id)),
|
|
172
|
-
("meta", cmdJson.meta->
|
|
172
|
+
("meta", cmdJson.meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema)),
|
|
173
173
|
("command", cmdJson.commandJson),
|
|
174
174
|
]),
|
|
175
175
|
)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
3
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
5
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
5
|
import * as Effect from "effect/Effect";
|
|
@@ -8,6 +7,7 @@ import * as Stream from "effect/Stream";
|
|
|
8
7
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
9
8
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
10
9
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
10
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
11
11
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
12
12
|
|
|
13
13
|
let commandOutcomeHook = {
|
|
@@ -127,7 +127,7 @@ function encodeCommandJson(cmdJson) {
|
|
|
127
127
|
],
|
|
128
128
|
[
|
|
129
129
|
"meta",
|
|
130
|
-
|
|
130
|
+
Util_Sury$Reventless.toJson(cmdJson.meta, Message$Reventless.metaSchema)
|
|
131
131
|
],
|
|
132
132
|
[
|
|
133
133
|
"command",
|
|
@@ -238,4 +238,4 @@ export {
|
|
|
238
238
|
registerHandler,
|
|
239
239
|
getHandlers,
|
|
240
240
|
}
|
|
241
|
-
/*
|
|
241
|
+
/* Stdlib_JsExn Not a pure module */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
5
5
|
|
|
6
|
-
let counterEventSchema =
|
|
6
|
+
let counterEventSchema = Sury.literal("CountFinished");
|
|
7
7
|
|
|
8
8
|
let name = ComponentType$ReventlessCore.toName("Counter");
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
@@ -10,9 +10,9 @@ import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
|
10
10
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
11
11
|
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
12
12
|
|
|
13
|
-
let countsStateSchema =
|
|
14
|
-
id: s.m(
|
|
15
|
-
count: s.m(
|
|
13
|
+
let countsStateSchema = Sury.$schema(s => ({
|
|
14
|
+
id: s.m(Sury.string),
|
|
15
|
+
count: s.m(Sury.int)
|
|
16
16
|
}));
|
|
17
17
|
|
|
18
18
|
function groupByCounterId(references) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
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";
|
|
9
9
|
|
|
10
|
-
let referencesStateSchema =
|
|
11
|
-
id: s.m(
|
|
12
|
-
inc: s.m(
|
|
10
|
+
let referencesStateSchema = Sury.$schema(s => ({
|
|
11
|
+
id: s.m(Sury.string),
|
|
12
|
+
inc: s.m(Sury.int)
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
15
|
function groupCountItemsByCounterId(countItems) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
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 Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
@@ -81,8 +81,8 @@ function mergedEventSchema(schemas) {
|
|
|
81
81
|
return schemas[0];
|
|
82
82
|
}
|
|
83
83
|
let seen = new Set();
|
|
84
|
-
return
|
|
85
|
-
if (schema.type === "
|
|
84
|
+
return Sury.union(schemas.flatMap(schema => {
|
|
85
|
+
if (schema.type === "anyOf") {
|
|
86
86
|
return schema.anyOf;
|
|
87
87
|
} else {
|
|
88
88
|
return [schema];
|
|
@@ -242,10 +242,11 @@ function Make(DcbEventLogStorage) {
|
|
|
242
242
|
let DcbEventLog = DcbEventLog_Builder$ReventlessCore.Make(DcbEventLogStorage)(DcbEventTopicPublisher);
|
|
243
243
|
let dcbEventLog = DcbEventLog.make(name, indexes$1, partitionTag, effectiveCrossPartitionTagKeys, opts);
|
|
244
244
|
Stdlib_Option.forEach(HooksConfig.hooks.onDcbEventLogCreated, hook => hook(dcbEventLog));
|
|
245
|
+
let commandSchema = Sury.json;
|
|
245
246
|
let DcbCommandTopic = CommandTopic_Builder$ReventlessCore.Make({
|
|
246
247
|
Id: Id$Reventless.$$String,
|
|
247
248
|
name: childName,
|
|
248
|
-
commandSchema:
|
|
249
|
+
commandSchema: commandSchema
|
|
249
250
|
})(DcbCommandTopicChannel);
|
|
250
251
|
let dcbCommandTopic = DcbCommandTopic.make(name + `Dcb`, {
|
|
251
252
|
kind: "Plugin",
|
|
@@ -254,10 +255,11 @@ function Make(DcbEventLogStorage) {
|
|
|
254
255
|
Stdlib_Option.forEach(HooksConfig.hooks.onDcbCommandTopicCreated, hook => hook(dcbCommandTopic));
|
|
255
256
|
let publishJsons = Component$ReventlessCore.operations(dcbCommandTopic).apply(ops => ops.publishJsons);
|
|
256
257
|
let name$1 = childName + "Async";
|
|
258
|
+
let commandSchema$1 = Sury.json;
|
|
257
259
|
let DcbAsyncCommandTopic = CommandTopic_Builder$ReventlessCore.Make({
|
|
258
260
|
Id: Id$Reventless.$$String,
|
|
259
261
|
name: name$1,
|
|
260
|
-
commandSchema:
|
|
262
|
+
commandSchema: commandSchema$1
|
|
261
263
|
})(DcbCommandTopicChannelAsync);
|
|
262
264
|
let asyncDcbCommandTopicOpt;
|
|
263
265
|
if (asyncSlices.length !== 0) {
|
|
@@ -447,7 +449,7 @@ function Make(DcbEventLogStorage) {
|
|
|
447
449
|
});
|
|
448
450
|
return [
|
|
449
451
|
byTag$1,
|
|
450
|
-
make(
|
|
452
|
+
make(Sury.json)
|
|
451
453
|
];
|
|
452
454
|
});
|
|
453
455
|
let dcbHandler = Pulumi.all([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
5
|
import * as Pulumi from "@pulumi/pulumi";
|
|
6
6
|
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
@@ -13,6 +13,7 @@ import * as DcbEventLog_Operations$ReventlessCore from "./DcbEventLog_Operations
|
|
|
13
13
|
|
|
14
14
|
function Make(Storage) {
|
|
15
15
|
return EventTopicPublisher => {
|
|
16
|
+
let eventSchema = Sury.json;
|
|
16
17
|
let make = (name, indexesOpt, partitionTag, crossPartitionTagKeysOpt, opts) => {
|
|
17
18
|
let indexes = indexesOpt !== undefined ? indexesOpt : [];
|
|
18
19
|
let crossPartitionTagKeys = crossPartitionTagKeysOpt !== undefined ? crossPartitionTagKeysOpt : [];
|
|
@@ -31,7 +32,7 @@ function Make(Storage) {
|
|
|
31
32
|
let SpecificEventTopic = EventTopic_Builder$ReventlessCore.Make({
|
|
32
33
|
Id: Id$Reventless.$$String,
|
|
33
34
|
name: "DcbEventLog",
|
|
34
|
-
eventSchema:
|
|
35
|
+
eventSchema: eventSchema
|
|
35
36
|
})(EventTopicPublisher);
|
|
36
37
|
let eventTopic = SpecificEventTopic.make(extra$1, storage.resources, owner, Util_Pulumi$ReventlessCore.ComponentResourceOptions.ofCustomResourceOptions(opts));
|
|
37
38
|
Component$ReventlessCore.setOperations(extra, Pulumi.all([
|
|
@@ -71,4 +72,4 @@ function Make(Storage) {
|
|
|
71
72
|
export {
|
|
72
73
|
Make,
|
|
73
74
|
}
|
|
74
|
-
/*
|
|
75
|
+
/* sury Not a pure module */
|
|
@@ -11,7 +11,7 @@ let makeStreamHandler = (
|
|
|
11
11
|
let jsonHandler: EventCollector.jsonEventsHandler = stream =>
|
|
12
12
|
stream
|
|
13
13
|
->Stream.mapEffect(json =>
|
|
14
|
-
Effect.trySync(~catch=_exn => "decode error", () => json->S.parseOrThrow(schema))
|
|
14
|
+
Effect.trySync(~catch=_exn => "decode error", () => json->S.parseOrThrow(~to=schema))
|
|
15
15
|
)
|
|
16
16
|
->jsonEventsHandler
|
|
17
17
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
S.enableJson()
|
|
2
1
|
// InboundTranslationSlice callback — receives external input and translates to commands.
|
|
3
2
|
//
|
|
4
3
|
// Maintains an audit log QueryDb and delegates translation to Translation.translate.
|
|
@@ -113,7 +112,7 @@ module Make = (
|
|
|
113
112
|
let requestId = Uuid.v4()
|
|
114
113
|
|
|
115
114
|
// Parse the external input
|
|
116
|
-
let input = try inputJson->S.parseOrThrow(Spec.externalInputSchema)->Ok catch {
|
|
115
|
+
let input = try inputJson->S.parseOrThrow(~to=Spec.externalInputSchema)->Ok catch {
|
|
117
116
|
| exn =>
|
|
118
117
|
let msg =
|
|
119
118
|
exn
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Sury from "sury";
|
|
4
5
|
import * as Uuid from "uuid";
|
|
5
6
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
6
7
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
@@ -10,20 +11,18 @@ import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_excep
|
|
|
10
11
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
11
12
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
S.literal("Success"),
|
|
17
|
-
S.literal("Failure")
|
|
14
|
+
let auditStatusSchema = Sury.union([
|
|
15
|
+
Sury.literal("Success"),
|
|
16
|
+
Sury.literal("Failure")
|
|
18
17
|
]);
|
|
19
18
|
|
|
20
|
-
let auditRowSchema =
|
|
21
|
-
input: s.m(
|
|
19
|
+
let auditRowSchema = Sury.$schema(s => ({
|
|
20
|
+
input: s.m(Sury.string),
|
|
22
21
|
status: s.m(auditStatusSchema),
|
|
23
|
-
targetIds: s.m(
|
|
24
|
-
commandCount: s.m(
|
|
25
|
-
error: s.m(
|
|
26
|
-
receivedAt: s.m(
|
|
22
|
+
targetIds: s.m(Sury.$option(Sury.array(Sury.string))),
|
|
23
|
+
commandCount: s.m(Sury.$option(Sury.int)),
|
|
24
|
+
error: s.m(Sury.$option(Sury.string)),
|
|
25
|
+
receivedAt: s.m(Sury.string)
|
|
27
26
|
}));
|
|
28
27
|
|
|
29
28
|
function receiveResultToOutcome(result) {
|
|
@@ -236,4 +235,4 @@ export {
|
|
|
236
235
|
takeAuditRow,
|
|
237
236
|
Make,
|
|
238
237
|
}
|
|
239
|
-
/*
|
|
238
|
+
/* auditStatusSchema Not a pure module */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
S.enableJson()
|
|
2
1
|
// OutboundTranslationSlice callback — implements the tracked external call pattern.
|
|
3
2
|
//
|
|
4
3
|
// Phase 1 (collect): updates the in-memory TODO list from events (no resolve)
|
|
@@ -144,7 +143,7 @@ module Make = (
|
|
|
144
143
|
| Some(_) => () // Already exists -- skip (idempotent)
|
|
145
144
|
| None =>
|
|
146
145
|
let row: todoRow = {
|
|
147
|
-
item: item->
|
|
146
|
+
item: item->Reventless.Util_Sury.toJson(Spec.outboundItemSchema),
|
|
148
147
|
status: Pending,
|
|
149
148
|
createdAt: now(),
|
|
150
149
|
retryCount: 0,
|
|
@@ -170,7 +169,7 @@ module Make = (
|
|
|
170
169
|
let _ = await pending->Array.reduce(Promise.resolve(), async (prev, (id, row)) => {
|
|
171
170
|
let _ = await prev
|
|
172
171
|
|
|
173
|
-
let item = try row.item->
|
|
172
|
+
let item = try row.item->Reventless.Util_Sury.fromJson(Spec.outboundItemSchema)->Some catch {
|
|
174
173
|
| exn =>
|
|
175
174
|
let errMsg =
|
|
176
175
|
exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
@@ -200,7 +199,7 @@ module Make = (
|
|
|
200
199
|
| Ok(Some((targetId, cmd))) =>
|
|
201
200
|
// Encode command and publish
|
|
202
201
|
let commandJson = try cmd
|
|
203
|
-
->
|
|
202
|
+
->Reventless.Util_Sury.toJson(Spec.inboundCommandSchema)
|
|
204
203
|
->Some catch {
|
|
205
204
|
| exn =>
|
|
206
205
|
let errMsg =
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
9
9
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
10
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
10
11
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
11
12
|
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
S.literal("Completed"),
|
|
19
|
-
S.literal("Failed")
|
|
14
|
+
let todoStatusSchema = Sury.union([
|
|
15
|
+
Sury.literal("Pending"),
|
|
16
|
+
Sury.literal("Processing"),
|
|
17
|
+
Sury.literal("Completed"),
|
|
18
|
+
Sury.literal("Failed")
|
|
20
19
|
]);
|
|
21
20
|
|
|
22
|
-
let todoRowSchema =
|
|
23
|
-
item: s.m(
|
|
21
|
+
let todoRowSchema = Sury.$schema(s => ({
|
|
22
|
+
item: s.m(Sury.json),
|
|
24
23
|
status: s.m(todoStatusSchema),
|
|
25
|
-
createdAt: s.m(
|
|
26
|
-
processedAt: s.m(
|
|
27
|
-
completedAt: s.m(
|
|
28
|
-
retryCount: s.m(
|
|
29
|
-
lastError: s.m(
|
|
24
|
+
createdAt: s.m(Sury.string),
|
|
25
|
+
processedAt: s.m(Sury.$option(Sury.string)),
|
|
26
|
+
completedAt: s.m(Sury.$option(Sury.string)),
|
|
27
|
+
retryCount: s.m(Sury.int),
|
|
28
|
+
lastError: s.m(Sury.$option(Sury.string))
|
|
30
29
|
}));
|
|
31
30
|
|
|
32
31
|
function todoRowSchemaFor(itemSchema) {
|
|
33
|
-
return
|
|
32
|
+
return Sury.$schema(s => ({
|
|
34
33
|
item: s.m(itemSchema),
|
|
35
34
|
status: s.m(todoStatusSchema),
|
|
36
|
-
createdAt: s.m(
|
|
37
|
-
processedAt: s.m(
|
|
38
|
-
completedAt: s.m(
|
|
39
|
-
retryCount: s.m(
|
|
40
|
-
lastError: s.m(
|
|
35
|
+
createdAt: s.m(Sury.string),
|
|
36
|
+
processedAt: s.m(Sury.$option(Sury.string)),
|
|
37
|
+
completedAt: s.m(Sury.$option(Sury.string)),
|
|
38
|
+
retryCount: s.m(Sury.int),
|
|
39
|
+
lastError: s.m(Sury.$option(Sury.string))
|
|
41
40
|
}));
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -53,7 +52,7 @@ function Make(Spec) {
|
|
|
53
52
|
if (match !== undefined) {
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
|
-
let row_item =
|
|
55
|
+
let row_item = Util_Sury$Reventless.toJson(param[1], Spec.outboundItemSchema);
|
|
57
56
|
let row_createdAt = new Date().toISOString();
|
|
58
57
|
let row = {
|
|
59
58
|
item: row_item,
|
|
@@ -82,7 +81,7 @@ function Make(Spec) {
|
|
|
82
81
|
await prev;
|
|
83
82
|
let item;
|
|
84
83
|
try {
|
|
85
|
-
item = Primitive_option.some(
|
|
84
|
+
item = Primitive_option.some(Util_Sury$Reventless.fromJson(row.item, Spec.outboundItemSchema));
|
|
86
85
|
} catch (raw_exn) {
|
|
87
86
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
88
87
|
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "unknown");
|
|
@@ -112,7 +111,7 @@ function Make(Spec) {
|
|
|
112
111
|
if (match !== undefined) {
|
|
113
112
|
let commandJson;
|
|
114
113
|
try {
|
|
115
|
-
commandJson =
|
|
114
|
+
commandJson = Util_Sury$Reventless.toJson(match[1], Spec.inboundCommandSchema);
|
|
116
115
|
} catch (raw_exn$2) {
|
|
117
116
|
let exn$2 = Primitive_exceptions.internalToException(raw_exn$2);
|
|
118
117
|
let errMsg$1 = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn$2), Stdlib_JsExn.message), "unknown");
|
|
@@ -183,4 +182,4 @@ export {
|
|
|
183
182
|
todoRowSchemaFor,
|
|
184
183
|
Make,
|
|
185
184
|
}
|
|
186
|
-
/*
|
|
185
|
+
/* todoStatusSchema Not a pure module */
|
|
@@ -25,7 +25,7 @@ module Make = (Spec: Spec): T => {
|
|
|
25
25
|
->JSON.Decode.object
|
|
26
26
|
->Option.flatMap(eventObj' => {
|
|
27
27
|
let metaJson = eventObj'->Dict.get("meta")
|
|
28
|
-
switch metaJson->Option.map(meta => meta->
|
|
28
|
+
switch metaJson->Option.map(meta => meta->Reventless.Util_Sury.fromJson(Message.metaSchema)) {
|
|
29
29
|
| Some(eventMeta) =>
|
|
30
30
|
let entry =
|
|
31
31
|
sideEffectsWithTags->Array.find(((module(SideEffect: Reventless.SideEffect.T), _)) =>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
3
|
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
5
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
5
|
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
@@ -10,6 +9,7 @@ import * as Stream from "effect/Stream";
|
|
|
10
9
|
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
11
10
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
12
11
|
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
12
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
13
13
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
14
14
|
import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
|
|
15
15
|
import * as Util_Error$ReventlessCore from "../../util/Util_Error.res.mjs";
|
|
@@ -24,7 +24,7 @@ function Make(Spec) {
|
|
|
24
24
|
let metaJson = eventObj$p["meta"];
|
|
25
25
|
let eventMeta;
|
|
26
26
|
try {
|
|
27
|
-
eventMeta = Stdlib_Option.map(metaJson, meta =>
|
|
27
|
+
eventMeta = Stdlib_Option.map(metaJson, meta => Util_Sury$Reventless.fromJson(meta, Message$ReventlessCore.metaSchema));
|
|
28
28
|
} catch (raw_err) {
|
|
29
29
|
let err = Primitive_exceptions.internalToException(raw_err);
|
|
30
30
|
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
@@ -92,4 +92,4 @@ function Make(Spec) {
|
|
|
92
92
|
export {
|
|
93
93
|
Make,
|
|
94
94
|
}
|
|
95
|
-
/*
|
|
95
|
+
/* Effect Not a pure module */
|
|
@@ -39,7 +39,7 @@ module Make = (
|
|
|
39
39
|
// fields entirely, while the consumer side (DcbDecode) parses with the sury
|
|
40
40
|
// schema — a js_nullable option field would reject the missing key and the
|
|
41
41
|
// event would be dropped as schema drift.
|
|
42
|
-
let json = event->
|
|
42
|
+
let json = event->Reventless.Util_Sury.toJson(Spec.eventSchema)
|
|
43
43
|
let (eventType, data) = json->Message.splitMessage
|
|
44
44
|
// Use `extractTagsExpanded` (not `extractTags`) so per-element tags on
|
|
45
45
|
// `array<string>` fields are emitted — e.g. OrderPlaced's
|
|
@@ -433,7 +433,7 @@ module Make = (
|
|
|
433
433
|
| Error(error) =>
|
|
434
434
|
// Business-rule rejection — no append, but the read snapshot is valid; cache it.
|
|
435
435
|
cachePut((state, headPosition))
|
|
436
|
-
let errorJson = error->
|
|
436
|
+
let errorJson = error->Reventless.Util_Sury.toJson(Spec.errorSchema)
|
|
437
437
|
let errorCode = errorJson->Message.variantNameOfJson
|
|
438
438
|
let (_, payloadDict) = errorJson->Message.splitMessage
|
|
439
439
|
let errorDetail =
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
3
|
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
5
4
|
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
5
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
@@ -11,6 +10,7 @@ import * as Stream$1 from "effect/Stream";
|
|
|
11
10
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
12
11
|
import * as Lru$ReventlessCore from "../../util/Lru.res.mjs";
|
|
13
12
|
import * as DcbDecode$Reventless from "@reventlessdev/reventless-spec/src/components/DcbDecode.res.mjs";
|
|
13
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
14
14
|
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
15
15
|
import * as Metrics$ReventlessCore from "../../util/Metrics.res.mjs";
|
|
16
16
|
import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
|
|
@@ -186,7 +186,7 @@ function Make(Spec) {
|
|
|
186
186
|
}
|
|
187
187
|
let rawEvents = newEvents$1.map(e => {
|
|
188
188
|
let parentMeta = command$p.meta;
|
|
189
|
-
let json =
|
|
189
|
+
let json = Util_Sury$Reventless.toJson(e, Spec.eventSchema);
|
|
190
190
|
let match = Message$ReventlessCore.splitMessage(json);
|
|
191
191
|
let eventType = match[0];
|
|
192
192
|
let baseTags = DcbTag$Reventless.extractTagsExpanded(Spec.eventSchema, e);
|
|
@@ -272,7 +272,7 @@ function Make(Spec) {
|
|
|
272
272
|
state,
|
|
273
273
|
headPosition
|
|
274
274
|
]);
|
|
275
|
-
let errorJson =
|
|
275
|
+
let errorJson = Util_Sury$Reventless.toJson(newEvents._0, Spec.errorSchema);
|
|
276
276
|
let errorCode = Message$ReventlessCore.variantNameOfJson(errorJson);
|
|
277
277
|
let match = Message$ReventlessCore.splitMessage(errorJson);
|
|
278
278
|
let payloadDict = match[1];
|
|
@@ -321,4 +321,4 @@ function Make(Spec) {
|
|
|
321
321
|
export {
|
|
322
322
|
Make,
|
|
323
323
|
}
|
|
324
|
-
/*
|
|
324
|
+
/* Stream Not a pure module */
|
|
@@ -103,7 +103,7 @@ module Make = (
|
|
|
103
103
|
// fall back defensively so a malformed envelope never drops the event.
|
|
104
104
|
let meta = switch envelopeDict->Dict.get("meta") {
|
|
105
105
|
| Some(m) =>
|
|
106
|
-
switch m->
|
|
106
|
+
switch m->Reventless.Util_Sury.fromJson(Message.metaSchema) {
|
|
107
107
|
| parsed => parsed
|
|
108
108
|
| exception _ => Message.generateMeta(~service=Spec.name)
|
|
109
109
|
}
|