@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,11 +1,11 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as Plugin_EventQuerySchema$ReventlessCore from "../../src/plugin/component/Plugin_EventQuerySchema.res.mjs";
|
|
5
5
|
|
|
6
|
-
let eventSchema =
|
|
6
|
+
let eventSchema = Sury.$schema(s => ({
|
|
7
7
|
TAG: "Happened",
|
|
8
|
-
thingId: s.m(
|
|
8
|
+
thingId: s.m(Sury.string)
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
11
|
let SomeEvent = {
|
|
@@ -1,30 +1,28 @@
|
|
|
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 Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
|
|
6
6
|
import * as SchemaWalker$ReventlessCore from "../../src/plugin/component/SchemaWalker.res.mjs";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
count: s.m(S.int),
|
|
13
|
-
rating: s.m(S.option(S.float))
|
|
8
|
+
let simpleRecordSchema = Sury.$schema(s => ({
|
|
9
|
+
label: s.m(Sury.string),
|
|
10
|
+
count: s.m(Sury.int),
|
|
11
|
+
rating: s.m(Sury.$option(Sury.float))
|
|
14
12
|
}));
|
|
15
13
|
|
|
16
|
-
let simpleVariantSchema =
|
|
17
|
-
|
|
14
|
+
let simpleVariantSchema = Sury.union([
|
|
15
|
+
Sury.$schema(s => ({
|
|
18
16
|
TAG: "Added",
|
|
19
|
-
id: s.m(
|
|
20
|
-
name: s.m(
|
|
17
|
+
id: s.m(Sury.string),
|
|
18
|
+
name: s.m(Sury.string)
|
|
21
19
|
})),
|
|
22
|
-
|
|
20
|
+
Sury.$schema(s => ({
|
|
23
21
|
TAG: "Renamed",
|
|
24
|
-
id: s.m(
|
|
25
|
-
newName: s.m(
|
|
22
|
+
id: s.m(Sury.string),
|
|
23
|
+
newName: s.m(Sury.string)
|
|
26
24
|
})),
|
|
27
|
-
|
|
25
|
+
Sury.literal("Removed")
|
|
28
26
|
]);
|
|
29
27
|
|
|
30
28
|
globalThis.describe("SchemaWalker:", () => {
|
|
@@ -139,15 +137,15 @@ globalThis.describe("SchemaWalker:", () => {
|
|
|
139
137
|
});
|
|
140
138
|
globalThis.describe("scalar / unsupported schema", () => {
|
|
141
139
|
globalThis.test("plain string schema → kind unknown", () => {
|
|
142
|
-
let result = SchemaWalker$ReventlessCore.walk("Scalar",
|
|
140
|
+
let result = SchemaWalker$ReventlessCore.walk("Scalar", Sury.string);
|
|
143
141
|
globalThis.expect(result.kind).toBe("unknown");
|
|
144
142
|
});
|
|
145
143
|
globalThis.test("plain string schema → empty fields", () => {
|
|
146
|
-
let result = SchemaWalker$ReventlessCore.walk("Scalar",
|
|
144
|
+
let result = SchemaWalker$ReventlessCore.walk("Scalar", Sury.string);
|
|
147
145
|
globalThis.expect(result.fields).toEqual([]);
|
|
148
146
|
});
|
|
149
147
|
globalThis.test("plain string schema → empty structuralHash", () => {
|
|
150
|
-
let result = SchemaWalker$ReventlessCore.walk("Scalar",
|
|
148
|
+
let result = SchemaWalker$ReventlessCore.walk("Scalar", Sury.string);
|
|
151
149
|
globalThis.expect(result.structuralHash).toBe("");
|
|
152
150
|
});
|
|
153
151
|
});
|
|
@@ -157,4 +155,4 @@ export {
|
|
|
157
155
|
simpleRecordSchema,
|
|
158
156
|
simpleVariantSchema,
|
|
159
157
|
}
|
|
160
|
-
/*
|
|
158
|
+
/* simpleRecordSchema Not a pure module */
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as StorageRef$Reventless from "@reventlessdev/reventless-spec/src/semantic/StorageRef.res.mjs";
|
|
6
6
|
|
|
7
|
-
let consumedEventSchema =
|
|
7
|
+
let consumedEventSchema = Sury.literal("OrderPlaced");
|
|
8
8
|
|
|
9
9
|
function evolve(_state, _event) {
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
let commandSchema =
|
|
13
|
+
let commandSchema = Sury.$schema(s => ({
|
|
14
14
|
TAG: "AttachInvoice",
|
|
15
15
|
orderId: s.m(DcbTag$Reventless.string),
|
|
16
16
|
documentUrl: s.m(StorageRef$Reventless.forStore(undefined, "documents")),
|
|
17
17
|
logoUrl: s.m(StorageRef$Reventless.forStore("branding", "logos"))
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
let errorSchema =
|
|
20
|
+
let errorSchema = Sury.literal("OrderNotFound");
|
|
21
21
|
|
|
22
|
-
let eventSchema =
|
|
22
|
+
let eventSchema = Sury.$schema(s => ({
|
|
23
23
|
TAG: "InvoiceAttached",
|
|
24
24
|
orderId: s.m(DcbTag$Reventless.string),
|
|
25
25
|
documentUrl: s.m(StorageRef$Reventless.forStore(undefined, "documents"))
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as StorageRef$Reventless from "@reventlessdev/reventless-spec/src/semantic/StorageRef.res.mjs";
|
|
6
6
|
|
|
7
|
-
let consumedEventSchema =
|
|
7
|
+
let consumedEventSchema = Sury.literal("OrderPlaced");
|
|
8
8
|
|
|
9
9
|
function evolve(_state, _event) {
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
let commandSchema =
|
|
13
|
+
let commandSchema = Sury.$schema(s => ({
|
|
14
14
|
TAG: "ChangePhoto",
|
|
15
15
|
productId: s.m(DcbTag$Reventless.string),
|
|
16
|
-
photoUrl: s.m(
|
|
17
|
-
caption: s.m(
|
|
16
|
+
photoUrl: s.m(Sury.string),
|
|
17
|
+
caption: s.m(Sury.string)
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
let errorSchema =
|
|
20
|
+
let errorSchema = Sury.literal("ProductNotFound");
|
|
21
21
|
|
|
22
|
-
let eventSchema =
|
|
22
|
+
let eventSchema = Sury.$schema(s => ({
|
|
23
23
|
TAG: "PhotoChanged",
|
|
24
24
|
productId: s.m(DcbTag$Reventless.string),
|
|
25
|
-
photoUrl: s.m(
|
|
25
|
+
photoUrl: s.m(Sury.string),
|
|
26
26
|
thumbnail: s.m(StorageRef$Reventless.forStore(undefined, "productPhotos"))
|
|
27
27
|
}));
|
|
28
28
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
|
|
6
6
|
|
|
7
|
-
let consumedEventSchema =
|
|
7
|
+
let consumedEventSchema = Sury.$schema(s => ({
|
|
8
8
|
TAG: "ShipmentBooked",
|
|
9
9
|
shipmentId: s.m(DcbTag$Reventless.string)
|
|
10
10
|
}));
|
|
@@ -13,14 +13,14 @@ function evolve(_state, _event) {
|
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
let commandSchema =
|
|
16
|
+
let commandSchema = Sury.$schema(s => ({
|
|
17
17
|
TAG: "DispatchShipment",
|
|
18
18
|
shipmentId: s.m(DcbTag$Reventless.string)
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
|
-
let errorSchema =
|
|
21
|
+
let errorSchema = Sury.literal("ShipmentNotFound");
|
|
22
22
|
|
|
23
|
-
let eventSchema =
|
|
23
|
+
let eventSchema = Sury.$schema(s => ({
|
|
24
24
|
TAG: "ShipmentDispatched",
|
|
25
25
|
shipmentId: s.m(DcbTag$Reventless.string)
|
|
26
26
|
}));
|
|
@@ -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 DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
|
|
6
|
-
let consumedEventSchema =
|
|
6
|
+
let consumedEventSchema = Sury.$schema(s => ({
|
|
7
7
|
TAG: "StockLow",
|
|
8
8
|
productId: s.m(DcbTag$Reventless.string)
|
|
9
9
|
}));
|
|
@@ -12,25 +12,25 @@ function evolve(_state, _event) {
|
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
let commandSchema =
|
|
16
|
-
|
|
15
|
+
let commandSchema = Sury.union([
|
|
16
|
+
Sury.$schema(s => ({
|
|
17
17
|
TAG: "Restock",
|
|
18
18
|
productId: s.m(DcbTag$Reventless.string)
|
|
19
19
|
})),
|
|
20
|
-
|
|
20
|
+
Sury.$schema(s => ({
|
|
21
21
|
TAG: "RequestRestock",
|
|
22
22
|
productId: s.m(DcbTag$Reventless.string)
|
|
23
23
|
}))
|
|
24
24
|
]);
|
|
25
25
|
|
|
26
|
-
let errorSchema =
|
|
26
|
+
let errorSchema = Sury.literal("UnknownProduct");
|
|
27
27
|
|
|
28
|
-
let eventSchema =
|
|
29
|
-
|
|
28
|
+
let eventSchema = Sury.union([
|
|
29
|
+
Sury.$schema(s => ({
|
|
30
30
|
TAG: "Restocked",
|
|
31
31
|
productId: s.m(DcbTag$Reventless.string)
|
|
32
32
|
})),
|
|
33
|
-
|
|
33
|
+
Sury.$schema(s => ({
|
|
34
34
|
TAG: "RestockRequested",
|
|
35
35
|
productId: s.m(DcbTag$Reventless.string)
|
|
36
36
|
}))
|
|
@@ -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 DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
|
|
6
|
-
let consumedEventSchema =
|
|
6
|
+
let consumedEventSchema = Sury.$schema(s => ({
|
|
7
7
|
TAG: "CatalogProductSynced",
|
|
8
8
|
productId: s.m(DcbTag$Reventless.string)
|
|
9
9
|
}));
|
|
@@ -12,14 +12,14 @@ function evolve(_state, _event) {
|
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
let commandSchema =
|
|
15
|
+
let commandSchema = Sury.$schema(s => ({
|
|
16
16
|
TAG: "PlaceOrder",
|
|
17
17
|
orderId: s.m(DcbTag$Reventless.string)
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
let errorSchema =
|
|
20
|
+
let errorSchema = Sury.literal("AlreadyPlaced");
|
|
21
21
|
|
|
22
|
-
let eventSchema =
|
|
22
|
+
let eventSchema = Sury.$schema(s => ({
|
|
23
23
|
TAG: "OrderPlaced",
|
|
24
24
|
orderId: s.m(DcbTag$Reventless.string)
|
|
25
25
|
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as Reference$Reventless from "@reventlessdev/reventless-spec/src/components/Reference.res.mjs";
|
|
6
6
|
|
|
7
|
-
let consumedEventSchema =
|
|
7
|
+
let consumedEventSchema = Sury.$schema(s => ({
|
|
8
8
|
TAG: "StockReserved",
|
|
9
9
|
reservationId: s.m(DcbTag$Reventless.string)
|
|
10
10
|
}));
|
|
@@ -13,20 +13,20 @@ function evolve(_state, _event) {
|
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
let commandSchema =
|
|
16
|
+
let commandSchema = Sury.$schema(s => ({
|
|
17
17
|
TAG: "ReserveStock",
|
|
18
18
|
reservationId: s.m(DcbTag$Reventless.partition),
|
|
19
19
|
customerId: s.m(Reference$Reventless.to_(undefined, undefined, "Customers")),
|
|
20
|
-
productIds: s.m(
|
|
21
|
-
warehouseIds: s.m(
|
|
20
|
+
productIds: s.m(Sury.array(Reference$Reventless.to_(undefined, "productId", "AvailableProducts"))),
|
|
21
|
+
warehouseIds: s.m(Sury.$option(Sury.array(Reference$Reventless.to_(undefined, "warehouseId", "Warehouses"))))
|
|
22
22
|
}));
|
|
23
23
|
|
|
24
|
-
let errorSchema =
|
|
24
|
+
let errorSchema = Sury.literal("OutOfStock");
|
|
25
25
|
|
|
26
|
-
let eventSchema =
|
|
26
|
+
let eventSchema = Sury.$schema(s => ({
|
|
27
27
|
TAG: "StockReserved",
|
|
28
28
|
reservationId: s.m(DcbTag$Reventless.partition),
|
|
29
|
-
productIds: s.m(
|
|
29
|
+
productIds: s.m(Sury.array(Reference$Reventless.to_(undefined, "productId", "AvailableProducts")))
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
32
|
function decide(_state, _command) {
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
|
|
6
6
|
|
|
7
|
-
let consumedEventSchema =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
let consumedEventSchema = Sury.union([
|
|
8
|
+
Sury.literal("OrderPlaced"),
|
|
9
|
+
Sury.literal("OrderShipped"),
|
|
10
|
+
Sury.literal("OrderCancelled")
|
|
11
11
|
]);
|
|
12
12
|
|
|
13
13
|
function evolve(_state, _event) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
let commandSchema =
|
|
18
|
-
|
|
17
|
+
let commandSchema = Sury.union([
|
|
18
|
+
Sury.$schema(s => ({
|
|
19
19
|
TAG: "ShipOrder",
|
|
20
20
|
orderId: s.m(DcbTag$Reventless.string)
|
|
21
21
|
})),
|
|
22
|
-
|
|
22
|
+
Sury.literal("CancelShipment")
|
|
23
23
|
]);
|
|
24
24
|
|
|
25
|
-
let errorSchema =
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
let errorSchema = Sury.union([
|
|
26
|
+
Sury.literal("OrderNotFound"),
|
|
27
|
+
Sury.$schema(s => ({
|
|
28
28
|
TAG: "NotShippable",
|
|
29
|
-
reason: s.m(
|
|
29
|
+
reason: s.m(Sury.string)
|
|
30
30
|
}))
|
|
31
31
|
]);
|
|
32
32
|
|
|
33
|
-
let eventSchema =
|
|
34
|
-
|
|
33
|
+
let eventSchema = Sury.union([
|
|
34
|
+
Sury.$schema(s => ({
|
|
35
35
|
TAG: "OrderShipped",
|
|
36
36
|
orderId: s.m(DcbTag$Reventless.string)
|
|
37
37
|
})),
|
|
38
|
-
|
|
38
|
+
Sury.literal("ShipmentVoided")
|
|
39
39
|
]);
|
|
40
40
|
|
|
41
41
|
function decide(_state, _command) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Test fixture spec for the near-duplicate-store check.
|
|
2
|
+
//
|
|
3
|
+
// Two uploadable fields whose names differ by a transposition. Both compile,
|
|
4
|
+
// both derive a store, and both would be provisioned — which is the failure the
|
|
5
|
+
// check exists to make loud, because nothing downstream can see it.
|
|
6
|
+
|
|
7
|
+
@@reventless.spec("TypoStore")
|
|
8
|
+
|
|
9
|
+
type state = bool
|
|
10
|
+
let initialState = false
|
|
11
|
+
|
|
12
|
+
@schema
|
|
13
|
+
type consumedEvent = ProductAdded
|
|
14
|
+
|
|
15
|
+
let evolve = (_state, _event) => true
|
|
16
|
+
|
|
17
|
+
@schema
|
|
18
|
+
type command =
|
|
19
|
+
| TypoStore({
|
|
20
|
+
productId: string,
|
|
21
|
+
productImage: Reventless.UploadableImage.t,
|
|
22
|
+
productImgae: Reventless.UploadableImage.t,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
@schema
|
|
26
|
+
type error = ProductNotFound
|
|
27
|
+
|
|
28
|
+
@schema
|
|
29
|
+
type event = TypoStored({productId: string})
|
|
30
|
+
|
|
31
|
+
let decide = (_state, _command): result<array<event>, error> => Ok([])
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Sury from "sury";
|
|
4
|
+
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
+
import * as UploadableImage$Reventless from "@reventlessdev/reventless-spec/src/semantic/UploadableImage.res.mjs";
|
|
6
|
+
|
|
7
|
+
let consumedEventSchema = Sury.literal("ProductAdded");
|
|
8
|
+
|
|
9
|
+
function evolve(_state, _event) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let commandSchema = Sury.$schema(s => ({
|
|
14
|
+
TAG: "TypoStore",
|
|
15
|
+
productId: s.m(DcbTag$Reventless.string),
|
|
16
|
+
productImage: s.m(UploadableImage$Reventless.forField(undefined, "productImages")),
|
|
17
|
+
productImgae: s.m(UploadableImage$Reventless.forField(undefined, "productImgaes"))
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
let errorSchema = Sury.literal("ProductNotFound");
|
|
21
|
+
|
|
22
|
+
let eventSchema = Sury.$schema(s => ({
|
|
23
|
+
TAG: "TypoStored",
|
|
24
|
+
productId: s.m(DcbTag$Reventless.string)
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
function decide(_state, _command) {
|
|
28
|
+
return {
|
|
29
|
+
TAG: "Ok",
|
|
30
|
+
_0: []
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function commandAuthorization(param) {
|
|
35
|
+
return "AllowAuthenticated";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let name = "TypoStore";
|
|
39
|
+
|
|
40
|
+
let Id;
|
|
41
|
+
|
|
42
|
+
let initialState = false;
|
|
43
|
+
|
|
44
|
+
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs";
|
|
45
|
+
|
|
46
|
+
let readConsistency = "EscalateOnRetry";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
name,
|
|
50
|
+
Id,
|
|
51
|
+
initialState,
|
|
52
|
+
consumedEventSchema,
|
|
53
|
+
evolve,
|
|
54
|
+
commandSchema,
|
|
55
|
+
errorSchema,
|
|
56
|
+
eventSchema,
|
|
57
|
+
decide,
|
|
58
|
+
moduleUrl,
|
|
59
|
+
commandAuthorization,
|
|
60
|
+
readConsistency,
|
|
61
|
+
}
|
|
62
|
+
/* consumedEventSchema Not a pure module */
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as Reference$Reventless from "@reventlessdev/reventless-spec/src/components/Reference.res.mjs";
|
|
6
6
|
import * as StorageRef$Reventless from "@reventlessdev/reventless-spec/src/semantic/StorageRef.res.mjs";
|
|
7
7
|
|
|
8
|
-
let consumedEventSchema =
|
|
8
|
+
let consumedEventSchema = Sury.literal("OrderPlaced");
|
|
9
9
|
|
|
10
10
|
function evolve(_state, _event) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
let commandSchema =
|
|
14
|
+
let commandSchema = Sury.$schema(s => ({
|
|
15
15
|
TAG: "UploadAvatar",
|
|
16
16
|
customerId: s.m(DcbTag$Reventless.string),
|
|
17
|
-
avatarUrl: s.m(
|
|
18
|
-
referredBy: s.m(
|
|
17
|
+
avatarUrl: s.m(Sury.$option(StorageRef$Reventless.forStore(undefined, "avatars"))),
|
|
18
|
+
referredBy: s.m(Sury.$option(Reference$Reventless.to_(undefined, undefined, "Customers")))
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
|
-
let errorSchema =
|
|
21
|
+
let errorSchema = Sury.literal("CustomerNotFound");
|
|
22
22
|
|
|
23
|
-
let eventSchema =
|
|
23
|
+
let eventSchema = Sury.$schema(s => ({
|
|
24
24
|
TAG: "AvatarUploaded",
|
|
25
25
|
customerId: s.m(DcbTag$Reventless.string),
|
|
26
|
-
avatarUrl: s.m(
|
|
26
|
+
avatarUrl: s.m(Sury.$option(StorageRef$Reventless.forStore(undefined, "avatars")))
|
|
27
27
|
}));
|
|
28
28
|
|
|
29
29
|
function decide(_state, _command) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Test fixture spec for the uploadable semantic types.
|
|
2
|
+
//
|
|
3
|
+
// The store is not written anywhere: it is the field's name, pluralised. This
|
|
4
|
+
// fixture carries the four shapes the derivation has to get right — a required
|
|
5
|
+
// field, an optional one, an array (whose marker goes on the element), and an
|
|
6
|
+
// explicit `@storageRef` override that keeps the type's semantic while
|
|
7
|
+
// replacing the derived store.
|
|
8
|
+
|
|
9
|
+
@@reventless.spec("UploadImages")
|
|
10
|
+
|
|
11
|
+
type state = bool
|
|
12
|
+
let initialState = false
|
|
13
|
+
|
|
14
|
+
@schema
|
|
15
|
+
type consumedEvent = ProductAdded
|
|
16
|
+
|
|
17
|
+
let evolve = (_state, _event) => true
|
|
18
|
+
|
|
19
|
+
@schema
|
|
20
|
+
type command =
|
|
21
|
+
| UploadImages({
|
|
22
|
+
productId: string,
|
|
23
|
+
// → `productImages`
|
|
24
|
+
productImage: Reventless.UploadableImage.t,
|
|
25
|
+
// → `categoryImages`, through the optional wrapper
|
|
26
|
+
categoryImage?: Reventless.UploadableImage.t,
|
|
27
|
+
// → `datasheets`; already plural, so the derivation is idempotent
|
|
28
|
+
datasheets: array<Reventless.UploadableFile.t>,
|
|
29
|
+
// The documented override: another plugin's store, and the field keeps
|
|
30
|
+
// `uploadableImage` rather than being downgraded to a bare storage ref.
|
|
31
|
+
@storageRef("branding.logos") logo: Reventless.UploadableImage.t,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
@schema
|
|
35
|
+
type error = ProductNotFound
|
|
36
|
+
|
|
37
|
+
@schema
|
|
38
|
+
type event = ImagesUploaded({productId: string, productImage: Reventless.UploadableImage.t})
|
|
39
|
+
|
|
40
|
+
let decide = (_state, _command): result<array<event>, error> => Ok([])
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Sury from "sury";
|
|
4
|
+
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
+
import * as UploadableFile$Reventless from "@reventlessdev/reventless-spec/src/semantic/UploadableFile.res.mjs";
|
|
6
|
+
import * as UploadableImage$Reventless from "@reventlessdev/reventless-spec/src/semantic/UploadableImage.res.mjs";
|
|
7
|
+
|
|
8
|
+
let consumedEventSchema = Sury.literal("ProductAdded");
|
|
9
|
+
|
|
10
|
+
function evolve(_state, _event) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let commandSchema = Sury.$schema(s => ({
|
|
15
|
+
TAG: "UploadImages",
|
|
16
|
+
productId: s.m(DcbTag$Reventless.string),
|
|
17
|
+
productImage: s.m(UploadableImage$Reventless.forField(undefined, "productImages")),
|
|
18
|
+
categoryImage: s.m(Sury.$option(UploadableImage$Reventless.forField(undefined, "categoryImages"))),
|
|
19
|
+
datasheets: s.m(Sury.array(UploadableFile$Reventless.forField(undefined, "datasheets"))),
|
|
20
|
+
logo: s.m(UploadableImage$Reventless.forField("branding", "logos"))
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
let errorSchema = Sury.literal("ProductNotFound");
|
|
24
|
+
|
|
25
|
+
let eventSchema = Sury.$schema(s => ({
|
|
26
|
+
TAG: "ImagesUploaded",
|
|
27
|
+
productId: s.m(DcbTag$Reventless.string),
|
|
28
|
+
productImage: s.m(UploadableImage$Reventless.forField(undefined, "productImages"))
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
function decide(_state, _command) {
|
|
32
|
+
return {
|
|
33
|
+
TAG: "Ok",
|
|
34
|
+
_0: []
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function commandAuthorization(param) {
|
|
39
|
+
return "AllowAuthenticated";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let name = "UploadImages";
|
|
43
|
+
|
|
44
|
+
let Id;
|
|
45
|
+
|
|
46
|
+
let initialState = false;
|
|
47
|
+
|
|
48
|
+
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs";
|
|
49
|
+
|
|
50
|
+
let readConsistency = "EscalateOnRetry";
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
name,
|
|
54
|
+
Id,
|
|
55
|
+
initialState,
|
|
56
|
+
consumedEventSchema,
|
|
57
|
+
evolve,
|
|
58
|
+
commandSchema,
|
|
59
|
+
errorSchema,
|
|
60
|
+
eventSchema,
|
|
61
|
+
decide,
|
|
62
|
+
moduleUrl,
|
|
63
|
+
commandAuthorization,
|
|
64
|
+
readConsistency,
|
|
65
|
+
}
|
|
66
|
+
/* consumedEventSchema Not a pure module */
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Sury from "sury";
|
|
4
4
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
5
|
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
6
6
|
import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
|
|
7
7
|
|
|
8
|
-
let consumedEventSchema =
|
|
8
|
+
let consumedEventSchema = Sury.$schema(s => ({
|
|
9
9
|
TAG: "ItemRecorded",
|
|
10
10
|
itemId: s.m(DcbTag$Reventless.string),
|
|
11
11
|
ownerId: s.m(DcbTag$Reventless.string),
|
|
12
|
-
version: s.m(
|
|
13
|
-
name: s.m(
|
|
14
|
-
total: s.m(
|
|
12
|
+
version: s.m(Sury.string),
|
|
13
|
+
name: s.m(Sury.string),
|
|
14
|
+
total: s.m(Sury.float)
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
|
-
let stateSchema =
|
|
18
|
-
itemId: s.m(
|
|
19
|
-
version: s.m(
|
|
20
|
-
ownerId: s.m(
|
|
21
|
-
name: s.m(
|
|
22
|
-
total: s.m(
|
|
17
|
+
let stateSchema = Sury.$schema(s => ({
|
|
18
|
+
itemId: s.m(Sury.string),
|
|
19
|
+
version: s.m(Sury.string),
|
|
20
|
+
ownerId: s.m(Sury.string),
|
|
21
|
+
name: s.m(Sury.string),
|
|
22
|
+
total: s.m(Sury.float)
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
25
|
function project(param) {
|
|
@@ -52,7 +52,7 @@ let subIdConfig = {
|
|
|
52
52
|
|
|
53
53
|
let makeId = (state => state.itemId);
|
|
54
54
|
|
|
55
|
-
let stateSchema$1 =
|
|
55
|
+
let stateSchema$1 = Sury.$Metadata_set(stateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
56
56
|
ids: ["itemId"],
|
|
57
57
|
compositeIds: [],
|
|
58
58
|
subIds: ["version"],
|
|
@@ -63,6 +63,7 @@ let stateSchema$1 = S.Metadata.set(stateSchema, StateAnnotations$Reventless.stat
|
|
|
63
63
|
]],
|
|
64
64
|
hidden: [],
|
|
65
65
|
summary: [],
|
|
66
|
+
internal: [],
|
|
66
67
|
drillTargets: [],
|
|
67
68
|
drillTargetKeys: [],
|
|
68
69
|
collapsed: [],
|