keiro-dsl-0.15.0.0: test/fixtures/behavior-complete.keiro
language keiro-dsl 4
context behavior-complete
id RequestId prefix=req
mapped structural record StartPayload {
haskell package=keiro-dsl module=BehaviorComplete.Domain type=StartPayload
binding = "BehaviorComplete.Bindings.startPayloadBinding"
binding-version = "1"
canonical-type = "behavior-complete.StartPayload.v1"
fixtures = "BehaviorComplete.Bindings.startPayloadCases"
wire object constructor=StartPayload unknown-fields=reject {
label as "display_label" : Text required
note as "optional_note" : Optional Text optional on-missing=null
}
}
aggregate Journey
regs
lastAmount Natural = 0
states Empty Active Closed!
command Start {
requestId:RequestId observedAt:Time amount:Natural
details:StartPayload
}
command Decide { amount:Natural }
command Ping { token:Bool }
command Retire { amount:Natural }
command LegacyStart { amount:Natural }
event Started = fields(Start)
event DecisionRecorded = fields(Decide)
event Retired = fields(Retire)
event RetirementAudited = fields(Retire)
event LegacyStarted = fields(LegacyStart)
Empty -- Start -->
guard cmd.amount <= 0
write lastAmount := cmd.amount
emit Started
goto Active
Active -- Decide -->
guard cmd.amount <= 5
write lastAmount := cmd.amount
emit DecisionRecorded
goto Active
replay-only Empty -- Start -->
guard cmd.amount > 0
write lastAmount := cmd.amount
emit Started
goto Active
Active -- Decide -->
guard cmd.amount > 5
write lastAmount := cmd.amount
emit DecisionRecorded
goto Active
replay-only Empty -- LegacyStart -->
write lastAmount := cmd.amount
emit LegacyStarted
goto Active
Active -- Ping -->
goto Active
Active -- Retire -->
guard cmd.amount > 0
write lastAmount := cmd.amount
emit Retired
emit RetirementAudited
goto Closed
replay-only Active -- Retire -->
guard cmd.amount <= 0
write lastAmount := cmd.amount
emit Retired
emit RetirementAudited
goto Closed
wire kind=ctorName fields=camelCase schemaVersion=1
snapshot every 1
state-codec version=1 shape-hash="behavior-complete-v1"