@reventlessdev/reventless-core 3.0.0-alpha.250 → 3.0.0-alpha.252
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 +7 -7
- package/src/admin/Platform_Admin_Structure.res +4 -1
- package/src/admin/Platform_Admin_Structure.res.mjs +4 -2
- package/src/admin/Platform_BakedManifest.res.mjs +3 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res +31 -1
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +29 -1
- package/src/admin/Platform_PluginStructuresApi.res +80 -8
- package/src/admin/Platform_PluginStructuresApi.res.mjs +76 -2
- package/src/admin/UiFragmentRegistry/StateChangeSlice/UiFragmentRegistry.res.mjs +8 -0
- package/src/components/Api/ApiNoApiHelpers.res +37 -3
- package/src/components/Api/ApiNoApiHelpers.res.mjs +29 -2
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +4 -4
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +3 -3
- package/src/plugin/api/PluginBaseFragment.res +3 -3
- package/src/plugin/component/Plugin_Structure.res +787 -384
- package/src/plugin/component/Plugin_Structure.res.mjs +430 -20
- package/src/plugin/connect/PluginConnectExtension_Mapping.res +3 -6
- package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +14 -2
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +0 -1
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +63 -3
- package/src/plugin/connect/PluginExtensionPoint_UiFragment.res.mjs +22 -3
- package/src/plugin/lifecycle/PluginBehavior.res +11 -11
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +11 -11
- package/src/plugin/lifecycle/PluginSpec.res +11 -3
- package/src/plugin/lifecycle/PluginSpec.res.mjs +11 -3
- package/tests/admin/AdminApiSchemaDriftTest.res +486 -0
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +619 -0
- package/tests/admin/Platform_Admin_StructureTest.res +8 -3
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +8 -2
- package/tests/admin/Platform_BakedManifestTest.res +2 -0
- package/tests/admin/Platform_BakedManifestTest.res.mjs +3 -1
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +10 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +30 -8
- package/tests/admin/Platform_PluginStructuresApiTest.res +28 -1
- package/tests/admin/Platform_PluginStructuresApiTest.res.mjs +27 -5
- package/tests/aggregate/AggregateCacheTest.res.mjs +15 -3
- package/tests/aggregate/AggregateConflictTest.res.mjs +15 -3
- package/tests/aggregate/AggregateFixtures.res.mjs +15 -3
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +21 -5
- package/tests/api/ApiNoApiTest.res +46 -0
- package/tests/api/ApiNoApiTest.res.mjs +49 -1
- package/tests/api/GraphQL_FragmentGeneratorTest.res.mjs +27 -3
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +12 -2
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +2 -0
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +12 -2
- package/tests/dcb/DcbFixtures.res.mjs +8 -0
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +18 -0
- package/tests/eventmapper/EventMapperFixtures.res.mjs +15 -3
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +9 -1
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +9 -1
- package/tests/message/MessageTest.res +2 -0
- package/tests/message/MessageTest.res.mjs +3 -1
- package/tests/plugin/PluginStructureAccessTest.res.mjs +2 -0
- package/tests/plugin/PluginStructureTest.res +294 -1
- package/tests/plugin/PluginStructureTest.res.mjs +373 -3
- package/tests/plugin/StateChangeSlice/PsAttachInvoice.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsChangePhoto.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsDispatchShipment.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsGatedCommands.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsReserveStock.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsTransitionSwitch.res +59 -0
- package/tests/plugin/StateChangeSlice/PsTransitionSwitch.res.mjs +115 -0
- package/tests/plugin/StateChangeSlice/PsTypoStore.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsUploadAvatar.res.mjs +8 -0
- package/tests/plugin/StateChangeSlice/PsUploadImages.res.mjs +8 -0
- package/tests/plugin/pluginDefinitionRequiredScalars.txt +26 -0
- package/tests/util/CommandPublisherTest.res.mjs +9 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Test fixture spec for `commandTransition` — the edge declared as a switch
|
|
2
|
+
// rather than as an attribute.
|
|
3
|
+
//
|
|
4
|
+
// Three cases in one command type:
|
|
5
|
+
//
|
|
6
|
+
// `Book` declares only through the switch, which is the case
|
|
7
|
+
// `@transition` cannot serve for a spliced constructor.
|
|
8
|
+
// `Rebook` carries BOTH. The switch says `Booked`, the attribute says
|
|
9
|
+
// `Draft`; the switch is what must reach the commandDef, because
|
|
10
|
+
// two sources of truth need a stated winner.
|
|
11
|
+
// `Abandon` declares nothing in either, and must stay unconstrained.
|
|
12
|
+
//
|
|
13
|
+
// The states go in as constructors of this file's own enum, so the compiler
|
|
14
|
+
// resolves them. `@transition` on `Rebook` cannot — it is stripped before the
|
|
15
|
+
// typechecker runs, which is why `PsDispatchShipment` can carry a typo at all.
|
|
16
|
+
|
|
17
|
+
@@reventless.spec("TransitionSwitch")
|
|
18
|
+
|
|
19
|
+
type bookingStatus = Draft | Booked | Abandoned
|
|
20
|
+
|
|
21
|
+
@schema
|
|
22
|
+
type consumedEvent = BookingDrafted({bookingId: string})
|
|
23
|
+
|
|
24
|
+
let evolve = (_state, _event) => true
|
|
25
|
+
|
|
26
|
+
type state = bool
|
|
27
|
+
let initialState = false
|
|
28
|
+
|
|
29
|
+
@schema
|
|
30
|
+
type command =
|
|
31
|
+
| Book({bookingId: string})
|
|
32
|
+
| @transition(([Draft]) => Draft) Rebook({bookingId: string})
|
|
33
|
+
| Abandon({bookingId: string})
|
|
34
|
+
|
|
35
|
+
@schema
|
|
36
|
+
type error = BookingNotFound
|
|
37
|
+
|
|
38
|
+
@schema
|
|
39
|
+
type event = BookingBooked({bookingId: string}) | BookingAbandoned({bookingId: string})
|
|
40
|
+
|
|
41
|
+
let decide = (_state, _command): result<array<event>, error> => Ok([])
|
|
42
|
+
|
|
43
|
+
type lifecycleState = bookingStatus
|
|
44
|
+
|
|
45
|
+
let commandTransition = (command: command): Reventless.Transition.t<lifecycleState> => {
|
|
46
|
+
open Reventless.Transition
|
|
47
|
+
switch command {
|
|
48
|
+
| Book(_) => Moves([Draft], Booked)
|
|
49
|
+
| Rebook(_) => Guards([Booked])
|
|
50
|
+
| Abandon(_) => Unrestricted
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Declared, so the structure has a graft to record. The value stands in for a
|
|
55
|
+
// trait package's own `declaration` — a fixture cannot depend on one, and what is
|
|
56
|
+
// under test is the collection, not where the value came from.
|
|
57
|
+
let traits: array<Reventless.Trait.t> = [
|
|
58
|
+
{trait: "@reventlessdev/trait-booking", version: "9.9.9", posture: SelfContained},
|
|
59
|
+
]
|
|
@@ -0,0 +1,115 @@
|
|
|
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 Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
|
|
6
|
+
|
|
7
|
+
let consumedEventSchema = Sury.$schema(s => ({
|
|
8
|
+
TAG: "BookingDrafted",
|
|
9
|
+
bookingId: s.m(DcbTag$Reventless.string)
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
function evolve(_state, _event) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let commandSchema = Sury.union([
|
|
17
|
+
Sury.$schema(s => ({
|
|
18
|
+
TAG: "Book",
|
|
19
|
+
bookingId: s.m(DcbTag$Reventless.string)
|
|
20
|
+
})),
|
|
21
|
+
Sury.$schema(s => ({
|
|
22
|
+
TAG: "Rebook",
|
|
23
|
+
bookingId: s.m(DcbTag$Reventless.string)
|
|
24
|
+
})),
|
|
25
|
+
Sury.$schema(s => ({
|
|
26
|
+
TAG: "Abandon",
|
|
27
|
+
bookingId: s.m(DcbTag$Reventless.string)
|
|
28
|
+
}))
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
let errorSchema = Sury.literal("BookingNotFound");
|
|
32
|
+
|
|
33
|
+
let eventSchema = Sury.union([
|
|
34
|
+
Sury.$schema(s => ({
|
|
35
|
+
TAG: "BookingBooked",
|
|
36
|
+
bookingId: s.m(DcbTag$Reventless.string)
|
|
37
|
+
})),
|
|
38
|
+
Sury.$schema(s => ({
|
|
39
|
+
TAG: "BookingAbandoned",
|
|
40
|
+
bookingId: s.m(DcbTag$Reventless.string)
|
|
41
|
+
}))
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
function decide(_state, _command) {
|
|
45
|
+
return {
|
|
46
|
+
TAG: "Ok",
|
|
47
|
+
_0: []
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function commandTransition(command) {
|
|
52
|
+
switch (command.TAG) {
|
|
53
|
+
case "Book" :
|
|
54
|
+
return {
|
|
55
|
+
TAG: "Moves",
|
|
56
|
+
_0: ["Draft"],
|
|
57
|
+
_1: "Booked"
|
|
58
|
+
};
|
|
59
|
+
case "Rebook" :
|
|
60
|
+
return {
|
|
61
|
+
TAG: "Guards",
|
|
62
|
+
_0: ["Booked"]
|
|
63
|
+
};
|
|
64
|
+
case "Abandon" :
|
|
65
|
+
return "Unrestricted";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let traits = [{
|
|
70
|
+
trait: "@reventlessdev/trait-booking",
|
|
71
|
+
version: "9.9.9",
|
|
72
|
+
posture: "SelfContained"
|
|
73
|
+
}];
|
|
74
|
+
|
|
75
|
+
let commandSchema$1 = Api$ReventlessInfra.markAllowedStates(commandSchema, [[
|
|
76
|
+
"Rebook",
|
|
77
|
+
["Draft"]
|
|
78
|
+
]]);
|
|
79
|
+
|
|
80
|
+
let commandSchema$2 = Api$ReventlessInfra.markTargetState(commandSchema$1, [[
|
|
81
|
+
"Rebook",
|
|
82
|
+
"Draft"
|
|
83
|
+
]]);
|
|
84
|
+
|
|
85
|
+
function commandAuthorization(param) {
|
|
86
|
+
return "AllowAuthenticated";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let name = "TransitionSwitch";
|
|
90
|
+
|
|
91
|
+
let Id;
|
|
92
|
+
|
|
93
|
+
let initialState = false;
|
|
94
|
+
|
|
95
|
+
let moduleUrl = "@reventlessdev/reventless-core/tests/plugin/StateChangeSlice/PsTransitionSwitch.res.mjs";
|
|
96
|
+
|
|
97
|
+
let readConsistency = "EscalateOnRetry";
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
name,
|
|
101
|
+
Id,
|
|
102
|
+
consumedEventSchema,
|
|
103
|
+
evolve,
|
|
104
|
+
initialState,
|
|
105
|
+
errorSchema,
|
|
106
|
+
eventSchema,
|
|
107
|
+
decide,
|
|
108
|
+
commandTransition,
|
|
109
|
+
traits,
|
|
110
|
+
commandSchema$2 as commandSchema,
|
|
111
|
+
moduleUrl,
|
|
112
|
+
commandAuthorization,
|
|
113
|
+
readConsistency,
|
|
114
|
+
}
|
|
115
|
+
/* consumedEventSchema Not a pure module */
|
|
@@ -35,6 +35,12 @@ function commandAuthorization(param) {
|
|
|
35
35
|
return "AllowAuthenticated";
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function commandTransition(param) {
|
|
39
|
+
return "Unrestricted";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let traits = [];
|
|
43
|
+
|
|
38
44
|
let name = "TypoStore";
|
|
39
45
|
|
|
40
46
|
let Id;
|
|
@@ -58,5 +64,7 @@ export {
|
|
|
58
64
|
moduleUrl,
|
|
59
65
|
commandAuthorization,
|
|
60
66
|
readConsistency,
|
|
67
|
+
commandTransition,
|
|
68
|
+
traits,
|
|
61
69
|
}
|
|
62
70
|
/* consumedEventSchema Not a pure module */
|
|
@@ -37,6 +37,12 @@ function commandAuthorization(param) {
|
|
|
37
37
|
return "AllowAuthenticated";
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function commandTransition(param) {
|
|
41
|
+
return "Unrestricted";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let traits = [];
|
|
45
|
+
|
|
40
46
|
let name = "UploadAvatar";
|
|
41
47
|
|
|
42
48
|
let Id;
|
|
@@ -60,5 +66,7 @@ export {
|
|
|
60
66
|
moduleUrl,
|
|
61
67
|
commandAuthorization,
|
|
62
68
|
readConsistency,
|
|
69
|
+
commandTransition,
|
|
70
|
+
traits,
|
|
63
71
|
}
|
|
64
72
|
/* consumedEventSchema Not a pure module */
|
|
@@ -39,6 +39,12 @@ function commandAuthorization(param) {
|
|
|
39
39
|
return "AllowAuthenticated";
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
function commandTransition(param) {
|
|
43
|
+
return "Unrestricted";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let traits = [];
|
|
47
|
+
|
|
42
48
|
let name = "UploadImages";
|
|
43
49
|
|
|
44
50
|
let Id;
|
|
@@ -62,5 +68,7 @@ export {
|
|
|
62
68
|
moduleUrl,
|
|
63
69
|
commandAuthorization,
|
|
64
70
|
readConsistency,
|
|
71
|
+
commandTransition,
|
|
72
|
+
traits,
|
|
65
73
|
}
|
|
66
74
|
/* consumedEventSchema Not a pure module */
|
|
@@ -74,13 +74,21 @@
|
|
|
74
74
|
.structure.automationSlices[].name: string
|
|
75
75
|
.structure.automationSlices[].producedCommandTypes[]: string
|
|
76
76
|
.structure.automationSlices[].targetName: string
|
|
77
|
+
.structure.extensionPoints[].acceptedCommands[].name: string
|
|
78
|
+
.structure.extensionPoints[].acceptedCommands[].toCommandTypes[]: string
|
|
77
79
|
.structure.extensionPoints[].commandTypes[]: string
|
|
78
80
|
.structure.extensionPoints[].delegateNames[]: string
|
|
79
81
|
.structure.extensionPoints[].name: string
|
|
82
|
+
.structure.extensionPoints[].publishedEvents[].fromEventTypes[]: string
|
|
83
|
+
.structure.extensionPoints[].publishedEvents[].name: string
|
|
80
84
|
.structure.extensionPoints[].sourceEventTypes[]: string
|
|
81
85
|
.structure.extensions[].commandTypes[]: string
|
|
82
86
|
.structure.extensions[].delegateNames[]: string
|
|
83
87
|
.structure.extensions[].eventTypes[]: string
|
|
88
|
+
.structure.extensions[].handledEvents[].name: string
|
|
89
|
+
.structure.extensions[].handledEvents[].toCommandTypes[]: string
|
|
90
|
+
.structure.extensions[].issuedCommands[].fromEventTypes[]: string
|
|
91
|
+
.structure.extensions[].issuedCommands[].name: string
|
|
84
92
|
.structure.extensions[].name: string
|
|
85
93
|
.structure.inboundTranslationSlices[].commandTypes[]: string
|
|
86
94
|
.structure.inboundTranslationSlices[].name: string
|
|
@@ -97,6 +105,24 @@
|
|
|
97
105
|
.structure.readModels[].retiredValues[]: string
|
|
98
106
|
.structure.readModels[].schema: string
|
|
99
107
|
.structure.readModels[].searchableFields[]: string
|
|
108
|
+
# `requiredCapabilities` is itself `js_nullable` and is NEW, so no persisted payload
|
|
109
|
+
# carries the array: a stored structure heals to null and these two are never reached.
|
|
110
|
+
# Required inside it because a declaration naming no capability, or no declaring
|
|
111
|
+
# component, is not a declaration — the same call `requiredStoreDeclarations` made for
|
|
112
|
+
# `store`/`component`/`field`.
|
|
113
|
+
.structure.requiredCapabilities[].capability: string
|
|
114
|
+
.structure.requiredCapabilities[].component: string
|
|
115
|
+
# `traitDeclarations` is itself `js_nullable` and is NEW, so no persisted payload
|
|
116
|
+
# carries the array: a stored structure heals to null and these four are never
|
|
117
|
+
# reached. Required inside it for the same reason the two above are — a graft
|
|
118
|
+
# naming no trait, no version, no posture or no component is not a record of a
|
|
119
|
+
# graft, and a fabricated `""` here would read as "grafted from nothing", which is
|
|
120
|
+
# worse than absent. The version is read from the trait's own package rather than
|
|
121
|
+
# written by hand, so it cannot be the empty string in practice either.
|
|
122
|
+
.structure.traitDeclarations[].component: string
|
|
123
|
+
.structure.traitDeclarations[].posture: string
|
|
124
|
+
.structure.traitDeclarations[].trait: string
|
|
125
|
+
.structure.traitDeclarations[].version: string
|
|
100
126
|
.structure.requiredStoreDeclarations[].component: string
|
|
101
127
|
.structure.requiredStoreDeclarations[].field: string
|
|
102
128
|
.structure.requiredStoreDeclarations[].store: string
|
|
@@ -15,10 +15,18 @@ function commandAuthorization(param) {
|
|
|
15
15
|
return "AllowAuthenticated";
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
function commandTransition(param) {
|
|
19
|
+
return "Unrestricted";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let traits = [];
|
|
23
|
+
|
|
18
24
|
let TestSpec = {
|
|
19
25
|
name: "TestCmd",
|
|
20
26
|
commandSchema: commandSchema,
|
|
21
|
-
commandAuthorization: commandAuthorization
|
|
27
|
+
commandAuthorization: commandAuthorization,
|
|
28
|
+
commandTransition: commandTransition,
|
|
29
|
+
traits: traits
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
function publishCommands(_name, cmds) {
|