@secondlayer/sdk 6.46.1 → 6.48.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/dist/index.js CHANGED
@@ -592,6 +592,11 @@ function assertFinalizedCheckpoint(returned, checkpoint) {
592
592
  throw new ValidationError(`onBatch returned cursor "${returned}", above the last delivered finalized event${boundary}. With finalizedOnly, events past that point were filtered out and will be re-read once finalized — committing beyond it skips them permanently. Return ctx.cursor (or nothing); never envelope.next_cursor.`, 400);
593
593
  }
594
594
  }
595
+ function assertSinkModeCompatible(sink, finalizedOnly) {
596
+ if (sink?.capabilities?.finalizedOnly && !finalizedOnly) {
597
+ throw new ValidationError("This sink declares capabilities.finalizedOnly — it cannot roll back reorged rows, and following the unfinalized tip would corrupt it at the first fork. Pass finalizedOnly: true to consume(), or use a sink that implements rollback.", 400);
598
+ }
599
+ }
595
600
  function batchContext(cursor, height, tip, reorgs = []) {
596
601
  const tipHeight = tip.block_height;
597
602
  return {
@@ -658,6 +663,7 @@ async function consumeStreamsEvents(opts) {
658
663
  const emptyBackoffMs = opts.emptyBackoffMs ?? 500;
659
664
  const maxPages = opts.maxPages ?? Number.POSITIVE_INFINITY;
660
665
  const maxEmptyPolls = opts.maxEmptyPolls ?? Number.POSITIVE_INFINITY;
666
+ assertSinkModeCompatible(opts.sink, finalizedOnly);
661
667
  const committedCursor = await opts.sink?.loadCursor() ?? null;
662
668
  let cursor = opts.fromCursor ?? committedCursor;
663
669
  const handledReorgs = new Set;
@@ -824,6 +830,7 @@ async function consumeIndexFeed(opts) {
824
830
  const emptyBackoffMs = opts.emptyBackoffMs ?? 500;
825
831
  const maxPages = opts.maxPages ?? Number.POSITIVE_INFINITY;
826
832
  const maxEmptyPolls = opts.maxEmptyPolls ?? Number.POSITIVE_INFINITY;
833
+ assertSinkModeCompatible(opts.sink, finalizedOnly);
827
834
  const committedCursor = await opts.sink?.loadCursor() ?? null;
828
835
  let cursor = opts.fromCursor ?? committedCursor;
829
836
  const handledReorgs = new Set;
@@ -1949,6 +1956,7 @@ function createStreamsClient(options) {
1949
1956
  sender: params.sender,
1950
1957
  recipient: params.recipient,
1951
1958
  assetIdentifier: params.assetIdentifier,
1959
+ filters: params.filters,
1952
1960
  signal: params.signal,
1953
1961
  fetchEvents
1954
1962
  });
@@ -2002,6 +2010,9 @@ function createStreamsClient(options) {
2002
2010
  fromCursor: seam,
2003
2011
  mode: params.mode ?? "tail",
2004
2012
  batchSize: params.batchSize ?? 100,
2013
+ types: params.types,
2014
+ notTypes: params.notTypes,
2015
+ filters: params.filters,
2005
2016
  fetchEvents,
2006
2017
  onBatch: params.onBatch,
2007
2018
  onReorg: params.onReorg,
@@ -2888,5 +2899,5 @@ export {
2888
2899
  ApiError
2889
2900
  };
2890
2901
 
2891
- //# debugId=6FA3451AA14E4BD464756E2164756E21
2902
+ //# debugId=AADEB8FAB0EE368C64756E2164756E21
2892
2903
  //# sourceMappingURL=index.js.map