@reventlessdev/online-shop-aggregates-ordering 3.0.0-alpha.233 → 3.0.0-alpha.235

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.
Files changed (162) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/bs/.compiler.log +2 -2
  3. package/lib/bs/OrderingPlugin.cmi +0 -0
  4. package/lib/bs/OrderingPlugin.cmt +0 -0
  5. package/lib/bs/OrderingPlugin.mlmap +1 -0
  6. package/lib/bs/compiler-info.json +1 -1
  7. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct-OrderingPlugin.cmi +0 -0
  8. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct-OrderingPlugin.cmt +0 -0
  9. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct.ast +0 -0
  10. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct.res.mjs +1 -1
  11. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct_Behavior-OrderingPlugin.cmi +0 -0
  12. package/lib/bs/src/CatalogProduct/Aggregate/CatalogProduct_Behavior-OrderingPlugin.cmt +0 -0
  13. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts-OrderingPlugin.cmi +0 -0
  14. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts-OrderingPlugin.cmt +0 -0
  15. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts_Projections-OrderingPlugin.cmi +0 -0
  16. package/lib/bs/src/CatalogProduct/ReadModel/AvailableProducts_Projections-OrderingPlugin.cmt +0 -0
  17. package/lib/bs/src/Customer/Aggregate/Customer-OrderingPlugin.cmi +0 -0
  18. package/lib/bs/src/Customer/Aggregate/Customer-OrderingPlugin.cmt +0 -0
  19. package/lib/bs/src/Customer/Aggregate/Customer.ast +0 -0
  20. package/lib/bs/src/Customer/Aggregate/Customer.res.mjs +1 -1
  21. package/lib/bs/src/Customer/Aggregate/Customer_Behavior-OrderingPlugin.cmi +0 -0
  22. package/lib/bs/src/Customer/Aggregate/Customer_Behavior-OrderingPlugin.cmt +0 -0
  23. package/lib/bs/src/Customer/ReadModel/Customers-OrderingPlugin.cmi +0 -0
  24. package/lib/bs/src/Customer/ReadModel/Customers-OrderingPlugin.cmt +0 -0
  25. package/lib/bs/src/Customer/ReadModel/Customers_Projections-OrderingPlugin.cmi +0 -0
  26. package/lib/bs/src/Customer/ReadModel/Customers_Projections-OrderingPlugin.cmt +0 -0
  27. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmi +0 -0
  28. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmt +0 -0
  29. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
  30. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
  31. package/lib/bs/src/LifecycleModel-OrderingPlugin.cmi +0 -0
  32. package/lib/bs/src/LifecycleModel-OrderingPlugin.cmj +0 -0
  33. package/lib/bs/src/LifecycleModel-OrderingPlugin.cmt +0 -0
  34. package/lib/bs/src/LifecycleModel.ast +0 -0
  35. package/lib/bs/src/LifecycleModel.res +14 -0
  36. package/lib/bs/src/LifecycleModel.res.mjs +38 -0
  37. package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmi +0 -0
  38. package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmt +0 -0
  39. package/lib/bs/src/Order/Aggregate/Order.ast +0 -0
  40. package/lib/bs/src/Order/Aggregate/Order.res +4 -1
  41. package/lib/bs/src/Order/Aggregate/Order.res.mjs +4 -1
  42. package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmi +0 -0
  43. package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmt +0 -0
  44. package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmi +0 -0
  45. package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmt +0 -0
  46. package/lib/bs/src/Order/ReadModel/Orders-OrderingPlugin.cmi +0 -0
  47. package/lib/bs/src/Order/ReadModel/Orders-OrderingPlugin.cmt +0 -0
  48. package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmi +0 -0
  49. package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmt +0 -0
  50. package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmi +0 -0
  51. package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmt +0 -0
  52. package/lib/bs/src/Plugin-OrderingPlugin.cmi +0 -0
  53. package/lib/bs/src/Plugin-OrderingPlugin.cmt +0 -0
  54. package/lib/bs/src/Plugin.ast +0 -0
  55. package/lib/bs/src/Plugin.res +1 -0
  56. package/lib/bs/src/Plugin.res.mjs +2 -1
  57. package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmi +0 -0
  58. package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmt +0 -0
  59. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
  60. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
  61. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
  62. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
  63. package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmi +0 -0
  64. package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmt +0 -0
  65. package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmi +0 -0
  66. package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmt +0 -0
  67. package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
  68. package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
  69. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
  70. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
  71. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
  72. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
  73. package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmi +0 -0
  74. package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmt +0 -0
  75. package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmi +0 -0
  76. package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmt +0 -0
  77. package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmi +0 -0
  78. package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmt +0 -0
  79. package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
  80. package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
  81. package/lib/ocaml/.compiler.log +2 -2
  82. package/lib/ocaml/AvailableProducts-OrderingPlugin.cmi +0 -0
  83. package/lib/ocaml/AvailableProducts-OrderingPlugin.cmt +0 -0
  84. package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
  85. package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
  86. package/lib/ocaml/AvailableProducts_Projections-OrderingPlugin.cmi +0 -0
  87. package/lib/ocaml/AvailableProducts_Projections-OrderingPlugin.cmt +0 -0
  88. package/lib/ocaml/CatalogProduct-OrderingPlugin.cmi +0 -0
  89. package/lib/ocaml/CatalogProduct-OrderingPlugin.cmt +0 -0
  90. package/lib/ocaml/CatalogProduct.ast +0 -0
  91. package/lib/ocaml/CatalogProduct_Behavior-OrderingPlugin.cmi +0 -0
  92. package/lib/ocaml/CatalogProduct_Behavior-OrderingPlugin.cmt +0 -0
  93. package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
  94. package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
  95. package/lib/ocaml/Customer-OrderingPlugin.cmi +0 -0
  96. package/lib/ocaml/Customer-OrderingPlugin.cmt +0 -0
  97. package/lib/ocaml/Customer.ast +0 -0
  98. package/lib/ocaml/Customer_Behavior-OrderingPlugin.cmi +0 -0
  99. package/lib/ocaml/Customer_Behavior-OrderingPlugin.cmt +0 -0
  100. package/lib/ocaml/Customer_GWT-OrderingPlugin.cmi +0 -0
  101. package/lib/ocaml/Customer_GWT-OrderingPlugin.cmt +0 -0
  102. package/lib/ocaml/Customers-OrderingPlugin.cmi +0 -0
  103. package/lib/ocaml/Customers-OrderingPlugin.cmt +0 -0
  104. package/lib/ocaml/Customers_GWT-OrderingPlugin.cmi +0 -0
  105. package/lib/ocaml/Customers_GWT-OrderingPlugin.cmt +0 -0
  106. package/lib/ocaml/Customers_Projections-OrderingPlugin.cmi +0 -0
  107. package/lib/ocaml/Customers_Projections-OrderingPlugin.cmt +0 -0
  108. package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmi +0 -0
  109. package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmt +0 -0
  110. package/lib/ocaml/LifecycleModel-OrderingPlugin.cmi +0 -0
  111. package/lib/ocaml/LifecycleModel-OrderingPlugin.cmj +0 -0
  112. package/lib/ocaml/LifecycleModel-OrderingPlugin.cmt +0 -0
  113. package/lib/ocaml/LifecycleModel.ast +0 -0
  114. package/lib/ocaml/LifecycleModel.res +14 -0
  115. package/lib/ocaml/Order-OrderingPlugin.cmi +0 -0
  116. package/lib/ocaml/Order-OrderingPlugin.cmt +0 -0
  117. package/lib/ocaml/Order.ast +0 -0
  118. package/lib/ocaml/Order.res +4 -1
  119. package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
  120. package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
  121. package/lib/ocaml/OrderNotifications-OrderingPlugin.cmi +0 -0
  122. package/lib/ocaml/OrderNotifications-OrderingPlugin.cmt +0 -0
  123. package/lib/ocaml/Order_Behavior-OrderingPlugin.cmi +0 -0
  124. package/lib/ocaml/Order_Behavior-OrderingPlugin.cmt +0 -0
  125. package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmi +0 -0
  126. package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmt +0 -0
  127. package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
  128. package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
  129. package/lib/ocaml/Order_GWT-OrderingPlugin.cmi +0 -0
  130. package/lib/ocaml/Order_GWT-OrderingPlugin.cmt +0 -0
  131. package/lib/ocaml/Order_Mappings-OrderingPlugin.cmi +0 -0
  132. package/lib/ocaml/Order_Mappings-OrderingPlugin.cmt +0 -0
  133. package/lib/ocaml/OrderingPlugin.cmi +0 -0
  134. package/lib/ocaml/OrderingPlugin.cmt +0 -0
  135. package/lib/ocaml/OrderingPlugin.mlmap +1 -0
  136. package/lib/ocaml/Orders-OrderingPlugin.cmi +0 -0
  137. package/lib/ocaml/Orders-OrderingPlugin.cmt +0 -0
  138. package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
  139. package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
  140. package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
  141. package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
  142. package/lib/ocaml/Orders_GWT-OrderingPlugin.cmi +0 -0
  143. package/lib/ocaml/Orders_GWT-OrderingPlugin.cmt +0 -0
  144. package/lib/ocaml/Orders_Projections-OrderingPlugin.cmi +0 -0
  145. package/lib/ocaml/Orders_Projections-OrderingPlugin.cmt +0 -0
  146. package/lib/ocaml/Plugin-OrderingPlugin.cmi +0 -0
  147. package/lib/ocaml/Plugin-OrderingPlugin.cmt +0 -0
  148. package/lib/ocaml/Plugin.ast +0 -0
  149. package/lib/ocaml/Plugin.res +1 -0
  150. package/lib/ocaml/Products_Extension-OrderingPlugin.cmi +0 -0
  151. package/lib/ocaml/Products_Extension-OrderingPlugin.cmt +0 -0
  152. package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
  153. package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
  154. package/package.json +8 -8
  155. package/src/CatalogProduct/Aggregate/CatalogProduct.res.mjs +1 -1
  156. package/src/Customer/Aggregate/Customer.res.mjs +1 -1
  157. package/src/LifecycleModel.res +14 -0
  158. package/src/LifecycleModel.res.mjs +38 -0
  159. package/src/Order/Aggregate/Order.res +4 -1
  160. package/src/Order/Aggregate/Order.res.mjs +4 -1
  161. package/src/Plugin.res +1 -0
  162. package/src/Plugin.res.mjs +2 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 3.0.0-alpha.235 (2026-09-07)
