@reventlessdev/online-shop-aggregates-ordering 3.0.0-alpha.227 → 3.0.0-alpha.229

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 (107) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/lib/bs/.compiler.log +2 -2
  3. package/lib/bs/compiler-info.json +1 -1
  4. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmi +0 -0
  5. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmj +0 -0
  6. package/lib/bs/src/Extension/Products_Extension-OrderingPlugin.cmt +0 -0
  7. package/lib/bs/src/Extension/Products_Extension.ast +0 -0
  8. package/lib/bs/src/Extension/Products_Extension.res +1 -0
  9. package/lib/bs/src/Extension/Products_Extension.res.mjs +15 -0
  10. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
  11. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
  12. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping.ast +0 -0
  13. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping.res +2 -2
  14. package/lib/bs/src/ExtensionPoint/Orders_ExtensionPointMapping.res.mjs +15 -0
  15. package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmi +0 -0
  16. package/lib/bs/src/Order/Aggregate/Order-OrderingPlugin.cmt +0 -0
  17. package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmi +0 -0
  18. package/lib/bs/src/Order/Aggregate/Order_Behavior-OrderingPlugin.cmt +0 -0
  19. package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmi +0 -0
  20. package/lib/bs/src/Order/Aggregate/Order_Mappings-OrderingPlugin.cmt +0 -0
  21. package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmi +0 -0
  22. package/lib/bs/src/Order/ReadModel/Orders_Projections-OrderingPlugin.cmt +0 -0
  23. package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmi +0 -0
  24. package/lib/bs/src/Order/SideEffect/Order_EmailNotification-OrderingPlugin.cmt +0 -0
  25. package/lib/bs/src/Plugin-OrderingPlugin.cmi +0 -0
  26. package/lib/bs/src/Plugin-OrderingPlugin.cmt +0 -0
  27. package/lib/bs/src/Plugin.res.mjs +9 -3
  28. package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmi +0 -0
  29. package/lib/bs/src/Task/OrderNotifications-OrderingPlugin.cmt +0 -0
  30. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
  31. package/lib/bs/tests/CatalogProduct/Aggregate/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
  32. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
  33. package/lib/bs/tests/CatalogProduct/ReadModel/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
  34. package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmi +0 -0
  35. package/lib/bs/tests/Customer/Aggregate/Customer_GWT-OrderingPlugin.cmt +0 -0
  36. package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmi +0 -0
  37. package/lib/bs/tests/Customer/ReadModel/Customers_GWT-OrderingPlugin.cmt +0 -0
  38. package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
  39. package/lib/bs/tests/Extension/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
  40. package/lib/bs/tests/Extension/Products_Extension_GWT.res.mjs +3 -1
  41. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
  42. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
  43. package/lib/bs/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +3 -1
  44. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
  45. package/lib/bs/tests/Order/Aggregate/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
  46. package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmi +0 -0
  47. package/lib/bs/tests/Order/Aggregate/Order_GWT-OrderingPlugin.cmt +0 -0
  48. package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmi +0 -0
  49. package/lib/bs/tests/Order/ReadModel/Orders_GWT-OrderingPlugin.cmt +0 -0
  50. package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmi +0 -0
  51. package/lib/bs/tests/Order/SideEffect/EmailService_Mock-OrderingPlugin.cmt +0 -0
  52. package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
  53. package/lib/bs/tests/Order/SideEffect/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
  54. package/lib/ocaml/.compiler.log +2 -2
  55. package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmi +0 -0
  56. package/lib/ocaml/AvailableProducts_GWT-OrderingPlugin.cmt +0 -0
  57. package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmi +0 -0
  58. package/lib/ocaml/CatalogProduct_GWT-OrderingPlugin.cmt +0 -0
  59. package/lib/ocaml/Customer_GWT-OrderingPlugin.cmi +0 -0
  60. package/lib/ocaml/Customer_GWT-OrderingPlugin.cmt +0 -0
  61. package/lib/ocaml/Customers_GWT-OrderingPlugin.cmi +0 -0
  62. package/lib/ocaml/Customers_GWT-OrderingPlugin.cmt +0 -0
  63. package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmi +0 -0
  64. package/lib/ocaml/EmailService_Mock-OrderingPlugin.cmt +0 -0
  65. package/lib/ocaml/Order-OrderingPlugin.cmi +0 -0
  66. package/lib/ocaml/Order-OrderingPlugin.cmt +0 -0
  67. package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmi +0 -0
  68. package/lib/ocaml/OrderMappings_GWT-OrderingPlugin.cmt +0 -0
  69. package/lib/ocaml/OrderNotifications-OrderingPlugin.cmi +0 -0
  70. package/lib/ocaml/OrderNotifications-OrderingPlugin.cmt +0 -0
  71. package/lib/ocaml/Order_Behavior-OrderingPlugin.cmi +0 -0
  72. package/lib/ocaml/Order_Behavior-OrderingPlugin.cmt +0 -0
  73. package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmi +0 -0
  74. package/lib/ocaml/Order_EmailNotification-OrderingPlugin.cmt +0 -0
  75. package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmi +0 -0
  76. package/lib/ocaml/Order_EmailNotification_GWT-OrderingPlugin.cmt +0 -0
  77. package/lib/ocaml/Order_GWT-OrderingPlugin.cmi +0 -0
  78. package/lib/ocaml/Order_GWT-OrderingPlugin.cmt +0 -0
  79. package/lib/ocaml/Order_Mappings-OrderingPlugin.cmi +0 -0
  80. package/lib/ocaml/Order_Mappings-OrderingPlugin.cmt +0 -0
  81. package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmi +0 -0
  82. package/lib/ocaml/Orders_ExtensionPointMapping-OrderingPlugin.cmt +0 -0
  83. package/lib/ocaml/Orders_ExtensionPointMapping.ast +0 -0
  84. package/lib/ocaml/Orders_ExtensionPointMapping.res +2 -2
  85. package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmi +0 -0
  86. package/lib/ocaml/Orders_ExtensionPointMapping_GWT-OrderingPlugin.cmt +0 -0
  87. package/lib/ocaml/Orders_GWT-OrderingPlugin.cmi +0 -0
  88. package/lib/ocaml/Orders_GWT-OrderingPlugin.cmt +0 -0
  89. package/lib/ocaml/Orders_Projections-OrderingPlugin.cmi +0 -0
  90. package/lib/ocaml/Orders_Projections-OrderingPlugin.cmt +0 -0
  91. package/lib/ocaml/Plugin-OrderingPlugin.cmi +0 -0
  92. package/lib/ocaml/Plugin-OrderingPlugin.cmt +0 -0
  93. package/lib/ocaml/Products_Extension-OrderingPlugin.cmi +0 -0
  94. package/lib/ocaml/Products_Extension-OrderingPlugin.cmj +0 -0
  95. package/lib/ocaml/Products_Extension-OrderingPlugin.cmt +0 -0
  96. package/lib/ocaml/Products_Extension.ast +0 -0
  97. package/lib/ocaml/Products_Extension.res +1 -0
  98. package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmi +0 -0
  99. package/lib/ocaml/Products_Extension_GWT-OrderingPlugin.cmt +0 -0
  100. package/package.json +8 -8
  101. package/src/Extension/Products_Extension.res +1 -0
  102. package/src/Extension/Products_Extension.res.mjs +15 -0
  103. package/src/ExtensionPoint/Orders_ExtensionPointMapping.res +2 -2
  104. package/src/ExtensionPoint/Orders_ExtensionPointMapping.res.mjs +15 -0
  105. package/src/Plugin.res.mjs +9 -3
  106. package/tests/Extension/Products_Extension_GWT.res.mjs +3 -1
  107. package/tests/ExtensionPoint/Orders_ExtensionPointMapping_GWT.res.mjs +3 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
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.229 (2026-08-27)
7
+
8
+ **Note:** Version bump only for package @reventlessdev/online-shop-aggregates-ordering
9
+
10
+
11
+
12
+
13
+
14
+ # 3.0.0-alpha.228 (2026-08-27)
15
+
16
+ ### Bug Fixes
17
+
18
+ * **ppx:** follow a let-bound action array merged into an arm's result ([230c72e](https://github.com/ReventlessDev/reventless-core/commit/230c72e25856d8ed20d0860e742b133b2c672d4a))
19
+ * feat(spec)!: reflect the command direction across a port, both halves ([f2fe258](https://github.com/ReventlessDev/reventless-core/commit/f2fe258d195b74f4a61488edee305665341020ea))
20
+ * feat(spec)!: read the port's translation table off the mapping's arms ([956348a](https://github.com/ReventlessDev/reventless-core/commit/956348a9fcb256cfff9db51809bdc27d73360e6c))
21
+
22
+ ### BREAKING CHANGES
23
+
24
+ * `ExtensionPointMapping.Mapping` gains `acceptedCommands` and
25
+ `ExtensionMapping.Mapping` gains `issuedCommands`; both are derived, so a
26
+ mapping the ppx can read needs no source change, and one it cannot names itself
27
+ at compile time. Definitions persisted before the two new def fields must be
28
+ re-emitted before a consumer can read them as present — and until then they
29
+ decode as None, which means unknown, not "issues nothing".
30
+ * `ExtensionPointMapping.Mapping` requires `publishedEvents` and
31
+ `ExtensionMapping.Mapping` requires `handledEvents`; the ppx injects both for
32
+ mappings it can read, so app code must build against the matching ppx. Plugin
33
+ definitions persisted before the new fields must be re-emitted before a consumer
34
+ reads them as present.
35
+
36
+
37
+
6
38
  # 3.0.0-alpha.227 (2026-08-23)
7
39
 
8
40
  **Note:** Version bump only for package @reventlessdev/online-shop-aggregates-ordering
@@ -1,2 +1,2 @@
1
- #Start(1787509261970)
2
- #Done(1787509267894)
1
+ #Start(1787841657084)
2
+ #Done(1787841661491)
@@ -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": "1787509267896"
7
+ "generated_at": "1787841661503"
8
8
  }
@@ -9,6 +9,7 @@ module Mapping = {
9
9
 
10
10
  open ExtensionPoint
11
11
  open Delegate
12
+
12
13
  let mapIncomingEvent = (_id, event, _meta, _pluginDef, _queryEngine) =>
13
14
  switch event {
14
15
  | ProductBecameAvailable({productId, name, price}) => [
@@ -25,11 +25,26 @@ function mapIncomingEvent(_id, event, _meta, _pluginDef, _queryEngine) {
25
25
  }
26
26
  }
27
27
 
28
+ let handledEvents = [
29
+ {
30
+ name: "ProductBecameAvailable",
31
+ toCommandTypes: ["Sync"]
32
+ },
33
+ {
34
+ name: "ProductPriceChanged",
35
+ toCommandTypes: ["UpdatePrice"]
36
+ }
37
+ ];
38
+
39
+ let issuedCommands = [];
40
+
28
41
  let Mapping = {
29
42
  ExtensionPoint: undefined,
30
43
  Delegate: undefined,
31
44
  mapIncomingEvent: mapIncomingEvent,
32
45
  mapOutgoingEvent: undefined,
46
+ handledEvents: handledEvents,
47
+ issuedCommands: issuedCommands,
33
48
  delegateModuleUrl: CatalogProduct$OrderingPlugin.moduleUrl,
34
49
  moduleUrl: "@reventlessdev/online-shop-aggregates-ordering/src/Extension/Products_Extension.res.mjs"
35
50
  };
@@ -1,5 +1,5 @@
1
- // Maps internal Order aggregate events to the stable OrdersExtensionPoint public API.
2
- // Decomposes a batch OrderPlaced (multiple productIds) into one ItemOrdered per product.
1
+ // Maps internal Order events to the OrdersExtensionPoint public API, one published
2
+ // event per product in a batch.
3
3
  @@reventless.spec
4
4
 
5
5
  module ExtensionPoint = OrderingSpec.Orders_ExtensionPoint
@@ -37,6 +37,19 @@ let mapOutgoingEvent = (_id, event, _meta, _queryEngine) => {
37
37
  }
38
38
  };
39
39
 
40
+ let publishedEvents = [
41
+ {
42
+ name: "ItemOrdered",
43
+ fromEventTypes: ["Placed"]
44
+ },
45
+ {
46
+ name: "ItemOrderCancelled",
47
+ fromEventTypes: ["Cancelled"]
48
+ }
49
+ ];
50
+
51
+ let acceptedCommands = [];
52
+
40
53
  let name = "Orders";
41
54
 
42
55
  let Id;
@@ -55,5 +68,7 @@ export {
55
68
  mapIncomingCommand,
56
69
  mapOutgoingEvent,
57
70
  moduleUrl,
71
+ publishedEvents,
72
+ acceptedCommands,
58
73
  }
59
74
  /* No side effect */
@@ -143,7 +143,9 @@ function Make(Platform) {
143
143
  },
144
144
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
145
145
  mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
146
- mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
146
+ mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent,
147
+ publishedEvents: Orders_ExtensionPointMapping$OrderingPlugin.publishedEvents,
148
+ acceptedCommands: Orders_ExtensionPointMapping$OrderingPlugin.acceptedCommands
147
149
  });
148
150
  let Products_Extension = Platform.Extension.Make({
149
151
  ExtensionPoint: {
@@ -165,7 +167,9 @@ function Make(Platform) {
165
167
  moduleUrl: Products_Extension$OrderingPlugin.Mapping.moduleUrl,
166
168
  delegateModuleUrl: Products_Extension$OrderingPlugin.Mapping.delegateModuleUrl,
167
169
  mapIncomingEvent: Products_Extension$OrderingPlugin.Mapping.mapIncomingEvent,
168
- mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent
170
+ mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent,
171
+ handledEvents: Products_Extension$OrderingPlugin.Mapping.handledEvents,
172
+ issuedCommands: Products_Extension$OrderingPlugin.Mapping.issuedCommands
169
173
  });
170
174
  let pluginStructure = Platform.Plugin.makePluginDefinition("Ordering", [
171
175
  CatalogProductAggregate,
@@ -194,7 +198,9 @@ function Make(Platform) {
194
198
  },
195
199
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
196
200
  mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
197
- mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
201
+ mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent,
202
+ publishedEvents: Orders_ExtensionPointMapping$OrderingPlugin.publishedEvents,
203
+ acceptedCommands: Orders_ExtensionPointMapping$OrderingPlugin.acceptedCommands
198
204
  }], Object.fromEntries([
199
205
  [
200
206
  "AvailableProducts",
@@ -26,7 +26,9 @@ let include = Delegate_GWT$ReventlessGwt.FromExtension({
26
26
  moduleUrl: Products_Extension$OrderingPlugin.Mapping.moduleUrl,
27
27
  delegateModuleUrl: Products_Extension$OrderingPlugin.Mapping.delegateModuleUrl,
28
28
  mapIncomingEvent: Products_Extension$OrderingPlugin.Mapping.mapIncomingEvent,
29
- mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent
29
+ mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent,
30
+ handledEvents: Products_Extension$OrderingPlugin.Mapping.handledEvents,
31
+ issuedCommands: Products_Extension$OrderingPlugin.Mapping.issuedCommands
30
32
  });
31
33
 
32
34
  let describe = include.describe;
@@ -25,7 +25,9 @@ let include = Delegate_GWT$ReventlessGwt.FromExtensionPoint({
25
25
  },
26
26
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
27
27
  mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
28
- mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
28
+ mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent,
29
+ publishedEvents: Orders_ExtensionPointMapping$OrderingPlugin.publishedEvents,
30
+ acceptedCommands: Orders_ExtensionPointMapping$OrderingPlugin.acceptedCommands
29
31
  });
30
32
 
31
33
  let describe = include.describe;
@@ -1,2 +1,2 @@
1
- #Start(1787509261970)
2
- #Done(1787509267894)
1
+ #Start(1787841657084)
2
+ #Done(1787841661491)
Binary file
Binary file
@@ -1,5 +1,5 @@
1
- // Maps internal Order aggregate events to the stable OrdersExtensionPoint public API.
2
- // Decomposes a batch OrderPlaced (multiple productIds) into one ItemOrdered per product.
1
+ // Maps internal Order events to the OrdersExtensionPoint public API, one published
2
+ // event per product in a batch.
3
3
  @@reventless.spec
4
4
 
5
5
  module ExtensionPoint = OrderingSpec.Orders_ExtensionPoint
Binary file
Binary file
Binary file
@@ -9,6 +9,7 @@ module Mapping = {
9
9
 
10
10
  open ExtensionPoint
11
11
  open Delegate
12
+
12
13
  let mapIncomingEvent = (_id, event, _meta, _pluginDef, _queryEngine) =>
13
14
  switch event {
14
15
  | ProductBecameAvailable({productId, name, price}) => [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/online-shop-aggregates-ordering",
3
- "version": "3.0.0-alpha.227",
3
+ "version": "3.0.0-alpha.229",
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.122",
24
+ "@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.123",
25
+ "@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.123",
25
26
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.19",
26
- "@reventlessdev/reventless-gwt": "1.0.0-alpha.197",
27
- "@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.122",
28
- "@reventlessdev/reventless-infra": "3.0.0-alpha.151",
29
- "@reventlessdev/reventless-local": "3.0.0-alpha.238",
30
- "@reventlessdev/reventless-spec": "3.0.0-alpha.123"
27
+ "@reventlessdev/reventless-gwt": "1.0.0-alpha.198",
28
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.152",
29
+ "@reventlessdev/reventless-local": "3.0.0-alpha.240",
30
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.124"
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.73"
35
+ "@reventlessdev/reventless-ppx": "1.0.0-alpha.74"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "rescript": "12.3.0"
@@ -9,6 +9,7 @@ module Mapping = {
9
9
 
10
10
  open ExtensionPoint
11
11
  open Delegate
12
+
12
13
  let mapIncomingEvent = (_id, event, _meta, _pluginDef, _queryEngine) =>
13
14
  switch event {
14
15
  | ProductBecameAvailable({productId, name, price}) => [
@@ -25,11 +25,26 @@ function mapIncomingEvent(_id, event, _meta, _pluginDef, _queryEngine) {
25
25
  }
26
26
  }
27
27
 
28
+ let handledEvents = [
29
+ {
30
+ name: "ProductBecameAvailable",
31
+ toCommandTypes: ["Sync"]
32
+ },
33
+ {
34
+ name: "ProductPriceChanged",
35
+ toCommandTypes: ["UpdatePrice"]
36
+ }
37
+ ];
38
+
39
+ let issuedCommands = [];
40
+
28
41
  let Mapping = {
29
42
  ExtensionPoint: undefined,
30
43
  Delegate: undefined,
31
44
  mapIncomingEvent: mapIncomingEvent,
32
45
  mapOutgoingEvent: undefined,
46
+ handledEvents: handledEvents,
47
+ issuedCommands: issuedCommands,
33
48
  delegateModuleUrl: CatalogProduct$OrderingPlugin.moduleUrl,
34
49
  moduleUrl: "@reventlessdev/online-shop-aggregates-ordering/src/Extension/Products_Extension.res.mjs"
35
50
  };
@@ -1,5 +1,5 @@
1
- // Maps internal Order aggregate events to the stable OrdersExtensionPoint public API.
2
- // Decomposes a batch OrderPlaced (multiple productIds) into one ItemOrdered per product.
1
+ // Maps internal Order events to the OrdersExtensionPoint public API, one published
2
+ // event per product in a batch.
3
3
  @@reventless.spec
4
4
 
5
5
  module ExtensionPoint = OrderingSpec.Orders_ExtensionPoint
@@ -37,6 +37,19 @@ let mapOutgoingEvent = (_id, event, _meta, _queryEngine) => {
37
37
  }
38
38
  };
39
39
 
40
+ let publishedEvents = [
41
+ {
42
+ name: "ItemOrdered",
43
+ fromEventTypes: ["Placed"]
44
+ },
45
+ {
46
+ name: "ItemOrderCancelled",
47
+ fromEventTypes: ["Cancelled"]
48
+ }
49
+ ];
50
+
51
+ let acceptedCommands = [];
52
+
40
53
  let name = "Orders";
41
54
 
42
55
  let Id;
@@ -55,5 +68,7 @@ export {
55
68
  mapIncomingCommand,
56
69
  mapOutgoingEvent,
57
70
  moduleUrl,
71
+ publishedEvents,
72
+ acceptedCommands,
58
73
  }
59
74
  /* No side effect */
@@ -143,7 +143,9 @@ function Make(Platform) {
143
143
  },
144
144
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
145
145
  mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
146
- mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
146
+ mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent,
147
+ publishedEvents: Orders_ExtensionPointMapping$OrderingPlugin.publishedEvents,
148
+ acceptedCommands: Orders_ExtensionPointMapping$OrderingPlugin.acceptedCommands
147
149
  });
148
150
  let Products_Extension = Platform.Extension.Make({
149
151
  ExtensionPoint: {
@@ -165,7 +167,9 @@ function Make(Platform) {
165
167
  moduleUrl: Products_Extension$OrderingPlugin.Mapping.moduleUrl,
166
168
  delegateModuleUrl: Products_Extension$OrderingPlugin.Mapping.delegateModuleUrl,
167
169
  mapIncomingEvent: Products_Extension$OrderingPlugin.Mapping.mapIncomingEvent,
168
- mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent
170
+ mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent,
171
+ handledEvents: Products_Extension$OrderingPlugin.Mapping.handledEvents,
172
+ issuedCommands: Products_Extension$OrderingPlugin.Mapping.issuedCommands
169
173
  });
170
174
  let pluginStructure = Platform.Plugin.makePluginDefinition("Ordering", [
171
175
  CatalogProductAggregate,
@@ -194,7 +198,9 @@ function Make(Platform) {
194
198
  },
195
199
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
196
200
  mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
197
- mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
201
+ mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent,
202
+ publishedEvents: Orders_ExtensionPointMapping$OrderingPlugin.publishedEvents,
203
+ acceptedCommands: Orders_ExtensionPointMapping$OrderingPlugin.acceptedCommands
198
204
  }], Object.fromEntries([
199
205
  [
200
206
  "AvailableProducts",
@@ -26,7 +26,9 @@ let include = Delegate_GWT$ReventlessGwt.FromExtension({
26
26
  moduleUrl: Products_Extension$OrderingPlugin.Mapping.moduleUrl,
27
27
  delegateModuleUrl: Products_Extension$OrderingPlugin.Mapping.delegateModuleUrl,
28
28
  mapIncomingEvent: Products_Extension$OrderingPlugin.Mapping.mapIncomingEvent,
29
- mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent
29
+ mapOutgoingEvent: Products_Extension$OrderingPlugin.Mapping.mapOutgoingEvent,
30
+ handledEvents: Products_Extension$OrderingPlugin.Mapping.handledEvents,
31
+ issuedCommands: Products_Extension$OrderingPlugin.Mapping.issuedCommands
30
32
  });
31
33
 
32
34
  let describe = include.describe;
@@ -25,7 +25,9 @@ let include = Delegate_GWT$ReventlessGwt.FromExtensionPoint({
25
25
  },
26
26
  moduleUrl: Orders_ExtensionPointMapping$OrderingPlugin.moduleUrl,
27
27
  mapIncomingCommand: Orders_ExtensionPointMapping$OrderingPlugin.mapIncomingCommand,
28
- mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent
28
+ mapOutgoingEvent: Orders_ExtensionPointMapping$OrderingPlugin.mapOutgoingEvent,
29
+ publishedEvents: Orders_ExtensionPointMapping$OrderingPlugin.publishedEvents,
30
+ acceptedCommands: Orders_ExtensionPointMapping$OrderingPlugin.acceptedCommands
29
31
  });
30
32
 
31
33
  let describe = include.describe;