You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sums, counts and similar folds lose the elements they combine, so they have no inverse and can only be one-way rules. Nothing in the rule set read more than one element into one value.
Decision: implement a one-way aggregate rule with a named direction: { op: "aggregate", fn: "sum", from: "orders[].lines[].qty", to: "sales[].units", direction: "encode" }, with fn one of count, sum, min and max. It reads the input document of the run, after the two-way rules have written. to has fewer wildcards than from, and the elements are grouped by their indexes at the wildcards to keeps, so the example writes one total per order; the groups are enumerated from the arrays themselves, so an order with no lines gets 0. count counts any value; the others take finite numbers, a sum that overflows throws, and min or max of an empty group throws because it has no answer. validateCrosswalk checks the wildcard counts and that the arrays to keeps are the counterparts of the arrays from groups by. assertRoundTrip leaves out a decode-direction aggregate's to, as it does a decode-direction default.
Activity
github-actions commentedon Oct 21, 2026
🎉 This issue has been resolved in version 0.7.0 🎉
The release is available on:
Your semantic-release bot 📦🚀