7
+
8
+ ### Features
9
+
10
+ * **core:** a command's lifecycle edge comes from its scenarios, not its claim ([1879d05](https://github.com/ReventlessDev/reventless-core/commit/1879d0570a981e7fae5bcd3808f8a36e898bd0fd))
11
+
12
+
13
+ # 3.0.0-alpha.234 (2026-09-04)
14
+
15
+ **Note:** Version bump only for package @reventlessdev/online-shop-aggregates-ordering
16
+
17
+
18
+
19
+
20
+
6
21
  # 3.0.0-alpha.233 (2026-09-04)
7
22
 
8
23
  **Note:** Version bump only for package @reventlessdev/online-shop-aggregates-ordering
@@ -1,2 +1,2 @@
1
- #Start(1788485578834)
2
- #Done(1788485583849)
1
+ #Start(1788762246366)
2
+ #Done(1788762252176)
Binary file
Binary file
@@ -13,6 +13,7 @@ Customers_GWT
13
13
  Customers_Projections
14
14
  EmailService
15
15
  EmailService_Mock
16
+ LifecycleModel
16
17
  Order
17
18
  OrderMappings_GWT
18
19
  OrderNotifications
@@ -4,5 +4,5 @@
4
4
  "bsc_hash": "75e3a59c95cc953608fd3dd6ea6ed68141bba4414a20a52f114261b8a48385fa",
