Skip to content

Commit

Permalink
Connector Warnings Cleanup (#74)
Browse files Browse the repository at this point in the history
* org, product connectors

* member, reservation, store connectors

* tenant, event connectors

* revert conf

* don't show missing warnings

* revert conf
  • Loading branch information
AlexWeinstein92 authored Mar 13, 2024
1 parent ab3806a commit ccf2fdb
Show file tree
Hide file tree
Showing 17 changed files with 370 additions and 136 deletions.
12 changes: 3 additions & 9 deletions src/main/riddl/Events/Reservations/reservation.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ type ReservationId is Id (ImprovingApp.Events.ReservationContext.Reservation)
context ReservationContext is {
include "reservationTypeDefinitions"
include "reservationMessages"

// TODO: List the names of the public reservation events here
type PublicReservationEvent is one of {
???
}

outlet Events is type PublicReservationEvent
include "reservationSources"

entity Reservation is {
option event-sourced
Expand All @@ -22,7 +16,7 @@ context ReservationContext is {
record ImprovingApp.Events.ReservationContext.Reservation.DraftState
"Copy fields from the command into Draft fields"
"adjust meta fields to reflect the change set"
send event ReservationEstablished to outlet ReservationContext.Events
send event ReservationEstablished to outlet ReservationEventsSource.Events
}
on other {
error "Only EstablishReservation command is allowed in the default state"
Expand All @@ -41,7 +35,7 @@ context ReservationContext is {
}
on command ImprovingApp.Events.ReservationContext.EditReservationInfo {
set field ImprovingApp.Events.ReservationContext.Reservation.Draft.reservationInfo to "EditReservationInfo.info"
send event ReservationInfoUpdated to outlet ReservationContext.Events
send event ReservationInfoUpdated to outlet ReservationEventsSource.Events
}
on command ImprovingApp.Events.ReservationContext.UpdateReservationStatus {
"morph entity Reservation to state provided in UpdateReservationStatus"
Expand Down
41 changes: 41 additions & 0 deletions src/main/riddl/Events/Reservations/reservationSources.riddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
connector ReservationCommandsChannel is {
from outlet ReservationCommandsSource.Commands to
inlet ReservationCommandsSink.Commands
}

connector ReservationEventsChannel is {
from outlet ReservationEventsSource.Events to
inlet ReservationEventsSink.Events
}

source ReservationCommandsSource is {
outlet Commands is type ReservationCommand
}

sink ReservationCommandsSink is {
inlet Commands is type ReservationCommand
}

source ReservationEventsSource is {
outlet Events is type ReservationEvent
}

sink ReservationEventsSink is {
inlet Events is type ReservationEvent
}

type ReservationCommand is one of {
EstablishReservation,
EditReservationInfo,
UpdateReservationStatus,
DeleteReservation,
GetReservationInfo
}

type ReservationEvent is one of {
ReservationEstablished,
ReservationInfoUpdated,
ReservationStatusUpdated,
ReservationDeleted,
ReservationInfoResult
}
38 changes: 19 additions & 19 deletions src/main/riddl/Events/eventContext.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ context EventContext is {
include "eventTypeDefinitions"
include "eventSources"

function incrementDelayedEventTime is {
function IncrementDelayedEventTime is {
requires {originalTime: DateTime, duration: Duration}
returns { newTime: DateTime }
body ???
Expand Down Expand Up @@ -41,7 +41,7 @@ context EventContext is {

handler EventHandler is {
on command CreateEvent {
send event EventCreated to outlet EventEvents.Events
send event EventCreated to outlet EventEventsSource.Events
morph entity Event to state DraftEvent with record DraftEventState
}
on other {
Expand All @@ -60,20 +60,20 @@ context EventContext is {
on command ScheduleEvent{
if "all required info fields are present" then {
"set a scheduled Akka call for emitting StartEvent at DraftEventState.info.expectedStart"
send event EventScheduled to outlet EventEvents.Events
send event EventScheduled to outlet EventEventsSource.Events
morph entity Event to state ScheduledEvent with record ScheduledEventState
}
}
on command EditEventInfo{
set field DraftEventState.info to "EventContext.newEditableInfoFromFieldsPresentInEditable"
set field DraftEventState.meta to "EventMetaInfo"
send event EventRescheduled
to outlet EventEvents.Events
to outlet EventEventsSource.Events
}
on command CancelEvent{
if "all required info fields are present" then {
"cancel associated scheduled call to emit StartEvent"
send event EventCancelled to outlet EventEvents.Events
send event EventCancelled to outlet EventEventsSource.Events
morph entity Event to state ScheduledEvent with record ScheduledEventState
}
}
Expand All @@ -82,13 +82,13 @@ context EventContext is {
"adjust associated scheduled call to emit StartEvent"
set field DraftEventState.info to "EditableEventInfo"
set field DraftEventState.meta to "EventMetaInfo"
send event EventRescheduled to outlet EventEvents.Events
send event EventRescheduled to outlet EventEventsSource.Events
}
}
on command DelayEvent{
if "all required info fields are present" then {
"adjust associated scheduled call to emit StartEvent"
send event EventDelayed to outlet EventEvents.Events
send event EventDelayed to outlet EventEventsSource.Events
morph entity Event to state ScheduledEvent with record ScheduledEventState
}
}
Expand Down Expand Up @@ -127,29 +127,29 @@ context EventContext is {
on command EditEventInfo {
set field ScheduledEventState.info to "EventContext.newInfoFromFieldsPresentInEditable"
set field ScheduledEventState.meta to "EventMetaInfo"
send event EventInfoEdited to outlet EventEvents.Events
send event EventInfoEdited to outlet EventEventsSource.Events
}
on command CancelEvent {
"cancel associated scheduled call to emit StartEvent"
send event EventCancelled to outlet EventEvents.Events
send event EventCancelled to outlet EventEventsSource.Events
become entity Event to handler CancelledEventHandler
}
on command DelayEvent {
"adjust associated scheduled Akka call to emit StartEvent"
send event EventDelayed to outlet EventEvents.Events
send event EventDelayed to outlet EventEventsSource.Events
become entity Event to handler DelayedEventHandler
}
on command StartEvent{
"create scheduled Akka call using ScheduledEventState.info.expectedEnd to emit EndEvent"
send event EventStarted to outlet EventEvents.Events
send event EventStarted to outlet EventEventsSource.Events
become entity Event to handler InProgressEventHandler
} briefly "to be invoked by Akka scheduler upon ScheduleEvent reception"
on command RescheduleEvent {
if "start is validated to be before end in command" then {
"adjust associated scheduled call to emit StartEvent"
set field ScheduledEventState.info to "EventInfo"
set field ScheduledEventState.meta to "EventMetaInfo"
send event EventRescheduled to outlet EventEvents.Events
send event EventRescheduled to outlet EventEventsSource.Events
}
}
on command EndEvent{
Expand Down Expand Up @@ -178,14 +178,14 @@ context EventContext is {
}
on command DelayEvent{
"adjust associated scheduled Akka call to emit StartEvent"
send event EventDelayed to outlet EventEvents.Events
send event EventDelayed to outlet EventEventsSource.Events
become entity Event to handler DelayedEventHandler
}
on command StartEvent {
error "Event is already started. Cannot start an event that is already in progress"
}
on command EndEvent {
send event EventEnded to outlet EventEvents.Events
send event EventEnded to outlet EventEventsSource.Events
become entity Event to handler PastEventHandler
}
// TODO: specify AddLiveUpdate on clause
Expand All @@ -203,27 +203,27 @@ context EventContext is {
on command EditEventInfo{
set field ScheduledEventState.info to "EventContext.newInfoFromFieldsPresentInEditable"
set field ScheduledEventState.meta to "EventMetaInfo"
send event EventInfoEdited to outlet EventEvents.Events
send event EventInfoEdited to outlet EventEventsSource.Events
}
on command CancelEvent{
"cancel associated scheduled call to emit StartEvent"
send event EventCancelled to outlet EventEvents.Events
send event EventCancelled to outlet EventEventsSource.Events
become entity Event to handler CancelledEventHandler
}
on command RescheduleEvent{
if "start is validated to be before end in command" then {
"adjust associated scheduled call to emit StartEvent"
set field ScheduledEventState.info to "EventInfo"
set field ScheduledEventState.meta to "EventMetaInfo"
send event EventRescheduled to outlet EventEvents.Events
send event EventRescheduled to outlet EventEventsSource.Events
}
}
on command DelayEvent{
error "Cannot delay a delayed event again, must be rescheduled"
}
on command StartEvent{
"create scheduled Akka call using ScheduledEventState.info.expectedEnd to emit EndEvent"
send event EventStarted to outlet EventEvents.Events
send event EventStarted to outlet EventEventsSource.Events
become entity Event to handler InProgressEventHandler
} briefly "to be invoked by Akka scheduler upon ScheduleEvent reception"
on command EndEvent{
Expand All @@ -240,7 +240,7 @@ context EventContext is {
"adjust associated scheduled call to emit StartEvent"
set field ScheduledEventState.info to "EventInfo"
set field ScheduledEventState.meta to "EventMetaInfo"
send event EventRescheduled to outlet EventEvents.Events
send event EventRescheduled to outlet EventEventsSource.Events
}
}
on other {
Expand Down
72 changes: 53 additions & 19 deletions src/main/riddl/Events/eventSources.riddl
Original file line number Diff line number Diff line change
@@ -1,22 +1,56 @@
source LiveUpdates is {
outlet Updates is type LiveUpdate
} explained as "This is a source for things that happen as an event progresses"

// plant EventPlant is {
// pipe EventPipe is {???}
// }
// source LiveUpdates is {
// outlet Updates is type LiveUpdate
// } explained as "This is a source for things that happen as an event progresses"

//ReservationAddedToEvent,
type PublicEventEvent is one of {
Events.EventContext.EventInfoEdited,
Events.EventContext.EventCreated,
Events.EventContext.EventScheduled,
Events.EventContext.EventCancelled,
Events.EventContext.EventRescheduled,
Events.EventContext.EventDelayed,
Events.EventContext.EventStarted,
Events.EventContext.EventEnded

connector EventCommandsChannel is {
from outlet EventCommandsSource.Commands to
inlet EventCommandsSink.Commands
}

connector EventEventsChannel is {
from outlet EventEventsSource.Events to
inlet EventEventsSink.Events
}

source EventCommandsSource is {
outlet Commands is type EventCommand
}

sink EventCommandsSink is {
inlet Commands is type EventCommand
}
source EventEvents is {
outlet Events is type PublicEventEvent
} explained as "This is a source for event from Events entities"

source EventEventsSource is {
outlet Events is type EventEvent
}

sink EventEventsSink is {
inlet Events is type EventEvent
}

type EventCommand is one of {
EditEventInfo,
CreateEvent,
ScheduleEvent,
CancelEvent,
RescheduleEvent,
DelayEvent,
StartEvent,
EndEvent,
TerminateEvent,
AddLiveUpdate
}

type EventEvent is one of {
EventInfoEdited,
EventCreated,
EventScheduled,
EventCancelled,
EventRescheduled,
EventDelayed,
EventStarted,
EventEnded,
EventTerminated
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ epic CreateReservation {
step from user GatewayAPI "Create Reservation" to entity ImprovingApp.Events.ReservationContext.Reservation
briefly "create reservation"
step send event ImprovingApp.Events.ReservationContext.ReservationEstablished
from entity ImprovingApp.Events.ReservationContext.Reservation to source ImprovingApp.Events.ReservationContext.PublicReservationEvent
from entity ImprovingApp.Events.ReservationContext.Reservation to source ImprovingApp.Events.ReservationContext.ReservationEventsSource
briefly "reservation created"
step send event ImprovingApp.Events.ReservationContext.ReservationEstablished
from source ImprovingApp.Events.ReservationContext.PublicReservationEvent to application App
from source ImprovingApp.Events.ReservationContext.ReservationEventsSource to application App
}
} briefly "A story about creating a reservation in Improving.app"
described as "This is the story of how a reservation comes into existence"
Expand Down
4 changes: 2 additions & 2 deletions src/main/riddl/Gateway/gatewayStories.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ epic RegisterMember {
briefly "send creation message"
step from context GatewayAPI "Register Member" to entity ImprovingApp.MemberContext.Member
briefly "add new Member"
step send event ImprovingApp.MemberContext.MemberRegistered from entity ImprovingApp.MemberContext.Member to source ImprovingApp.MemberContext.MemberEvents
step send event ImprovingApp.MemberContext.MemberRegistered from entity ImprovingApp.MemberContext.Member to source ImprovingApp.MemberContext.MemberEventsSource
briefly "Member added in Draft state"
step send event ImprovingApp.MemberContext.MemberRegistered from source ImprovingApp.MemberContext.MemberEvents to application App
step send event ImprovingApp.MemberContext.MemberRegistered from source ImprovingApp.MemberContext.MemberEventsSource to application App
//example Foo is {...}
}
} briefly "A story about registering a member in Improving.app"
Expand Down
4 changes: 2 additions & 2 deletions src/main/riddl/ImprovingApp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ command = hugo

# This block provides options that are common to any command.
common = {
show-times = true
show-include-times = true
verbose = true
verbose = false
quiet = false
dry-run = false
show-warnings = true
Expand All @@ -16,6 +15,7 @@ common = {
show-usage-warnings = false
debug = false
group-by-message-kind = true
warnings-are-fatal = true
}

# This block provides options for the "hugo" command to translate riddl to a hugo web site.
Expand Down
43 changes: 43 additions & 0 deletions src/main/riddl/Members/memberSources.riddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
connector MemberCommandsChannel is {
from outlet MemberCommandsSource.Commands to
inlet MemberCommandsSink.Commands
}

connector MemberEventsChannel is {
from outlet MemberEventsSource.Events to
inlet MemberEventsSink.Events
}

source MemberCommandsSource is {
outlet Commands is type MemberCommand
}

sink MemberCommandsSink is {
inlet Commands is type MemberCommand
}

source MemberEventsSource is {
outlet Events is type MemberEvent
}

sink MemberEventsSink is {
inlet Events is type MemberEvent
}

type MemberCommand is one of {
ImprovingApp.MemberContext.RegisterMember,
ImprovingApp.MemberContext.ActivateMember,
ImprovingApp.MemberContext.SuspendMember,
ImprovingApp.MemberContext.TerminateMember,
ImprovingApp.MemberContext.EditMemberInfo,
ImprovingApp.MemberContext.GetMemberData
}

type MemberEvent is one of {
ImprovingApp.MemberContext.MemberRegistered,
ImprovingApp.MemberContext.MemberActivated,
ImprovingApp.MemberContext.MemberSuspended,
ImprovingApp.MemberContext.MemberTerminated,
ImprovingApp.MemberContext.MemberInfoEdited,
ImprovingApp.MemberContext.MemberData
}
Loading

0 comments on commit ccf2fdb

Please sign in to comment.