@reventlessdev/reventless-local 3.0.0-alpha.227 → 3.0.0-alpha.229
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 +20 -0
- package/package.json +10 -10
- package/src/LocalPlatformRegistry.res +2 -2
- package/src/LocalPlatformRegistry.res.mjs +14 -13
- package/src/Platform.res +10 -10
- package/src/Platform.res.mjs +17 -16
- package/src/adapter/Auth/LocalAuth.res +3 -3
- package/src/adapter/Auth/LocalAuth.res.mjs +3 -2
- package/src/adapter/Auth/UserStore.res +1 -1
- package/src/adapter/Auth/UserStore.res.mjs +7 -6
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_GraphQL.res +1 -1
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_GraphQL.res.mjs +1 -1
- package/src/adapter/CommandTopic/LocalCommandTopicRemoteChannel.res +1 -1
- package/src/adapter/CommandTopic/LocalCommandTopicRemoteChannel.res.mjs +3 -3
- package/src/adapter/DcbEventLog/DcbEventLogStorage_Sqlite.res +2 -2
- package/src/adapter/DcbEventLog/DcbEventLogStorage_Sqlite.res.mjs +4 -4
- package/src/adapter/DomainGraphQL_Server.res +2 -2
- package/src/adapter/DomainGraphQL_Server.res.mjs +3 -3
- package/src/adapter/DomainMCP_Server.res +1 -1
- package/src/adapter/MCP_ServerInstance.res +1 -1
- package/tests/BakedManifestFilesTest.res +0 -1
- package/tests/PluginEventDecodeTest.res +3 -3
- package/tests/PluginEventDecodeTest.res.mjs +4 -4
- package/tests/ShellConfigTest.res +0 -1
- package/tests/adapter/CommandAuthorizationTest.res.mjs +7 -7
- package/tests/adapter/GraphQL_SchemaInspectorTest.res.mjs +59 -59
- package/tests/adapter/LocalAuthHttpTest.res +1 -1
- package/tests/adapter/LocalAuthHttpTest.res.mjs +2 -2
- package/tests/adapter/QueryDbListResolverTest.res.mjs +5 -5
- package/tests/components/aggregate/AggregateFixtures.res.mjs +6 -6
- package/tests/components/automationslice/AutomationSliceFixtures.res +4 -4
- package/tests/components/automationslice/AutomationSliceFixtures.res.mjs +20 -19
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res +2 -2
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res.mjs +23 -22
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res +4 -4
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res.mjs +21 -20
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res +0 -1
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res.mjs +6 -8
- package/tests/components/commandgenerator/CommandGeneratorTest.res +1 -1
- package/tests/components/commandgenerator/CommandGeneratorTest.res.mjs +2 -2
- package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +9 -9
- package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +9 -9
- package/tests/components/dcb/DcbCrossPartitionFixtures.res +3 -3
- package/tests/components/dcb/DcbCrossPartitionFixtures.res.mjs +22 -21
- package/tests/components/dcb/DcbEventLogAppendStreamTest.res +1 -1
- package/tests/components/dcb/DcbEventLogAppendStreamTest.res.mjs +2 -2
- package/tests/components/dcb/DcbFixtures.res +2 -2
- package/tests/components/dcb/DcbFixtures.res.mjs +12 -11
- package/tests/components/eventlog/EventLogFixtures.res.mjs +6 -6
- package/tests/components/eventlog/EventLogProvisioningSeamTest.res.mjs +3 -3
- package/tests/components/eventtopic/EventTopicFixtures.res.mjs +6 -6
- package/tests/components/eventtopic/EventTopicStreamFixtures.res.mjs +6 -6
- package/tests/components/extensionpoint/ExtensionPointFixtures.res +0 -1
- package/tests/components/extensionpoint/ExtensionPointFixtures.res.mjs +11 -13
- package/tests/components/extensionpoint/ExtensionPointTest.res +3 -3
- package/tests/components/extensionpoint/ExtensionPointTest.res.mjs +4 -4
- package/tests/components/inboundtranslationslice/InboundTranslationSliceCallbackTest.res.mjs +10 -10
- package/tests/components/inboundtranslationslice/InboundTranslationSliceFixtures.res.mjs +9 -9
- package/tests/components/outboundtranslationslice/OutboundTranslationSliceFixtures.res.mjs +23 -21
- package/tests/components/outboundtranslationslice/OutboundTranslationSlicePlatformFixtures.res +2 -2
- package/tests/components/outboundtranslationslice/OutboundTranslationSlicePlatformFixtures.res.mjs +17 -14
- package/tests/components/querydb/QueryDbFixtures.res.mjs +4 -4
- package/tests/components/querydb/QueryDbSubIdFixtures.res.mjs +6 -6
- package/tests/components/readmodel/DcbReadModelE2EFixtures.res +3 -3
- package/tests/components/readmodel/DcbReadModelE2EFixtures.res.mjs +17 -16
- package/tests/components/readmodel/DcbReadModelTypoFailFastTest.res.mjs +7 -7
- package/tests/components/readmodel/MixedSourceReadModelFixtures.res +5 -5
- package/tests/components/readmodel/MixedSourceReadModelFixtures.res.mjs +20 -19
- package/tests/components/readmodel/ReadModelFixtures.res +3 -3
- package/tests/components/readmodel/ReadModelFixtures.res.mjs +9 -8
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res +2 -3
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +7 -8
- package/tests/components/stateviewslice/StateViewSliceFixtures.res +2 -2
- package/tests/components/stateviewslice/StateViewSliceFixtures.res.mjs +22 -21
- package/tests/components/stateviewslice/StateViewSliceSubIdFixtures.res +2 -2
- package/tests/components/stateviewslice/StateViewSliceSubIdFixtures.res.mjs +27 -26
- package/tests/components/task/TaskFixtures.res +0 -1
- package/tests/components/task/TaskFixtures.res.mjs +0 -3
|
@@ -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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
@@ -8,6 +8,7 @@ import * as Stream from "effect/Stream";
|
|
|
8
8
|
import * as Pulumi from "@pulumi/pulumi";
|
|
9
9
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
10
10
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
11
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
11
12
|
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
12
13
|
import * as Component$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Component.res.mjs";
|
|
13
14
|
import * as AutomationSlice$Reventless from "@reventlessdev/reventless-spec/src/components/AutomationSlice.res.mjs";
|
|
@@ -22,19 +23,19 @@ let name = "Place";
|
|
|
22
23
|
|
|
23
24
|
let moduleUrl = import.meta.url;
|
|
24
25
|
|
|
25
|
-
let eventSchema =
|
|
26
|
+
let eventSchema = Sury.$schema(s => ({
|
|
26
27
|
TAG: "Placed",
|
|
27
28
|
orderId: s.m(DcbTag$Reventless.string)
|
|
28
29
|
}));
|
|
29
30
|
|
|
30
|
-
let consumedEventSchema =
|
|
31
|
+
let consumedEventSchema = Sury.literal("Placed");
|
|
31
32
|
|
|
32
|
-
let commandSchema =
|
|
33
|
+
let commandSchema = Sury.$schema(s => ({
|
|
33
34
|
TAG: "Place",
|
|
34
35
|
orderId: s.m(DcbTag$Reventless.string)
|
|
35
36
|
}));
|
|
36
37
|
|
|
37
|
-
let errorSchema =
|
|
38
|
+
let errorSchema = Sury.literal("AlreadyPlaced");
|
|
38
39
|
|
|
39
40
|
function commandAuthorization(param) {
|
|
40
41
|
return "AllowAuthenticated";
|
|
@@ -87,25 +88,25 @@ let name$1 = "Ship";
|
|
|
87
88
|
|
|
88
89
|
let moduleUrl$2 = import.meta.url;
|
|
89
90
|
|
|
90
|
-
let eventSchema$1 =
|
|
91
|
+
let eventSchema$1 = Sury.$schema(s => ({
|
|
91
92
|
TAG: "Shipped",
|
|
92
93
|
orderId: s.m(DcbTag$Reventless.string)
|
|
93
94
|
}));
|
|
94
95
|
|
|
95
|
-
let consumedEventSchema$1 =
|
|
96
|
-
|
|
96
|
+
let consumedEventSchema$1 = Sury.union([
|
|
97
|
+
Sury.$schema(s => ({
|
|
97
98
|
TAG: "Placed",
|
|
98
|
-
orderId: s.m(
|
|
99
|
+
orderId: s.m(Sury.string)
|
|
99
100
|
})),
|
|
100
|
-
|
|
101
|
+
Sury.literal("Shipped")
|
|
101
102
|
]);
|
|
102
103
|
|
|
103
|
-
let commandSchema$1 =
|
|
104
|
+
let commandSchema$1 = Sury.$schema(s => ({
|
|
104
105
|
TAG: "Ship",
|
|
105
106
|
orderId: s.m(DcbTag$Reventless.string)
|
|
106
107
|
}));
|
|
107
108
|
|
|
108
|
-
let errorSchema$1 =
|
|
109
|
+
let errorSchema$1 = Sury.literal("NotPlaced");
|
|
109
110
|
|
|
110
111
|
function commandAuthorization$1(param) {
|
|
111
112
|
return "AllowAuthenticated";
|
|
@@ -178,14 +179,14 @@ let ShipBehavior = {
|
|
|
178
179
|
|
|
179
180
|
let name$2 = "TestLogDcbEventLog";
|
|
180
181
|
|
|
181
|
-
let eventSchema$2 =
|
|
182
|
-
|
|
182
|
+
let eventSchema$2 = Sury.union([
|
|
183
|
+
Sury.$schema(s => ({
|
|
183
184
|
TAG: "Placed",
|
|
184
|
-
orderId: s.m(
|
|
185
|
+
orderId: s.m(Sury.string)
|
|
185
186
|
})),
|
|
186
|
-
|
|
187
|
+
Sury.$schema(s => ({
|
|
187
188
|
TAG: "Shipped",
|
|
188
|
-
orderId: s.m(
|
|
189
|
+
orderId: s.m(Sury.string)
|
|
189
190
|
}))
|
|
190
191
|
]);
|
|
191
192
|
|
|
@@ -199,11 +200,11 @@ let name$3 = "AutoShip";
|
|
|
199
200
|
|
|
200
201
|
let moduleUrl$4 = import.meta.url;
|
|
201
202
|
|
|
202
|
-
let todoItemSchema =
|
|
203
|
-
orderId: s.m(
|
|
203
|
+
let todoItemSchema = Sury.$schema(s => ({
|
|
204
|
+
orderId: s.m(Sury.string)
|
|
204
205
|
}));
|
|
205
206
|
|
|
206
|
-
let commandSchema$2 =
|
|
207
|
+
let commandSchema$2 = Sury.$schema(s => ({
|
|
207
208
|
TAG: "Ship",
|
|
208
209
|
orderId: s.m(DcbTag$Reventless.string)
|
|
209
210
|
}));
|
|
@@ -304,7 +305,7 @@ async function publishJsons(cmdJsons) {
|
|
|
304
305
|
],
|
|
305
306
|
[
|
|
306
307
|
"meta",
|
|
307
|
-
|
|
308
|
+
Util_Sury$Reventless.toJson(cmdJson.meta, Message$Reventless.metaSchema)
|
|
308
309
|
],
|
|
309
310
|
[
|
|
310
311
|
"command",
|
|
@@ -387,7 +388,7 @@ function placeCmdJson(orderId) {
|
|
|
387
388
|
return {
|
|
388
389
|
id: orderId,
|
|
389
390
|
meta: TestFixtures$ReventlessLocal.testMeta,
|
|
390
|
-
commandJson:
|
|
391
|
+
commandJson: Util_Sury$Reventless.toJson({
|
|
391
392
|
TAG: "Place",
|
|
392
393
|
orderId: orderId
|
|
393
394
|
}, commandSchema)
|
|
@@ -193,8 +193,8 @@ let publishAggregateEvent = async (id, event: OrderAggregateSource.event) => {
|
|
|
193
193
|
let eventJson = JSON.Encode.object(
|
|
194
194
|
Dict.fromArray([
|
|
195
195
|
("id", id->JSON.Encode.string),
|
|
196
|
-
("meta", meta->
|
|
197
|
-
("event", event->
|
|
196
|
+
("meta", meta->Reventless.Util_Sury.toJson(Message.metaSchema)),
|
|
197
|
+
("event", event->Reventless.Util_Sury.toJson(OrderAggregateSource.eventSchema)),
|
|
198
198
|
]),
|
|
199
199
|
)
|
|
200
200
|
await Bus.publishEvent(OrderAggregateSource.name, "test", meta, eventJson)
|
|
@@ -205,8 +205,8 @@ let publishDcbEvent = async (id, event: InventoryDcbSource.event) => {
|
|
|
205
205
|
let eventJson = JSON.Encode.object(
|
|
206
206
|
Dict.fromArray([
|
|
207
207
|
("id", id->JSON.Encode.string),
|
|
208
|
-
("meta", meta->
|
|
209
|
-
("event", event->
|
|
208
|
+
("meta", meta->Reventless.Util_Sury.toJson(Message.metaSchema)),
|
|
209
|
+
("event", event->Reventless.Util_Sury.toJson(InventoryDcbSource.eventSchema)),
|
|
210
210
|
]),
|
|
211
211
|
)
|
|
212
212
|
await Bus.publishEvent(InventoryDcbSource.name, "test", meta, eventJson)
|
|
@@ -1,10 +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 Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
5
|
import * as Pulumi from "@pulumi/pulumi";
|
|
6
6
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
7
7
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
8
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
8
9
|
import * as Adapter$ReventlessInfra from "@reventlessdev/reventless-infra/src/adapter/Adapter.res.mjs";
|
|
9
10
|
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
10
11
|
import * as AutomationSlice$Reventless from "@reventlessdev/reventless-spec/src/components/AutomationSlice.res.mjs";
|
|
@@ -14,10 +15,10 @@ import * as AutomationSlice_Builder$ReventlessLocal from "../../../src/component
|
|
|
14
15
|
|
|
15
16
|
let name = "OrderAggregateEventTopic";
|
|
16
17
|
|
|
17
|
-
let eventSchema =
|
|
18
|
+
let eventSchema = Sury.$schema(s => ({
|
|
18
19
|
TAG: "OrderShipped",
|
|
19
|
-
orderId: s.m(
|
|
20
|
-
productId: s.m(
|
|
20
|
+
orderId: s.m(Sury.string),
|
|
21
|
+
productId: s.m(Sury.string)
|
|
21
22
|
}));
|
|
22
23
|
|
|
23
24
|
let OrderAggregateSource = {
|
|
@@ -28,16 +29,16 @@ let OrderAggregateSource = {
|
|
|
28
29
|
|
|
29
30
|
let name$1 = "InventoryDcbEventLog";
|
|
30
31
|
|
|
31
|
-
let eventSchema$1 =
|
|
32
|
-
|
|
32
|
+
let eventSchema$1 = Sury.union([
|
|
33
|
+
Sury.$schema(s => ({
|
|
33
34
|
TAG: "StockReserved",
|
|
34
|
-
orderId: s.m(
|
|
35
|
-
productId: s.m(
|
|
35
|
+
orderId: s.m(Sury.string),
|
|
36
|
+
productId: s.m(Sury.string)
|
|
36
37
|
})),
|
|
37
|
-
|
|
38
|
+
Sury.$schema(s => ({
|
|
38
39
|
TAG: "StockReleased",
|
|
39
|
-
orderId: s.m(
|
|
40
|
-
productId: s.m(
|
|
40
|
+
orderId: s.m(Sury.string),
|
|
41
|
+
productId: s.m(Sury.string)
|
|
41
42
|
}))
|
|
42
43
|
]);
|
|
43
44
|
|
|
@@ -51,13 +52,13 @@ let name$2 = "AutoFulfill";
|
|
|
51
52
|
|
|
52
53
|
let moduleUrl = import.meta.url;
|
|
53
54
|
|
|
54
|
-
let todoItemSchema =
|
|
55
|
-
orderId: s.m(
|
|
56
|
-
productId: s.m(
|
|
57
|
-
fromAggregate: s.m(
|
|
55
|
+
let todoItemSchema = Sury.$schema(s => ({
|
|
56
|
+
orderId: s.m(Sury.string),
|
|
57
|
+
productId: s.m(Sury.string),
|
|
58
|
+
fromAggregate: s.m(Sury.bool)
|
|
58
59
|
}));
|
|
59
60
|
|
|
60
|
-
let commandSchema =
|
|
61
|
+
let commandSchema = Sury.$schema(s => ({
|
|
61
62
|
TAG: "MarkFulfilled",
|
|
62
63
|
orderId: s.m(DcbTag$Reventless.string),
|
|
63
64
|
productId: s.m(DcbTag$Reventless.string)
|
|
@@ -216,11 +217,11 @@ async function publishAggregateEvent(id, event) {
|
|
|
216
217
|
],
|
|
217
218
|
[
|
|
218
219
|
"meta",
|
|
219
|
-
|
|
220
|
+
Util_Sury$Reventless.toJson(meta, Message$Reventless.metaSchema)
|
|
220
221
|
],
|
|
221
222
|
[
|
|
222
223
|
"event",
|
|
223
|
-
|
|
224
|
+
Util_Sury$Reventless.toJson(event, eventSchema)
|
|
224
225
|
]
|
|
225
226
|
]);
|
|
226
227
|
return await Bus.publishEvent(name, "test", meta, eventJson);
|
|
@@ -235,11 +236,11 @@ async function publishDcbEvent(id, event) {
|
|
|
235
236
|
],
|
|
236
237
|
[
|
|
237
238
|
"meta",
|
|
238
|
-
|
|
239
|
+
Util_Sury$Reventless.toJson(meta, Message$Reventless.metaSchema)
|
|
239
240
|
],
|
|
240
241
|
[
|
|
241
242
|
"event",
|
|
242
|
-
|
|
243
|
+
Util_Sury$Reventless.toJson(event, eventSchema$1)
|
|
243
244
|
]
|
|
244
245
|
]);
|
|
245
246
|
return await Bus.publishEvent(name$1, "test", meta, eventJson);
|
|
@@ -1,28 +1,26 @@
|
|
|
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 TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
6
6
|
import * as CommandGenerator_Builder$ReventlessCore from "@reventlessdev/reventless-core/src/components/CommandGenerator/CommandGenerator_Builder.res.mjs";
|
|
7
7
|
import * as LocalCommandGeneratorResolvers$ReventlessLocal from "../../../src/adapter/CommandGenerator/LocalCommandGeneratorResolvers.res.mjs";
|
|
8
8
|
|
|
9
|
-
S.enableJson();
|
|
10
|
-
|
|
11
9
|
TestRunner$ReventlessLocal.setup();
|
|
12
10
|
|
|
13
11
|
let name = "TestCGAggregate";
|
|
14
12
|
|
|
15
|
-
let commandSchema =
|
|
13
|
+
let commandSchema = Sury.$schema(s => ({
|
|
16
14
|
TAG: "CreateCGItem",
|
|
17
|
-
name: s.m(
|
|
15
|
+
name: s.m(Sury.string)
|
|
18
16
|
}));
|
|
19
17
|
|
|
20
|
-
let eventSchema =
|
|
18
|
+
let eventSchema = Sury.$schema(s => ({
|
|
21
19
|
TAG: "CGItemCreated",
|
|
22
|
-
name: s.m(
|
|
20
|
+
name: s.m(Sury.string)
|
|
23
21
|
}));
|
|
24
22
|
|
|
25
|
-
let errorSchema =
|
|
23
|
+
let errorSchema = Sury.literal("CGAlreadyExists");
|
|
26
24
|
|
|
27
25
|
let moduleUrl = import.meta.url;
|
|
28
26
|
|
|
@@ -30,7 +30,7 @@ describe("CommandGenerator_Builder.Make:", () => {
|
|
|
30
30
|
expect(cmd.id)->toBe("item-1")
|
|
31
31
|
|
|
32
32
|
// commandJson should decode to CreateCGItem({name: "widget"})
|
|
33
|
-
let decoded = cmd.commandJson->
|
|
33
|
+
let decoded = cmd.commandJson->Reventless.Util_Sury.fromJson(CGSpec.commandSchema)
|
|
34
34
|
expect(decoded)->toEqual(CGSpec.CreateCGItem({name: "widget"}))
|
|
35
35
|
})
|
|
36
36
|
|
|
@@ -1,8 +1,8 @@
|
|
|
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 "effect/Effect";
|
|
5
4
|
import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
|
|
5
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
6
6
|
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
7
7
|
import * as CommandGeneratorFixtures$ReventlessLocal from "./CommandGeneratorFixtures.res.mjs";
|
|
8
8
|
|
|
@@ -30,7 +30,7 @@ globalThis.describe("CommandGenerator_Builder.Make:", () => {
|
|
|
30
30
|
globalThis.expect(CommandGeneratorFixtures$ReventlessLocal.capturedCmds.contents.length).toBe(1);
|
|
31
31
|
let cmd = CommandGeneratorFixtures$ReventlessLocal.capturedCmds.contents[0];
|
|
32
32
|
globalThis.expect(cmd.id).toBe("item-1");
|
|
33
|
-
let decoded =
|
|
33
|
+
let decoded = Util_Sury$Reventless.fromJson(cmd.commandJson, CommandGeneratorFixtures$ReventlessLocal.CGSpec.commandSchema);
|
|
34
34
|
globalThis.expect(decoded).toEqual({
|
|
35
35
|
TAG: "CreateCGItem",
|
|
36
36
|
name: "widget"
|
|
@@ -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 LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
6
6
|
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
@@ -9,23 +9,23 @@ import * as LocalCommandTopicChannel$ReventlessLocal from "../../../src/adapter/
|
|
|
9
9
|
|
|
10
10
|
let name = "TestCommandTopicItem";
|
|
11
11
|
|
|
12
|
-
let commandSchema =
|
|
13
|
-
|
|
12
|
+
let commandSchema = Sury.union([
|
|
13
|
+
Sury.$schema(s => ({
|
|
14
14
|
TAG: "CreateItem",
|
|
15
|
-
name: s.m(
|
|
15
|
+
name: s.m(Sury.string)
|
|
16
16
|
})),
|
|
17
|
-
|
|
17
|
+
Sury.$schema(s => ({
|
|
18
18
|
TAG: "DeleteItem",
|
|
19
|
-
id: s.m(
|
|
19
|
+
id: s.m(Sury.string)
|
|
20
20
|
}))
|
|
21
21
|
]);
|
|
22
22
|
|
|
23
|
-
let eventSchema =
|
|
23
|
+
let eventSchema = Sury.$schema(s => ({
|
|
24
24
|
TAG: "ItemCreated",
|
|
25
|
-
name: s.m(
|
|
25
|
+
name: s.m(Sury.string)
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
|
-
let errorSchema =
|
|
28
|
+
let errorSchema = Sury.literal("AlreadyExists");
|
|
29
29
|
|
|
30
30
|
let moduleUrl = import.meta.url;
|
|
31
31
|
|
|
@@ -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 Message$ReventlessCore from "@reventlessdev/reventless-core/src/Message.res.mjs";
|
|
6
6
|
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
@@ -11,23 +11,23 @@ import * as LocalCommandTopicChannel$ReventlessLocal from "../../../src/adapter/
|
|
|
11
11
|
|
|
12
12
|
let name = "StreamCmdItem";
|
|
13
13
|
|
|
14
|
-
let commandSchema =
|
|
15
|
-
|
|
14
|
+
let commandSchema = Sury.union([
|
|
15
|
+
Sury.$schema(s => ({
|
|
16
16
|
TAG: "CreateItem",
|
|
17
|
-
name: s.m(
|
|
17
|
+
name: s.m(Sury.string)
|
|
18
18
|
})),
|
|
19
|
-
|
|
19
|
+
Sury.$schema(s => ({
|
|
20
20
|
TAG: "DeleteItem",
|
|
21
|
-
id: s.m(
|
|
21
|
+
id: s.m(Sury.string)
|
|
22
22
|
}))
|
|
23
23
|
]);
|
|
24
24
|
|
|
25
|
-
let eventSchema =
|
|
25
|
+
let eventSchema = Sury.$schema(s => ({
|
|
26
26
|
TAG: "ItemCreated",
|
|
27
|
-
name: s.m(
|
|
27
|
+
name: s.m(Sury.string)
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
|
-
let errorSchema =
|
|
30
|
+
let errorSchema = Sury.literal("AlreadyExists");
|
|
31
31
|
|
|
32
32
|
let moduleUrl = import.meta.url;
|
|
33
33
|
|
|
@@ -125,7 +125,7 @@ let publishJsons: ReventlessInfra.CommandTopic.publishJsons = async cmdJsons =>
|
|
|
125
125
|
let fullBody = JSON.Encode.object(
|
|
126
126
|
Dict.fromArray([
|
|
127
127
|
("id", JSON.Encode.string(cmdJson.id)),
|
|
128
|
-
("meta", cmdJson.meta->
|
|
128
|
+
("meta", cmdJson.meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema)),
|
|
129
129
|
("command", cmdJson.commandJson),
|
|
130
130
|
]),
|
|
131
131
|
)
|
|
@@ -157,7 +157,7 @@ let dispatch = async (commandJson, id) =>
|
|
|
157
157
|
await publishJsons([{Reventless.Message.id, meta: testMeta, commandJson}])
|
|
158
158
|
|
|
159
159
|
let encodeEvent = (event: CatalogLog.event): ReventlessInfra.DcbEventLog.rawEvent => {
|
|
160
|
-
let json = event->
|
|
160
|
+
let json = event->Reventless.Util_Sury.toJson(CatalogLog.eventSchema)
|
|
161
161
|
let (eventType, data) = json->ReventlessCore.Message.splitMessage
|
|
162
162
|
let tags = Reventless.DcbTag.extractTags(CatalogLog.eventSchema, event)
|
|
163
163
|
let meta = ReventlessCore.Message.generateMeta(~service="test")
|
|
@@ -165,6 +165,6 @@ let encodeEvent = (event: CatalogLog.event): ReventlessInfra.DcbEventLog.rawEven
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
let addProductJson = (productId, categoryId, name) =>
|
|
168
|
-
AddProductSpec.AddProduct({productId, categoryId, name})->
|
|
168
|
+
AddProductSpec.AddProduct({productId, categoryId, name})->Reventless.Util_Sury.toJson(
|
|
169
169
|
AddProductSpec.commandSchema,
|
|
170
170
|
)
|
|
@@ -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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
@@ -8,6 +8,7 @@ import * as Stream from "effect/Stream";
|
|
|
8
8
|
import * as Pulumi from "@pulumi/pulumi";
|
|
9
9
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
10
10
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
11
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
11
12
|
import * as Message$ReventlessCore from "@reventlessdev/reventless-core/src/Message.res.mjs";
|
|
12
13
|
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
13
14
|
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
@@ -16,17 +17,17 @@ import * as TestFixtures$ReventlessLocal from "../../TestFixtures.res.mjs";
|
|
|
16
17
|
import * as DcbEventLog_Builder$ReventlessLocal from "../../../src/components/DcbEventLog_Builder.res.mjs";
|
|
17
18
|
import * as StateChangeSlice_Builder$ReventlessLocal from "../../../src/components/StateChangeSlice_Builder.res.mjs";
|
|
18
19
|
|
|
19
|
-
let eventSchema =
|
|
20
|
-
|
|
20
|
+
let eventSchema = Sury.union([
|
|
21
|
+
Sury.$schema(s => ({
|
|
21
22
|
TAG: "ProductAdded",
|
|
22
23
|
productId: s.m(DcbTag$Reventless.partition),
|
|
23
24
|
categoryId: s.m(DcbTag$Reventless.string),
|
|
24
|
-
name: s.m(
|
|
25
|
+
name: s.m(Sury.string)
|
|
25
26
|
})),
|
|
26
|
-
|
|
27
|
+
Sury.$schema(s => ({
|
|
27
28
|
TAG: "CategoryAdded",
|
|
28
29
|
categoryId: s.m(DcbTag$Reventless.string),
|
|
29
|
-
name: s.m(
|
|
30
|
+
name: s.m(Sury.string)
|
|
30
31
|
}))
|
|
31
32
|
]);
|
|
32
33
|
|
|
@@ -38,34 +39,34 @@ let name = "AddProduct";
|
|
|
38
39
|
|
|
39
40
|
let moduleUrl = import.meta.url;
|
|
40
41
|
|
|
41
|
-
let eventSchema$1 =
|
|
42
|
+
let eventSchema$1 = Sury.$schema(s => ({
|
|
42
43
|
TAG: "ProductAdded",
|
|
43
44
|
productId: s.m(DcbTag$Reventless.partition),
|
|
44
45
|
categoryId: s.m(DcbTag$Reventless.string),
|
|
45
|
-
name: s.m(
|
|
46
|
+
name: s.m(Sury.string)
|
|
46
47
|
}));
|
|
47
48
|
|
|
48
|
-
let consumedEventSchema =
|
|
49
|
-
|
|
49
|
+
let consumedEventSchema = Sury.union([
|
|
50
|
+
Sury.$schema(s => ({
|
|
50
51
|
TAG: "ProductAdded",
|
|
51
|
-
productId: s.m(
|
|
52
|
+
productId: s.m(Sury.string)
|
|
52
53
|
})),
|
|
53
|
-
|
|
54
|
+
Sury.$schema(s => ({
|
|
54
55
|
TAG: "CategoryAdded",
|
|
55
|
-
categoryId: s.m(
|
|
56
|
+
categoryId: s.m(Sury.string)
|
|
56
57
|
}))
|
|
57
58
|
]);
|
|
58
59
|
|
|
59
|
-
let commandSchema =
|
|
60
|
+
let commandSchema = Sury.$schema(s => ({
|
|
60
61
|
TAG: "AddProduct",
|
|
61
62
|
productId: s.m(DcbTag$Reventless.partition),
|
|
62
63
|
categoryId: s.m(DcbTag$Reventless.string),
|
|
63
|
-
name: s.m(
|
|
64
|
+
name: s.m(Sury.string)
|
|
64
65
|
}));
|
|
65
66
|
|
|
66
|
-
let errorSchema =
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
let errorSchema = Sury.union([
|
|
68
|
+
Sury.literal("ProductAlreadyExists"),
|
|
69
|
+
Sury.literal("CategoryNotFound")
|
|
69
70
|
]);
|
|
70
71
|
|
|
71
72
|
function commandAuthorization(param) {
|
|
@@ -195,7 +196,7 @@ async function publishJsons(cmdJsons) {
|
|
|
195
196
|
],
|
|
196
197
|
[
|
|
197
198
|
"meta",
|
|
198
|
-
|
|
199
|
+
Util_Sury$Reventless.toJson(cmdJson.meta, Message$Reventless.metaSchema)
|
|
199
200
|
],
|
|
200
201
|
[
|
|
201
202
|
"command",
|
|
@@ -236,7 +237,7 @@ async function dispatch(commandJson, id) {
|
|
|
236
237
|
}
|
|
237
238
|
|
|
238
239
|
function encodeEvent(event) {
|
|
239
|
-
let json =
|
|
240
|
+
let json = Util_Sury$Reventless.toJson(event, eventSchema);
|
|
240
241
|
let match = Message$ReventlessCore.splitMessage(json);
|
|
241
242
|
let tags = DcbTag$Reventless.extractTags(eventSchema, event);
|
|
242
243
|
let meta = Message$ReventlessCore.generateMeta("test", undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
@@ -249,7 +250,7 @@ function encodeEvent(event) {
|
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
function addProductJson(productId, categoryId, name) {
|
|
252
|
-
return
|
|
253
|
+
return Util_Sury$Reventless.toJson({
|
|
253
254
|
TAG: "AddProduct",
|
|
254
255
|
productId: productId,
|
|
255
256
|
categoryId: categoryId,
|
|
@@ -7,7 +7,7 @@ open DcbFixtures
|
|
|
7
7
|
|
|
8
8
|
// Helper to encode a typed event into a raw event for appending to the DcbEventLog
|
|
9
9
|
let encodeEvent = (event: DcbFixtures.ItemEventLog.event): ReventlessInfra.DcbEventLog.rawEvent => {
|
|
10
|
-
let json = event->
|
|
10
|
+
let json = event->Reventless.Util_Sury.toJson(DcbFixtures.ItemEventLog.eventSchema)
|
|
11
11
|
let (eventType, data) = json->ReventlessCore.Message.splitMessage
|
|
12
12
|
let tags = Reventless.DcbTag.extractTags(DcbFixtures.ItemEventLog.eventSchema, event)
|
|
13
13
|
let meta = ReventlessCore.Message.generateMeta(~service="test")
|
|
@@ -1,16 +1,16 @@
|
|
|
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 "effect/Effect";
|
|
5
4
|
import * as Stream from "effect/Stream";
|
|
6
5
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
6
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
7
7
|
import * as Message$ReventlessCore from "@reventlessdev/reventless-core/src/Message.res.mjs";
|
|
8
8
|
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
9
9
|
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
10
10
|
import * as DcbFixtures$ReventlessLocal from "./DcbFixtures.res.mjs";
|
|
11
11
|
|
|
12
12
|
function encodeEvent(event) {
|
|
13
|
-
let json =
|
|
13
|
+
let json = Util_Sury$Reventless.toJson(event, DcbFixtures$ReventlessLocal.ItemEventLog.eventSchema);
|
|
14
14
|
let match = Message$ReventlessCore.splitMessage(json);
|
|
15
15
|
let tags = DcbTag$Reventless.extractTags(DcbFixtures$ReventlessLocal.ItemEventLog.eventSchema, event);
|
|
16
16
|
let meta = Message$ReventlessCore.generateMeta("test", undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
@@ -106,7 +106,7 @@ let publishJsons: ReventlessInfra.CommandTopic.publishJsons = async cmdJsons =>
|
|
|
106
106
|
let fullBody = JSON.Encode.object(
|
|
107
107
|
Dict.fromArray([
|
|
108
108
|
("id", JSON.Encode.string(cmdJson.id)),
|
|
109
|
-
("meta", cmdJson.meta->
|
|
109
|
+
("meta", cmdJson.meta->Reventless.Util_Sury.toJson(Reventless.Message.metaSchema)),
|
|
110
110
|
("command", cmdJson.commandJson),
|
|
111
111
|
]),
|
|
112
112
|
)
|
|
@@ -142,4 +142,4 @@ let tagQuery = (id: string): Reventless.DcbTag.query => [
|
|
|
142
142
|
let typeQuery = (eventType: string): Reventless.DcbTag.query => [{eventTypes: [eventType]}]
|
|
143
143
|
|
|
144
144
|
let addItemJson = (id, name) =>
|
|
145
|
-
AddItemSpec.AddItem({id, name})->
|
|
145
|
+
AddItemSpec.AddItem({id, name})->Reventless.Util_Sury.toJson(AddItemSpec.commandSchema)
|
|
@@ -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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
@@ -8,6 +8,7 @@ import * as Stream from "effect/Stream";
|
|
|
8
8
|
import * as Pulumi from "@pulumi/pulumi";
|
|
9
9
|
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
10
10
|
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
11
|
+
import * as Util_Sury$Reventless from "@reventlessdev/reventless-spec/src/util/Util_Sury.res.mjs";
|
|
11
12
|
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
12
13
|
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
13
14
|
import * as CommandTopic$ReventlessCore from "@reventlessdev/reventless-core/src/components/CommandTopic/CommandTopic.res.mjs";
|
|
@@ -15,10 +16,10 @@ import * as TestFixtures$ReventlessLocal from "../../TestFixtures.res.mjs";
|
|
|
15
16
|
import * as DcbEventLog_Builder$ReventlessLocal from "../../../src/components/DcbEventLog_Builder.res.mjs";
|
|
16
17
|
import * as StateChangeSlice_Builder$ReventlessLocal from "../../../src/components/StateChangeSlice_Builder.res.mjs";
|
|
17
18
|
|
|
18
|
-
let eventSchema =
|
|
19
|
+
let eventSchema = Sury.$schema(s => ({
|
|
19
20
|
TAG: "ItemAdded",
|
|
20
21
|
id: s.m(DcbTag$Reventless.string),
|
|
21
|
-
name: s.m(
|
|
22
|
+
name: s.m(Sury.string)
|
|
22
23
|
}));
|
|
23
24
|
|
|
24
25
|
let ItemEventLog = {
|
|
@@ -29,21 +30,21 @@ let name = "AddItem";
|
|
|
29
30
|
|
|
30
31
|
let moduleUrl = import.meta.url;
|
|
31
32
|
|
|
32
|
-
let eventSchema$1 =
|
|
33
|
+
let eventSchema$1 = Sury.$schema(s => ({
|
|
33
34
|
TAG: "ItemAdded",
|
|
34
35
|
id: s.m(DcbTag$Reventless.string),
|
|
35
|
-
name: s.m(
|
|
36
|
+
name: s.m(Sury.string)
|
|
36
37
|
}));
|
|
37
38
|
|
|
38
|
-
let consumedEventSchema =
|
|
39
|
+
let consumedEventSchema = Sury.literal("ItemAdded");
|
|
39
40
|
|
|
40
|
-
let commandSchema =
|
|
41
|
+
let commandSchema = Sury.$schema(s => ({
|
|
41
42
|
TAG: "AddItem",
|
|
42
43
|
id: s.m(DcbTag$Reventless.string),
|
|
43
|
-
name: s.m(
|
|
44
|
+
name: s.m(Sury.string)
|
|
44
45
|
}));
|
|
45
46
|
|
|
46
|
-
let errorSchema =
|
|
47
|
+
let errorSchema = Sury.literal("ItemAlreadyExists");
|
|
47
48
|
|
|
48
49
|
function commandAuthorization(param) {
|
|
49
50
|
return "AllowAuthenticated";
|
|
@@ -147,7 +148,7 @@ async function publishJsons(cmdJsons) {
|
|
|
147
148
|
],
|
|
148
149
|
[
|
|
149
150
|
"meta",
|
|
150
|
-
|
|
151
|
+
Util_Sury$Reventless.toJson(cmdJson.meta, Message$Reventless.metaSchema)
|
|
151
152
|
],
|
|
152
153
|
[
|
|
153
154
|
"command",
|
|
@@ -194,7 +195,7 @@ function typeQuery(eventType) {
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
function addItemJson(id, name) {
|
|
197
|
-
return
|
|
198
|
+
return Util_Sury$Reventless.toJson({
|
|
198
199
|
TAG: "AddItem",
|
|
199
200
|
id: id,
|
|
200
201
|
name: name
|