@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.d.ts +1305 -1202
- package/dist/index.js +12 -1
- package/dist/index.js.map +7 -7
- package/dist/sinks/bun-sqlite.d.ts +158 -0
- package/dist/sinks/bun-sqlite.js +255 -0
- package/dist/sinks/bun-sqlite.js.map +12 -0
- package/dist/sinks/core.d.ts +195 -0
- package/dist/sinks/core.js +215 -0
- package/dist/sinks/core.js.map +11 -0
- package/dist/sinks/drizzle.d.ts +184 -0
- package/dist/sinks/drizzle.js +309 -0
- package/dist/sinks/drizzle.js.map +12 -0
- package/dist/sinks/kysely.d.ts +87 -2
- package/dist/sinks/kysely.js +91 -54
- package/dist/sinks/kysely.js.map +6 -5
- package/dist/sinks/testing.d.ts +183 -0
- package/dist/sinks/testing.js +194 -0
- package/dist/sinks/testing.js.map +10 -0
- package/dist/streams/index.d.ts +577 -473
- package/dist/streams/index.js +11 -1
- package/dist/streams/index.js.map +6 -6
- package/dist/streams/rows.d.ts +208 -208
- package/dist/streams/rows.js +1 -1
- package/dist/streams/rows.js.map +2 -2
- package/dist/subgraphs/index.d.ts +1063 -959
- package/dist/subgraphs/index.js +12 -1
- package/dist/subgraphs/index.js.map +6 -6
- package/dist/x402.d.ts +49 -49
- package/dist/x402.js +1 -1
- package/dist/x402.js.map +2 -2
- package/package.json +26 -4
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=
|
|
2902
|
+
//# debugId=AADEB8FAB0EE368C64756E2164756E21
|
|
2892
2903
|
//# sourceMappingURL=index.js.map
|