@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.
@@ -336,6 +336,11 @@ function assertFinalizedCheckpoint(returned, checkpoint) {
336
336
  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);
337
337
  }
338
338
  }
339
+ function assertSinkModeCompatible(sink, finalizedOnly) {
340
+ if (sink?.capabilities?.finalizedOnly && !finalizedOnly) {
341
+ 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);
342
+ }
343
+ }
339
344
  function batchContext(cursor, height, tip, reorgs = []) {
340
345
  const tipHeight = tip.block_height;
341
346
  return {
@@ -402,6 +407,7 @@ async function consumeStreamsEvents(opts) {
402
407
  const emptyBackoffMs = opts.emptyBackoffMs ?? 500;
403
408
  const maxPages = opts.maxPages ?? Number.POSITIVE_INFINITY;
404
409
  const maxEmptyPolls = opts.maxEmptyPolls ?? Number.POSITIVE_INFINITY;
410
+ assertSinkModeCompatible(opts.sink, finalizedOnly);
405
411
  const committedCursor = await opts.sink?.loadCursor() ?? null;
406
412
  let cursor = opts.fromCursor ?? committedCursor;
407
413
  const handledReorgs = new Set;
@@ -1145,6 +1151,7 @@ function createStreamsClient(options) {
1145
1151
  sender: params.sender,
1146
1152
  recipient: params.recipient,
1147
1153
  assetIdentifier: params.assetIdentifier,
1154
+ filters: params.filters,
1148
1155
  signal: params.signal,
1149
1156
  fetchEvents
1150
1157
  });
@@ -1198,6 +1205,9 @@ function createStreamsClient(options) {
1198
1205
  fromCursor: seam,
1199
1206
  mode: params.mode ?? "tail",
1200
1207
  batchSize: params.batchSize ?? 100,
1208
+ types: params.types,
1209
+ notTypes: params.notTypes,
1210
+ filters: params.filters,
1201
1211
  fetchEvents,
1202
1212
  onBatch: params.onBatch,
1203
1213
  onReorg: params.onReorg,
@@ -1488,5 +1498,5 @@ export {
1488
1498
  AuthError
1489
1499
  };
1490
1500
 
1491
- //# debugId=7FB2A1B15B80F53464756E2164756E21
1501
+ //# debugId=B0215D03435631CA64756E2164756E21
1492
1502
  //# sourceMappingURL=index.js.map