@reventlessdev/reventless-core 3.0.0-alpha.170 → 3.0.0-alpha.172
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 +14 -0
- package/package.json +14 -14
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +5 -2
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res.mjs +3 -3
- package/src/components/Heartbeat/Heartbeat.res +2 -2
- package/src/components/Heartbeat/Heartbeat_Builder.res +2 -2
- package/src/components/Heartbeat/Heartbeat_Builder.res.mjs +2 -4
- package/src/components/Task/Task_Builder.res +6 -4
- package/src/components/Task/Task_Builder.res.mjs +4 -4
- package/src/plugin/component/Plugin_Builder.res +5 -1
- package/src/plugin/component/Plugin_Builder.res.mjs +1 -1
- package/src/plugin/component/Plugin_Helpers.res +6 -1
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +2 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +3 -3
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +12 -5
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +8 -2
- package/tests/plugin/HeartbeatDisconnectGraceTest.res +98 -0
- package/tests/IdentityTest.res.mjs +0 -174
- package/tests/adapter/MonitoringTest.res.mjs +0 -82
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +0 -356
- package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +0 -101
- package/tests/aggregate/AggregateCacheTest.res.mjs +0 -433
- package/tests/aggregate/AggregateCallbackTest.res.mjs +0 -143
- package/tests/aggregate/AggregateCausationTest.res.mjs +0 -47
- package/tests/aggregate/AggregateConflictTest.res.mjs +0 -386
- package/tests/aggregate/AggregateFixtures.res.mjs +0 -308
- package/tests/aggregate/AggregateRejectionTest.res.mjs +0 -166
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +0 -645
- package/tests/api/ApiNoApiTest.res.mjs +0 -90
- package/tests/api/GraphQL_StitcherTest.res.mjs +0 -112
- package/tests/api/SimpleTest.res.mjs +0 -10
- package/tests/api/SuryToJsonSchemaTest.res.mjs +0 -674
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +0 -160
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +0 -197
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +0 -152
- package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +0 -106
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +0 -109
- package/tests/counter/CounterCallbackTest.res.mjs +0 -140
- package/tests/counter/CounterFixtures.res.mjs +0 -67
- package/tests/dcb/DcbDecodeTest.res.mjs +0 -194
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +0 -268
- package/tests/dcb/DcbFixtures.res.mjs +0 -534
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +0 -480
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +0 -540
- package/tests/dcb/DcbTagTest.res.mjs +0 -867
- package/tests/dcb/DcbValidationTest.res.mjs +0 -476
- package/tests/eventlog/EventLogFixtures.res.mjs +0 -196
- package/tests/eventlog/EventLogOperationsTest.res.mjs +0 -192
- package/tests/eventlog/EventLogRetryTest.res.mjs +0 -195
- package/tests/eventmapper/EventMapperCallbackTest.res.mjs +0 -141
- package/tests/eventmapper/EventMapperFixtures.res.mjs +0 -440
- package/tests/eventmapper/EventMapperTest.res.mjs +0 -83
- package/tests/eventtopic/EventTopicFixtures.res.mjs +0 -65
- package/tests/eventtopic/EventTopicOperationsTest.res.mjs +0 -71
- package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +0 -94
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +0 -205
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +0 -304
- package/tests/ftp/FTPTest.res.mjs +0 -88
- package/tests/logger/LogFormatTest.res.mjs +0 -309
- package/tests/logger/LoggerLazyTest.res.mjs +0 -40
- package/tests/message/MessageTest.res.mjs +0 -218
- package/tests/message/MetaEnvelopeTest.res.mjs +0 -188
- package/tests/plugin/ManifestVisibilityTest.res.mjs +0 -215
- package/tests/plugin/PluginSpecExperiment.res.mjs +0 -31
- package/tests/plugin/PluginStructureTest.res.mjs +0 -419
- package/tests/plugin/PluginVersionTest.res.mjs +0 -30
- package/tests/plugin/SchemaWalkerTest.res.mjs +0 -160
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +0 -62
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +0 -95
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +0 -81
- package/tests/poc/StructuralSubtypingPoc.res.mjs +0 -61
- package/tests/projection/ProjectionOptimizeTest.res.mjs +0 -75
- package/tests/querydb/QueryDbFixtures.res.mjs +0 -135
- package/tests/querydb/QueryDbOperationsTest.res.mjs +0 -168
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +0 -77
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +0 -139
- package/tests/util/CommandPublisherTest.res.mjs +0 -78
- package/tests/util/CsvStreamTest.res.mjs +0 -51
- package/tests/util/LruTest.res.mjs +0 -105
- package/tests/util/MetricsTest.res.mjs +0 -53
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
-
|
|
6
|
-
let consumedEventSchema = S.union([
|
|
7
|
-
S.literal("OrderPlaced"),
|
|
8
|
-
S.literal("OrderShipped"),
|
|
9
|
-
S.literal("OrderCancelled")
|
|
10
|
-
]);
|
|
11
|
-
|
|
12
|
-
function evolve(_state, _event) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let commandSchema = S.union([
|
|
17
|
-
S.schema(s => ({
|
|
18
|
-
TAG: "ShipOrder",
|
|
19
|
-
orderId: s.m(DcbTag$Reventless.string)
|
|
20
|
-
})),
|
|
21
|
-
S.literal("CancelShipment")
|
|
22
|
-
]);
|
|
23
|
-
|
|
24
|
-
let errorSchema = S.literal("OrderNotFound");
|
|
25
|
-
|
|
26
|
-
let eventSchema = S.union([
|
|
27
|
-
S.schema(s => ({
|
|
28
|
-
TAG: "OrderShipped",
|
|
29
|
-
orderId: s.m(DcbTag$Reventless.string)
|
|
30
|
-
})),
|
|
31
|
-
S.literal("ShipmentVoided")
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
function decide(_state, _command) {
|
|
35
|
-
return {
|
|
36
|
-
TAG: "Ok",
|
|
37
|
-
_0: []
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function commandAuthorization(param) {
|
|
42
|
-
return "AllowAuthenticated";
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let name = "ShipOrder";
|
|
46
|
-
|
|
47
|
-
let Id;
|
|
48
|
-
|
|
49
|
-
let initialState = false;
|
|
50
|
-
|
|
51
|
-
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs";
|
|
52
|
-
|
|
53
|
-
let readConsistency = "EscalateOnRetry";
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
name,
|
|
57
|
-
Id,
|
|
58
|
-
initialState,
|
|
59
|
-
consumedEventSchema,
|
|
60
|
-
evolve,
|
|
61
|
-
commandSchema,
|
|
62
|
-
errorSchema,
|
|
63
|
-
eventSchema,
|
|
64
|
-
decide,
|
|
65
|
-
moduleUrl,
|
|
66
|
-
commandAuthorization,
|
|
67
|
-
readConsistency,
|
|
68
|
-
}
|
|
69
|
-
/* consumedEventSchema Not a pure module */
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
-
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
6
|
-
import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
|
|
7
|
-
|
|
8
|
-
let consumedEventSchema = S.schema(s => ({
|
|
9
|
-
TAG: "ItemRecorded",
|
|
10
|
-
itemId: s.m(DcbTag$Reventless.string),
|
|
11
|
-
ownerId: s.m(DcbTag$Reventless.string),
|
|
12
|
-
version: s.m(S.string),
|
|
13
|
-
name: s.m(S.string)
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
let stateSchema = S.schema(s => ({
|
|
17
|
-
itemId: s.m(S.string),
|
|
18
|
-
version: s.m(S.string),
|
|
19
|
-
ownerId: s.m(S.string),
|
|
20
|
-
name: s.m(S.string)
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
function project(event) {
|
|
24
|
-
let itemId = event.itemId;
|
|
25
|
-
return [{
|
|
26
|
-
TAG: "Set",
|
|
27
|
-
_0: itemId,
|
|
28
|
-
_1: {
|
|
29
|
-
itemId: itemId,
|
|
30
|
-
version: event.version,
|
|
31
|
-
ownerId: event.ownerId,
|
|
32
|
-
name: event.name
|
|
33
|
-
}
|
|
34
|
-
}];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let config = ReadModel$Reventless.config(undefined, undefined, [{
|
|
38
|
-
index: "byOwner",
|
|
39
|
-
type_: "S",
|
|
40
|
-
idField: "ownerId",
|
|
41
|
-
projectionType: "ALL"
|
|
42
|
-
}]);
|
|
43
|
-
|
|
44
|
-
let subIdConfig = {
|
|
45
|
-
subIdField: "version",
|
|
46
|
-
getSubId: (state => state.version)
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
let makeId = (state => state.itemId);
|
|
50
|
-
|
|
51
|
-
let stateSchema$1 = S.Metadata.set(stateSchema, StateAnnotations$Reventless.stateAnnotationsId, {
|
|
52
|
-
ids: ["itemId"],
|
|
53
|
-
compositeIds: [],
|
|
54
|
-
subIds: ["version"],
|
|
55
|
-
compositeSubIds: [],
|
|
56
|
-
indexes: [[
|
|
57
|
-
"ownerId",
|
|
58
|
-
"byOwner"
|
|
59
|
-
]],
|
|
60
|
-
hidden: [],
|
|
61
|
-
summary: [],
|
|
62
|
-
drillTargets: [],
|
|
63
|
-
drillTargetKeys: [],
|
|
64
|
-
collapsed: [],
|
|
65
|
-
scan: [],
|
|
66
|
-
scanSort: [],
|
|
67
|
-
status: undefined,
|
|
68
|
-
groupBy: undefined,
|
|
69
|
-
visibility: undefined
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
let name = "AnnotatedView";
|
|
73
|
-
|
|
74
|
-
let Id;
|
|
75
|
-
|
|
76
|
-
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs";
|
|
77
|
-
|
|
78
|
-
let authorization = "AllowAuthenticated";
|
|
79
|
-
|
|
80
|
-
let visibility = "Public";
|
|
81
|
-
|
|
82
|
-
export {
|
|
83
|
-
name,
|
|
84
|
-
Id,
|
|
85
|
-
consumedEventSchema,
|
|
86
|
-
project,
|
|
87
|
-
config,
|
|
88
|
-
subIdConfig,
|
|
89
|
-
makeId,
|
|
90
|
-
stateSchema$1 as stateSchema,
|
|
91
|
-
moduleUrl,
|
|
92
|
-
authorization,
|
|
93
|
-
visibility,
|
|
94
|
-
}
|
|
95
|
-
/* consumedEventSchema Not a pure module */
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
-
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
6
|
-
|
|
7
|
-
let consumedEventSchema = S.union([
|
|
8
|
-
S.schema(s => ({
|
|
9
|
-
TAG: "CatalogProductSynced",
|
|
10
|
-
productId: s.m(DcbTag$Reventless.string),
|
|
11
|
-
name: s.m(S.string)
|
|
12
|
-
})),
|
|
13
|
-
S.schema(s => ({
|
|
14
|
-
TAG: "CatalogProductPriceChanged",
|
|
15
|
-
productId: s.m(DcbTag$Reventless.string)
|
|
16
|
-
}))
|
|
17
|
-
]);
|
|
18
|
-
|
|
19
|
-
let stateSchema = S.schema(s => ({
|
|
20
|
-
productId: s.m(S.string),
|
|
21
|
-
name: s.m(S.string)
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
function project(event) {
|
|
25
|
-
if (event.TAG !== "CatalogProductSynced") {
|
|
26
|
-
return [{
|
|
27
|
-
TAG: "Update",
|
|
28
|
-
_0: event.productId,
|
|
29
|
-
_1: s => s
|
|
30
|
-
}];
|
|
31
|
-
}
|
|
32
|
-
let productId = event.productId;
|
|
33
|
-
return [{
|
|
34
|
-
TAG: "Set",
|
|
35
|
-
_0: productId,
|
|
36
|
-
_1: {
|
|
37
|
-
productId: productId,
|
|
38
|
-
name: event.name
|
|
39
|
-
}
|
|
40
|
-
}];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
44
|
-
|
|
45
|
-
let name = "AvailableProducts";
|
|
46
|
-
|
|
47
|
-
let Id;
|
|
48
|
-
|
|
49
|
-
let subIdConfig;
|
|
50
|
-
|
|
51
|
-
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs";
|
|
52
|
-
|
|
53
|
-
let authorization = "AllowAuthenticated";
|
|
54
|
-
|
|
55
|
-
let visibility = "Public";
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
name,
|
|
59
|
-
Id,
|
|
60
|
-
consumedEventSchema,
|
|
61
|
-
stateSchema,
|
|
62
|
-
project,
|
|
63
|
-
config,
|
|
64
|
-
subIdConfig,
|
|
65
|
-
moduleUrl,
|
|
66
|
-
authorization,
|
|
67
|
-
visibility,
|
|
68
|
-
}
|
|
69
|
-
/* consumedEventSchema Not a pure module */
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
-
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
6
|
-
import * as DisplayName$Reventless from "@reventlessdev/reventless-spec/src/components/DisplayName.res.mjs";
|
|
7
|
-
|
|
8
|
-
let consumedEventSchema = S.schema(s => ({
|
|
9
|
-
TAG: "CustomerAdded",
|
|
10
|
-
customerId: s.m(DcbTag$Reventless.string),
|
|
11
|
-
firstName: s.m(S.string),
|
|
12
|
-
lastName: s.m(S.string)
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
let stateSchema = S.schema(s => ({
|
|
16
|
-
customerId: s.m(S.string),
|
|
17
|
-
firstName: s.m(S.string),
|
|
18
|
-
lastName: s.m(S.string),
|
|
19
|
-
displayName: s.m(S.option(S.string))
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
let stateSchema$1 = S.Metadata.set(stateSchema, DisplayName$Reventless.displayNameId, {
|
|
23
|
-
fields: [
|
|
24
|
-
"firstName",
|
|
25
|
-
"lastName"
|
|
26
|
-
],
|
|
27
|
-
separator: " "
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
function project(event) {
|
|
31
|
-
let customerId = event.customerId;
|
|
32
|
-
return [{
|
|
33
|
-
TAG: "Set",
|
|
34
|
-
_0: customerId,
|
|
35
|
-
_1: {
|
|
36
|
-
customerId: customerId,
|
|
37
|
-
firstName: event.firstName,
|
|
38
|
-
lastName: event.lastName
|
|
39
|
-
}
|
|
40
|
-
}];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
44
|
-
|
|
45
|
-
let name = "Customers";
|
|
46
|
-
|
|
47
|
-
let Id;
|
|
48
|
-
|
|
49
|
-
let subIdConfig;
|
|
50
|
-
|
|
51
|
-
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateViewSlice/PsCustomersView.res.mjs";
|
|
52
|
-
|
|
53
|
-
let authorization = "AllowAuthenticated";
|
|
54
|
-
|
|
55
|
-
let visibility = "Public";
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
name,
|
|
59
|
-
Id,
|
|
60
|
-
consumedEventSchema,
|
|
61
|
-
stateSchema$1 as stateSchema,
|
|
62
|
-
project,
|
|
63
|
-
config,
|
|
64
|
-
subIdConfig,
|
|
65
|
-
moduleUrl,
|
|
66
|
-
authorization,
|
|
67
|
-
visibility,
|
|
68
|
-
}
|
|
69
|
-
/* consumedEventSchema Not a pure module */
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
5
|
-
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
6
|
-
|
|
7
|
-
let consumedEventSchema = S.union([
|
|
8
|
-
S.schema(s => ({
|
|
9
|
-
TAG: "OrderPlaced",
|
|
10
|
-
orderId: s.m(DcbTag$Reventless.string),
|
|
11
|
-
customerName: s.m(S.string)
|
|
12
|
-
})),
|
|
13
|
-
S.schema(s => ({
|
|
14
|
-
TAG: "OrderShipped",
|
|
15
|
-
orderId: s.m(DcbTag$Reventless.string)
|
|
16
|
-
})),
|
|
17
|
-
S.schema(s => ({
|
|
18
|
-
TAG: "OrderCancelled",
|
|
19
|
-
orderId: s.m(DcbTag$Reventless.string)
|
|
20
|
-
}))
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
let stateSchema = S.schema(s => ({
|
|
24
|
-
orderId: s.m(S.string),
|
|
25
|
-
customerName: s.m(S.string)
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
function project(event) {
|
|
29
|
-
switch (event.TAG) {
|
|
30
|
-
case "OrderPlaced" :
|
|
31
|
-
let orderId = event.orderId;
|
|
32
|
-
return [{
|
|
33
|
-
TAG: "Set",
|
|
34
|
-
_0: orderId,
|
|
35
|
-
_1: {
|
|
36
|
-
orderId: orderId,
|
|
37
|
-
customerName: event.customerName
|
|
38
|
-
}
|
|
39
|
-
}];
|
|
40
|
-
case "OrderShipped" :
|
|
41
|
-
return [{
|
|
42
|
-
TAG: "Update",
|
|
43
|
-
_0: event.orderId,
|
|
44
|
-
_1: s => s
|
|
45
|
-
}];
|
|
46
|
-
case "OrderCancelled" :
|
|
47
|
-
return [{
|
|
48
|
-
TAG: "Update",
|
|
49
|
-
_0: event.orderId,
|
|
50
|
-
_1: s => s
|
|
51
|
-
}];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
56
|
-
|
|
57
|
-
let name = "Orders";
|
|
58
|
-
|
|
59
|
-
let Id;
|
|
60
|
-
|
|
61
|
-
let subIdConfig;
|
|
62
|
-
|
|
63
|
-
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateViewSlice/PsOrdersView.res.mjs";
|
|
64
|
-
|
|
65
|
-
let authorization = "AllowAuthenticated";
|
|
66
|
-
|
|
67
|
-
let visibility = "Public";
|
|
68
|
-
|
|
69
|
-
export {
|
|
70
|
-
name,
|
|
71
|
-
Id,
|
|
72
|
-
consumedEventSchema,
|
|
73
|
-
stateSchema,
|
|
74
|
-
project,
|
|
75
|
-
config,
|
|
76
|
-
subIdConfig,
|
|
77
|
-
moduleUrl,
|
|
78
|
-
authorization,
|
|
79
|
-
visibility,
|
|
80
|
-
}
|
|
81
|
-
/* consumedEventSchema Not a pure module */
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function acceptSubset(M) {
|
|
5
|
-
return M.Spec.name;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function coerceSuperset(M) {
|
|
9
|
-
return M;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function passSupersetsAsSubsets(aggregates) {
|
|
13
|
-
return aggregates.map(M => M);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function finishAggregates(aggregates) {
|
|
17
|
-
aggregates.forEach(M => M.AggregateRuntimeBuilder.finish());
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function platformImplSatisfiesSpec(P) {
|
|
21
|
-
let $$let = P.Aggregate.Make;
|
|
22
|
-
return {
|
|
23
|
-
Aggregate: {
|
|
24
|
-
Make: funarg => $$let(funarg)
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function coerceReadModelSuperset(M) {
|
|
30
|
-
return M;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function coerceSupersetV2(M) {
|
|
34
|
-
return M;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function passSupersetsAsSubsetsV2(aggregates) {
|
|
38
|
-
return aggregates.map(M => M);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function platformImplSatisfiesSpecV2(P) {
|
|
42
|
-
let $$let = P.Aggregate.Make;
|
|
43
|
-
return {
|
|
44
|
-
Aggregate: {
|
|
45
|
-
Make: funarg => $$let(funarg)
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
acceptSubset,
|
|
52
|
-
coerceSuperset,
|
|
53
|
-
passSupersetsAsSubsets,
|
|
54
|
-
finishAggregates,
|
|
55
|
-
platformImplSatisfiesSpec,
|
|
56
|
-
coerceReadModelSuperset,
|
|
57
|
-
coerceSupersetV2,
|
|
58
|
-
passSupersetsAsSubsetsV2,
|
|
59
|
-
platformImplSatisfiesSpecV2,
|
|
60
|
-
}
|
|
61
|
-
/* No side effect */
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
|
-
import * as Projection$ReventlessCore from "../../src/Projection.res.mjs";
|
|
5
|
-
|
|
6
|
-
globalThis.describe("Projection.optimizeActions", () => {
|
|
7
|
-
globalThis.test("does not duplicate the pre-merge action (off-by-one regression)", () => {
|
|
8
|
-
let optimized = Projection$ReventlessCore.optimizeActions([
|
|
9
|
-
{
|
|
10
|
-
TAG: "Delete",
|
|
11
|
-
_0: "a"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
TAG: "Update",
|
|
15
|
-
_0: "a",
|
|
16
|
-
_1: x => x + 1 | 0
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
TAG: "Set",
|
|
20
|
-
_0: "a",
|
|
21
|
-
_1: 99
|
|
22
|
-
}
|
|
23
|
-
]);
|
|
24
|
-
globalThis.expect(optimized.length).toBe(2);
|
|
25
|
-
let sets = Stdlib_Array.filterMap(optimized, a => {
|
|
26
|
-
if (typeof a !== "object" || a.TAG !== "Set") {
|
|
27
|
-
return;
|
|
28
|
-
} else {
|
|
29
|
-
return [
|
|
30
|
-
a._0,
|
|
31
|
-
a._1
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
globalThis.expect(sets).toEqual([[
|
|
36
|
-
"a",
|
|
37
|
-
99
|
|
38
|
-
]]);
|
|
39
|
-
});
|
|
40
|
-
globalThis.test("merges a same-id Create+Update chain into a single Create", () => {
|
|
41
|
-
let optimized = Projection$ReventlessCore.optimizeActions([
|
|
42
|
-
{
|
|
43
|
-
TAG: "Create",
|
|
44
|
-
_0: "a",
|
|
45
|
-
_1: 0
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
TAG: "Update",
|
|
49
|
-
_0: "a",
|
|
50
|
-
_1: x => x + 1 | 0
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
TAG: "Update",
|
|
54
|
-
_0: "a",
|
|
55
|
-
_1: x => x + 10 | 0
|
|
56
|
-
}
|
|
57
|
-
]);
|
|
58
|
-
let creates = Stdlib_Array.filterMap(optimized, a => {
|
|
59
|
-
if (typeof a !== "object" || a.TAG !== "Create") {
|
|
60
|
-
return;
|
|
61
|
-
} else {
|
|
62
|
-
return [
|
|
63
|
-
a._0,
|
|
64
|
-
a._1
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
globalThis.expect(creates).toEqual([[
|
|
69
|
-
"a",
|
|
70
|
-
11
|
|
71
|
-
]]);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
/* Not a pure module */
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
5
|
-
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
-
import * as Stream from "effect/Stream";
|
|
7
|
-
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
8
|
-
|
|
9
|
-
S.enableJson();
|
|
10
|
-
|
|
11
|
-
let moduleUrl = import.meta.url;
|
|
12
|
-
|
|
13
|
-
let stateSchema = S.schema(s => ({
|
|
14
|
-
name: s.m(S.string),
|
|
15
|
-
count: s.m(S.int)
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
19
|
-
|
|
20
|
-
let ItemQueryDbSpec = {
|
|
21
|
-
Id: undefined,
|
|
22
|
-
name: "TestItemQueryDb",
|
|
23
|
-
moduleUrl: moduleUrl,
|
|
24
|
-
stateSchema: stateSchema,
|
|
25
|
-
config: config,
|
|
26
|
-
subIdConfig: undefined,
|
|
27
|
-
authorization: "AllowAuthenticated",
|
|
28
|
-
visibility: "Public"
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
let store = {
|
|
32
|
-
contents: {}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
let failNextWrite = {
|
|
36
|
-
contents: false
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
async function mockJsonOps_load(id) {
|
|
40
|
-
return {
|
|
41
|
-
TAG: "Ok",
|
|
42
|
-
_0: Stdlib_Option.getOr(store.contents[id], [])
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function mockJsonOps_loadStream(id) {
|
|
47
|
-
return Stream.fromIterable(Stdlib_Option.getOr(store.contents[id], []));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function mockJsonOps_save(id, state, _saveMode, _ttl) {
|
|
51
|
-
if (failNextWrite.contents) {
|
|
52
|
-
failNextWrite.contents = false;
|
|
53
|
-
return {
|
|
54
|
-
TAG: "Error",
|
|
55
|
-
_0: {
|
|
56
|
-
TAG: "NotSavedToStorage",
|
|
57
|
-
_0: "mock failure"
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
} else {
|
|
61
|
-
store.contents[id] = [state];
|
|
62
|
-
return {
|
|
63
|
-
TAG: "Ok",
|
|
64
|
-
_0: undefined
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function mockJsonOps_saveBatch(batch) {
|
|
70
|
-
if (failNextWrite.contents) {
|
|
71
|
-
failNextWrite.contents = false;
|
|
72
|
-
return {
|
|
73
|
-
TAG: "Error",
|
|
74
|
-
_0: {
|
|
75
|
-
TAG: "BatchNotFullyWrittenToStorage",
|
|
76
|
-
_0: "mock failure"
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
} else {
|
|
80
|
-
batch.forEach(param => {
|
|
81
|
-
store.contents[param[0]] = [param[1]];
|
|
82
|
-
});
|
|
83
|
-
return {
|
|
84
|
-
TAG: "Ok",
|
|
85
|
-
_0: undefined
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async function mockJsonOps_count(_id, _field, inc) {
|
|
91
|
-
return {
|
|
92
|
-
TAG: "Ok",
|
|
93
|
-
_0: inc
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function mockJsonOps_delete(id, _subId) {
|
|
98
|
-
Stdlib_Dict.$$delete(store.contents, id);
|
|
99
|
-
return {
|
|
100
|
-
TAG: "Ok",
|
|
101
|
-
_0: undefined
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async function mockJsonOps_deleteBatch(ids) {
|
|
106
|
-
ids.forEach(param => Stdlib_Dict.$$delete(store.contents, param[0]));
|
|
107
|
-
return {
|
|
108
|
-
TAG: "Ok",
|
|
109
|
-
_0: undefined
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let mockJsonOps = {
|
|
114
|
-
load: mockJsonOps_load,
|
|
115
|
-
loadStream: mockJsonOps_loadStream,
|
|
116
|
-
save: mockJsonOps_save,
|
|
117
|
-
saveBatch: mockJsonOps_saveBatch,
|
|
118
|
-
count: mockJsonOps_count,
|
|
119
|
-
delete: mockJsonOps_delete,
|
|
120
|
-
deleteBatch: mockJsonOps_deleteBatch
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
function reset() {
|
|
124
|
-
store.contents = {};
|
|
125
|
-
failNextWrite.contents = false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export {
|
|
129
|
-
ItemQueryDbSpec,
|
|
130
|
-
store,
|
|
131
|
-
failNextWrite,
|
|
132
|
-
mockJsonOps,
|
|
133
|
-
reset,
|
|
134
|
-
}
|
|
135
|
-
/* Not a pure module */
|