@secondlayer/sdk 6.47.0 → 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 +1286 -1211
- package/dist/index.js +8 -1
- package/dist/index.js.map +5 -5
- 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 +558 -482
- package/dist/streams/index.js +7 -1
- package/dist/streams/index.js.map +4 -4
- 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 +1044 -968
- package/dist/subgraphs/index.js +8 -1
- package/dist/subgraphs/index.js.map +5 -5
- package/dist/x402.d.ts +49 -49
- package/dist/x402.js +1 -1
- package/dist/x402.js.map +2 -2
- package/package.json +25 -3
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;
|
|
@@ -2892,5 +2899,5 @@ export {
|
|
|
2892
2899
|
ApiError
|
|
2893
2900
|
};
|
|
2894
2901
|
|
|
2895
|
-
//# debugId=
|
|
2902
|
+
//# debugId=AADEB8FAB0EE368C64756E2164756E21
|
|
2896
2903
|
//# sourceMappingURL=index.js.map
|