@secondlayer/sdk 6.24.0 → 6.24.1
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 +32 -7
- package/dist/index.js +5 -2
- package/dist/index.js.map +5 -5
- package/dist/streams/index.d.ts +20 -3
- package/dist/streams/index.js +5 -2
- package/dist/streams/index.js.map +4 -4
- package/dist/subgraphs/index.d.ts +18 -4
- package/dist/subgraphs/index.js +5 -2
- package/dist/subgraphs/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -488,6 +488,12 @@ type StreamsReorg = {
|
|
|
488
488
|
from: string
|
|
489
489
|
to: string
|
|
490
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* First position of the new canonical chain at the fork, `fork:0`
|
|
493
|
+
* (INCLUSIVE). Not an exclusive resume token — resuming directly from it
|
|
494
|
+
* skips `fork:0`. The consumer rewinds to the foot of `fork_point_height`
|
|
495
|
+
* (`Cursor.atHeight`) to re-read the new run from `fork:0` inclusive.
|
|
496
|
+
*/
|
|
491
497
|
new_canonical_tip: string
|
|
492
498
|
};
|
|
493
499
|
type StreamsEventsEnvelope = {
|
|
@@ -870,9 +876,12 @@ type IndexTip = {
|
|
|
870
876
|
/**
|
|
871
877
|
* A chain reorg overlapping a returned page's height range. Height-keyed feeds
|
|
872
878
|
* (`/transactions`, `/contract-calls`, `/stacking`) populate this so a consumer
|
|
873
|
-
* can reconcile: roll back
|
|
874
|
-
*
|
|
875
|
-
*
|
|
879
|
+
* can reconcile: roll back every row at `block_height >= fork_point_height`
|
|
880
|
+
* (the whole fork block is replaced, so the rollback is inclusive of the fork
|
|
881
|
+
* height), then re-read the canonical run from the foot of `fork_point_height`.
|
|
882
|
+
* The SDK consumers do exactly this — they rewind to `Cursor.atHeight(
|
|
883
|
+
* fork_point_height)`, an exclusive cursor that re-reads from `fork:0`
|
|
884
|
+
* inclusive. Empty when the page spans no reorg.
|
|
876
885
|
*/
|
|
877
886
|
type IndexReorg = {
|
|
878
887
|
id: string
|
|
@@ -885,7 +894,12 @@ type IndexReorg = {
|
|
|
885
894
|
from: string
|
|
886
895
|
to: string
|
|
887
896
|
}
|
|
888
|
-
/**
|
|
897
|
+
/**
|
|
898
|
+
* First position of the new canonical chain at the fork, `fork:0`
|
|
899
|
+
* (INCLUSIVE). Not an exclusive resume token — resuming a `(bh,ei) > cursor`
|
|
900
|
+
* read directly from it would skip `fork:0`. To re-read the new run, rewind
|
|
901
|
+
* to the foot of `fork_point_height` (`Cursor.atHeight`), not to this value.
|
|
902
|
+
*/
|
|
889
903
|
new_canonical_tip: string
|
|
890
904
|
};
|
|
891
905
|
type IndexUsage = {
|
|
@@ -2025,9 +2039,20 @@ type DecodedEventColumns = {
|
|
|
2025
2039
|
*/
|
|
2026
2040
|
declare const Cursor: {
|
|
2027
2041
|
/**
|
|
2028
|
-
* Cursor at the foot of `height
|
|
2029
|
-
*
|
|
2030
|
-
*
|
|
2042
|
+
* Cursor at the foot of `height` — a position that sorts strictly below the
|
|
2043
|
+
* first event of block `height` (`height:0`) and strictly above every event
|
|
2044
|
+
* of block `height - 1`. Cursors are exclusive (`(bh,ei) > after`), so
|
|
2045
|
+
* resuming from it re-reads the entire canonical run starting at `height:0`
|
|
2046
|
+
* inclusive. This is the position to rewind to after a reorg whose fork point
|
|
2047
|
+
* is `height`: the new canonical block at `height` carries a fresh first
|
|
2048
|
+
* event at `(height, 0)` that the consumer MUST re-read.
|
|
2049
|
+
*
|
|
2050
|
+
* Encoded as `${height-1}:${SENTINEL}` rather than the seemingly-natural
|
|
2051
|
+
* `${height}:0` — that earlier form was an off-by-one: being exclusive, it
|
|
2052
|
+
* skipped `(height, 0)`, silently dropping the fork block's first row on
|
|
2053
|
+
* every reorg. The sentinel is int4 max (the `event_index`/`tx_index` column
|
|
2054
|
+
* type), larger than any real index, so nothing at `height - 1` survives the
|
|
2055
|
+
* keyset and the next returned row is exactly `(height, 0)`.
|
|
2031
2056
|
*/
|
|
2032
2057
|
atHeight(height: number): string
|
|
2033
2058
|
/** Parse a `<block>:<index>` cursor. Throws `ValidationError` if malformed. */
|
package/dist/index.js
CHANGED
|
@@ -491,9 +491,12 @@ class StreamsSignatureError extends Error {
|
|
|
491
491
|
}
|
|
492
492
|
|
|
493
493
|
// src/streams/cursor.ts
|
|
494
|
+
var REWIND_FOOT_INDEX_SENTINEL = 2147483647;
|
|
494
495
|
var Cursor = {
|
|
495
496
|
atHeight(height) {
|
|
496
|
-
|
|
497
|
+
if (height <= 0)
|
|
498
|
+
return "0:0";
|
|
499
|
+
return `${height - 1}:${REWIND_FOOT_INDEX_SENTINEL}`;
|
|
497
500
|
},
|
|
498
501
|
parse(cursor) {
|
|
499
502
|
const parts = cursor.split(":");
|
|
@@ -2502,5 +2505,5 @@ export {
|
|
|
2502
2505
|
ApiError
|
|
2503
2506
|
};
|
|
2504
2507
|
|
|
2505
|
-
//# debugId=
|
|
2508
|
+
//# debugId=83F19CEB4B72C83564756E2164756E21
|
|
2506
2509
|
//# sourceMappingURL=index.js.map
|