Skip to content

Commit

Permalink
Fixing compilation for most up to date RIDDL version (#73)
Browse files Browse the repository at this point in the history
* feat: first pass at fixing compilation for updated riddl

* removing unnecessary comments

* removing unnecessary comments

* fixing after RIDDL update for comments bug

* commenting out interactions

* commenting out examples, fixing bugs accordingly

* Modernize the build

* Fix options and LocationId errors

* Fix remaining parsing errors

* various changes

* Enable the group-messages-by-kind option

* lots of error fixes

* Fix some validation errors

* Fix various undefined references and ambiguities

* applicatioon & organization fixes

* event, order, reservation, tenant fixes

* store fixes

* product, event fixes

* no errors left

* Correct RIDDL input to resolve remaining issues per riddlc 0.39

* Upgrade to riddlc 0.39.0 release

---------

Co-authored-by: reidspencer <[email protected]>
  • Loading branch information
AlexWeinstein92 and reidspencer authored Mar 9, 2024
1 parent 7e18157 commit b1294b4
Show file tree
Hide file tree
Showing 69 changed files with 743 additions and 1,982 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Global / onChangedBuildSource := ReloadOnSourceChanges
scalaVersion := "3.3.1"
lazy val riddl_version = "0.24.5"
lazy val riddl_version = "0.39.0"
libraryDependencies ++= Seq(
"com.reactific" %% "riddl-testkit" % riddl_version % "test",
"com.reactific" %% "riddl-hugo" % riddl_version % "test",
Expand All @@ -10,7 +10,7 @@ libraryDependencies ++= Seq(
enablePlugins(RiddlSbtPlugin)
riddlcOptions :=
Seq("--show-times", "from", "src/main/riddl/ImprovingApp.conf", "hugo")
riddlcMinVersion := "0.24.6"
riddlcMinVersion := s"${riddl_version}"
riddlcPath := file(
// NOTE: Set this to your local path which will always have this portion
// NOTE: of the path as a constant: riddl/riddlc/target/universal/stage/bin/riddlc
Expand Down
24 changes: 13 additions & 11 deletions src/main/riddl/AllIdsProjections/allIdsProjections.riddl
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
//all comments to be implemented post kalix-study
//all comments to be implemented post kalix-study

query GetAllTenantIds is {}
query GetAllTenantIds is { ??? }
result AllTenantIds is {tenants: TenantId*}

query GetAllOrgIds is {}
query GetAllOrgIds is { ??? }
result AllOrgIds is {orgs: OrganizationId*}

query GetAllEventIds is {}
query GetAllEventIds is { ??? }
result AllEventIds {events: EventId*}

query GetAllMemberIds is {}
query GetAllMemberIds is { ??? }
result AllMemberIds is {members: MemberId*}

query GetAllStoreIds is {}
result AllStoreIds is {stores: StoreId*}
query GetAllStoreIds is { ??? }
result AllStoreIds is {stores: StoreContext.StoreId*}

query GetAllSkus is {}
query GetAllSkus is { ??? }
result AllSkus is {skus: SKU*}

context AllIdsProjections is {
Expand All @@ -25,8 +26,9 @@ context AllIdsProjections is {
//tenantStatus: TenantContext.Status
}
handler AllTenantIdsViewHandler is {

on event TenantEstablished {
"create row with tenant set to TenantEstablished.tenantId"// and tenantStatus to Draft"
"create row with tenant set to TenantEstablished.tenantId and tenantStatus to Draft"
}
//on event TenantContext.StatusUpdated {
// then "update row with tenant set to StatusUpdated.tenantId to tenantStatus with StatusUpdated.newStatus"
Expand All @@ -43,7 +45,7 @@ context AllIdsProjections is {
//orgStatus: OrganizationContext.Status
}
handler AllOrgIdsViewHandler is {
on event OrganizationEstablished {
on event ImprovingApp.OrganizationContext.OrganizationEstablished {
"create row with org set to OrganizationEstablished.orgId"// and orgStatus set to Draft"
}
//on event OrganizationStatusUpdated {
Expand Down Expand Up @@ -88,7 +90,7 @@ context AllIdsProjections is {
projector AllMemberIdsView is {
record AllMemberIdsFields {
member: MemberId,
memberStatus: MemberContext.Status
memberStatus: MemberContext.MemberStates
}
handler AllMemberIdsViewHandler is {
on event MemberContext.MemberRegistered {
Expand All @@ -105,7 +107,7 @@ context AllIdsProjections is {

projector AllStoreIdsView is {
record AllStoreIdsFields {
store: StoreId
store: StoreContext.StoreId
}
handler AllStoreIdsViewHandler is {
on event StoreCreated {
Expand Down
75 changes: 30 additions & 45 deletions src/main/riddl/Applications/application.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ application UserInterface is {
command EstablishOrganization is {
info: MemberContext.EditableInfo briefly "Details about an organization required for it to exist. See OrganizationContext.Organization.Info for details.",
tenant: TenantId,
parent: Parent?,
parent: OrganizationContext.Parent?,
members: MemberList,
owners: OwnerList,
contacts: ContactList,
Expand All @@ -12,29 +12,27 @@ application UserInterface is {
result OrganizationEstablished is {
organizationId: OrganizationId briefly "Unique identifier returned by EstablishOrganization command",
info: OrganizationContext.Info,
parent: Parent?,
parent: OrganizationContext.Parent?,
members: MemberList,
owners: OwnerList,
contacts: ContactList,
meta: OrganizationContext.MetaInfo
}
command CreateOrganization { ??? } // FIXME: needs to be completed

group Organization is {
input EstablishOrganization is {
acquires command UserInterface.EstablishOrganization
}
output DisplayOrganization is {
presents result OrganizationEstablished
}
input EstablishOrganization acquires command UserInterface.EstablishOrganization

output DisplayOrganization presents result UserInterface.OrganizationEstablished
}

handler OrgHandler is {
on command EstablishOrganization from user OrgOwner {
tell command UserInterface.CreateOrganization to context ImprovingApp.OrganizationContext
on command OrganizationContext.EstablishOrganization from user OrgOwner {
tell command OrganizationContext.OrganizationEstablished to context OrganizationContext
}
on event OrganizationEstablished from context ImprovingApp.OrganizationContext {
tell result ImprovingApp.OrganizationContext.OrganizationEstablished to
projector ImprovingApp.OrganizationContext.OrganizationViews
on event OrganizationContext.OrganizationEstablished from context OrganizationContext {
//tell resultOrganizationContext.OrganizationEstablished to
// projector Relationships.OrganizationViews
}
}

Expand All @@ -50,52 +48,43 @@ application UserInterface is {
}

group Member is {
input RegisterMember is {
acquires command UserInterface.RegisterMember
}
output DisplayMemberDetails is {
presents result MemberRegistered
}
input RegisterMember acquires command UserInterface.RegisterMember
output DisplayMemberDetails presents result ImprovingApp.UserInterface.MemberRegistered
}

handler MemberHandler is {
on command RegisterMember from user DemoMember {
on command ImprovingApp.GatewayAPI.MemberGateway.RegisterMember from user DemoMember {
tell command UserInterface.RegisterMember to context ImprovingApp.MemberContext
}
on event MemberRegistered from context ImprovingApp.MemberContext {
tell result ImprovingApp.MemberContext.MemberRegistered to
projector ImprovingApp.MemberContext.MemberViews
on event ImprovingApp.GatewayAPI.MemberGateway.MemberRegistered from context ImprovingApp.MemberContext {
//tell result ImprovingApp.MemberContext.MemberRegistered to
// projector ImprovingApp.MemberContext.MemberViews
}
}

command PurchaseProduct is {
productSku: ProductContext.SKU
}
type ProductPurchased is {
event ProductPurchased is {
productSku: ProductContext.SKU,
productInfo: ProductContext.ProductInfo,
productMeta: ProductContext.ProductMetaInfo
}
result ProductsPurchased is {
products: ProductPurchased*
products: ProductContext.SKU*
}

group Product is {
input PurchaseProduct is {
acquires command UserInterface.PurchaseProduct
}
output DisplayPurchases is {
presents result ProductsPurchased
}
input PurchaseProduct acquires command UserInterface.PurchaseProduct
output DisplayPurchases presents result ProductsPurchased
}

handler ProductHandler is {
on command PurchaseProduct from user Member {
tell command PurchaseProduct to context ProductContext
on command ImprovingApp.GatewayAPI.DemoScenarioGateway.PurchaseProduct from user ImprovingApp.GatewayAPI.Member {
tell command ImprovingApp.UserInterface.PurchaseProduct to context ProductContext
}
on event ProductContext.ProductPurchased
from context ProductContext {
tell result ProductContext.ProductCreated to projector ProductContext.ProductViews
on event ImprovingApp.UserInterface.ProductPurchased from context ProductContext {
//tell result ProductContext.ProductCreated to projector ProductContext.ProductViews
}
}
}
Expand All @@ -109,19 +98,15 @@ application CommandLine is {
}

group Scenario is {
input StartScenario is {
acquires command CommandLine.StartScenario
}
output DisplayScenario is {
presents result CommandLine.ScenarioStarted
}
input StartScenario acquires command CommandLine.StartScenario
output DisplayScenario presents result CommandLine.ScenarioStarted
}

handler CurlHandler is {
on command StartScenario from user Member {
tell command CommandLine.StartScenario to context GatewayContext
on command ImprovingApp.CommandLine.StartScenario from user ImprovingApp.GatewayAPI.Member {
tell command CommandLine.StartScenario to context GatewayAction
}
on event ScenarioStarted from context ImprovingApp.GatewayContext {
on result ImprovingApp.CommandLine.ScenarioStarted from context GatewayAction {
"display in terminal"
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/main/riddl/Calendars/calendar.riddl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
context Calendars is {
//Thinking of "outsourcing" this feature to google calendar. As such, this domain is an integration
//to the 3rd party app. It would be a good chance to teach the focuser pattern. There might also be
//some light customization (TBD).
//The google calendar API can be found here: https://developers.google.com/calendar/api
???
???
}

//Thinking of "outsourcing" this feature to google calendar. As such, this domain is an integration
//to the 3rd party app. It would be a good chance to teach the focuser pattern. There might also be
//some light customization (TBD).
//The google calendar API can be found here: https://developers.google.com/calendar/api

18 changes: 9 additions & 9 deletions src/main/riddl/Commerce/commerce.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ context Commerce is {
condition: String,
action: String
}
type PaymentId is Id( Payment )
type PaymentId is Id( Commerce.Payment )
type DeliveryId is Id( Delivery )
type DeliveryInfo is {
orderId: OrderId,
location: LocationId,
location: Venues.LocationId,
specialInstructions: String
} //not part of MVP

type NullState is Nothing

entity Promotion is {
state Active of ^^NullState is {???}
state Active of Commerce.NullState is {???}
handler ActivePromotionHandler is {???}
state Expired of ^^NullState is {???}
state Expired of Commerce.NullState is {???}
handler InactivePromotionHandler is {???}
} //not part of MVP

Expand All @@ -33,20 +33,20 @@ context Commerce is {
amount: Number,
dateProcessed: DateTime
}
state Payment of ^PaymentState is {
state Payment of PaymentState is {
handler PaymentHandler is {???}
}
}
entity Cart is {???} //develop as a future feature - Persistant Cart - Training exercise

entity Delivery is {
state Pending of ^^NullState is {???}
state Pending of Commerce.NullState is {???}
handler PendingDeliveryHandler is {???}
state Ready of ^^NullState is {???}
state Ready of Commerce.NullState is {???}
handler ReadyDeliveryHandler is {???}
state EnRoute of ^^NullState is {???}
state EnRoute of Commerce.NullState is {???}
handler EnRoutDeliveryHandler is {???}
state Delivered of ^^NullState is {???}
state Delivered of Commerce.NullState is {???}
handler DeliveredDeliveryHandler is {???}
} //not part of MVP
}
4 changes: 2 additions & 2 deletions src/main/riddl/Common/Contact.riddl
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Improving Inc.

// Types for Contact Information
type MobileNumber is Pattern("\\(([0-9]{3})\\)([0-9]{3})-([0-9]{4})")
briefly "North American Phone Number standard"
type EmailAddress is Pattern("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-](?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-])|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])\")@(?:(?:[a-z0-9](?:[a-z0-9-][a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-][a-z0-9])?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])")
Expand All @@ -11,6 +9,7 @@ type USPostalCode is Pattern("\\d{5}(-\\d{4})?")
briefly "A USA Postal Code"
type PostalCode is one of { CAPostalCode, USPostalCode }
briefly "Either a USA or Canadian postal code"
// Types for Contact Information

type Address is {
line1: String,
Expand All @@ -29,3 +28,4 @@ type Contact is {
userName: String
} briefly "Contact information for an individual"

// Copyright (c) 2022 Improving Inc.
19 changes: 11 additions & 8 deletions src/main/riddl/Epics/epics.riddl
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
user OrgOwner is "the person that owns the organization"
user Member is "any member (user) of the system"

epic EstablishOrganization by author Reid is {
user ImprovingApp.OrgOwner wants "to establish an organization" so that
"they can conduct business as that organization"
include "memberEpics"

epic EstablishOrganization is {
by author Reid
case primary is {
user OrgOwner wants "to establish an organization" so that "they can conduct business as that organization"
step from user OrgOwner "creates an Organization" to input
ImprovingApp.UserInterface.Organization.EstablishOrganization briefly "fill out form",
ImprovingApp.UserInterface.Organization.EstablishOrganization briefly "fill out form"
step
from output ImprovingApp.UserInterface.Organization.DisplayOrganization
"organizationAdded"
Expand All @@ -15,10 +17,11 @@ epic EstablishOrganization by author Reid is {
} briefly "A story about establishing an organization in Improving.app"
described as "This is the story of how an organization comes to existence"

epic RegisterMemberToOrganization by author Reid is {
user ImprovingApp.OrgOwner wants "to register a member" so that
"they can fill the roster for their organization"
case primary is { ??? }
epic RegisterMemberToOrganization is {
by author Reid
case primary is {
//user OrgOwner wants "to register a member" so that "they can fill the roster for their organization"
}
} briefly "A story about registering a member into an organization"
described as "TBD"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// TODO: convert every Feature to an epic and every Scenario to a case
// Note: this will involve creating components for application UserInterface for each epic

epic RegisterMember by author Alex is {
epic RegisterMember is {
user Member wants "to register as a member" so that "they can perform functions in the app"
by author Alex
term 'member' described as {
| An entity that is allowed to do queries on other entities or actions on other entities.
| Much of their behaviour will be constrained or permitted be based on ownership, membership, &
| permissions in the future.
}
}
// TODO: convert every Feature to an epic and every Scenario to a case
// Note: this will involve creating components for application UserInterface for each epic

// case RegisterActiveMember is {
// step from user Member "register as a member" to input
// Then the new registration is validated for handle and member id (make sure they are unique in the system(
Expand Down
Loading

0 comments on commit b1294b4

Please sign in to comment.