envio 3.15.0-subgraph → 3.16.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/README.md +40 -34
- package/evm.schema.json +3 -3
- package/fuel.schema.json +2 -2
- package/index.d.ts +3 -3
- package/licenses/README.md +1 -1
- package/package.json +9 -10
- package/src/Batch.res.mjs +5 -5
- package/src/BatchProcessing.res +1 -0
- package/src/BatchProcessing.res.mjs +1 -0
- package/src/Bin.res +0 -7
- package/src/Bin.res.mjs +0 -8
- package/src/ChainFetching.res +17 -456
- package/src/ChainFetching.res.mjs +33 -404
- package/src/ChainState.res +48 -83
- package/src/ChainState.res.mjs +83 -115
- package/src/ChainState.resi +0 -26
- package/src/Clock.res +57 -0
- package/src/Clock.res.mjs +72 -0
- package/src/Config.res +7 -16
- package/src/Config.res.mjs +4 -11
- package/src/ContractRegisterContext.res +6 -3
- package/src/ContractRegisterContext.res.mjs +2 -4
- package/src/Core.res +5 -136
- package/src/Core.res.mjs +1 -90
- package/src/CrossChainState.res +2 -8
- package/src/CrossChainState.res.mjs +3 -3
- package/src/Ecosystem.res +4 -7
- package/src/Ecosystem.res.mjs +8 -8
- package/src/EffectState.res +10 -2
- package/src/EffectState.res.mjs +8 -4
- package/src/EffectState.resi +3 -1
- package/src/EntityId.res +2 -7
- package/src/EntityId.res.mjs +1 -8
- package/src/EntityTables.res +4 -1
- package/src/EntityTables.res.mjs +1 -1
- package/src/Env.res +0 -16
- package/src/Env.res.mjs +0 -11
- package/src/EventProcessing.res +1 -38
- package/src/EventProcessing.res.mjs +1 -28
- package/src/FetchState.res +160 -319
- package/src/FetchState.res.mjs +182 -292
- package/src/FinalizeBackfill.res +2 -4
- package/src/FinalizeBackfill.res.mjs +3 -4
- package/src/HandlerLoader.res +15 -39
- package/src/HandlerLoader.res.mjs +8 -27
- package/src/HandlerRegister.res +0 -4
- package/src/HandlerRegister.res.mjs +2 -5
- package/src/HandlerRegister.resi +0 -2
- package/src/InMemoryTable.res +17 -16
- package/src/InMemoryTable.res.mjs +14 -15
- package/src/IndexerState.res +28 -4
- package/src/IndexerState.res.mjs +19 -6
- package/src/IndexerState.resi +4 -0
- package/src/Internal.res +0 -110
- package/src/Internal.res.mjs +1 -115
- package/src/LoadLayer.res +21 -47
- package/src/LoadLayer.res.mjs +47 -72
- package/src/LoadLayer.resi +0 -26
- package/src/Main.res +1 -14
- package/src/Main.res.mjs +3 -4
- package/src/Persistence.res +3 -23
- package/src/Persistence.res.mjs +3 -3
- package/src/Rollback.res +0 -1
- package/src/Rollback.res.mjs +1 -1
- package/src/RunScope.res +0 -3
- package/src/SafeCheckpointTracking.res +4 -4
- package/src/SafeCheckpointTracking.res.mjs +1 -1
- package/src/SimulateItems.res +26 -42
- package/src/SimulateItems.res.mjs +16 -40
- package/src/StagedRows.res +106 -0
- package/src/StagedRows.res.mjs +102 -0
- package/src/Staging.res +32 -14
- package/src/Staging.res.mjs +17 -20
- package/src/Storage.res +277 -998
- package/src/Storage.res.mjs +216 -731
- package/src/Supervisor.res +75 -56
- package/src/Supervisor.res.mjs +55 -26
- package/src/TestIndexer.res +22 -27
- package/src/TestIndexer.res.mjs +20 -17
- package/src/Throttler.res +15 -8
- package/src/Throttler.res.mjs +9 -6
- package/src/Throttler.resi +1 -1
- package/src/UserContext.res +46 -410
- package/src/UserContext.res.mjs +30 -318
- package/src/Utils.res +0 -23
- package/src/Utils.res.mjs +1 -17
- package/src/Writing.res +0 -1
- package/src/Writing.res.mjs +1 -1
- package/src/bindings/ClickHouse.res +0 -322
- package/src/bindings/ClickHouse.res.mjs +0 -338
- package/src/bindings/StorageClient.res +107 -175
- package/src/bindings/StorageClient.res.mjs +19 -8
- package/src/bindings/Vitest.res +0 -26
- package/src/bindings/Vitest.res.mjs +0 -3
- package/src/db/Table.res +24 -150
- package/src/db/Table.res.mjs +38 -272
- package/src/sources/AddressSet.res +0 -2
- package/src/sources/AddressStore.res +0 -3
- package/src/sources/ChainSources.res +2 -0
- package/src/sources/ChainSources.res.mjs +2 -2
- package/src/sources/EvmChain.res +4 -7
- package/src/sources/EvmChain.res.mjs +5 -4
- package/src/sources/EvmHyperSyncSource.res +2 -2
- package/src/sources/EvmHyperSyncSource.res.mjs +1 -1
- package/src/sources/EvmRpcClient.res +13 -3
- package/src/sources/EvmRpcClient.res.mjs +4 -3
- package/src/sources/EvmRpcWs.res +4 -3
- package/src/sources/EvmRpcWs.res.mjs +2 -2
- package/src/sources/HeightFeed.res +31 -10
- package/src/sources/HeightFeed.res.mjs +10 -6
- package/src/sources/HeightStream.res +32 -17
- package/src/sources/HeightStream.res.mjs +10 -10
- package/src/sources/HyperSync.res +1 -2
- package/src/sources/HyperSync.res.mjs +1 -2
- package/src/sources/HyperSyncSSE.res +4 -6
- package/src/sources/HyperSyncSSE.res.mjs +2 -2
- package/src/sources/RpcSource.res +10 -1
- package/src/sources/RpcSource.res.mjs +4 -3
- package/src/sources/Source.res +3 -0
- package/src/sources/SourceManager.res +85 -104
- package/src/sources/SourceManager.res.mjs +18 -37
- package/src/sources/SourceManager.resi +3 -5
- package/src/sources/StartBlockResolver.res +1 -0
- package/src/sources/StartBlockResolver.res.mjs +4 -3
- package/src/sources/SvmHyperSyncSource.res +2 -2
- package/src/sources/SvmHyperSyncSource.res.mjs +1 -1
- package/svm.schema.json +3 -3
- package/src/EffectCacheLookup.res +0 -98
- package/src/EffectCacheLookup.res.mjs +0 -116
- package/src/PgWriting.res +0 -36
- package/src/PgWriting.res.mjs +0 -34
- package/src/PreloadLookahead.res +0 -184
- package/src/PreloadLookahead.res.mjs +0 -197
- package/src/SubgraphLog.res +0 -19
- package/src/SubgraphLog.res.mjs +0 -26
- package/src/SyncWrites.res +0 -101
- package/src/SyncWrites.res.mjs +0 -98
- package/src/db/IndexDefinition.res +0 -47
- package/src/db/IndexDefinition.res.mjs +0 -60
- package/src/sources/CallSource.res +0 -274
- package/src/sources/CallSource.res.mjs +0 -196
- package/src/subgraph/abi-types.ts +0 -84
- package/src/subgraph/aggregations.ts +0 -745
- package/src/subgraph/as-package.ts +0 -143
- package/src/subgraph/assemblyscript-regex.ts +0 -67
- package/src/subgraph/assemblyscript.ts +0 -731
- package/src/subgraph/blocks.ts +0 -398
- package/src/subgraph/calls-source.ts +0 -702
- package/src/subgraph/calls.ts +0 -258
- package/src/subgraph/conformance.ts +0 -106
- package/src/subgraph/errors.ts +0 -85
- package/src/subgraph/graft.ts +0 -73
- package/src/subgraph/graph-cli-worker.mjs +0 -35
- package/src/subgraph/graph-cli.ts +0 -900
- package/src/subgraph/graph-node-decimal.ts +0 -199
- package/src/subgraph/graph-ts-enums.ts +0 -28
- package/src/subgraph/graph-ts-types/VERSION +0 -2
- package/src/subgraph/graph-ts-types/chain/arweave.d.ts +0 -70
- package/src/subgraph/graph-ts-types/chain/cosmos.d.ts +0 -327
- package/src/subgraph/graph-ts-types/chain/ethereum.d.ts +0 -233
- package/src/subgraph/graph-ts-types/chain/near.d.ts +0 -253
- package/src/subgraph/graph-ts-types/chain/starknet.d.ts +0 -32
- package/src/subgraph/graph-ts-types/common/collections.d.ts +0 -136
- package/src/subgraph/graph-ts-types/common/conversion.d.ts +0 -11
- package/src/subgraph/graph-ts-types/common/datasource.d.ts +0 -30
- package/src/subgraph/graph-ts-types/common/eager-offset.d.ts +0 -0
- package/src/subgraph/graph-ts-types/common/json.d.ts +0 -17
- package/src/subgraph/graph-ts-types/common/numbers.d.ts +0 -120
- package/src/subgraph/graph-ts-types/common/value.d.ts +0 -120
- package/src/subgraph/graph-ts-types/common/yaml.d.ts +0 -90
- package/src/subgraph/graph-ts-types/global/global.d.ts +0 -194
- package/src/subgraph/graph-ts-types/helper-functions.d.ts +0 -22
- package/src/subgraph/graph-ts-types/index.d.ts +0 -102
- package/src/subgraph/graph-ts.ts +0 -4280
- package/src/subgraph/hosts.ts +0 -554
- package/src/subgraph/log.ts +0 -28
- package/src/subgraph/receipts.ts +0 -184
- package/src/subgraph/register-slots.ts +0 -93
- package/src/subgraph/rollup.ts +0 -109
- package/src/subgraph/rpc.ts +0 -337
- package/src/subgraph/runtime.ts +0 -2060
- package/src/subgraph/scope.ts +0 -177
- package/src/subgraph/stats.ts +0 -42
- package/src/subgraph/template-instances.ts +0 -66
- package/src/subgraph/toolchain.ts +0 -327
- package/src/subgraph/transient.ts +0 -176
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where AssemblyScript finds a library that has no JavaScript entry.
|
|
3
|
-
*
|
|
4
|
-
* `asc` resolves `import { decode } from "as-base64"` to the package's
|
|
5
|
-
* `assembly/index.ts` (or the file its package.json names as `ascMain`), and a
|
|
6
|
-
* subpath such as `as-bignum/assembly/integer/u128` to the TypeScript file of
|
|
7
|
-
* that name. Node only knows `main`/`exports`, so `as-base64` — whose
|
|
8
|
-
* package.json names neither — is "Cannot find package .../index.js". This is
|
|
9
|
-
* the AssemblyScript half of resolution, run only after Node has failed.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
13
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
|
-
import path from "node:path";
|
|
15
|
-
|
|
16
|
-
function isFile(file: string): boolean {
|
|
17
|
-
try {
|
|
18
|
-
return statSync(file).isFile();
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** The package name and the path inside it: `@scope/pkg/sub/file` → [`@scope/pkg`, `sub/file`]. */
|
|
25
|
-
function splitSpecifier(specifier: string): [string, string] | null {
|
|
26
|
-
const parts = specifier.split("/");
|
|
27
|
-
const nameLength = specifier.startsWith("@") ? 2 : 1;
|
|
28
|
-
if (parts.length < nameLength || parts.slice(0, nameLength).some((part) => part === "")) return null;
|
|
29
|
-
return [parts.slice(0, nameLength).join("/"), parts.slice(nameLength).join("/")];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** The `.ts` file AssemblyScript would load for `specifier` imported from `parentUrl`, as a URL. */
|
|
33
|
-
export function resolveAssemblyScriptPackage(specifier: string, parentUrl: string | undefined): string | null {
|
|
34
|
-
if (!parentUrl?.startsWith("file:")) return null;
|
|
35
|
-
if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("node:")) return null;
|
|
36
|
-
const split = splitSpecifier(specifier);
|
|
37
|
-
if (!split) return null;
|
|
38
|
-
const [name, inner] = split;
|
|
39
|
-
|
|
40
|
-
let dir = path.dirname(fileURLToPath(parentUrl));
|
|
41
|
-
for (;;) {
|
|
42
|
-
const packageDir = path.join(dir, "node_modules", name);
|
|
43
|
-
if (existsSync(packageDir)) {
|
|
44
|
-
const found = resolveInPackage(packageDir, inner);
|
|
45
|
-
if (found) return pathToFileURL(found).href;
|
|
46
|
-
}
|
|
47
|
-
const up = path.dirname(dir);
|
|
48
|
-
if (up === dir) return null;
|
|
49
|
-
dir = up;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function resolveInPackage(packageDir: string, inner: string): string | null {
|
|
54
|
-
const candidates: string[] = [];
|
|
55
|
-
if (inner === "") {
|
|
56
|
-
let manifest: { ascMain?: unknown; types?: unknown } = {};
|
|
57
|
-
try {
|
|
58
|
-
manifest = JSON.parse(readFileSync(path.join(packageDir, "package.json"), "utf8"));
|
|
59
|
-
} catch {
|
|
60
|
-
// A package without a readable manifest still has its assembly/ directory.
|
|
61
|
-
}
|
|
62
|
-
if (typeof manifest.ascMain === "string") candidates.push(manifest.ascMain);
|
|
63
|
-
candidates.push("assembly/index.ts");
|
|
64
|
-
if (typeof manifest.types === "string" && manifest.types.endsWith(".ts") && !manifest.types.endsWith(".d.ts")) {
|
|
65
|
-
candidates.push(manifest.types);
|
|
66
|
-
}
|
|
67
|
-
candidates.push("index.ts");
|
|
68
|
-
} else {
|
|
69
|
-
candidates.push(inner, `${inner}.ts`, path.join(inner, "index.ts"), path.join("assembly", inner, "index.ts"));
|
|
70
|
-
}
|
|
71
|
-
for (const candidate of candidates) {
|
|
72
|
-
const file = path.join(packageDir, candidate);
|
|
73
|
-
if (candidate.endsWith(".ts") && !candidate.endsWith(".d.ts") && isFile(file)) return file;
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* A bare import of a package the workspace declares (`workspaces`, or
|
|
80
|
-
* pnpm-workspace.yaml), resolved in that package as an install would link it:
|
|
81
|
-
* enzyme's mappings import `@enzymefinance/subgraph-utils`, its
|
|
82
|
-
* `packages/utils`, whose `main` is `index.ts`. `workspace` maps package names
|
|
83
|
-
* to their directories.
|
|
84
|
-
*/
|
|
85
|
-
export function resolveWorkspacePackage(specifier: string, workspace: Map<string, string>): string | null {
|
|
86
|
-
const split = splitSpecifier(specifier);
|
|
87
|
-
if (!split) return null;
|
|
88
|
-
const [name, inner] = split;
|
|
89
|
-
const packageDir = workspace.get(name);
|
|
90
|
-
if (!packageDir) return null;
|
|
91
|
-
if (inner === "") {
|
|
92
|
-
const { main } = readManifest(packageDir);
|
|
93
|
-
if (typeof main === "string") {
|
|
94
|
-
const base = path.join(packageDir, main);
|
|
95
|
-
const file = [base, `${base}.ts`, `${base}.js`, path.join(base, "index.ts"), path.join(base, "index.js")].find(
|
|
96
|
-
isFile,
|
|
97
|
-
);
|
|
98
|
-
if (file) return pathToFileURL(file).href;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const found = resolveInPackage(packageDir, inner);
|
|
102
|
-
return found ? pathToFileURL(found).href : null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function readManifest(packageDir: string): { main?: unknown; scripts?: Record<string, unknown> } {
|
|
106
|
-
try {
|
|
107
|
-
return JSON.parse(readFileSync(path.join(packageDir, "package.json"), "utf8")) ?? {};
|
|
108
|
-
} catch {
|
|
109
|
-
return {};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Why a workspace package that `resolveWorkspacePackage` found no entry for
|
|
115
|
-
* can't load: the `main` its package.json names isn't written yet. sushiswap's
|
|
116
|
-
* `const` renders its own index.ts per network (`"prepare:mainnet": "mustache
|
|
117
|
-
* ../../config/mainnet.json index.template.ts > index.ts"`), which the root runs
|
|
118
|
-
* through `yarn workspaces run prepare:mainnet`.
|
|
119
|
-
*/
|
|
120
|
-
export function unwrittenWorkspaceEntry(
|
|
121
|
-
specifier: string,
|
|
122
|
-
workspace: Map<string, string>,
|
|
123
|
-
workspaceRoot: string | null,
|
|
124
|
-
): Error | null {
|
|
125
|
-
const split = splitSpecifier(specifier);
|
|
126
|
-
if (!split || split[1] !== "") return null;
|
|
127
|
-
const [name] = split;
|
|
128
|
-
const packageDir = workspace.get(name);
|
|
129
|
-
if (!packageDir) return null;
|
|
130
|
-
const { main, scripts } = readManifest(packageDir);
|
|
131
|
-
if (typeof main !== "string") return null;
|
|
132
|
-
const writers = Object.entries(scripts ?? {})
|
|
133
|
-
.filter(([, script]) => typeof script === "string" && script.includes(path.basename(main)))
|
|
134
|
-
.map(([script]) => script);
|
|
135
|
-
const where = path.relative(workspaceRoot ?? packageDir, packageDir);
|
|
136
|
-
return new Error(
|
|
137
|
-
`${name} is a package of the project's workspace (${where}), and the ${main} its package.json names ` +
|
|
138
|
-
"doesn't exist: " +
|
|
139
|
-
(writers.length > 0
|
|
140
|
-
? `its scripts ${writers.join(", ")} write it. Run the one for your network, then start envio again.`
|
|
141
|
-
: "a build step of that package writes it. Run it, then start envio again."),
|
|
142
|
-
);
|
|
143
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `assemblyscript-regex`, the regular-expression library AssemblyScript
|
|
3
|
-
* mappings import (Polymarket's resolution subgraph tests an update string with
|
|
4
|
-
* it). The package is AssemblyScript through and through — `unchecked`, `<i32>`
|
|
5
|
-
* casts, memory-level matching — so mappings get this JavaScript-backed class
|
|
6
|
-
* with the same surface instead: a pattern, a `test`, an `exec` that answers a
|
|
7
|
-
* match with its `index`, `input` and `matches` (the whole match, then each
|
|
8
|
-
* group, an unmatched group as an empty string), and `replace`.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const JsRegExp = globalThis.RegExp;
|
|
12
|
-
|
|
13
|
-
export class RegExpMatch {
|
|
14
|
-
constructor(
|
|
15
|
-
public index: number,
|
|
16
|
-
public input: string,
|
|
17
|
-
public matches: string[],
|
|
18
|
-
) {}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class RegExp {
|
|
22
|
-
lastIndex = 0;
|
|
23
|
-
readonly source: string;
|
|
24
|
-
readonly flags: string;
|
|
25
|
-
private readonly re: globalThis.RegExp;
|
|
26
|
-
|
|
27
|
-
constructor(pattern: string, flags = "") {
|
|
28
|
-
this.source = pattern;
|
|
29
|
-
this.flags = flags;
|
|
30
|
-
this.re = new JsRegExp(pattern, flags);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get global(): boolean {
|
|
34
|
-
return this.re.global;
|
|
35
|
-
}
|
|
36
|
-
get ignoreCase(): boolean {
|
|
37
|
-
return this.re.ignoreCase;
|
|
38
|
-
}
|
|
39
|
-
get multiline(): boolean {
|
|
40
|
-
return this.re.multiline;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
test(text: string): boolean {
|
|
44
|
-
return this.exec(text) !== null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exec(text: string): RegExpMatch | null {
|
|
48
|
-
const sticky = this.re.global || this.re.sticky;
|
|
49
|
-
if (sticky) this.re.lastIndex = this.lastIndex;
|
|
50
|
-
const match = this.re.exec(text);
|
|
51
|
-
if (sticky) this.lastIndex = match ? this.re.lastIndex : 0;
|
|
52
|
-
if (!match) return null;
|
|
53
|
-
return new RegExpMatch(
|
|
54
|
-
match.index,
|
|
55
|
-
text,
|
|
56
|
-
Array.from(match, (group) => group ?? ""),
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
replace(text: string, replacement: string): string {
|
|
61
|
-
return text.replace(this.re, replacement);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
toString(): string {
|
|
65
|
-
return `/${this.source}/${this.flags}`;
|
|
66
|
-
}
|
|
67
|
-
}
|