5
5
  "rescript_config_hash": "4c884bf958b93b21c77764e35498f269b81377cfcc324135f1ab7a1cc5b569cb",
6
6
  "runtime_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/runtime",
7
- "generated_at": "1788485583856"
7
+ "generated_at": "1788762252180"
8
8
  }
@@ -33,7 +33,7 @@ function commandAuthorization(param) {
33
33
  }
34
34
 
35
35
  function commandTransition(param) {
36
- return "Unrestricted";
36
+ return "Undeclared";
37
37
  }
38
38
 
39
39
  let traits = [];
@@ -48,7 +48,7 @@ function commandAuthorization(param) {
48
48
  }
49
49
 
50
50
  function commandTransition(param) {
51
- return "Unrestricted";
51
+ return "Undeclared";
52
52
  }
53
53
 
54
54
  let traits = [];
Binary file
@@ -0,0 +1,14 @@
1
+ // AUTO-GENERATED — do not edit. Run `pnpm run check:lifecycle:update` to update.
2
+ //
3
+ // What ordering's own given/when/then scenarios say about each command: the
4
+ // states one shows it taking effect from, the states those land in, and whether
5
+ // it brings a row into existence. `Plugin_Structure` prefers this to the
6
+ // `@transition` annotation where it says anything, and falls back to the
7
+ // annotation where it is silent.
8
+
9
+ let model: array<Reventless.Plugin.derivedEdge> = [
10
+ {component: "Order", command: "Cancel", level: Reventless.Plugin.Instance, allowedStates: ["Placed"], targets: ["Cancelled"]},
11
+ {component: "Order", command: "Place", level: Reventless.Plugin.Collection, allowedStates: [], targets: ["Placed"]},
12
+ {component: "Order", command: "Refund", level: Reventless.Plugin.Instance, allowedStates: ["Cancelled"], targets: ["Refunded"]},
13
+ {component: "Order", command: "Ship", level: Reventless.Plugin.Instance, allowedStates: ["Placed"], targets: ["Shipped"]},
14
+ ]
@@ -0,0 +1,38 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ let model = [
5
+ {
6
+ component: "Order",
7
+ command: "Cancel",
8
+ level: "Instance",
9
+ allowedStates: ["Placed"],
10
+ targets: ["Cancelled"]
11
+ },
12
+ {
13
+ component: "Order",
14
+ command: "Place",
15
+ level: "Collection",
16
+ allowedStates: [],
17
+ targets: ["Placed"]
18
+ },
19
+ {
20
+ component: "Order",
21
+ command: "Refund",
22
+ level: "Instance",
23
+ allowedStates: ["Cancelled"],
24
+ targets: ["Refunded"]
25
+ },
26
+ {
27
+ component: "Order",
28
+ command: "Ship",
29
+ level: "Instance",
30
+ allowedStates: ["Placed"],
31
+ targets: ["Shipped"]
32
+ }
33
+ ];
34
+
35
+ export {
36
+ model,
37
+ }
38
+ /* No side effect */
@@ -33,7 +33,10 @@ type lifecycleState = Orders.lifecycle
33
33
  let commandTransition = (command: command): Reventless.Transition.t<lifecycleState> => {
34
34
  open Reventless.Transition
35
35
  switch command {
36
- | Place(_) => Unrestricted
36
+ // Brings the row into existence, so there is no state it could come from.
37
+ // Not `Unrestricted`: the scenarios show it inert on an order already placed,
38
+ // shipped or cancelled, which is the opposite of legal in every state.
39
+ | Place(_) => Creates(Orders.Placed)
37
40
  | Ship => Moves([Orders.Placed], Orders.Shipped)
38
41
  | Cancel => Moves([Orders.Placed], Orders.Cancelled)
39
42
  | Refund(_) => Moves([Orders.Cancelled], Orders.Refunded)
@@ -59,7 +59,10 @@ function commandTransition(command) {
59
59
  };
60
60
  }
61
61
  } else if (command.TAG === "Place") {
62
- return "Unrestricted";
62
+ return {
63
+ TAG: "Creates",
64
+ _0: "Placed"
65
+ };
63
66
  } else {
64
67
  return {
65
68
  TAG: "Moves",
Binary file
@@ -41,6 +41,7 @@ module Make = (Platform: ReventlessInfra.Platform.T) => {
41
41
  ~extensions=[module(Products_Extension)],
42
42
  ~extensionPoints=[module(Orders_ExtensionPointMapping)],
43
43
  ~componentChapters=Dict.fromArray([("AvailableProducts", "CatalogProduct"), ("CatalogProduct", "CatalogProduct"), ("Customer", "Customer"), ("Customers", "Customer"), ("Order", "Order"), ("Orders", "Order")]),
44
+ ~lifecycleModel=LifecycleModel.model,
44
45
  )
45
46
 
46
47
  let make = () =>
@@ -7,6 +7,7 @@ import * as Orders$OrderingPlugin from "./Order/ReadModel/Orders.res.mjs";
7
7
  import * as Customer$OrderingPlugin from "./Customer/Aggregate/Customer.res.mjs";
8
8
  import * as Customers$OrderingPlugin from "./Customer/ReadModel/Customers.res.mjs";
9
9
  import * as CatalogProduct$OrderingPlugin from "./CatalogProduct/Aggregate/CatalogProduct.res.mjs";
10
+ import * as LifecycleModel$OrderingPlugin from "./LifecycleModel.res.mjs";
10
11
  import * as Order_Behavior$OrderingPlugin from "./Order/Aggregate/Order_Behavior.res.mjs";
11
12
  import * as Order_Mappings$OrderingPlugin from "./Order/Aggregate/Order_Mappings.res.mjs";
12
13
  import * as NoEventMappings$ReventlessInfra from "@reventlessdev/reventless-infra/src/types/NoEventMappings.res.mjs";
@@ -238,7 +239,7 @@ function Make(Platform) {
238
239
  "Orders",
239
240
  "Order"
240
241
  ]
241
- ]));
242
+ ]), LifecycleModel$OrderingPlugin.model);
242
243
  let make = () => Platform.Plugin.make("Ordering", 5, [Orders_ExtensionPoint], [Products_Extension], [
243
244
  CatalogProductAggregate,
244
245
  CustomerAggregate,
@@ -1,2 +1,2 @@
1
- #Start(1788485578834)
2
- #Done(1788485583849)
1
+ #Start(1788762246366)
2
+ #Done(1788762252176)
Binary file
Binary file
Binary file
@@ -0,0 +1,14 @@
1
+ // AUTO-GENERATED — do not edit. Run `pnpm run check:lifecycle:update` to update.
2
+ //
3
+ // What ordering's own given/when/then scenarios say about each command: the
4
+ // states one shows it taking effect from, the states those land in, and whether
5
+ // it brings a row into existence. `Plugin_Structure` prefers this to the
6
+ // `@transition` annotation where it says anything, and falls back to the
7
+ // annotation where it is silent.
8
+
9
+ let model: array<Reventless.Plugin.derivedEdge> = [
10
+ {component: "Order", command: "Cancel", level: Reventless.Plugin.Instance, allowedStates: ["Placed"], targets: ["Cancelled"]},
11
+ {component: "Order", command: "Place", level: Reventless.Plugin.Collection, allowedStates: [], targets: ["Placed"]},
12
+ {component: "Order", command: "Refund", level: Reventless.Plugin.Instance, allowedStates: ["Cancelled"], targets: ["Refunded"]},
13
+ {component: "Order", command: "Ship", level: Reventless.Plugin.Instance, allowedStates: ["Placed"], targets: ["Shipped"]},
14
+ ]
Binary file
Binary file
Binary file
@@ -33,7 +33,10 @@ type lifecycleState = Orders.lifecycle
33
33
  let commandTransition = (command: command): Reventless.Transition.t<lifecycleState> => {
34
34
  open Reventless.Transition
35
35
  switch command {
36
- | Place(_) => Unrestricted
36
+ // Brings the row into existence, so there is no state it could come from.
37
+ // Not `Unrestricted`: the scenarios show it inert on an order already placed,
38
+ // shipped or cancelled, which is the opposite of legal in every state.
39
+ | Place(_) => Creates(Orders.Placed)
37
40
  | Ship => Moves([Orders.Placed], Orders.Shipped)
38
41
  | Cancel => Moves([Orders.Placed], Orders.Cancelled)
39
42
  | Refund(_) => Moves([Orders.Cancelled], Orders.Refunded)
Binary file
Binary file
@@ -13,6 +13,7 @@ Customers_GWT
13
13
  Customers_Projections
14
14
  EmailService
15
15
  EmailService_Mock
16
+ LifecycleModel
16
17
  Order
17
18
  OrderMappings_GWT
18
19
  OrderNotifications
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -41,6 +41,7 @@ module Make = (Platform: ReventlessInfra.Platform.T) => {
41
41
  ~extensions=[module(Products_Extension)],
42
42
  ~extensionPoints=[module(Orders_ExtensionPointMapping)],
43
43
  ~componentChapters=Dict.fromArray([("AvailableProducts", "CatalogProduct"), ("CatalogProduct", "CatalogProduct"), ("Customer", "Customer"), ("Customers", "Customer"), ("Order", "Order"), ("Orders", "Order")]),
44
+ ~lifecycleModel=LifecycleModel.model,
44
45
  )
45
46
 
46
47
  let make = () =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/online-shop-aggregates-ordering",
3
- "version": "3.0.0-alpha.233",
3
+ "version": "3.0.0-alpha.235",
4
4
  "description": "Online Shop example — Ordering plugin (Customer & Order aggregates)",
5
5
  "license": "Apache-2.0",
6
6
  "jest": {
@@ -21,18 +21,18 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "sury": "11.0.0-rc.2",
24
- "@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.127",
24
+ "@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.129",
25
25
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.19",
26
- "@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.127",
27
- "@reventlessdev/reventless-gwt": "1.0.0-alpha.202",
28
- "@reventlessdev/reventless-infra": "3.0.0-alpha.156",
29
- "@reventlessdev/reventless-local": "3.0.0-alpha.244",
30
- "@reventlessdev/reventless-spec": "3.0.0-alpha.128"
26
+ "@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.129",
27
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.158",
28
+ "@reventlessdev/reventless-gwt": "1.0.0-alpha.204",
29
+ "@reventlessdev/reventless-local": "3.0.0-alpha.246",
30
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.130"
31
31
  },
32
32
  "devDependencies": {
33
33
  "rescript": "12.3.0",
34
34
  "sury-ppx": "11.0.0-rc.2",
35
- "@reventlessdev/reventless-ppx": "1.0.0-alpha.77"
35
+ "@reventlessdev/reventless-ppx": "1.0.0-alpha.78"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "rescript": "12.3.0"
@@ -33,7 +33,7 @@ function commandAuthorization(param) {
33
33
  }
34
34
 
35
35
  function commandTransition(param) {
36
- return "Unrestricted";
36
+ return "Undeclared";
37
37
  }
38
38
 
39
39
  let traits = [];
@@ -48,7 +48,7 @@ function commandAuthorization(param) {
48
48
  }
49
49
 
50
50
  function commandTransition(param) {
51
- return "Unrestricted";
51
+ return "Undeclared";
52
52
  }
53
53
 
54
54
  let traits = [];
@@ -0,0 +1,14 @@
1
+ // AUTO-GENERATED — do not edit. Run `pnpm run check:lifecycle:update` to update.
2
+ //
3
+ // What ordering's own given/when/then scenarios say about each command: the
4
+ // states one shows it taking effect from, the states those land in, and whether
5
+ // it brings a row into existence. `Plugin_Structure` prefers this to the
6
+ // `@transition` annotation where it says anything, and falls back to the
7
+ // annotation where it is silent.
8
+
9
+ let model: array<Reventless.Plugin.derivedEdge> = [
10
+ {component: "Order", command: "Cancel", level: Reventless.Plugin.Instance, allowedStates: ["Placed"], targets: ["Cancelled"]},
11
+ {component: "Order", command: "Place", level: Reventless.Plugin.Collection, allowedStates: [], targets: ["Placed"]},
12
+ {component: "Order", command: "Refund", level: Reventless.Plugin.Instance, allowedStates: ["Cancelled"], targets: ["Refunded"]},
13
+ {component: "Order", command: "Ship", level: Reventless.Plugin.Instance, allowedStates: ["Placed"], targets: ["Shipped"]},
14
+ ]
@@ -0,0 +1,38 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+
4
+ let model = [
5
+ {
6
+ component: "Order",
7
+ command: "Cancel",
8
+ level: "Instance",
9
+ allowedStates: ["Placed"],
10
+ targets: ["Cancelled"]
11
+ },
12
+ {
13
+ component: "Order",
14
+ command: "Place",
15
+ level: "Collection",
16
+ allowedStates: [],
17
+ targets: ["Placed"]
18
+ },
19
+ {
20
+ component: "Order",
21
+ command: "Refund",
22
+ level: "Instance",
23
+ allowedStates: ["Cancelled"],
24
+ targets: ["Refunded"]
25
+ },
26
+ {
27
+ component: "Order",
28
+ command: "Ship",
29
+ level: "Instance",
30
+ allowedStates: ["Placed"],
31
+ targets: ["Shipped"]
32
+ }
33
+ ];
34
+
35
+ export {
36
+ model,
37
+ }
38
+ /* No side effect */
@@ -33,7 +33,10 @@ type lifecycleState = Orders.lifecycle
33
33
  let commandTransition = (command: command): Reventless.Transition.t<lifecycleState> => {
34
34
  open Reventless.Transition
35
35
  switch command {
36
- | Place(_) => Unrestricted
36
+ // Brings the row into existence, so there is no state it could come from.
37
+ // Not `Unrestricted`: the scenarios show it inert on an order already placed,
38
+ // shipped or cancelled, which is the opposite of legal in every state.
39
+ | Place(_) => Creates(Orders.Placed)
37
40
  | Ship => Moves([Orders.Placed], Orders.Shipped)
38
41
  | Cancel => Moves([Orders.Placed], Orders.Cancelled)
39
42
  | Refund(_) => Moves([Orders.Cancelled], Orders.Refunded)
@@ -59,7 +59,10 @@ function commandTransition(command) {
59
59
  };
60
60
  }
61
61
  } else if (command.TAG === "Place") {
62
- return "Unrestricted";
62
+ return {
63
+ TAG: "Creates",
64
+ _0: "Placed"
65
+ };
63
66
  } else {
64
67
  return {
65
68
  TAG: "Moves",
package/src/Plugin.res CHANGED
@@ -41,6 +41,7 @@ module Make = (Platform: ReventlessInfra.Platform.T) => {
41
41
  ~extensions=[module(Products_Extension)],
42
42
  ~extensionPoints=[module(Orders_ExtensionPointMapping)],
43
43
  ~componentChapters=Dict.fromArray([("AvailableProducts", "CatalogProduct"), ("CatalogProduct", "CatalogProduct"), ("Customer", "Customer"), ("Customers", "Customer"), ("Order", "Order"), ("Orders", "Order")]),
44
+ ~lifecycleModel=LifecycleModel.model,
44
45
  )
45
46
 
46
47
  let make = () =>
@@ -7,6 +7,7 @@ import * as Orders$OrderingPlugin from "./Order/ReadModel/Orders.res.mjs";
7
7
  import * as Customer$OrderingPlugin from "./Customer/Aggregate/Customer.res.mjs";
8
8
  import * as Customers$OrderingPlugin from "./Customer/ReadModel/Customers.res.mjs";
9
9
  import * as CatalogProduct$OrderingPlugin from "./CatalogProduct/Aggregate/CatalogProduct.res.mjs";
10
+ import * as LifecycleModel$OrderingPlugin from "./LifecycleModel.res.mjs";
10
11
  import * as Order_Behavior$OrderingPlugin from "./Order/Aggregate/Order_Behavior.res.mjs";
11
12
  import * as Order_Mappings$OrderingPlugin from "./Order/Aggregate/Order_Mappings.res.mjs";
12
13
  import * as NoEventMappings$ReventlessInfra from "@reventlessdev/reventless-infra/src/types/NoEventMappings.res.mjs";
@@ -238,7 +239,7 @@ function Make(Platform) {
238
239
  "Orders",
239
240
  "Order"
240
241
  ]
241
- ]));
242
+ ]), LifecycleModel$OrderingPlugin.model);
242
243
  let make = () => Platform.Plugin.make("Ordering", 5, [Orders_ExtensionPoint], [Products_Extension], [
243
244
  CatalogProductAggregate,
244
245
  CustomerAggregate,