@reventlessdev/reventless-gwt 1.0.0-alpha.248 → 1.0.0-alpha.249
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/README.md +1 -1
- package/package.json +7 -7
- package/src/.gwtignore +1 -1
- package/src/{Behavior_GWT.res → Decision_GWT.res} +25 -25
- package/src/{Behavior_GWT.res.mjs → Decision_GWT.res.mjs} +10 -10
- package/src/Delegate_GWT.res +1 -1
- package/src/EventMapping_GWT.res +7 -7
- package/src/EventMapping_GWT.res.mjs +3 -3
- package/src/Flow_GWT.res +14 -14
- package/src/Flow_GWT.res.mjs +6 -6
- package/src/Hint.res +1 -1
- package/src/Mapping_GWT.res +8 -8
- package/src/Mapping_GWT.res.mjs +6 -6
- package/src/Outcome.res +1 -1
- package/src/Query_GWT.res +1 -1
- package/src/RunnerHook.res +1 -1
- package/src/ScenarioRecorder.res +2 -2
- package/src/ScenarioRecorder.res.mjs +1 -1
- package/src/StateChange/ExternalAddCategorySlice.res +1 -1
- package/src/StateChange/WithFixtures.res +1 -1
- package/src/StateChange/WithManualOpen.res +1 -1
- package/tests/CallerTest.res +7 -7
- package/tests/CallerTest.res.mjs +8 -8
- package/tests/FlowAggregateGwtTest.res +6 -6
- package/tests/FlowAggregateGwtTest.res.mjs +6 -6
- package/tests/FlowCrossPluginGwtTest.res +8 -8
- package/tests/FlowCrossPluginGwtTest.res.mjs +8 -8
- package/tests/FlowGwtTest.res +4 -4
- package/tests/FlowGwtTest.res.mjs +4 -4
- package/tests/HintTest.res +2 -2
- package/tests/HintTest.res.mjs +1 -1
- package/tests/MappingGwtTest.res +5 -5
- package/tests/MappingGwtTest.res.mjs +6 -6
- package/tests/ScenarioRecorderTest.res +1 -1
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res +3 -3
- package/tests/StateChange/ExternalAddCategorySlice_GWT.res.mjs +5 -5
- package/tests/StateChange/WithFixtures_GWT.res.mjs +5 -5
- package/tests/StateChange/WithManualOpen_GWT.res.mjs +5 -5
- package/tests/StateChangeSliceAuthorizeGwtTest.res +10 -10
- package/tests/StateChangeSliceAuthorizeGwtTest.res.mjs +14 -14
- package/tests/StateChangeSliceGwtTest.res +9 -9
- package/tests/StateChangeSliceGwtTest.res.mjs +12 -12
- /package/src/StateChange/{ExternalAddCategorySlice_Behavior.res → ExternalAddCategorySlice_Decision.res} +0 -0
- /package/src/StateChange/{ExternalAddCategorySlice_Behavior.res.mjs → ExternalAddCategorySlice_Decision.res.mjs} +0 -0
- /package/src/StateChange/{WithFixtures_Behavior.res → WithFixtures_Decision.res} +0 -0
- /package/src/StateChange/{WithFixtures_Behavior.res.mjs → WithFixtures_Decision.res.mjs} +0 -0
- /package/src/StateChange/{WithManualOpen_Behavior.res → WithManualOpen_Decision.res} +0 -0
- /package/src/StateChange/{WithManualOpen_Behavior.res.mjs → WithManualOpen_Decision.res.mjs} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// on command + event, payload-less consumed events.
|
|
5
5
|
//
|
|
6
6
|
// Spec half (Plan 02 Phase 6) — types, schemas, name. The matching impl
|
|
7
|
-
// half lives in [
|
|
7
|
+
// half lives in [ExternalAddCategorySlice_Decision.res].
|
|
8
8
|
|
|
9
9
|
let name = "ExternalAddCategory"
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// [WithFixtures]; named differently so it gets its own companion
|
|
4
4
|
// [<Stem>_Fixtures] sibling that the PPX considers for auto-open.
|
|
5
5
|
//
|
|
6
|
-
// Spec half — pairs with [
|
|
6
|
+
// Spec half — pairs with [WithManualOpen_Decision.res].
|
|
7
7
|
|
|
8
8
|
let name = "WithManualOpen"
|
|
9
9
|
|
package/tests/CallerTest.res
CHANGED
|
@@ -13,23 +13,23 @@ module Roles = {
|
|
|
13
13
|
|
|
14
14
|
describe("Caller.owner", () => {
|
|
15
15
|
testSync("takes a typed id as the user id it stands for", () =>
|
|
16
|
-
expect(
|
|
16
|
+
expect(Decision_GWT.Caller.owner(CustomerId.makeFromString("c1")).claim)->toEqual(
|
|
17
17
|
Reventless.Message.CallerClaim.Owned({userId: "c1"}),
|
|
18
18
|
)
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
testSync("takes a plain string too", () =>
|
|
22
|
-
expect(
|
|
22
|
+
expect(Decision_GWT.Caller.owner("c1").claim)->toEqual(
|
|
23
23
|
Reventless.Message.CallerClaim.Owned({userId: "c1"}),
|
|
24
24
|
)
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
testSync("holds no role unless given some", () =>
|
|
28
|
-
expect(
|
|
28
|
+
expect(Decision_GWT.Caller.owner("c1").roles)->toEqual([])
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
testSync("holds the roles it is given, by name", () =>
|
|
32
|
-
expect(
|
|
32
|
+
expect(Decision_GWT.Caller.owner("c1", ~roles=[Roles.Merchandiser]).roles)->toEqual([
|
|
33
33
|
"Merchandiser",
|
|
34
34
|
])
|
|
35
35
|
)
|
|
@@ -38,7 +38,7 @@ describe("Caller.owner", () => {
|
|
|
38
38
|
// with a recorded owner would only ever refuse — a silent wrong answer.
|
|
39
39
|
testSync("refuses a value that is not an id", () =>
|
|
40
40
|
expect(
|
|
41
|
-
switch
|
|
41
|
+
switch Decision_GWT.Caller.owner(42) {
|
|
42
42
|
| _ => false
|
|
43
43
|
| exception _ => true
|
|
44
44
|
},
|
|
@@ -48,13 +48,13 @@ describe("Caller.owner", () => {
|
|
|
48
48
|
|
|
49
49
|
describe("Caller.inRoles", () => {
|
|
50
50
|
testSync("is signed in, holds the roles, and owns nothing in particular", () => {
|
|
51
|
-
let caller =
|
|
51
|
+
let caller = Decision_GWT.Caller.inRoles([Roles.Merchandiser])
|
|
52
52
|
expect((caller.signedIn, caller.roles))->toEqual((true, ["Merchandiser"]))
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
testSync("refuses a role that is not a payload-less case", () =>
|
|
56
56
|
expect(
|
|
57
|
-
switch
|
|
57
|
+
switch Decision_GWT.Caller.inRoles([42]) {
|
|
58
58
|
| _ => false
|
|
59
59
|
| exception _ => true
|
|
60
60
|
},
|
package/tests/CallerTest.res.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as Decision_GWT$ReventlessGwt from "../src/Decision_GWT.res.mjs";
|
|
5
5
|
|
|
6
6
|
let CustomerId = Id$Reventless.Make({
|
|
7
7
|
key: "customerId"
|
|
@@ -11,27 +11,27 @@ let Roles = {};
|
|
|
11
11
|
|
|
12
12
|
globalThis.describe("Caller.owner", () => {
|
|
13
13
|
globalThis.test("takes a typed id as the user id it stands for", () => {
|
|
14
|
-
globalThis.expect(
|
|
14
|
+
globalThis.expect(Decision_GWT$ReventlessGwt.Caller.owner(CustomerId.makeFromString("c1"), undefined).claim).toEqual({
|
|
15
15
|
TAG: "Owned",
|
|
16
16
|
userId: "c1"
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
globalThis.test("takes a plain string too", () => {
|
|
20
|
-
globalThis.expect(
|
|
20
|
+
globalThis.expect(Decision_GWT$ReventlessGwt.Caller.owner("c1", undefined).claim).toEqual({
|
|
21
21
|
TAG: "Owned",
|
|
22
22
|
userId: "c1"
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
globalThis.test("holds no role unless given some", () => {
|
|
26
|
-
globalThis.expect(
|
|
26
|
+
globalThis.expect(Decision_GWT$ReventlessGwt.Caller.owner("c1", undefined).roles).toEqual([]);
|
|
27
27
|
});
|
|
28
28
|
globalThis.test("holds the roles it is given, by name", () => {
|
|
29
|
-
globalThis.expect(
|
|
29
|
+
globalThis.expect(Decision_GWT$ReventlessGwt.Caller.owner("c1", ["Merchandiser"]).roles).toEqual(["Merchandiser"]);
|
|
30
30
|
});
|
|
31
31
|
globalThis.test("refuses a value that is not an id", () => {
|
|
32
32
|
let tmp;
|
|
33
33
|
try {
|
|
34
|
-
|
|
34
|
+
Decision_GWT$ReventlessGwt.Caller.owner(42, undefined);
|
|
35
35
|
tmp = false;
|
|
36
36
|
} catch (exn) {
|
|
37
37
|
tmp = true;
|
|
@@ -42,7 +42,7 @@ globalThis.describe("Caller.owner", () => {
|
|
|
42
42
|
|
|
43
43
|
globalThis.describe("Caller.inRoles", () => {
|
|
44
44
|
globalThis.test("is signed in, holds the roles, and owns nothing in particular", () => {
|
|
45
|
-
let caller =
|
|
45
|
+
let caller = Decision_GWT$ReventlessGwt.Caller.inRoles(["Merchandiser"]);
|
|
46
46
|
globalThis.expect([
|
|
47
47
|
caller.signedIn,
|
|
48
48
|
caller.roles
|
|
@@ -54,7 +54,7 @@ globalThis.describe("Caller.inRoles", () => {
|
|
|
54
54
|
globalThis.test("refuses a role that is not a payload-less case", () => {
|
|
55
55
|
let tmp;
|
|
56
56
|
try {
|
|
57
|
-
|
|
57
|
+
Decision_GWT$ReventlessGwt.Caller.inRoles([42]);
|
|
58
58
|
tmp = false;
|
|
59
59
|
} catch (exn) {
|
|
60
60
|
tmp = true;
|
|
@@ -24,7 +24,7 @@ module CatalogProductAggregate = {
|
|
|
24
24
|
type error = AlreadySynced
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
module
|
|
27
|
+
module CatalogProductDecision = {
|
|
28
28
|
module Spec = CatalogProductAggregate
|
|
29
29
|
|
|
30
30
|
type state = NotSynced | Synced
|
|
@@ -44,7 +44,7 @@ module CatalogProductBehavior = {
|
|
|
44
44
|
| (Synced, _) => Error(CatalogProductAggregate.AlreadySynced)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
let moduleUrl = "test://
|
|
47
|
+
let moduleUrl = "test://CatalogProductDecision"
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// -- Aggregate: Order ---------------------------------------------------------
|
|
@@ -68,7 +68,7 @@ module OrderAggregate = {
|
|
|
68
68
|
| NotPlaced
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
module
|
|
71
|
+
module OrderDecision = {
|
|
72
72
|
module Spec = OrderAggregate
|
|
73
73
|
|
|
74
74
|
type state = {placed: bool, shipped: bool}
|
|
@@ -98,13 +98,13 @@ module OrderBehavior = {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
let moduleUrl = "test://
|
|
101
|
+
let moduleUrl = "test://OrderDecision"
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// -- Step modules -------------------------------------------------------------
|
|
105
105
|
|
|
106
|
-
module Sync = AggregateCommandStep(CatalogProductAggregate,
|
|
107
|
-
module Place = AggregateCommandStep(OrderAggregate,
|
|
106
|
+
module Sync = AggregateCommandStep(CatalogProductAggregate, CatalogProductDecision)
|
|
107
|
+
module Place = AggregateCommandStep(OrderAggregate, OrderDecision)
|
|
108
108
|
|
|
109
109
|
// -- Flows --------------------------------------------------------------------
|
|
110
110
|
|
|
@@ -59,9 +59,9 @@ function decide(state, command) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
let moduleUrl = "test://
|
|
62
|
+
let moduleUrl = "test://CatalogProductDecision";
|
|
63
63
|
|
|
64
|
-
let
|
|
64
|
+
let CatalogProductDecision = {
|
|
65
65
|
Spec: undefined,
|
|
66
66
|
initialState: "NotSynced",
|
|
67
67
|
snapshot: undefined,
|
|
@@ -169,9 +169,9 @@ function decide$1(state, command) {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
let moduleUrl$1 = "test://
|
|
172
|
+
let moduleUrl$1 = "test://OrderDecision";
|
|
173
173
|
|
|
174
|
-
let
|
|
174
|
+
let OrderDecision = {
|
|
175
175
|
Spec: undefined,
|
|
176
176
|
initialState: initialState,
|
|
177
177
|
snapshot: undefined,
|
|
@@ -278,9 +278,9 @@ Flow_GWT$ReventlessGwt.describe("Aggregate flow (single plugin)", () => {
|
|
|
278
278
|
|
|
279
279
|
export {
|
|
280
280
|
CatalogProductAggregate,
|
|
281
|
-
|
|
281
|
+
CatalogProductDecision,
|
|
282
282
|
OrderAggregate,
|
|
283
|
-
|
|
283
|
+
OrderDecision,
|
|
284
284
|
Sync,
|
|
285
285
|
Place,
|
|
286
286
|
}
|
|
@@ -46,7 +46,7 @@ module AddProductSlice = {
|
|
|
46
46
|
})
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
module
|
|
49
|
+
module AddProductDecision = {
|
|
50
50
|
module Spec = AddProductSlice
|
|
51
51
|
type state = {added: bool}
|
|
52
52
|
let initialState = {added: false}
|
|
@@ -164,7 +164,7 @@ module RecordDemandSlice = {
|
|
|
164
164
|
let commandTransition = (_: command): Reventless.Transition.t<lifecycleState> => Unrestricted
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
module
|
|
167
|
+
module RecordDemandDecision = {
|
|
168
168
|
module Spec = RecordDemandSlice
|
|
169
169
|
type state = {count: int}
|
|
170
170
|
let initialState = {count: 0}
|
|
@@ -225,7 +225,7 @@ module SyncProductSlice = {
|
|
|
225
225
|
let commandTransition = (_: command): Reventless.Transition.t<lifecycleState> => Unrestricted
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
module
|
|
228
|
+
module SyncProductDecision = {
|
|
229
229
|
module Spec = SyncProductSlice
|
|
230
230
|
type state = {synced: bool}
|
|
231
231
|
let initialState = {synced: false}
|
|
@@ -278,7 +278,7 @@ module PlaceOrderSlice = {
|
|
|
278
278
|
})
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
module
|
|
281
|
+
module PlaceOrderDecision = {
|
|
282
282
|
module Spec = PlaceOrderSlice
|
|
283
283
|
type state = {placed: array<string>, available: array<string>}
|
|
284
284
|
let initialState = {placed: [], available: []}
|
|
@@ -308,14 +308,14 @@ module PlaceOrderBehavior = {
|
|
|
308
308
|
// Step modules
|
|
309
309
|
// ===========================================================================
|
|
310
310
|
|
|
311
|
-
module AddProduct = CommandStep(AddProductSlice,
|
|
311
|
+
module AddProduct = CommandStep(AddProductSlice, AddProductDecision)
|
|
312
312
|
module ProductsEp = ExtensionPointStep(ProductsEpMapping)
|
|
313
313
|
module ProductsExt = ExtensionStep(ProductsExtMapping)
|
|
314
|
-
module Sync = CommandStep(SyncProductSlice,
|
|
315
|
-
module Place = CommandStep(PlaceOrderSlice,
|
|
314
|
+
module Sync = CommandStep(SyncProductSlice, SyncProductDecision)
|
|
315
|
+
module Place = CommandStep(PlaceOrderSlice, PlaceOrderDecision)
|
|
316
316
|
module OrdersEp = ExtensionPointStep(OrdersEpMapping)
|
|
317
317
|
module OrdersExt = ExtensionStep(OrdersExtMapping)
|
|
318
|
-
module Demand = CommandStep(RecordDemandSlice,
|
|
318
|
+
module Demand = CommandStep(RecordDemandSlice, RecordDemandDecision)
|
|
319
319
|
|
|
320
320
|
// ===========================================================================
|
|
321
321
|
// Flows
|
|
@@ -77,7 +77,7 @@ function decide(state, command) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
let
|
|
80
|
+
let AddProductDecision = {
|
|
81
81
|
Spec: undefined,
|
|
82
82
|
initialState: initialState,
|
|
83
83
|
evolve: evolve,
|
|
@@ -362,7 +362,7 @@ function decide$1(_state, command) {
|
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
let
|
|
365
|
+
let RecordDemandDecision = {
|
|
366
366
|
Spec: undefined,
|
|
367
367
|
initialState: initialState$1,
|
|
368
368
|
evolve: evolve$1,
|
|
@@ -473,7 +473,7 @@ function decide$2(_state, command) {
|
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
let
|
|
476
|
+
let SyncProductDecision = {
|
|
477
477
|
Spec: undefined,
|
|
478
478
|
initialState: initialState$2,
|
|
479
479
|
evolve: evolve$2,
|
|
@@ -620,7 +620,7 @@ function decide$3(state, command) {
|
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
|
|
623
|
-
let
|
|
623
|
+
let PlaceOrderDecision = {
|
|
624
624
|
Spec: undefined,
|
|
625
625
|
initialState: initialState$3,
|
|
626
626
|
evolve: evolve$3,
|
|
@@ -887,7 +887,7 @@ export {
|
|
|
887
887
|
EPM,
|
|
888
888
|
EM,
|
|
889
889
|
AddProductSlice,
|
|
890
|
-
|
|
890
|
+
AddProductDecision,
|
|
891
891
|
ProductsEpSpec,
|
|
892
892
|
ProductDelegate,
|
|
893
893
|
ProductsEpMapping,
|
|
@@ -895,13 +895,13 @@ export {
|
|
|
895
895
|
OrderDelegate,
|
|
896
896
|
OrdersEpMapping,
|
|
897
897
|
RecordDemandSlice,
|
|
898
|
-
|
|
898
|
+
RecordDemandDecision,
|
|
899
899
|
OrdersExtMapping,
|
|
900
900
|
SyncProductSlice,
|
|
901
|
-
|
|
901
|
+
SyncProductDecision,
|
|
902
902
|
ProductsExtMapping,
|
|
903
903
|
PlaceOrderSlice,
|
|
904
|
-
|
|
904
|
+
PlaceOrderDecision,
|
|
905
905
|
AddProduct,
|
|
906
906
|
ProductsEp,
|
|
907
907
|
ProductsExt,
|
package/tests/FlowGwtTest.res
CHANGED
|
@@ -28,7 +28,7 @@ module PlaceOrderSlice = {
|
|
|
28
28
|
type event = OrderPlaced({orderId: @s.matches(Reventless.DcbTag.string) string, item: string})
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
module
|
|
31
|
+
module PlaceOrderDecision = {
|
|
32
32
|
module Spec = PlaceOrderSlice
|
|
33
33
|
type state = {placed: bool}
|
|
34
34
|
let initialState = {placed: false}
|
|
@@ -95,7 +95,7 @@ module ShipOrderSlice = {
|
|
|
95
95
|
type event = OrderShipped({orderId: @s.matches(Reventless.DcbTag.string) string})
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
module
|
|
98
|
+
module ShipOrderDecision = {
|
|
99
99
|
module Spec = ShipOrderSlice
|
|
100
100
|
type state = {placed: bool, shipped: bool}
|
|
101
101
|
let initialState = {placed: false, shipped: false}
|
|
@@ -167,9 +167,9 @@ module ConfirmSlice = {
|
|
|
167
167
|
|
|
168
168
|
// -- Step modules ------------------------------------------------------------
|
|
169
169
|
|
|
170
|
-
module Place = CommandStep(PlaceOrderSlice,
|
|
170
|
+
module Place = CommandStep(PlaceOrderSlice, PlaceOrderDecision)
|
|
171
171
|
module Auto = AutomationStep(AutoShipSlice)
|
|
172
|
-
module Ship = CommandStep(ShipOrderSlice,
|
|
172
|
+
module Ship = CommandStep(ShipOrderSlice, ShipOrderDecision)
|
|
173
173
|
module View = ViewStep(OrdersViewSlice, OrdersViewProjection)
|
|
174
174
|
module Confirm = OutboundStep(ConfirmSlice)
|
|
175
175
|
|
|
@@ -74,7 +74,7 @@ function decide(state, command) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
let
|
|
77
|
+
let PlaceOrderDecision = {
|
|
78
78
|
Spec: undefined,
|
|
79
79
|
initialState: initialState,
|
|
80
80
|
evolve: evolve,
|
|
@@ -248,7 +248,7 @@ function decide$1(state, command) {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
let
|
|
251
|
+
let ShipOrderDecision = {
|
|
252
252
|
Spec: undefined,
|
|
253
253
|
initialState: initialState$1,
|
|
254
254
|
evolve: evolve$1,
|
|
@@ -463,10 +463,10 @@ Flow_GWT$ReventlessGwt.describe("Order flow (single plugin)", () => {
|
|
|
463
463
|
|
|
464
464
|
export {
|
|
465
465
|
PlaceOrderSlice,
|
|
466
|
-
|
|
466
|
+
PlaceOrderDecision,
|
|
467
467
|
AutoShipSlice,
|
|
468
468
|
ShipOrderSlice,
|
|
469
|
-
|
|
469
|
+
ShipOrderDecision,
|
|
470
470
|
OrdersViewSlice,
|
|
471
471
|
OrdersViewProjection,
|
|
472
472
|
ConfirmSlice,
|
package/tests/HintTest.res
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// A state mismatch's hint names the fold that produced the state: `project` for
|
|
2
|
-
// a view's scenario, `evolve` for a
|
|
2
|
+
// a view's scenario, `evolve` for a decision's.
|
|
3
3
|
|
|
4
4
|
open JestGlobals
|
|
5
5
|
|
|
@@ -46,7 +46,7 @@ describe("Hint for a StateMismatch", () => {
|
|
|
46
46
|
}
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
-
testSync("a
|
|
49
|
+
testSync("a decision's differing state still points at evolve", () => {
|
|
50
50
|
let hint = Hint.forMismatch(
|
|
51
51
|
~slice="AddCategory",
|
|
52
52
|
Outcome.StateMismatch({key: "c1", expected: None, actual: None}),
|
package/tests/HintTest.res.mjs
CHANGED
|
@@ -80,7 +80,7 @@ globalThis.describe("Hint for a StateMismatch", () => {
|
|
|
80
80
|
globalThis.expect(hint.locus).toBe("CategoriesView.project");
|
|
81
81
|
globalThis.expect(hint.message).toBe("project() filed a different row than expected. Check the arm for the event and the key it sets.");
|
|
82
82
|
});
|
|
83
|
-
globalThis.test("a
|
|
83
|
+
globalThis.test("a decision's differing state still points at evolve", () => {
|
|
84
84
|
let hint = Hint$ReventlessGwt.forMismatch("AddCategory", {
|
|
85
85
|
TAG: "StateMismatch",
|
|
86
86
|
key: "c1",
|
package/tests/MappingGwtTest.res
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// module types.
|
|
8
8
|
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
|
-
// Shared Aggregate specs +
|
|
10
|
+
// Shared Aggregate specs + decisions used by the Aggr→* cases below.
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
|
|
13
13
|
module CategorySpec = {
|
|
@@ -26,7 +26,7 @@ module CategorySpec = {
|
|
|
26
26
|
let moduleUrl = ""
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
module
|
|
29
|
+
module CategoryDecision = {
|
|
30
30
|
module Spec = CategorySpec
|
|
31
31
|
type state = NotCreated | Created
|
|
32
32
|
let initialState = NotCreated
|
|
@@ -64,7 +64,7 @@ module ProductSpec = {
|
|
|
64
64
|
let moduleUrl = ""
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
module
|
|
67
|
+
module ProductDecision = {
|
|
68
68
|
module Spec = ProductSpec
|
|
69
69
|
type state = Pristine | Mirrored
|
|
70
70
|
let initialState = Pristine
|
|
@@ -164,8 +164,8 @@ module InventorySlice = {
|
|
|
164
164
|
// Adapter aliases — built once, shared across mappings.
|
|
165
165
|
// ---------------------------------------------------------------------------
|
|
166
166
|
|
|
167
|
-
module CategorySource = Mapping_GWT.
|
|
168
|
-
module ProductTarget = Mapping_GWT.
|
|
167
|
+
module CategorySource = Mapping_GWT.FromDecision(CategorySpec, CategoryDecision)
|
|
168
|
+
module ProductTarget = Mapping_GWT.FromDecision(ProductSpec, ProductDecision)
|
|
169
169
|
module NotificationSource = Mapping_GWT.FromStateChangeSlice(NotificationSlice)
|
|
170
170
|
module NotificationTarget = Mapping_GWT.FromStateChangeSlice(NotificationSlice)
|
|
171
171
|
module InventoryTarget = Mapping_GWT.FromStateChangeSlice(InventorySlice)
|
|
@@ -69,7 +69,7 @@ function decide(state, cmd) {
|
|
|
69
69
|
|
|
70
70
|
let moduleUrl$1 = "";
|
|
71
71
|
|
|
72
|
-
let
|
|
72
|
+
let CategoryDecision = {
|
|
73
73
|
Spec: undefined,
|
|
74
74
|
initialState: "NotCreated",
|
|
75
75
|
snapshot: undefined,
|
|
@@ -145,7 +145,7 @@ function decide$1(state, cmd) {
|
|
|
145
145
|
|
|
146
146
|
let moduleUrl$3 = "";
|
|
147
147
|
|
|
148
|
-
let
|
|
148
|
+
let ProductDecision = {
|
|
149
149
|
Spec: undefined,
|
|
150
150
|
initialState: "Pristine",
|
|
151
151
|
snapshot: undefined,
|
|
@@ -298,7 +298,7 @@ let InventorySlice = {
|
|
|
298
298
|
readConsistency: "EscalateOnRetry"
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
let CategorySource = Mapping_GWT$ReventlessGwt.
|
|
301
|
+
let CategorySource = Mapping_GWT$ReventlessGwt.FromDecision({
|
|
302
302
|
Id: {
|
|
303
303
|
schema: Id$Reventless.StringPure.schema,
|
|
304
304
|
make: prim => prim,
|
|
@@ -339,7 +339,7 @@ let CategorySource = Mapping_GWT$ReventlessGwt.FromBehavior({
|
|
|
339
339
|
moduleUrl: moduleUrl$1
|
|
340
340
|
});
|
|
341
341
|
|
|
342
|
-
let ProductTarget = Mapping_GWT$ReventlessGwt.
|
|
342
|
+
let ProductTarget = Mapping_GWT$ReventlessGwt.FromDecision({
|
|
343
343
|
Id: {
|
|
344
344
|
schema: Id$Reventless.StringPure.schema,
|
|
345
345
|
make: prim => prim,
|
|
@@ -611,9 +611,9 @@ DcbToDcbGwt.describe("Inventory → Notification (DCB → DCB)", () => {
|
|
|
611
611
|
|
|
612
612
|
export {
|
|
613
613
|
CategorySpec,
|
|
614
|
-
|
|
614
|
+
CategoryDecision,
|
|
615
615
|
ProductSpec,
|
|
616
|
-
|
|
616
|
+
ProductDecision,
|
|
617
617
|
NotificationSlice,
|
|
618
618
|
InventorySlice,
|
|
619
619
|
CategorySource,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
open JestGlobals
|
|
2
2
|
|
|
3
|
-
// `ScenarioRecorder` writes what a
|
|
3
|
+
// `ScenarioRecorder` writes what a decision test runs as a sidecar `check-lifecycle` reads, for
|
|
4
4
|
// a suite whose source names nothing (one written against a binding). Each case records into a
|
|
5
5
|
// file of its own under the OS temp folder, named by `setFile` as an external runner would.
|
|
6
6
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// External-Spec verification test for @@reventless.gwt.
|
|
2
2
|
//
|
|
3
3
|
// Zero payload, no local module, no alias. The PPX resolves:
|
|
4
|
-
// - Kind from the folder segment "StateChange" ->
|
|
4
|
+
// - Kind from the folder segment "StateChange" -> Decision
|
|
5
5
|
// - Spec from the filename stem (strip "_GWT") -> ExternalAddCategorySlice
|
|
6
|
-
// - Impl derived as
|
|
6
|
+
// - Impl derived as ExternalAddCategorySlice_Decision
|
|
7
7
|
// - open ExternalAddCategorySlice +
|
|
8
|
-
// include
|
|
8
|
+
// include Decision_GWT.Make(ExternalAddCategorySlice, ExternalAddCategorySlice_Decision)
|
|
9
9
|
//
|
|
10
10
|
// Mirrors the canonical consumer pattern documented in
|
|
11
11
|
// docs/guides/given-when-then.md § 4.10.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Decision_GWT$ReventlessGwt from "../../src/Decision_GWT.res.mjs";
|
|
4
4
|
import * as ExternalAddCategorySlice$ReventlessGwt from "../../src/StateChange/ExternalAddCategorySlice.res.mjs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as ExternalAddCategorySlice_Decision$ReventlessGwt from "../../src/StateChange/ExternalAddCategorySlice_Decision.res.mjs";
|
|
6
6
|
|
|
7
|
-
let include =
|
|
7
|
+
let include = Decision_GWT$ReventlessGwt.Make(ExternalAddCategorySlice$ReventlessGwt)(ExternalAddCategorySlice_Decision$ReventlessGwt);
|
|
8
8
|
|
|
9
9
|
let describe = include.describe;
|
|
10
10
|
|
|
@@ -51,7 +51,7 @@ let thenEventWithError = include.thenEventWithError;
|
|
|
51
51
|
|
|
52
52
|
let thenEventsWithError = include.thenEventsWithError;
|
|
53
53
|
|
|
54
|
-
let
|
|
54
|
+
let thenForbidden = include.thenForbidden;
|
|
55
55
|
|
|
56
56
|
let thenAppendsConditionedOn = include.thenAppendsConditionedOn;
|
|
57
57
|
|
|
@@ -72,7 +72,7 @@ export {
|
|
|
72
72
|
thenEventWithError,
|
|
73
73
|
thenEventsWithError,
|
|
74
74
|
thenError,
|
|
75
|
-
|
|
75
|
+
thenForbidden,
|
|
76
76
|
thenAppendsConditionedOn,
|
|
77
77
|
thenAppendsConditionedOnExactly,
|
|
78
78
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Decision_GWT$ReventlessGwt from "../../src/Decision_GWT.res.mjs";
|
|
4
4
|
import * as WithFixtures$ReventlessGwt from "../../src/StateChange/WithFixtures.res.mjs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as WithFixtures_Decision$ReventlessGwt from "../../src/StateChange/WithFixtures_Decision.res.mjs";
|
|
6
6
|
import * as WithFixtures_Fixtures$ReventlessGwt from "./WithFixtures_Fixtures.res.mjs";
|
|
7
7
|
|
|
8
|
-
let include =
|
|
8
|
+
let include = Decision_GWT$ReventlessGwt.Make(WithFixtures$ReventlessGwt)(WithFixtures_Decision$ReventlessGwt);
|
|
9
9
|
|
|
10
10
|
let describe = include.describe;
|
|
11
11
|
|
|
@@ -37,7 +37,7 @@ let thenEventsWithError = include.thenEventsWithError;
|
|
|
37
37
|
|
|
38
38
|
let thenError = include.thenError;
|
|
39
39
|
|
|
40
|
-
let
|
|
40
|
+
let thenForbidden = include.thenForbidden;
|
|
41
41
|
|
|
42
42
|
let thenAppendsConditionedOn = include.thenAppendsConditionedOn;
|
|
43
43
|
|
|
@@ -58,7 +58,7 @@ export {
|
|
|
58
58
|
thenEventWithError,
|
|
59
59
|
thenEventsWithError,
|
|
60
60
|
thenError,
|
|
61
|
-
|
|
61
|
+
thenForbidden,
|
|
62
62
|
thenAppendsConditionedOn,
|
|
63
63
|
thenAppendsConditionedOnExactly,
|
|
64
64
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
|
-
import * as
|
|
3
|
+
import * as Decision_GWT$ReventlessGwt from "../../src/Decision_GWT.res.mjs";
|
|
4
4
|
import * as WithManualOpen$ReventlessGwt from "../../src/StateChange/WithManualOpen.res.mjs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as WithManualOpen_Decision$ReventlessGwt from "../../src/StateChange/WithManualOpen_Decision.res.mjs";
|
|
6
6
|
import * as WithManualOpen_Fixtures$ReventlessGwt from "./WithManualOpen_Fixtures.res.mjs";
|
|
7
7
|
|
|
8
|
-
let include =
|
|
8
|
+
let include = Decision_GWT$ReventlessGwt.Make(WithManualOpen$ReventlessGwt)(WithManualOpen_Decision$ReventlessGwt);
|
|
9
9
|
|
|
10
10
|
let describe = include.describe;
|
|
11
11
|
|
|
@@ -37,7 +37,7 @@ let thenEventsWithError = include.thenEventsWithError;
|
|
|
37
37
|
|
|
38
38
|
let thenError = include.thenError;
|
|
39
39
|
|
|
40
|
-
let
|
|
40
|
+
let thenForbidden = include.thenForbidden;
|
|
41
41
|
|
|
42
42
|
let thenAppendsConditionedOn = include.thenAppendsConditionedOn;
|
|
43
43
|
|
|
@@ -58,7 +58,7 @@ export {
|
|
|
58
58
|
thenEventWithError,
|
|
59
59
|
thenEventsWithError,
|
|
60
60
|
thenError,
|
|
61
|
-
|
|
61
|
+
thenForbidden,
|
|
62
62
|
thenAppendsConditionedOn,
|
|
63
63
|
thenAppendsConditionedOnExactly,
|
|
64
64
|
}
|