@secondlayer/sdk 10.0.0 → 10.1.0

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/AGENTS.md CHANGED
@@ -96,6 +96,13 @@ await sl.streams.events.consume({
96
96
  });
97
97
  ```
98
98
 
99
+ Folds (balances, counters, last-wins owner) do not go in `tables`. Invert or
100
+ recompute them in the sink's `onRollback`, same transaction, before the
101
+ fact-table delete. Doomed rows are still visible; remaining facts are
102
+ `height < forkPointHeight`. A throw aborts the rewind. Consume `onReorg`
103
+ runs after that transaction and must not mutate. Derive undo from the doomed
104
+ rows so a re-applied rollback is a no-op.
105
+
99
106
  Hand-rolling it is allowed, but the checkpoint write must be inside the same
100
107
  transaction as the row writes.
101
108
 
package/dist/index.d.ts CHANGED
@@ -763,7 +763,8 @@ type StreamsEventsConsumeParams<
763
763
  * the loop resumes from the sink's committed cursor, `onBatch` receives
764
764
  * `ctx.tx` and must write ONLY through it (rows and cursor commit in one
765
765
  * transaction), reorg rollback is automatic, and `onBatch`'s return value
766
- * is ignored.
766
+ * is ignored. Folds (balances) invert in the sink's `onRollback`, not in
767
+ * `onReorg`.
767
768
  */
768
769
  sink?: ConsumerSink<TTx>;
769
770
  /** Fires once per page, before `onBatch` and before any early return. */
@@ -1118,7 +1119,8 @@ type IndexConsumeOptions<
1118
1119
  * the loop resumes from the sink's committed cursor, `onBatch` receives
1119
1120
  * `ctx.tx` and must write ONLY through it (rows and cursor commit in one
1120
1121
  * transaction — a throw aborts both), reorg rollback is automatic (no
1121
- * `onReorg` needed), and `onBatch`'s return value is ignored.
1122
+ * `onReorg` needed), and `onBatch`'s return value is ignored. Folds
1123
+ * (balances) invert in the sink's `onRollback`, not in `onReorg`.
1122
1124
  */
1123
1125
  sink?: ConsumerSink<TTx>;
1124
1126
  /** Fires once per page, before `onBatch` and before any early return —