@reventlessdev/reventless-gwt 1.0.0-alpha.247 → 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 +21 -0
- package/README.md +1 -1
- package/package.json +7 -7
- package/src/.gwtignore +1 -1
- package/src/{Behavior_GWT.res → Decision_GWT.res} +110 -40
- package/src/{Behavior_GWT.res.mjs → Decision_GWT.res.mjs} +92 -42
- 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 +182 -0
- package/src/ScenarioRecorder.res.mjs +287 -0
- 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 +101 -0
- package/tests/ScenarioRecorderTest.res.mjs +163 -0
- 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
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Nodefs from "node:fs";
|
|
4
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
+
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
7
|
+
|
|
8
|
+
function enabled() {
|
|
9
|
+
let match = process.env["REVENTLESS_EMIT_SIDECAR"];
|
|
10
|
+
if (match === undefined) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
switch (match) {
|
|
14
|
+
case "1" :
|
|
15
|
+
case "TRUE" :
|
|
16
|
+
case "true" :
|
|
17
|
+
return true;
|
|
18
|
+
default:
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let current = {
|
|
24
|
+
contents: undefined
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let fileOverride = {
|
|
28
|
+
contents: undefined
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function setFile(path) {
|
|
32
|
+
fileOverride.contents = path;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let jestTestPath = (function () {
|
|
36
|
+
try {
|
|
37
|
+
const state = globalThis.expect && globalThis.expect.getState && globalThis.expect.getState();
|
|
38
|
+
return state && typeof state.testPath === "string" ? state.testPath : undefined;
|
|
39
|
+
} catch (_) { return undefined; }
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function testFile() {
|
|
43
|
+
let f = fileOverride.contents;
|
|
44
|
+
if (f !== undefined) {
|
|
45
|
+
return f;
|
|
46
|
+
} else {
|
|
47
|
+
return jestTestPath();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let recorded = new Map();
|
|
52
|
+
|
|
53
|
+
let specsOf = new Map();
|
|
54
|
+
|
|
55
|
+
let foreign = new Set();
|
|
56
|
+
|
|
57
|
+
function baseOf(file) {
|
|
58
|
+
return Stdlib_Array.reduce([
|
|
59
|
+
".res.mjs",
|
|
60
|
+
".res.js",
|
|
61
|
+
".res",
|
|
62
|
+
".mjs",
|
|
63
|
+
".js"
|
|
64
|
+
], file, (f, ext) => {
|
|
65
|
+
if (f.endsWith(ext)) {
|
|
66
|
+
return f.slice(0, f.length - ext.length | 0);
|
|
67
|
+
} else {
|
|
68
|
+
return f;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function sidecarFor(file, spec) {
|
|
74
|
+
let specs = Stdlib_Option.getOr(specsOf.get(file), []);
|
|
75
|
+
if (!specs.includes(spec)) {
|
|
76
|
+
specs.push(spec);
|
|
77
|
+
specsOf.set(file, specs);
|
|
78
|
+
}
|
|
79
|
+
if (specs.indexOf(spec) === 0) {
|
|
80
|
+
return baseOf(file) + `.gwt.json`;
|
|
81
|
+
} else {
|
|
82
|
+
return baseOf(file) + `.` + spec + `.gwt.json`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function writtenByPpx(path) {
|
|
87
|
+
if (!Nodefs.existsSync(path)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
let d;
|
|
91
|
+
try {
|
|
92
|
+
d = JSON.parse(Nodefs.readFileSync(path, "utf8"));
|
|
93
|
+
} catch (exn) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
if (typeof d === "object" && d !== null && !Array.isArray(d)) {
|
|
97
|
+
return Primitive_object.notequal(d["recorded"], true);
|
|
98
|
+
} else {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function entryJson(e) {
|
|
104
|
+
return Object.fromEntries([
|
|
105
|
+
[
|
|
106
|
+
"kind",
|
|
107
|
+
e.kind
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
"element",
|
|
111
|
+
e.element
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"values",
|
|
115
|
+
[]
|
|
116
|
+
]
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function write(path, file, spec, scenarios) {
|
|
121
|
+
let json = Object.fromEntries([
|
|
122
|
+
[
|
|
123
|
+
"specName",
|
|
124
|
+
spec + ` (recorded)`
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
"stem",
|
|
128
|
+
spec
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
"file",
|
|
132
|
+
file
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
"componentKind",
|
|
136
|
+
"Decision"
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
"recorded",
|
|
140
|
+
true
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
"scenarios",
|
|
144
|
+
scenarios.map(s => (Object.fromEntries([
|
|
145
|
+
[
|
|
146
|
+
"title",
|
|
147
|
+
s.title
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
"given",
|
|
151
|
+
s.given.map(entryJson)
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
"when",
|
|
155
|
+
s.when_.map(entryJson)
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
"then",
|
|
159
|
+
s.then_.map(entryJson)
|
|
160
|
+
]
|
|
161
|
+
])))
|
|
162
|
+
]
|
|
163
|
+
]);
|
|
164
|
+
Nodefs.writeFileSync(path, Stdlib_Option.getOr(JSON.stringify(json, undefined, 2), "{}") + "\n", "utf8");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function around(spec, title, body) {
|
|
168
|
+
if (!enabled()) {
|
|
169
|
+
return body();
|
|
170
|
+
}
|
|
171
|
+
current.contents = {
|
|
172
|
+
title: title,
|
|
173
|
+
given: [],
|
|
174
|
+
when_: [],
|
|
175
|
+
then_: []
|
|
176
|
+
};
|
|
177
|
+
let finish = () => {
|
|
178
|
+
let scenario = current.contents;
|
|
179
|
+
current.contents = undefined;
|
|
180
|
+
let match = testFile();
|
|
181
|
+
if (scenario === undefined) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (match === undefined) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
let path = sidecarFor(match, spec);
|
|
188
|
+
if (!foreign.has(path) && !recorded.has(path) && writtenByPpx(path)) {
|
|
189
|
+
foreign.add(path);
|
|
190
|
+
}
|
|
191
|
+
if (foreign.has(path)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let match$1 = Stdlib_Option.getOr(recorded.get(path), [
|
|
195
|
+
spec,
|
|
196
|
+
[]
|
|
197
|
+
]);
|
|
198
|
+
let scenarios = match$1[1].filter(o => o.title !== scenario.title).concat([scenario]);
|
|
199
|
+
recorded.set(path, [
|
|
200
|
+
spec,
|
|
201
|
+
scenarios
|
|
202
|
+
]);
|
|
203
|
+
write(path, match, spec, scenarios);
|
|
204
|
+
};
|
|
205
|
+
let outcome;
|
|
206
|
+
try {
|
|
207
|
+
outcome = body();
|
|
208
|
+
} catch (e) {
|
|
209
|
+
finish();
|
|
210
|
+
throw e;
|
|
211
|
+
}
|
|
212
|
+
finish();
|
|
213
|
+
return outcome;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function recording() {
|
|
217
|
+
return Stdlib_Option.isSome(current.contents);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function push(pick, entries) {
|
|
221
|
+
Stdlib_Option.forEach(current.contents, s => {
|
|
222
|
+
entries.forEach(e => {
|
|
223
|
+
pick(s).push(e);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function given(names) {
|
|
229
|
+
push(s => s.given, names.map(element => ({
|
|
230
|
+
kind: "event",
|
|
231
|
+
element: element
|
|
232
|
+
})));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function whenCommand(name) {
|
|
236
|
+
push(s => s.when_, [{
|
|
237
|
+
kind: "command",
|
|
238
|
+
element: name
|
|
239
|
+
}]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function thenEvents(names) {
|
|
243
|
+
push(s => s.then_, names.map(element => ({
|
|
244
|
+
kind: "event",
|
|
245
|
+
element: element
|
|
246
|
+
})));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function thenError(name) {
|
|
250
|
+
push(s => s.then_, [{
|
|
251
|
+
kind: "error",
|
|
252
|
+
element: name
|
|
253
|
+
}]);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function thenNoEvent() {
|
|
257
|
+
push(s => s.then_, [{
|
|
258
|
+
kind: "noEvent",
|
|
259
|
+
element: ""
|
|
260
|
+
}]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export {
|
|
264
|
+
enabled,
|
|
265
|
+
current,
|
|
266
|
+
fileOverride,
|
|
267
|
+
setFile,
|
|
268
|
+
jestTestPath,
|
|
269
|
+
testFile,
|
|
270
|
+
recorded,
|
|
271
|
+
specsOf,
|
|
272
|
+
foreign,
|
|
273
|
+
baseOf,
|
|
274
|
+
sidecarFor,
|
|
275
|
+
writtenByPpx,
|
|
276
|
+
entryJson,
|
|
277
|
+
write,
|
|
278
|
+
around,
|
|
279
|
+
recording,
|
|
280
|
+
push,
|
|
281
|
+
given,
|
|
282
|
+
whenCommand,
|
|
283
|
+
thenEvents,
|
|
284
|
+
thenError,
|
|
285
|
+
thenNoEvent,
|
|
286
|
+
}
|
|
287
|
+
/* recorded Not a pure module */
|
|
@@ -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,
|