@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/streams/index.js
CHANGED
|
@@ -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=
|
|
1501
|
+
//# debugId=B0215D03435631CA64756E2164756E21
|
|
1492
1502
|
//# sourceMappingURL=index.js.map
|