@reventlessdev/reventless-core 3.0.0-alpha.300 → 3.0.0-alpha.302
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 +32 -0
- package/README.md +3 -3
- package/package.json +10 -10
- package/src/{Behavior.res → Decision.res} +1 -1
- package/src/Message.res +1 -1
- package/src/ResourceAttribution.res +8 -8
- package/src/adapter/Auth/Auth_ActiveRole.res +1 -1
- package/src/adapter/Auth/Auth_RefusalVocabulary.res +1 -1
- package/src/adapter/EventLogProvisioning/EventLogProvisioning.res +1 -1
- package/src/adapter/Runtime/AggregateRuntime_Builder.res +2 -2
- package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res +10 -5
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res +2 -2
- package/src/adapter/Runtime/EventCollectorRuntime_Builder.res +1 -1
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +8 -3
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder.res +1 -1
- package/src/adapter/Runtime/PluginRuntime_Builder.res +3 -3
- package/src/adapter/Runtime/Runtime.res +10 -9
- package/src/adapter/Runtime/TaskRuntime_Builder.res +1 -1
- package/src/adapter/RuntimeExtension/RuntimeExtension.res +3 -3
- package/src/admin/Platform_Admin_Structure.res +3 -3
- package/src/admin/Platform_Admin_Structure.res.mjs +1 -1
- package/src/admin/Platform_BakedManifest.res +8 -8
- package/src/admin/Platform_BakedManifest.res.mjs +2 -2
- package/src/admin/Platform_ComponentDefinitionsApi.res +12 -12
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +11 -11
- package/src/admin/Platform_PluginStructuresApi.res +7 -7
- package/src/admin/Platform_PluginStructuresApi.res.mjs +4 -4
- package/src/admin/UiFragmentRegistry/StateChange/{UiFragmentRegistry_Behavior.res → UiFragmentRegistry_Decision.res} +1 -1
- package/src/admin/UiFragmentRegistry/StateChange/{UiFragmentRegistry_Behavior.res.mjs → UiFragmentRegistry_Decision.res.mjs} +1 -1
- package/src/admin/UiFragmentRegistry/StateView/UiFragments.res.mjs +1 -4
- package/src/components/Aggregate/Aggregate_Builder.res +2 -2
- package/src/components/Aggregate/Aggregate_Builder.res.mjs +2 -2
- package/src/components/Aggregate/Aggregate_Callback.res +17 -17
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +11 -11
- package/src/components/Api/ApiNoApiHelpers.res +1 -1
- package/src/components/Api/GraphQL_FragmentGenerator.res +1 -1
- package/src/components/Api/SchemaType.res +1 -1
- package/src/components/Api/SuryToJsonSchema.res +1 -1
- package/src/components/CommandGenerator/CommandGenerator.res +1 -1
- package/src/components/CommandGenerator/CommandGenerator_Adapter.res +6 -1
- package/src/components/CommandTopic/CommandTopic.res +2 -2
- package/src/components/CommandTopic/CommandTopic_Adapter.res +1 -1
- package/src/components/CommandTopic/CommandTopic_Helpers.res +4 -4
- package/src/components/EventCollector/EventCollector.res +1 -1
- package/src/components/EventCollector/EventCollector_Adapter.res +1 -1
- package/src/components/EventLog/EventLog_Operations.res +2 -2
- package/src/components/Heartbeat/Heartbeat.res +1 -1
- package/src/components/ReadModel/ReadModel.res +1 -1
- package/src/components/StateChangeSlice/StateChangeSlice.res +1 -1
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +3 -3
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res.mjs +3 -3
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +9 -9
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +4 -4
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +2 -2
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +1 -1
- package/src/components/StateViewSlice/StateViewSlice_Callback.res +2 -2
- package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +1 -1
- package/src/components/Task/Task_Adapter.res +1 -1
- package/src/components/Task/Task_Builder.res +1 -1
- package/src/plugin/component/Plugin_Builder.res +7 -7
- package/src/plugin/component/Plugin_Builder.res.mjs +3 -3
- package/src/plugin/component/Plugin_BuiltHook.res +1 -1
- package/src/plugin/component/Plugin_Structure.res +19 -19
- package/src/plugin/component/Plugin_Structure.res.mjs +8 -8
- package/src/plugin/lifecycle/{PluginBehavior.res → PluginDecision.res} +4 -4
- package/src/plugin/lifecycle/{PluginBehavior.res.mjs → PluginDecision.res.mjs} +1 -1
- package/tests/admin/AdminApiSchemaDriftTest.res +8 -8
- package/tests/admin/AdminApiSchemaDriftTest.res.mjs +54 -54
- package/tests/admin/Platform_Admin_StructureTest.res +10 -10
- package/tests/admin/Platform_Admin_StructureTest.res.mjs +5 -5
- package/tests/admin/Platform_BakedManifestTest.res +7 -7
- package/tests/admin/Platform_BakedManifestTest.res.mjs +9 -9
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +11 -11
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +5 -5
- package/tests/admin/Platform_PluginStructuresApiTest.res +3 -3
- package/tests/aggregate/AggregateCacheTest.res +4 -4
- package/tests/aggregate/AggregateCacheTest.res.mjs +2 -2
- package/tests/aggregate/AggregateCallbackTest.res +2 -2
- package/tests/aggregate/AggregateCallbackTest.res.mjs +1 -1
- package/tests/aggregate/AggregateConflictTest.res +4 -4
- package/tests/aggregate/AggregateConflictTest.res.mjs +2 -2
- package/tests/aggregate/AggregateFixtures.res +5 -5
- package/tests/aggregate/AggregateFixtures.res.mjs +2 -2
- package/tests/aggregate/AggregateRejectionTest.res +1 -1
- package/tests/aggregate/AggregateSnapshotTest.res +7 -7
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +4 -4
- package/tests/api/PsInternalFieldsReadModel.res +1 -1
- package/tests/api/TaggedUnionSchemaTest.res +1 -1
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res +1 -1
- package/tests/commandgenerator/CommandGeneratorFixtures.res +2 -2
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +2 -2
- package/tests/commandgenerator/OwnerActingTest.res +4 -4
- package/tests/commandgenerator/OwnerActingTest.res.mjs +4 -4
- package/tests/commandgenerator/OwnerStampingTest.res +1 -1
- package/tests/commandtopic/CommandOutcomeHookTest.res +2 -2
- package/tests/commandtopic/CommandOutcomeHookTest.res.mjs +3 -3
- package/tests/dcb/DcbStateChangeSliceTest.res +5 -5
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +5 -5
- package/tests/message/MessageTest.res +1 -1
- package/tests/plugin/ManifestVisibilityTest.res +2 -2
- package/tests/plugin/PluginStructureAccessTest.res +1 -1
- package/tests/plugin/PluginStructureAccessTest.res.mjs +4 -4
- package/tests/plugin/PluginStructureTest.res +24 -24
- package/tests/plugin/PluginStructureTest.res.mjs +27 -27
- package/tests/plugin/StateView/PsAnnotatedView.res +1 -1
- package/tests/plugin/StateView/PsAnnotatedView.res.mjs +1 -4
- package/tests/plugin/StateView/PsAvailableProductsView.res.mjs +1 -4
- package/tests/plugin/StateView/PsCategoriesView.res.mjs +1 -4
- package/tests/plugin/StateView/PsCustomersView.res.mjs +1 -4
- package/tests/plugin/StateView/PsGatedView.res.mjs +1 -4
- package/tests/plugin/StateView/PsOrdersView.res.mjs +1 -4
- package/tests/plugin/StateView/PsShipmentsView.res.mjs +1 -4
- package/tests/projection/LifecycleTrailTest.res +1 -1
- /package/src/{Behavior.res.mjs → Decision.res.mjs} +0 -0
|
@@ -25,10 +25,10 @@ module AggSpec = {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// ─────────────────────────────────────────────────────────────
|
|
28
|
-
//
|
|
28
|
+
// Decision
|
|
29
29
|
// ─────────────────────────────────────────────────────────────
|
|
30
30
|
|
|
31
|
-
module
|
|
31
|
+
module TestDecision = {
|
|
32
32
|
module Spec = AggSpec
|
|
33
33
|
|
|
34
34
|
@schema
|
|
@@ -36,8 +36,8 @@ module TestBehavior = {
|
|
|
36
36
|
|
|
37
37
|
let initialState = NotCreated
|
|
38
38
|
|
|
39
|
-
// Hand-written
|
|
40
|
-
//
|
|
39
|
+
// Hand-written decision (no @@reventless.decision PPX) — satisfy the
|
|
40
|
+
// Decision.T snapshot field manually.
|
|
41
41
|
let snapshot = None
|
|
42
42
|
|
|
43
43
|
let moduleUrl: string = %raw(`import.meta.url`)
|
|
@@ -167,7 +167,7 @@ module TestOps = {
|
|
|
167
167
|
// Callback handler under test
|
|
168
168
|
// ─────────────────────────────────────────────────────────────
|
|
169
169
|
|
|
170
|
-
module TestHandler = Aggregate_Callback.Make(AggSpec,
|
|
170
|
+
module TestHandler = Aggregate_Callback.Make(AggSpec, TestDecision, TestOps)
|
|
171
171
|
|
|
172
172
|
// ─────────────────────────────────────────────────────────────
|
|
173
173
|
// Test helpers
|
|
@@ -114,7 +114,7 @@ function decide(state, command) {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
let
|
|
117
|
+
let TestDecision = {
|
|
118
118
|
Spec: undefined,
|
|
119
119
|
stateSchema: stateSchema,
|
|
120
120
|
initialState: "NotCreated",
|
|
@@ -306,7 +306,7 @@ let OuterEventLog;
|
|
|
306
306
|
|
|
307
307
|
export {
|
|
308
308
|
AggSpec,
|
|
309
|
-
|
|
309
|
+
TestDecision,
|
|
310
310
|
makeMockEL,
|
|
311
311
|
mock,
|
|
312
312
|
OuterEventLog,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Tests for the Aggregate decide-rejection propagation path.
|
|
2
|
-
// Verifies that domain rejections from
|
|
2
|
+
// Verifies that domain rejections from Decision.decide:
|
|
3
3
|
// 1. Surface to producers via CommandTopic_Helpers.rejectedResultChannel (with errorCode + detail)
|
|
4
4
|
// 2. Return Ok(reference) so async (SQS) consumers delete the message — domain rejections don't redeliver
|
|
5
5
|
// 3. Don't cancel surviving commands inside the same batch
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Step 5 of docs/plans/done/aggregate-snapshotting.md — the Aggregate_Callback
|
|
2
|
-
// snapshot wiring: a snapshot-enabled
|
|
2
|
+
// snapshot wiring: a snapshot-enabled decision seeds cold replays from the
|
|
3
3
|
// latest persisted snapshot (hash-gated) and writes a fresh one every
|
|
4
4
|
// `interval` events, fire-and-forget. Snapshots never affect correctness — the
|
|
5
5
|
// OCC append is the only consistency primitive — so a drifted/absent snapshot
|
|
@@ -28,7 +28,7 @@ module AggSpec = {
|
|
|
28
28
|
let moduleUrl: string = %raw(`import.meta.url`)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
module
|
|
31
|
+
module TestDecision = {
|
|
32
32
|
module Spec = AggSpec
|
|
33
33
|
|
|
34
34
|
@schema
|
|
@@ -205,11 +205,11 @@ module MakeOps = (
|
|
|
205
205
|
module TestOps = MakeOps({
|
|
206
206
|
let name = "SnapshotMockEventLog"
|
|
207
207
|
})
|
|
208
|
-
module TestHandler = Aggregate_Callback.Make(AggSpec,
|
|
208
|
+
module TestHandler = Aggregate_Callback.Make(AggSpec, TestDecision, TestOps)
|
|
209
209
|
|
|
210
|
-
// A second
|
|
210
|
+
// A second decision with snapshots DISABLED, sharing the same mock, to prove
|
|
211
211
|
// disabled aggregates do zero snapshot traffic.
|
|
212
|
-
module
|
|
212
|
+
module PlainDecision = {
|
|
213
213
|
module Spec = AggSpec
|
|
214
214
|
|
|
215
215
|
@schema
|
|
@@ -233,7 +233,7 @@ module PlainBehavior = {
|
|
|
233
233
|
module PlainOps = MakeOps({
|
|
234
234
|
let name = "PlainMockEventLog"
|
|
235
235
|
})
|
|
236
|
-
module PlainHandler = Aggregate_Callback.Make(AggSpec,
|
|
236
|
+
module PlainHandler = Aggregate_Callback.Make(AggSpec, PlainDecision, PlainOps)
|
|
237
237
|
|
|
238
238
|
let makeItem = (~id="agg-1", reference, command): CommandTopic.topicItem<
|
|
239
239
|
Message.command'<string, AggSpec.command>,
|
|
@@ -318,7 +318,7 @@ describe("Aggregate_Callback — snapshots:", () => {
|
|
|
318
318
|
| Some(snap) =>
|
|
319
319
|
expect(snap.seqNr)->toBe(20)
|
|
320
320
|
// 20 items folded through the seeded state — no double-count, no gap.
|
|
321
|
-
let decoded = snap.state->Reventless.Util_Sury.fromJson(
|
|
321
|
+
let decoded = snap.state->Reventless.Util_Sury.fromJson(TestDecision.stateSchema)
|
|
322
322
|
expect(decoded.items->Array.length)->toBe(20)
|
|
323
323
|
| None => expect("expected snapshot at 20")->toBe("none")
|
|
324
324
|
}
|
|
@@ -88,7 +88,7 @@ function decide(_state, command) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
let
|
|
91
|
+
let TestDecision = {
|
|
92
92
|
Spec: undefined,
|
|
93
93
|
stateSchema: stateSchema,
|
|
94
94
|
initialState: initialState,
|
|
@@ -369,7 +369,7 @@ function decide$1(_state, command) {
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
let
|
|
372
|
+
let PlainDecision = {
|
|
373
373
|
Spec: undefined,
|
|
374
374
|
stateSchema: stateSchema$1,
|
|
375
375
|
initialState: initialState$1,
|
|
@@ -642,7 +642,7 @@ let OuterEventLog;
|
|
|
642
642
|
|
|
643
643
|
export {
|
|
644
644
|
AggSpec,
|
|
645
|
-
|
|
645
|
+
TestDecision,
|
|
646
646
|
testMeta,
|
|
647
647
|
makeMockEL,
|
|
648
648
|
mock,
|
|
@@ -650,7 +650,7 @@ export {
|
|
|
650
650
|
MakeOps,
|
|
651
651
|
TestOps,
|
|
652
652
|
TestHandler,
|
|
653
|
-
|
|
653
|
+
PlainDecision,
|
|
654
654
|
PlainOps,
|
|
655
655
|
PlainHandler,
|
|
656
656
|
makeItem,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// A spec file rather than a module inside the test, and named `*ReadModel*`
|
|
6
6
|
// deliberately: the annotation machinery runs under `@@reventless.spec` AND only
|
|
7
|
-
// for a file the PPX
|
|
7
|
+
// for a file the PPX recognizes as a read model or state view. That is also the
|
|
8
8
|
// honest scope for `@internal` — it describes a read model's state.
|
|
9
9
|
|
|
10
10
|
@@reventless.spec("InternalFieldsReadModel")
|
|
@@ -129,7 +129,7 @@ describe("GraphQL_FragmentGenerator emits a union", () => {
|
|
|
129
129
|
expect(row->String.includes("history: [Geolocation!]!"))->toBe(true)
|
|
130
130
|
})
|
|
131
131
|
|
|
132
|
-
// Unchanged
|
|
132
|
+
// Unchanged behavior, pinned: without a name there is no type to emit, and
|
|
133
133
|
// inventing one would publish a contract nothing can stamp a `__typename` for.
|
|
134
134
|
testSync("an unnamed union stays a String", () => {
|
|
135
135
|
let unnamed = fragmentFor(
|
|
@@ -207,7 +207,7 @@ describe("CommandGenerator_Callback.generateCommand:", () => {
|
|
|
207
207
|
},
|
|
208
208
|
)
|
|
209
209
|
|
|
210
|
-
// The control the drop is
|
|
210
|
+
// The control the drop is modeled on: absent and explicitly-null must
|
|
211
211
|
// reach the domain as the same command.
|
|
212
212
|
testPromise(
|
|
213
213
|
"and one simply omitted produce the same command",
|
|
@@ -26,10 +26,10 @@ module CmdGenAggSpec = {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// ─────────────────────────────────────────────────────────────
|
|
29
|
-
//
|
|
29
|
+
// Decision
|
|
30
30
|
// ─────────────────────────────────────────────────────────────
|
|
31
31
|
|
|
32
|
-
module
|
|
32
|
+
module CmdGenDecision = {
|
|
33
33
|
module Spec = CmdGenAggSpec
|
|
34
34
|
type state = unit
|
|
35
35
|
|
|
@@ -80,7 +80,7 @@ function decide(_state, command) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
let
|
|
83
|
+
let CmdGenDecision = {
|
|
84
84
|
Spec: undefined,
|
|
85
85
|
moduleUrl: moduleUrl$1,
|
|
86
86
|
initialState: undefined,
|
|
@@ -212,7 +212,7 @@ function reset() {
|
|
|
212
212
|
|
|
213
213
|
export {
|
|
214
214
|
CmdGenAggSpec,
|
|
215
|
-
|
|
215
|
+
CmdGenDecision,
|
|
216
216
|
capturedCmds,
|
|
217
217
|
MockPublishSpec,
|
|
218
218
|
TestGenerator,
|
|
@@ -54,7 +54,7 @@ module OrderSlice = {
|
|
|
54
54
|
| OrderNotFound
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
module
|
|
57
|
+
module OrderDecision = {
|
|
58
58
|
type state = {placed: bool, cancelled: bool}
|
|
59
59
|
let initialState = {placed: false, cancelled: false}
|
|
60
60
|
let moduleUrl = OrderSlice.moduleUrl
|
|
@@ -83,7 +83,7 @@ module OrderBehavior = {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
module OrderHandler = StateChangeSlice_Callback.Make(OrderSlice,
|
|
86
|
+
module OrderHandler = StateChangeSlice_Callback.Make(OrderSlice, OrderDecision)
|
|
87
87
|
|
|
88
88
|
let dcbMock = DcbFixtures.makeMockStorage()
|
|
89
89
|
|
|
@@ -128,7 +128,7 @@ module AccountSpec = {
|
|
|
128
128
|
let moduleUrl: string = %raw(`import.meta.url`)
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
module
|
|
131
|
+
module AccountDecision = {
|
|
132
132
|
module Spec = AccountSpec
|
|
133
133
|
|
|
134
134
|
@schema
|
|
@@ -210,7 +210,7 @@ module AccountOps = {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
module AccountHandler = Aggregate_Callback.Make(AccountSpec,
|
|
213
|
+
module AccountHandler = Aggregate_Callback.Make(AccountSpec, AccountDecision, AccountOps)
|
|
214
214
|
|
|
215
215
|
// ─── Callers ────────────────────────────────────────────────────────────────
|
|
216
216
|
|
|
@@ -175,7 +175,7 @@ function decide(state, command) {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
let
|
|
178
|
+
let OrderDecision = {
|
|
179
179
|
initialState: initialState,
|
|
180
180
|
moduleUrl: moduleUrl,
|
|
181
181
|
evolve: evolve,
|
|
@@ -352,7 +352,7 @@ function decide$1(state, command) {
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
let
|
|
355
|
+
let AccountDecision = {
|
|
356
356
|
Spec: undefined,
|
|
357
357
|
stateSchema: stateSchema,
|
|
358
358
|
initialState: "NotOpen",
|
|
@@ -978,7 +978,7 @@ let OuterEventLog;
|
|
|
978
978
|
|
|
979
979
|
export {
|
|
980
980
|
OrderSlice,
|
|
981
|
-
|
|
981
|
+
OrderDecision,
|
|
982
982
|
OrderHandler,
|
|
983
983
|
dcbMock,
|
|
984
984
|
DcbOps,
|
|
@@ -986,7 +986,7 @@ export {
|
|
|
986
986
|
dcbEventLog,
|
|
987
987
|
orderPartition,
|
|
988
988
|
AccountSpec,
|
|
989
|
-
|
|
989
|
+
AccountDecision,
|
|
990
990
|
accountEvents,
|
|
991
991
|
snapshotReads,
|
|
992
992
|
OuterEventLog,
|
|
@@ -224,7 +224,7 @@ describe("the schema a generator is built with must answer for its commands:", (
|
|
|
224
224
|
let _ = await permissive(
|
|
225
225
|
placeOrder(~customerId="cust-B", ~identity=cognito(~userId="cust-A", ~groups=["User"])),
|
|
226
226
|
)->Effect.runPromise
|
|
227
|
-
// Not the
|
|
227
|
+
// Not the behavior we want anywhere — recorded so that a change making the
|
|
228
228
|
// permissive path stamp correctly is a deliberate one, and so the contrast
|
|
229
229
|
// with the case below cannot be read as incidental.
|
|
230
230
|
expect(lastPublished()->fieldOf("customerId"))->toEqual(Some(str("cust-B")))
|
|
@@ -25,7 +25,7 @@ let dcbEventLog: DcbEventLog.operations = {
|
|
|
25
25
|
appendStream: EventLogOps.appendStream,
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
module
|
|
28
|
+
module SliceDecision = {
|
|
29
29
|
type state = DcbFixtures.TestCommandSpec.state
|
|
30
30
|
let initialState = DcbFixtures.TestCommandSpec.initialState
|
|
31
31
|
let evolve = DcbFixtures.TestCommandSpec.evolve
|
|
@@ -33,7 +33,7 @@ module SliceBehavior = {
|
|
|
33
33
|
let moduleUrl = DcbFixtures.TestCommandSpec.moduleUrl
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
module SliceHandler = StateChangeSlice_Callback.Make(DcbFixtures.TestCommandSpec,
|
|
36
|
+
module SliceHandler = StateChangeSlice_Callback.Make(DcbFixtures.TestCommandSpec, SliceDecision)
|
|
37
37
|
|
|
38
38
|
let sliceItem = (reference, command): CommandTopic.topicItem<
|
|
39
39
|
Message.command'<Reventless.Id.String.t, DcbFixtures.TestCommandSpec.command>,
|
|
@@ -49,7 +49,7 @@ let decide = DcbFixtures$ReventlessCore.TestCommandSpec.decide;
|
|
|
49
49
|
|
|
50
50
|
let moduleUrl = DcbFixtures$ReventlessCore.TestCommandSpec.moduleUrl;
|
|
51
51
|
|
|
52
|
-
let
|
|
52
|
+
let SliceDecision = {
|
|
53
53
|
initialState: initialState,
|
|
54
54
|
evolve: evolve,
|
|
55
55
|
decide: decide,
|
|
@@ -67,7 +67,7 @@ let SliceHandler = StateChangeSlice_Callback$ReventlessCore.Make({
|
|
|
67
67
|
commandTransition: DcbFixtures$ReventlessCore.TestCommandSpec.commandTransition,
|
|
68
68
|
traits: DcbFixtures$ReventlessCore.TestCommandSpec.traits,
|
|
69
69
|
readConsistency: DcbFixtures$ReventlessCore.TestCommandSpec.readConsistency
|
|
70
|
-
})(
|
|
70
|
+
})(SliceDecision);
|
|
71
71
|
|
|
72
72
|
function sliceItem(reference, command) {
|
|
73
73
|
return {
|
|
@@ -373,7 +373,7 @@ export {
|
|
|
373
373
|
TestDcbOps,
|
|
374
374
|
EventLogOps,
|
|
375
375
|
dcbEventLog,
|
|
376
|
-
|
|
376
|
+
SliceDecision,
|
|
377
377
|
SliceHandler,
|
|
378
378
|
sliceItem,
|
|
379
379
|
runSlice,
|
|
@@ -18,7 +18,7 @@ let testDcbEventLog: DcbEventLog.operations = {
|
|
|
18
18
|
appendStream: EventLogOps.appendStream,
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
module
|
|
21
|
+
module TestCommandDecision = {
|
|
22
22
|
type state = DcbFixtures.TestCommandSpec.state
|
|
23
23
|
let initialState = DcbFixtures.TestCommandSpec.initialState
|
|
24
24
|
let evolve = DcbFixtures.TestCommandSpec.evolve
|
|
@@ -27,10 +27,10 @@ module TestCommandBehavior = {
|
|
|
27
27
|
}
|
|
28
28
|
module TestHandler = StateChangeSlice_Callback.Make(
|
|
29
29
|
DcbFixtures.TestCommandSpec,
|
|
30
|
-
|
|
30
|
+
TestCommandDecision,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
// Per-slice `readConsistency` overrides: same types/
|
|
33
|
+
// Per-slice `readConsistency` overrides: same types/decision as TestCommandSpec,
|
|
34
34
|
// only the build-time consistency mode differs. The default (TestCommandSpec) is
|
|
35
35
|
// `EscalateOnRetry`; these force strong / eventual on every attempt.
|
|
36
36
|
module StrongSpec = {
|
|
@@ -41,8 +41,8 @@ module EventualSpec = {
|
|
|
41
41
|
include DcbFixtures.TestCommandSpec
|
|
42
42
|
let readConsistency = Reventless.ReadConsistency.AlwaysEventual
|
|
43
43
|
}
|
|
44
|
-
module StrongHandler = StateChangeSlice_Callback.Make(StrongSpec,
|
|
45
|
-
module EventualHandler = StateChangeSlice_Callback.Make(EventualSpec,
|
|
44
|
+
module StrongHandler = StateChangeSlice_Callback.Make(StrongSpec, TestCommandDecision)
|
|
45
|
+
module EventualHandler = StateChangeSlice_Callback.Make(EventualSpec, TestCommandDecision)
|
|
46
46
|
|
|
47
47
|
let makeTopicItem = (reference, command): CommandTopic.topicItem<
|
|
48
48
|
Message.command'<Reventless.Id.String.t, DcbFixtures.TestCommandSpec.command>,
|
|
@@ -45,7 +45,7 @@ let decide = DcbFixtures$ReventlessCore.TestCommandSpec.decide;
|
|
|
45
45
|
|
|
46
46
|
let moduleUrl = DcbFixtures$ReventlessCore.TestCommandSpec.moduleUrl;
|
|
47
47
|
|
|
48
|
-
let
|
|
48
|
+
let TestCommandDecision = {
|
|
49
49
|
initialState: initialState,
|
|
50
50
|
evolve: evolve,
|
|
51
51
|
decide: decide,
|
|
@@ -63,7 +63,7 @@ let TestHandler = StateChangeSlice_Callback$ReventlessCore.Make({
|
|
|
63
63
|
commandTransition: DcbFixtures$ReventlessCore.TestCommandSpec.commandTransition,
|
|
64
64
|
traits: DcbFixtures$ReventlessCore.TestCommandSpec.traits,
|
|
65
65
|
readConsistency: DcbFixtures$ReventlessCore.TestCommandSpec.readConsistency
|
|
66
|
-
})(
|
|
66
|
+
})(TestCommandDecision);
|
|
67
67
|
|
|
68
68
|
let name = DcbFixtures$ReventlessCore.TestCommandSpec.name;
|
|
69
69
|
|
|
@@ -162,7 +162,7 @@ let StrongHandler = StateChangeSlice_Callback$ReventlessCore.Make({
|
|
|
162
162
|
commandTransition: commandTransition,
|
|
163
163
|
traits: traits,
|
|
164
164
|
readConsistency: "AlwaysStrong"
|
|
165
|
-
})(
|
|
165
|
+
})(TestCommandDecision);
|
|
166
166
|
|
|
167
167
|
let EventualHandler = StateChangeSlice_Callback$ReventlessCore.Make({
|
|
168
168
|
name: name$1,
|
|
@@ -175,7 +175,7 @@ let EventualHandler = StateChangeSlice_Callback$ReventlessCore.Make({
|
|
|
175
175
|
commandTransition: commandTransition$1,
|
|
176
176
|
traits: traits$1,
|
|
177
177
|
readConsistency: "AlwaysEventual"
|
|
178
|
-
})(
|
|
178
|
+
})(TestCommandDecision);
|
|
179
179
|
|
|
180
180
|
function makeTopicItem(reference, command) {
|
|
181
181
|
return {
|
|
@@ -544,7 +544,7 @@ export {
|
|
|
544
544
|
TestDcbOps,
|
|
545
545
|
EventLogOps,
|
|
546
546
|
testDcbEventLog,
|
|
547
|
-
|
|
547
|
+
TestCommandDecision,
|
|
548
548
|
TestHandler,
|
|
549
549
|
StrongSpec,
|
|
550
550
|
EventualSpec,
|
|
@@ -158,7 +158,7 @@ describe("Message should", () => {
|
|
|
158
158
|
let json = event'->Message.encodeEvent'(S.string, PluginSpec.eventSchema)
|
|
159
159
|
|
|
160
160
|
// Simulate the persisted JSON as written before these fields existed: drop the
|
|
161
|
-
// mandatory enum `kind`, a top-level `T | null` field, and two nested
|
|
161
|
+
// mandatory enum `kind`, a top-level `T | null` field, and two nested writeSideDef
|
|
162
162
|
// fields (a mandatory array + a `T | null`).
|
|
163
163
|
let oldJson = %raw(`function(j){
|
|
164
164
|
var c = JSON.parse(JSON.stringify(j));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Verifies that ReadModel.Spec.visibility flows through PPX injection, that the
|
|
2
2
|
// filter predicate used by Plugin_Builder.makeAutoUIManifest excludes Internal
|
|
3
3
|
// entries while leaving Public ones intact, and that Plugin_Structure.make
|
|
4
|
-
// CARRIES Internal entries but tags them via `
|
|
4
|
+
// CARRIES Internal entries but tags them via `readSideDef.visibility` (the
|
|
5
5
|
// dev-graph contract). Does NOT instantiate the full Plugin_Builder.Make functor
|
|
6
6
|
// — the filter is a pure switch on a Spec field and is therefore testable in
|
|
7
7
|
// isolation via stubbed ReadModel.T modules.
|
|
@@ -120,7 +120,7 @@ describe("ReadModel visibility filter", () => {
|
|
|
120
120
|
|
|
121
121
|
describe("Plugin_Structure.make — visibility tagging", () => {
|
|
122
122
|
// pluginStructure CARRIES Internal read models (so the dev graph / dead-code
|
|
123
|
-
// tools can see them) and tags each via `
|
|
123
|
+
// tools can see them) and tags each via `readSideDef.visibility`
|
|
124
124
|
// (`None` = Public, `Some("Internal")` = Internal). The deployed AutoUI
|
|
125
125
|
// consumers re-filter on that tag — visibility does not remove entries from
|
|
126
126
|
// pluginStructure itself. See Plugin_Structure.res / Visibility.res.
|
|
@@ -18,7 +18,7 @@ type svsComponent = Component.t<
|
|
|
18
18
|
|
|
19
19
|
module PsGatedCommandsSlice: ReventlessInfra.StateChangeSlice.T = {
|
|
20
20
|
module Spec = PsGatedCommands
|
|
21
|
-
module
|
|
21
|
+
module Decision = {
|
|
22
22
|
type state = PsGatedCommands.state
|
|
23
23
|
let initialState = PsGatedCommands.initialState
|
|
24
24
|
let evolve = PsGatedCommands.evolve
|
|
@@ -12,7 +12,7 @@ import * as PsGatedCommands$ReventlessCore from "./StateChange/PsGatedCommands.r
|
|
|
12
12
|
import * as Plugin_Structure$ReventlessCore from "../../src/plugin/component/Plugin_Structure.res.mjs";
|
|
13
13
|
import * as Platform_ComponentDefinitionsApi$ReventlessCore from "../../src/admin/Platform_ComponentDefinitionsApi.res.mjs";
|
|
14
14
|
|
|
15
|
-
let
|
|
15
|
+
let Decision = {
|
|
16
16
|
initialState: false,
|
|
17
17
|
evolve: PsGatedCommands$ReventlessCore.evolve,
|
|
18
18
|
decide: PsGatedCommands$ReventlessCore.decide,
|
|
@@ -38,7 +38,7 @@ let PsGatedCommandsSlice_Spec = {
|
|
|
38
38
|
|
|
39
39
|
let PsGatedCommandsSlice = {
|
|
40
40
|
Spec: PsGatedCommandsSlice_Spec,
|
|
41
|
-
|
|
41
|
+
Decision: Decision,
|
|
42
42
|
isAsync: false,
|
|
43
43
|
make: make
|
|
44
44
|
};
|
|
@@ -56,7 +56,7 @@ let PsGatedViewSlice_Spec = {
|
|
|
56
56
|
name: PsGatedView$ReventlessCore.name,
|
|
57
57
|
moduleUrl: PsGatedView$ReventlessCore.moduleUrl,
|
|
58
58
|
stateSchema: PsGatedView$ReventlessCore.stateSchema,
|
|
59
|
-
|
|
59
|
+
Id: {
|
|
60
60
|
schema: Id$Reventless.StringPure.schema,
|
|
61
61
|
make: prim => prim,
|
|
62
62
|
makeFromString: prim => prim,
|
|
@@ -89,7 +89,7 @@ let PsOrdersViewSlice_Spec = {
|
|
|
89
89
|
name: PsOrdersView$ReventlessCore.name,
|
|
90
90
|
moduleUrl: PsOrdersView$ReventlessCore.moduleUrl,
|
|
91
91
|
stateSchema: PsOrdersView$ReventlessCore.stateSchema,
|
|
92
|
-
|
|
92
|
+
Id: {
|
|
93
93
|
schema: Id$Reventless.StringPure.schema,
|
|
94
94
|
make: prim => prim,
|
|
95
95
|
makeFromString: prim => prim,
|