@reventlessdev/online-shop-aggregates-catalog 3.0.0-alpha.103 → 3.0.0-alpha.105

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 (128) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/bs/.compiler.log +2 -2
  3. package/lib/bs/compiler-info.json +1 -1
  4. package/lib/bs/src/Category/Aggregate/Category-CatalogPlugin.cmi +0 -0
  5. package/lib/bs/src/Category/Aggregate/Category-CatalogPlugin.cmt +0 -0
  6. package/lib/bs/src/Category/Aggregate/Category_Behavior-CatalogPlugin.cmi +0 -0
  7. package/lib/bs/src/Category/Aggregate/Category_Behavior-CatalogPlugin.cmj +0 -0
  8. package/lib/bs/src/Category/Aggregate/Category_Behavior-CatalogPlugin.cmt +0 -0
  9. package/lib/bs/src/Category/Aggregate/Category_Behavior.ast +0 -0
  10. package/lib/bs/src/Category/Aggregate/Category_Behavior.res.mjs +3 -0
  11. package/lib/bs/src/Category/ReadModel/Categories-CatalogPlugin.cmi +0 -0
  12. package/lib/bs/src/Category/ReadModel/Categories-CatalogPlugin.cmt +0 -0
  13. package/lib/bs/src/Category/ReadModel/Categories_Projections-CatalogPlugin.cmi +0 -0
  14. package/lib/bs/src/Category/ReadModel/Categories_Projections-CatalogPlugin.cmt +0 -0
  15. package/lib/bs/src/Extension/Orders_Extension-CatalogPlugin.cmi +0 -0
  16. package/lib/bs/src/Extension/Orders_Extension-CatalogPlugin.cmt +0 -0
  17. package/lib/bs/src/ExtensionPoint/Products_ExtensionPointMapping-CatalogPlugin.cmi +0 -0
  18. package/lib/bs/src/ExtensionPoint/Products_ExtensionPointMapping-CatalogPlugin.cmt +0 -0
  19. package/lib/bs/src/Plugin-CatalogPlugin.cmi +0 -0
  20. package/lib/bs/src/Plugin-CatalogPlugin.cmt +0 -0
  21. package/lib/bs/src/Plugin.res.mjs +3 -0
  22. package/lib/bs/src/Product/Aggregate/Product-CatalogPlugin.cmi +0 -0
  23. package/lib/bs/src/Product/Aggregate/Product-CatalogPlugin.cmt +0 -0
  24. package/lib/bs/src/Product/Aggregate/Product_Behavior-CatalogPlugin.cmi +0 -0
  25. package/lib/bs/src/Product/Aggregate/Product_Behavior-CatalogPlugin.cmt +0 -0
  26. package/lib/bs/src/Product/Aggregate/Product_Behavior.ast +0 -0
  27. package/lib/bs/src/Product/Aggregate/Product_Behavior.res +6 -0
  28. package/lib/bs/src/Product/Aggregate/Product_Behavior.res.mjs +6 -0
  29. package/lib/bs/src/Product/ReadModel/Products-CatalogPlugin.cmi +0 -0
  30. package/lib/bs/src/Product/ReadModel/Products-CatalogPlugin.cmt +0 -0
  31. package/lib/bs/src/Product/ReadModel/Products_Projections-CatalogPlugin.cmi +0 -0
  32. package/lib/bs/src/Product/ReadModel/Products_Projections-CatalogPlugin.cmt +0 -0
  33. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand-CatalogPlugin.cmi +0 -0
  34. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand-CatalogPlugin.cmt +0 -0
  35. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior-CatalogPlugin.cmi +0 -0
  36. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior-CatalogPlugin.cmj +0 -0
  37. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior-CatalogPlugin.cmt +0 -0
  38. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior.ast +0 -0
  39. package/lib/bs/src/ProductDemand/Aggregate/ProductDemand_Behavior.res.mjs +3 -0
  40. package/lib/bs/src/ProductDemand/ReadModel/ProductDemands-CatalogPlugin.cmi +0 -0
  41. package/lib/bs/src/ProductDemand/ReadModel/ProductDemands-CatalogPlugin.cmt +0 -0
  42. package/lib/bs/src/ProductDemand/ReadModel/ProductDemands_Projections-CatalogPlugin.cmi +0 -0
  43. package/lib/bs/src/ProductDemand/ReadModel/ProductDemands_Projections-CatalogPlugin.cmt +0 -0
  44. package/lib/bs/src/Task/ImportProducts-CatalogPlugin.cmi +0 -0
  45. package/lib/bs/src/Task/ImportProducts-CatalogPlugin.cmt +0 -0
  46. package/lib/bs/tests/Category/Aggregate/Category_GWT-CatalogPlugin.cmi +0 -0
  47. package/lib/bs/tests/Category/Aggregate/Category_GWT-CatalogPlugin.cmt +0 -0
  48. package/lib/bs/tests/Category/Aggregate/Category_GWT.res.mjs +1 -0
  49. package/lib/bs/tests/Category/ReadModel/Categories_GWT-CatalogPlugin.cmi +0 -0
  50. package/lib/bs/tests/Category/ReadModel/Categories_GWT-CatalogPlugin.cmt +0 -0
  51. package/lib/bs/tests/Extension/Orders_Extension_GWT-CatalogPlugin.cmi +0 -0
  52. package/lib/bs/tests/Extension/Orders_Extension_GWT-CatalogPlugin.cmt +0 -0
  53. package/lib/bs/tests/ExtensionPoint/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmi +0 -0
  54. package/lib/bs/tests/ExtensionPoint/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmt +0 -0
  55. package/lib/bs/tests/Product/Aggregate/Product_GWT-CatalogPlugin.cmi +0 -0
  56. package/lib/bs/tests/Product/Aggregate/Product_GWT-CatalogPlugin.cmt +0 -0
  57. package/lib/bs/tests/Product/Aggregate/Product_GWT.res.mjs +1 -0
  58. package/lib/bs/tests/Product/ReadModel/Products_GWT-CatalogPlugin.cmi +0 -0
  59. package/lib/bs/tests/Product/ReadModel/Products_GWT-CatalogPlugin.cmt +0 -0
  60. package/lib/bs/tests/ProductDemand/Aggregate/ProductDemand_GWT-CatalogPlugin.cmi +0 -0
  61. package/lib/bs/tests/ProductDemand/Aggregate/ProductDemand_GWT-CatalogPlugin.cmt +0 -0
  62. package/lib/bs/tests/ProductDemand/Aggregate/ProductDemand_GWT.res.mjs +1 -0
  63. package/lib/bs/tests/ProductDemand/ReadModel/ProductDemands_GWT-CatalogPlugin.cmi +0 -0
  64. package/lib/bs/tests/ProductDemand/ReadModel/ProductDemands_GWT-CatalogPlugin.cmt +0 -0
  65. package/lib/ocaml/.compiler.log +2 -2
  66. package/lib/ocaml/Categories-CatalogPlugin.cmi +0 -0
  67. package/lib/ocaml/Categories-CatalogPlugin.cmt +0 -0
  68. package/lib/ocaml/Categories_GWT-CatalogPlugin.cmi +0 -0
  69. package/lib/ocaml/Categories_GWT-CatalogPlugin.cmt +0 -0
  70. package/lib/ocaml/Categories_Projections-CatalogPlugin.cmi +0 -0
  71. package/lib/ocaml/Categories_Projections-CatalogPlugin.cmt +0 -0
  72. package/lib/ocaml/Category-CatalogPlugin.cmi +0 -0
  73. package/lib/ocaml/Category-CatalogPlugin.cmt +0 -0
  74. package/lib/ocaml/Category_Behavior-CatalogPlugin.cmi +0 -0
  75. package/lib/ocaml/Category_Behavior-CatalogPlugin.cmj +0 -0
  76. package/lib/ocaml/Category_Behavior-CatalogPlugin.cmt +0 -0
  77. package/lib/ocaml/Category_Behavior.ast +0 -0
  78. package/lib/ocaml/Category_GWT-CatalogPlugin.cmi +0 -0
  79. package/lib/ocaml/Category_GWT-CatalogPlugin.cmt +0 -0
  80. package/lib/ocaml/ImportProducts-CatalogPlugin.cmi +0 -0
  81. package/lib/ocaml/ImportProducts-CatalogPlugin.cmt +0 -0
  82. package/lib/ocaml/Orders_Extension-CatalogPlugin.cmi +0 -0
  83. package/lib/ocaml/Orders_Extension-CatalogPlugin.cmt +0 -0
  84. package/lib/ocaml/Orders_Extension_GWT-CatalogPlugin.cmi +0 -0
  85. package/lib/ocaml/Orders_Extension_GWT-CatalogPlugin.cmt +0 -0
  86. package/lib/ocaml/Plugin-CatalogPlugin.cmi +0 -0
  87. package/lib/ocaml/Plugin-CatalogPlugin.cmt +0 -0
  88. package/lib/ocaml/Product-CatalogPlugin.cmi +0 -0
  89. package/lib/ocaml/Product-CatalogPlugin.cmt +0 -0
  90. package/lib/ocaml/ProductDemand-CatalogPlugin.cmi +0 -0
  91. package/lib/ocaml/ProductDemand-CatalogPlugin.cmt +0 -0
  92. package/lib/ocaml/ProductDemand_Behavior-CatalogPlugin.cmi +0 -0
  93. package/lib/ocaml/ProductDemand_Behavior-CatalogPlugin.cmj +0 -0
  94. package/lib/ocaml/ProductDemand_Behavior-CatalogPlugin.cmt +0 -0
  95. package/lib/ocaml/ProductDemand_Behavior.ast +0 -0
  96. package/lib/ocaml/ProductDemand_GWT-CatalogPlugin.cmi +0 -0
  97. package/lib/ocaml/ProductDemand_GWT-CatalogPlugin.cmt +0 -0
  98. package/lib/ocaml/ProductDemands-CatalogPlugin.cmi +0 -0
  99. package/lib/ocaml/ProductDemands-CatalogPlugin.cmt +0 -0
  100. package/lib/ocaml/ProductDemands_GWT-CatalogPlugin.cmi +0 -0
  101. package/lib/ocaml/ProductDemands_GWT-CatalogPlugin.cmt +0 -0
  102. package/lib/ocaml/ProductDemands_Projections-CatalogPlugin.cmi +0 -0
  103. package/lib/ocaml/ProductDemands_Projections-CatalogPlugin.cmt +0 -0
  104. package/lib/ocaml/Product_Behavior-CatalogPlugin.cmi +0 -0
  105. package/lib/ocaml/Product_Behavior-CatalogPlugin.cmt +0 -0
  106. package/lib/ocaml/Product_Behavior.ast +0 -0
  107. package/lib/ocaml/Product_Behavior.res +6 -0
  108. package/lib/ocaml/Product_GWT-CatalogPlugin.cmi +0 -0
  109. package/lib/ocaml/Product_GWT-CatalogPlugin.cmt +0 -0
  110. package/lib/ocaml/Products-CatalogPlugin.cmi +0 -0
  111. package/lib/ocaml/Products-CatalogPlugin.cmt +0 -0
  112. package/lib/ocaml/Products_ExtensionPointMapping-CatalogPlugin.cmi +0 -0
  113. package/lib/ocaml/Products_ExtensionPointMapping-CatalogPlugin.cmt +0 -0
  114. package/lib/ocaml/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmi +0 -0
  115. package/lib/ocaml/Products_ExtensionPointMapping_GWT-CatalogPlugin.cmt +0 -0
  116. package/lib/ocaml/Products_GWT-CatalogPlugin.cmi +0 -0
  117. package/lib/ocaml/Products_GWT-CatalogPlugin.cmt +0 -0
  118. package/lib/ocaml/Products_Projections-CatalogPlugin.cmi +0 -0
  119. package/lib/ocaml/Products_Projections-CatalogPlugin.cmt +0 -0
  120. package/package.json +8 -8
  121. package/src/Category/Aggregate/Category_Behavior.res.mjs +3 -0
  122. package/src/Plugin.res.mjs +3 -0
  123. package/src/Product/Aggregate/Product_Behavior.res +6 -0
  124. package/src/Product/Aggregate/Product_Behavior.res.mjs +6 -0
  125. package/src/ProductDemand/Aggregate/ProductDemand_Behavior.res.mjs +3 -0
  126. package/tests/Category/Aggregate/Category_GWT.res.mjs +1 -0
  127. package/tests/Product/Aggregate/Product_GWT.res.mjs +1 -0
  128. package/tests/ProductDemand/Aggregate/ProductDemand_GWT.res.mjs +1 -0
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.105 (2026-07-04)
7
+
8
+ ### Features
9
+
10
+ * **examples,docs:** enable aggregate snapshots on the Product example + document the feature (aggregate-snapshotting plan, steps 6-7, COMPLETE) ([fdda793](https://github.com/ReventlessDev/reventless-core/commit/fdda793e7bba0cd7482b4ba3ac1c73572f75a3c0))
11
+
12
+
13
+ # 3.0.0-alpha.104 (2026-07-03)
14
+
15
+ **Note:** Version bump only for package @reventlessdev/online-shop-aggregates-catalog
16
+
17
+
18
+
19
+
20
+
6
21
  # 3.0.0-alpha.103 (2026-07-02)
7
22
 
8
23
  **Note:** Version bump only for package @reventlessdev/online-shop-aggregates-catalog
@@ -1,2 +1,2 @@
1
- #Start(1782989601816)
2
- #Done(1782989603169)
1
+ #Start(1783190314371)
2
+ #Done(1783190315724)
@@ -4,5 +4,5 @@
4
4
  "bsc_hash": "75e3a59c95cc953608fd3dd6ea6ed68141bba4414a20a52f114261b8a48385fa",
5
5
  "rescript_config_hash": "50d5358a2cbe328e82ae9b442e4615b86dbfe6b2ce05e9eca04a0c78da0e4708",
6
6
  "runtime_path": "/home/runner/work/reventless-core/reventless-core/node_modules/@rescript/runtime",
7
- "generated_at": "1782989603176"
7
+ "generated_at": "1783190315738"
8
8
  }
@@ -95,6 +95,8 @@ let initialState = "NotCreated";
95
95
 
96
96
  let moduleUrl = "@reventlessdev/online-shop-aggregates-catalog/src/Category/Aggregate/Category_Behavior.res.mjs";
97
97
 
98
+ let snapshot;
99
+
98
100
  export {
99
101
  Spec,
100
102
  stateSchema,
@@ -102,5 +104,6 @@ export {
102
104
  evolve,
103
105
  decide,
104
106
  moduleUrl,
107
+ snapshot,
105
108
  }
106
109
  /* stateSchema Not a pure module */
Binary file
Binary file
@@ -34,6 +34,7 @@ function Make(Platform) {
34
34
  initialState: Category_Behavior$CatalogPlugin.initialState,
35
35
  evolve: Category_Behavior$CatalogPlugin.evolve,
36
36
  decide: Category_Behavior$CatalogPlugin.decide,
37
+ snapshot: undefined,
37
38
  moduleUrl: Category_Behavior$CatalogPlugin.moduleUrl
38
39
  })(NoEventMappings$ReventlessInfra.Make({
39
40
  name: Category$CatalogPlugin.name,
@@ -52,6 +53,7 @@ function Make(Platform) {
52
53
  initialState: Product_Behavior$CatalogPlugin.initialState,
53
54
  evolve: Product_Behavior$CatalogPlugin.evolve,
54
55
  decide: Product_Behavior$CatalogPlugin.decide,
56
+ snapshot: Product_Behavior$CatalogPlugin.snapshot,
55
57
  moduleUrl: Product_Behavior$CatalogPlugin.moduleUrl
56
58
  })(NoEventMappings$ReventlessInfra.Make({
57
59
  name: Product$CatalogPlugin.name,
@@ -70,6 +72,7 @@ function Make(Platform) {
70
72
  initialState: ProductDemand_Behavior$CatalogPlugin.initialState,
71
73
  evolve: ProductDemand_Behavior$CatalogPlugin.evolve,
72
74
  decide: ProductDemand_Behavior$CatalogPlugin.decide,
75
+ snapshot: undefined,
73
76
  moduleUrl: ProductDemand_Behavior$CatalogPlugin.moduleUrl
74
77
  })(NoEventMappings$ReventlessInfra.Make({
75
78
  name: ProductDemand$CatalogPlugin.name,
@@ -1,7 +1,13 @@
1
1
  // Product aggregate behavior.
2
2
  // Implements the state machine for adding and updating products.
3
+ //
4
+ // Snapshotting is enabled (every 50 events): a long-lived product with many
5
+ // price/name updates seeds its cold replay from the latest snapshot instead of
6
+ // folding full history. See the "Replay cost and snapshots" section of the
7
+ // aggregate component docs.
3
8
 
4
9
  @@reventless.behavior
10
+ @@reventless.snapshots(50)
5
11
 
6
12
  @schema
7
13
  type state =
@@ -133,6 +133,11 @@ function decide(state, command) {
133
133
  }
134
134
  }
135
135
 
136
+ let snapshot = {
137
+ interval: 50,
138
+ stateSchema: stateSchema
139
+ };
140
+
136
141
  let Spec;
137
142
 
138
143
  let initialState = "NotCreated";
@@ -146,5 +151,6 @@ export {
146
151
  evolve,
147
152
  decide,
148
153
  moduleUrl,
154
+ snapshot,
149
155
  }
150
156
  /* stateSchema Not a pure module */
@@ -91,6 +91,8 @@ let initialState = "NotCreated";
91
91
 
92
92
  let moduleUrl = "@reventlessdev/online-shop-aggregates-catalog/src/ProductDemand/Aggregate/ProductDemand_Behavior.res.mjs";
93
93
 
94
+ let snapshot;
95
+
94
96
  export {
95
97
  Spec,
96
98
  stateSchema,
@@ -98,5 +100,6 @@ export {
98
100
  evolve,
99
101
  decide,
100
102
  moduleUrl,
103
+ snapshot,
101
104
  }
102
105
  /* stateSchema Not a pure module */
@@ -19,6 +19,7 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
19
19
  initialState: Category_Behavior$CatalogPlugin.initialState,
20
20
  evolve: Category_Behavior$CatalogPlugin.evolve,
21
21
  decide: Category_Behavior$CatalogPlugin.decide,
22
+ snapshot: undefined,
22
23
  moduleUrl: Category_Behavior$CatalogPlugin.moduleUrl
23
24
  });
24
25
 
@@ -19,6 +19,7 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
19
19
  initialState: Product_Behavior$CatalogPlugin.initialState,
20
20
  evolve: Product_Behavior$CatalogPlugin.evolve,
21
21
  decide: Product_Behavior$CatalogPlugin.decide,
22
+ snapshot: Product_Behavior$CatalogPlugin.snapshot,
22
23
  moduleUrl: Product_Behavior$CatalogPlugin.moduleUrl
23
24
  });
24
25
 
@@ -19,6 +19,7 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
19
19
  initialState: ProductDemand_Behavior$CatalogPlugin.initialState,
20
20
  evolve: ProductDemand_Behavior$CatalogPlugin.evolve,
21
21
  decide: ProductDemand_Behavior$CatalogPlugin.decide,
22
+ snapshot: undefined,
22
23
  moduleUrl: ProductDemand_Behavior$CatalogPlugin.moduleUrl
23
24
  });
24
25
 
@@ -1,2 +1,2 @@
1
- #Start(1782989601816)
2
- #Done(1782989603169)
1
+ #Start(1783190314371)
2
+ #Done(1783190315724)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,7 +1,13 @@
1
1
  // Product aggregate behavior.
2
2
  // Implements the state machine for adding and updating products.
3
+ //
4
+ // Snapshotting is enabled (every 50 events): a long-lived product with many
5
+ // price/name updates seeds its cold replay from the latest snapshot instead of
6
+ // folding full history. See the "Replay cost and snapshots" section of the
7
+ // aggregate component docs.
3
8
 
4
9
  @@reventless.behavior
10
+ @@reventless.snapshots(50)
5
11
 
6
12
  @schema
7
13
  type state =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/online-shop-aggregates-catalog",
3
- "version": "3.0.0-alpha.103",
3
+ "version": "3.0.0-alpha.105",
4
4
  "description": "Online Shop example — Catalog plugin (Product & Category 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-alpha.4",
24
- "@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.59",
25
- "@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.59",
24
+ "@reventlessdev/online-shop-aggregates-catalog-spec": "3.0.0-alpha.60",
25
+ "@reventlessdev/online-shop-aggregates-ordering-spec": "3.0.0-alpha.60",
26
26
  "@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.14",
27
- "@reventlessdev/reventless-gwt": "1.0.0-alpha.76",
28
- "@reventlessdev/reventless-infra": "3.0.0-alpha.83",
29
- "@reventlessdev/reventless-local": "3.0.0-alpha.115",
30
- "@reventlessdev/reventless-spec": "3.0.0-alpha.63"
27
+ "@reventlessdev/reventless-gwt": "1.0.0-alpha.78",
28
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.84",
29
+ "@reventlessdev/reventless-local": "3.0.0-alpha.117",
30
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.64"
31
31
  },
32
32
  "devDependencies": {
33
33
  "rescript": "^12.3.0",
34
34
  "sury-ppx": "11.0.0-alpha.2",
35
- "@reventlessdev/reventless-ppx": "1.0.0-alpha.48"
35
+ "@reventlessdev/reventless-ppx": "1.0.0-alpha.50"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "rescript": "^12.3.0"
@@ -95,6 +95,8 @@ let initialState = "NotCreated";
95
95
 
96
96
  let moduleUrl = "@reventlessdev/online-shop-aggregates-catalog/src/Category/Aggregate/Category_Behavior.res.mjs";
97
97
 
98
+ let snapshot;
99
+
98
100
  export {
99
101
  Spec,
100
102
  stateSchema,
@@ -102,5 +104,6 @@ export {
102
104
  evolve,
103
105
  decide,
104
106
  moduleUrl,
107
+ snapshot,
105
108
  }
106
109
  /* stateSchema Not a pure module */
@@ -34,6 +34,7 @@ function Make(Platform) {
34
34
  initialState: Category_Behavior$CatalogPlugin.initialState,
35
35
  evolve: Category_Behavior$CatalogPlugin.evolve,
36
36
  decide: Category_Behavior$CatalogPlugin.decide,
37
+ snapshot: undefined,
37
38
  moduleUrl: Category_Behavior$CatalogPlugin.moduleUrl
38
39
  })(NoEventMappings$ReventlessInfra.Make({
39
40
  name: Category$CatalogPlugin.name,
@@ -52,6 +53,7 @@ function Make(Platform) {
52
53
  initialState: Product_Behavior$CatalogPlugin.initialState,
53
54
  evolve: Product_Behavior$CatalogPlugin.evolve,
54
55
  decide: Product_Behavior$CatalogPlugin.decide,
56
+ snapshot: Product_Behavior$CatalogPlugin.snapshot,
55
57
  moduleUrl: Product_Behavior$CatalogPlugin.moduleUrl
56
58
  })(NoEventMappings$ReventlessInfra.Make({
57
59
  name: Product$CatalogPlugin.name,
@@ -70,6 +72,7 @@ function Make(Platform) {
70
72
  initialState: ProductDemand_Behavior$CatalogPlugin.initialState,
71
73
  evolve: ProductDemand_Behavior$CatalogPlugin.evolve,
72
74
  decide: ProductDemand_Behavior$CatalogPlugin.decide,
75
+ snapshot: undefined,
73
76
  moduleUrl: ProductDemand_Behavior$CatalogPlugin.moduleUrl
74
77
  })(NoEventMappings$ReventlessInfra.Make({
75
78
  name: ProductDemand$CatalogPlugin.name,
@@ -1,7 +1,13 @@
1
1
  // Product aggregate behavior.
2
2
  // Implements the state machine for adding and updating products.
3
+ //
4
+ // Snapshotting is enabled (every 50 events): a long-lived product with many
5
+ // price/name updates seeds its cold replay from the latest snapshot instead of
6
+ // folding full history. See the "Replay cost and snapshots" section of the
7
+ // aggregate component docs.
3
8
 
4
9
  @@reventless.behavior
10
+ @@reventless.snapshots(50)
5
11
 
6
12
  @schema
7
13
  type state =
@@ -133,6 +133,11 @@ function decide(state, command) {
133
133
  }
134
134
  }
135
135
 
136
+ let snapshot = {
137
+ interval: 50,
138
+ stateSchema: stateSchema
139
+ };
140
+
136
141
  let Spec;
137
142
 
138
143
  let initialState = "NotCreated";
@@ -146,5 +151,6 @@ export {
146
151
  evolve,
147
152
  decide,
148
153
  moduleUrl,
154
+ snapshot,
149
155
  }
150
156
  /* stateSchema Not a pure module */
@@ -91,6 +91,8 @@ let initialState = "NotCreated";
91
91
 
92
92
  let moduleUrl = "@reventlessdev/online-shop-aggregates-catalog/src/ProductDemand/Aggregate/ProductDemand_Behavior.res.mjs";
93
93
 
94
+ let snapshot;
95
+
94
96
  export {
95
97
  Spec,
96
98
  stateSchema,
@@ -98,5 +100,6 @@ export {
98
100
  evolve,
99
101
  decide,
100
102
  moduleUrl,
103
+ snapshot,
101
104
  }
102
105
  /* stateSchema Not a pure module */
@@ -19,6 +19,7 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
19
19
  initialState: Category_Behavior$CatalogPlugin.initialState,
20
20
  evolve: Category_Behavior$CatalogPlugin.evolve,
21
21
  decide: Category_Behavior$CatalogPlugin.decide,
22
+ snapshot: undefined,
22
23
  moduleUrl: Category_Behavior$CatalogPlugin.moduleUrl
23
24
  });
24
25
 
@@ -19,6 +19,7 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
19
19
  initialState: Product_Behavior$CatalogPlugin.initialState,
20
20
  evolve: Product_Behavior$CatalogPlugin.evolve,
21
21
  decide: Product_Behavior$CatalogPlugin.decide,
22
+ snapshot: Product_Behavior$CatalogPlugin.snapshot,
22
23
  moduleUrl: Product_Behavior$CatalogPlugin.moduleUrl
23
24
  });
24
25
 
@@ -19,6 +19,7 @@ let include = Behavior_GWT$ReventlessGwt.MakeFromAggregate({
19
19
  initialState: ProductDemand_Behavior$CatalogPlugin.initialState,
20
20
  evolve: ProductDemand_Behavior$CatalogPlugin.evolve,
21
21
  decide: ProductDemand_Behavior$CatalogPlugin.decide,
22
+ snapshot: undefined,
22
23
  moduleUrl: ProductDemand_Behavior$CatalogPlugin.moduleUrl
23
24
  });
24
25