@rotorsoft/act 1.23.40 → 1.23.41
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.
package/dist/index.js
CHANGED
|
@@ -1166,6 +1166,7 @@ function merge_projection(proj, events) {
|
|
|
1166
1166
|
};
|
|
1167
1167
|
} else {
|
|
1168
1168
|
for (const [name, reaction] of proj_register.reactions) {
|
|
1169
|
+
if ([...existing.reactions.values()].includes(reaction)) continue;
|
|
1169
1170
|
let key = name;
|
|
1170
1171
|
while (existing.reactions.has(key)) key = `${key}_p`;
|
|
1171
1172
|
existing.reactions.set(key, reaction);
|
|
@@ -4429,7 +4430,9 @@ function register_batch_handler(proj, batch_handlers) {
|
|
|
4429
4430
|
if (!proj.batchHandler || !proj.target) return;
|
|
4430
4431
|
const existing = batch_handlers.get(proj.target);
|
|
4431
4432
|
if (existing && existing !== proj.batchHandler) {
|
|
4432
|
-
throw new Error(
|
|
4433
|
+
throw new Error(
|
|
4434
|
+
`Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
|
|
4435
|
+
);
|
|
4433
4436
|
}
|
|
4434
4437
|
batch_handlers.set(proj.target, proj.batchHandler);
|
|
4435
4438
|
}
|
|
@@ -4595,6 +4598,10 @@ function act() {
|
|
|
4595
4598
|
throw new Error(
|
|
4596
4599
|
`State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
|
|
4597
4600
|
);
|
|
4601
|
+
if (batch_handlers.has(proj.target) || fold_specs.some((s) => s.target === proj.target))
|
|
4602
|
+
throw new Error(
|
|
4603
|
+
`Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
|
|
4604
|
+
);
|
|
4598
4605
|
fold_specs.push({
|
|
4599
4606
|
target: proj.target,
|
|
4600
4607
|
merged,
|