envio 3.11.0 → 3.12.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/index.d.ts +3 -0
- package/package.json +6 -6
- package/src/Batch.res +111 -78
- package/src/Batch.res.mjs +53 -46
- package/src/BatchProcessing.res +1 -11
- package/src/BatchProcessing.res.mjs +1 -4
- package/src/ChainFetching.res +7 -3
- package/src/ChainFetching.res.mjs +1 -1
- package/src/ChainState.res +82 -20
- package/src/ChainState.res.mjs +51 -13
- package/src/ChainState.resi +6 -1
- package/src/Config.res +58 -37
- package/src/Config.res.mjs +63 -53
- package/src/CrossChainState.res +50 -53
- package/src/CrossChainState.res.mjs +25 -23
- package/src/CrossChainState.resi +6 -13
- package/src/EffectState.res +13 -4
- package/src/EffectState.resi +7 -1
- package/src/EventProcessing.res +6 -6
- package/src/EventProcessing.res.mjs +6 -6
- package/src/FetchState.res +65 -46
- package/src/FetchState.res.mjs +68 -36
- package/src/FinalizeBackfill.res +16 -12
- package/src/FinalizeBackfill.res.mjs +3 -3
- package/src/HistoryPolicy.res +46 -0
- package/src/HistoryPolicy.res.mjs +50 -0
- package/src/InMemoryStore.res +30 -32
- package/src/InMemoryStore.res.mjs +33 -28
- package/src/InMemoryTable.res +155 -67
- package/src/InMemoryTable.res.mjs +151 -60
- package/src/IndexerState.res +66 -45
- package/src/IndexerState.res.mjs +57 -29
- package/src/IndexerState.resi +8 -13
- package/src/Internal.res +4 -2
- package/src/LoadLayer.res +68 -38
- package/src/LoadLayer.res.mjs +50 -64
- package/src/LoadLayer.resi +1 -1
- package/src/Main.res +25 -24
- package/src/Main.res.mjs +24 -25
- package/src/Metrics.res +49 -1
- package/src/Metrics.res.mjs +26 -3
- package/src/Persistence.res +55 -16
- package/src/Persistence.res.mjs +18 -3
- package/src/PgStorage.res +286 -180
- package/src/PgStorage.res.mjs +209 -122
- package/src/PruneStaleHistory.res +9 -15
- package/src/PruneStaleHistory.res.mjs +11 -20
- package/src/Rollback.res +9 -14
- package/src/Rollback.res.mjs +5 -3
- package/src/Sink.res +7 -5
- package/src/Sink.res.mjs +4 -4
- package/src/Staging.res +298 -0
- package/src/Staging.res.mjs +257 -0
- package/src/TestIndexer.res +14 -30
- package/src/TestIndexer.res.mjs +11 -9
- package/src/UserContext.res +20 -36
- package/src/UserContext.res.mjs +6 -9
- package/src/Utils.res +10 -4
- package/src/Utils.res.mjs +16 -16
- package/src/Writing.res +34 -20
- package/src/Writing.res.mjs +15 -20
- package/src/bindings/ClickHouse.res +41 -34
- package/src/bindings/ClickHouse.res.mjs +36 -30
- package/src/bindings/ClickHouseSink.res +45 -186
- package/src/bindings/ClickHouseSink.res.mjs +21 -174
- package/src/db/CheckpointSequence.res +109 -0
- package/src/db/CheckpointSequence.res.mjs +99 -0
- package/src/db/EntityFilter.res +487 -275
- package/src/db/EntityFilter.res.mjs +557 -309
- package/src/db/EntityHistory.res +6 -5
- package/src/db/EntityHistory.res.mjs +5 -5
- package/src/db/Frontier.res +86 -0
- package/src/db/Frontier.res.mjs +126 -0
- package/src/db/InternalTable.res +145 -27
- package/src/db/InternalTable.res.mjs +115 -29
- package/src/db/RollbackFloors.res +34 -41
- package/src/db/RollbackFloors.res.mjs +27 -71
- package/src/db/Table.res +21 -6
- package/src/db/Table.res.mjs +13 -4
- package/src/sources/BlockStore.res +8 -0
- package/src/sources/EvmHyperSyncSource.res +5 -1
- package/src/sources/EvmHyperSyncSource.res.mjs +4 -3
- package/src/sources/FuelHyperSyncSource.res +1 -0
- package/src/sources/FuelHyperSyncSource.res.mjs +1 -1
- package/src/sources/HyperSync.res +6 -0
- package/src/sources/HyperSync.res.mjs +5 -2
- package/src/sources/HyperSync.resi +2 -0
- package/src/sources/HyperSyncClient.res +6 -0
- package/src/sources/HyperSyncSSE.res +1 -1
- package/src/sources/HyperSyncSSE.res.mjs +4 -10
- package/src/sources/RequestStat.res +8 -1
- package/src/sources/RpcSource.res +1 -0
- package/src/sources/RpcSource.res.mjs +1 -1
- package/src/sources/SimulateSource.res +1 -0
- package/src/sources/SimulateSource.res.mjs +1 -1
- package/src/sources/Source.res +11 -3
- package/src/sources/SourceManager.res +34 -13
- package/src/sources/SourceManager.res.mjs +26 -9
- package/src/sources/SourceManager.resi +2 -0
- package/src/sources/SvmHyperSyncClient.res +5 -0
- package/src/sources/SvmHyperSyncSource.res +3 -0
- package/src/sources/SvmHyperSyncSource.res.mjs +4 -2
- package/src/tui/Tui.res +56 -143
- package/src/tui/Tui.res.mjs +70 -166
- package/src/tui/components/TuiData.res +61 -16
- package/src/tui/components/TuiData.res.mjs +53 -15
- package/svm.schema.json +0 -7
- package/src/db/CheckpointBounds.res +0 -53
- package/src/db/CheckpointBounds.res.mjs +0 -44
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Frontier from "./Frontier.res.mjs";
|
|
4
|
+
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
5
|
+
|
|
6
|
+
function fromEntities(entities) {
|
|
7
|
+
if (entities.some(entityConfig => entityConfig.crossChain)) {
|
|
8
|
+
return "SharedAcrossChains";
|
|
9
|
+
} else {
|
|
10
|
+
return "PerChain";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function position(sequence, frontier, chainId) {
|
|
15
|
+
if (sequence === "SharedAcrossChains") {
|
|
16
|
+
return Frontier.max(frontier);
|
|
17
|
+
} else {
|
|
18
|
+
return Frontier.get(frontier, chainId);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function forScope(sequence, frontier, scope) {
|
|
23
|
+
if (scope === "crossChain") {
|
|
24
|
+
if (sequence === "SharedAcrossChains") {
|
|
25
|
+
return Frontier.max(frontier);
|
|
26
|
+
} else {
|
|
27
|
+
return Frontier.min(frontier);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
return Frontier.get(frontier, scope);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function findForScope(sequence, frontier, scope) {
|
|
35
|
+
if (scope === "crossChain") {
|
|
36
|
+
return forScope(sequence, frontier, scope);
|
|
37
|
+
} else {
|
|
38
|
+
return Frontier.find(frontier, scope);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function cursor(sequence, frontier) {
|
|
43
|
+
return {
|
|
44
|
+
sequence: sequence,
|
|
45
|
+
frontier: Frontier.copy(frontier)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function next(cursor, chainId) {
|
|
50
|
+
let checkpointId = position(cursor.sequence, cursor.frontier, chainId) + 1n;
|
|
51
|
+
Frontier.set(cursor.frontier, chainId, checkpointId);
|
|
52
|
+
return checkpointId;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let relation = `unnest($1::` + "BIGINT" + `[],$2::` + "BIGINT" + `[]) AS envio_bounds(chain_id, checkpoint_id)`;
|
|
56
|
+
|
|
57
|
+
function sql(bounds, chainIdColumn, tableRef) {
|
|
58
|
+
let match = bounds.sequence;
|
|
59
|
+
if (match === "SharedAcrossChains") {
|
|
60
|
+
return {
|
|
61
|
+
join: "",
|
|
62
|
+
using: "",
|
|
63
|
+
usingMatch: "",
|
|
64
|
+
checkpointId: "$1"
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (chainIdColumn === undefined) {
|
|
68
|
+
return Stdlib_JsError.throwWithMessage("Internal error: per-chain checkpoint bounds can't bound a table with no chain-id column. Only a schema whose entities are all per-chain has them.");
|
|
69
|
+
}
|
|
70
|
+
let chainMatch = `envio_bounds.chain_id = ` + tableRef + `."` + chainIdColumn + `"`;
|
|
71
|
+
return {
|
|
72
|
+
join: ` JOIN ` + relation + ` ON ` + chainMatch,
|
|
73
|
+
using: ` USING ` + relation,
|
|
74
|
+
usingMatch: ` AND ` + chainMatch,
|
|
75
|
+
checkpointId: "envio_bounds.checkpoint_id"
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function params(bounds) {
|
|
80
|
+
let match = bounds.sequence;
|
|
81
|
+
if (match === "SharedAcrossChains") {
|
|
82
|
+
return [Frontier.min(bounds.byChain).toString()];
|
|
83
|
+
} else {
|
|
84
|
+
return Frontier.unnestParams(bounds.byChain);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
fromEntities,
|
|
90
|
+
position,
|
|
91
|
+
forScope,
|
|
92
|
+
findForScope,
|
|
93
|
+
cursor,
|
|
94
|
+
next,
|
|
95
|
+
relation,
|
|
96
|
+
sql,
|
|
97
|
+
params,
|
|
98
|
+
}
|
|
99
|
+
/* Frontier Not a pure module */
|