@artblocks/abx-indexer 0.1.0-alpha.2 → 0.1.0-alpha.20
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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/indexer.d.ts +51 -8
- package/dist/indexer.d.ts.map +1 -1
- package/dist/indexer.js +147 -15
- package/dist/indexer.js.map +1 -1
- package/dist/store.d.ts +133 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +299 -28
- package/dist/store.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Replays the event spine from chain into a disposable, rebuildable projection.
|
|
5
5
|
* The canonical re-index: how every service onboards or exits a project.
|
|
6
6
|
*/
|
|
7
|
-
export { SelfHostIndexer, type IndexResult } from './indexer.js';
|
|
7
|
+
export { SelfHostIndexer, type IndexResult, type ReindexOptions } from './indexer.js';
|
|
8
8
|
export { SqliteStore, type Store, type ProjectRegistration, type EffectStatusRow, type EffectArtifactRow, } from './store.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,eAAe,EAAE,KAAK,WAAW,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAC,MAAM,cAAc,CAAC;AACpF,OAAO,EACL,WAAW,EACX,KAAK,KAAK,EACV,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,eAAe,EAAwC,MAAM,cAAc,CAAC;AACpF,OAAO,EACL,WAAW,GAKZ,MAAM,YAAY,CAAC"}
|
package/dist/indexer.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { type Address, type ProjectState, type PublicClient } from '@artblocks/abx-sdk';
|
|
2
|
-
import
|
|
2
|
+
import type { Log } from 'viem';
|
|
3
|
+
import { type IndexStatusRow, type Store, type ProjectRegistration } from './store.js';
|
|
4
|
+
export interface ReindexOptions {
|
|
5
|
+
full?: boolean;
|
|
6
|
+
readUriDocuments?: boolean;
|
|
7
|
+
rpcUrl?: string;
|
|
8
|
+
/** Already-fetched logs for this project covering {@link toBlock}. Skips the
|
|
9
|
+
* per-project `eth_getLogs` — the watch loop that scanned the registered set
|
|
10
|
+
* holds the delta and should be the only getLogs. */
|
|
11
|
+
logs?: readonly Log[];
|
|
12
|
+
/** Inclusive scan head `logs` cover. Required with `logs`. */
|
|
13
|
+
toBlock?: bigint;
|
|
14
|
+
}
|
|
3
15
|
export interface IndexResult {
|
|
4
16
|
state: ProjectState;
|
|
5
17
|
elapsedMs: number;
|
|
@@ -16,12 +28,26 @@ export interface IndexResult {
|
|
|
16
28
|
export declare class SelfHostIndexer {
|
|
17
29
|
readonly store: Store;
|
|
18
30
|
private clients;
|
|
31
|
+
/** Catch-up runs in flight, per lowercased address — see {@link reindexShared}. */
|
|
32
|
+
private inFlight;
|
|
19
33
|
constructor(store?: Store);
|
|
34
|
+
/**
|
|
35
|
+
* The pooled read client for a chain, or — with `rpcUrl` — one pinned to a SINGLE endpoint.
|
|
36
|
+
*
|
|
37
|
+
* The default (no `rpcUrl`) is a viem `fallback` across every configured endpoint, which fails
|
|
38
|
+
* over on an *error*. It does not fail over on a successful empty answer, which is exactly what an
|
|
39
|
+
* endpoint that has pruned its log history returns for an old block: `[]`, HTTP 200. Pinning one
|
|
40
|
+
* endpoint is how a caller can re-run the same scan against each in turn and find one that holds
|
|
41
|
+
* the history (see the CLI's empty-scan recovery). Pooled per (chain, endpoint) so the pinned
|
|
42
|
+
* clients don't evict the shared one.
|
|
43
|
+
*/
|
|
20
44
|
private client;
|
|
21
45
|
/** The RPC client for a chain — exposed for reads that aren't a reindex (e.g. deploy-block
|
|
22
46
|
* discovery in the admin control plane). Reuses the same pooled client as `reindex`. */
|
|
23
47
|
publicClient(chainKey: string): PublicClient;
|
|
24
|
-
/** Register a project to index (the minimum needed to replay it).
|
|
48
|
+
/** Register a project to index (the minimum needed to replay it). A FIRST registration enters the
|
|
49
|
+
* lifecycle at `queued`; a re-add leaves the existing lifecycle row alone (it's operational
|
|
50
|
+
* history, not operator input — see IndexStatusRow). */
|
|
25
51
|
register(reg: Omit<ProjectRegistration, 'registeredAt'>): ProjectRegistration;
|
|
26
52
|
/**
|
|
27
53
|
* Re-index a single project. By default this is **incremental**: it resumes from
|
|
@@ -30,13 +56,30 @@ export declare class SelfHostIndexer {
|
|
|
30
56
|
* replay. `{full: true}` forces a replay from the deploy block (the durability
|
|
31
57
|
* proof, and what runs automatically when there's no prior state). Idempotent.
|
|
32
58
|
*/
|
|
33
|
-
reindex(address: Address, opts?:
|
|
34
|
-
|
|
35
|
-
|
|
59
|
+
reindex(address: Address, opts?: ReindexOptions): Promise<IndexResult>;
|
|
60
|
+
/**
|
|
61
|
+
* {@link reindex}, but concurrent calls for the same project COALESCE into one run.
|
|
62
|
+
*
|
|
63
|
+
* Catch-up is the expensive, RPC-bound operation, and several triggers can point at one project at
|
|
64
|
+
* once: a re-POST arriving while a first backfill is still running, a watcher tick landing
|
|
65
|
+
* mid-catch-up. Starting a second reconstruct there doubles the load on the RPC that was already
|
|
66
|
+
* the bottleneck — so the second caller joins the first run instead. A caller that needs a *full*
|
|
67
|
+
* replay while an incremental is in flight gets its replay queued after it, never dropped.
|
|
68
|
+
*/
|
|
69
|
+
reindexShared(address: Address, opts?: ReindexOptions): Promise<IndexResult>;
|
|
70
|
+
/** Is a catch-up for this project running right now? (Lets a caller answer "still backfilling"
|
|
71
|
+
* without starting more work.) */
|
|
72
|
+
isCatchingUp(address: Address): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* A project's lifecycle row, with the default for a store that predates the lifecycle: an existing
|
|
75
|
+
* projection is already being served, so it reads `live` (freshness is what `toBlock` vs head is
|
|
76
|
+
* for) — reporting `queued` there would tell every client on an upgraded node that its serving
|
|
77
|
+
* projects are pending. A registration with no projection is genuinely `queued`.
|
|
78
|
+
*/
|
|
79
|
+
indexStatus(address: Address): IndexStatusRow;
|
|
80
|
+
private track;
|
|
36
81
|
/** Re-index every registered project. */
|
|
37
|
-
reindexAll(opts?:
|
|
38
|
-
full?: boolean;
|
|
39
|
-
}): Promise<IndexResult[]>;
|
|
82
|
+
reindexAll(opts?: ReindexOptions): Promise<IndexResult[]>;
|
|
40
83
|
getProject(address: Address): ProjectState | null;
|
|
41
84
|
/** Throw away a project's reconstructed projection, keeping its registration — the next
|
|
42
85
|
* {@link reindex} then rebuilds it from the deploy block. The projection is a disposable cache of
|
package/dist/indexer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,MAAM,C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,cAAc;IAU7C,OAAO,CAAC,KAAK;IAoBb,yCAAyC;IACnC,UAAU,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAQnE,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;IAIjD;;0GAEsG;IACtG,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAItC,YAAY,IAAI,YAAY,EAAE;CAG/B"}
|
package/dist/indexer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makePublicClient, reconstructIncremental, reconstructProject, } from '@artblocks/abx-sdk';
|
|
1
|
+
import { classifyIndexError, makePublicClient, reconstructFromLogs, reconstructIncremental, reconstructProject, } from '@artblocks/abx-sdk';
|
|
2
2
|
import { SqliteStore } from './store.js';
|
|
3
3
|
/**
|
|
4
4
|
* The reference indexer (Layer 3). It does one thing well: replay the event
|
|
@@ -11,13 +11,26 @@ import { SqliteStore } from './store.js';
|
|
|
11
11
|
export class SelfHostIndexer {
|
|
12
12
|
store;
|
|
13
13
|
clients = new Map();
|
|
14
|
+
/** Catch-up runs in flight, per lowercased address — see {@link reindexShared}. */
|
|
15
|
+
inFlight = new Map();
|
|
14
16
|
constructor(store) {
|
|
15
17
|
this.store = store ?? new SqliteStore();
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* The pooled read client for a chain, or — with `rpcUrl` — one pinned to a SINGLE endpoint.
|
|
21
|
+
*
|
|
22
|
+
* The default (no `rpcUrl`) is a viem `fallback` across every configured endpoint, which fails
|
|
23
|
+
* over on an *error*. It does not fail over on a successful empty answer, which is exactly what an
|
|
24
|
+
* endpoint that has pruned its log history returns for an old block: `[]`, HTTP 200. Pinning one
|
|
25
|
+
* endpoint is how a caller can re-run the same scan against each in turn and find one that holds
|
|
26
|
+
* the history (see the CLI's empty-scan recovery). Pooled per (chain, endpoint) so the pinned
|
|
27
|
+
* clients don't evict the shared one.
|
|
28
|
+
*/
|
|
29
|
+
client(chainKey, rpcUrl) {
|
|
30
|
+
const key = rpcUrl ? `${chainKey}|${rpcUrl}` : chainKey;
|
|
31
|
+
let c = this.clients.get(key);
|
|
19
32
|
if (!c)
|
|
20
|
-
this.clients.set(
|
|
33
|
+
this.clients.set(key, (c = makePublicClient({ chainKey, rpcUrl })));
|
|
21
34
|
return c;
|
|
22
35
|
}
|
|
23
36
|
/** The RPC client for a chain — exposed for reads that aren't a reindex (e.g. deploy-block
|
|
@@ -25,10 +38,14 @@ export class SelfHostIndexer {
|
|
|
25
38
|
publicClient(chainKey) {
|
|
26
39
|
return this.client(chainKey);
|
|
27
40
|
}
|
|
28
|
-
/** Register a project to index (the minimum needed to replay it).
|
|
41
|
+
/** Register a project to index (the minimum needed to replay it). A FIRST registration enters the
|
|
42
|
+
* lifecycle at `queued`; a re-add leaves the existing lifecycle row alone (it's operational
|
|
43
|
+
* history, not operator input — see IndexStatusRow). */
|
|
29
44
|
register(reg) {
|
|
30
45
|
const full = { ...reg, registeredAt: new Date().toISOString() };
|
|
31
46
|
this.store.register(full);
|
|
47
|
+
if (!this.store.getIndexStatus(full.address))
|
|
48
|
+
this.store.setIndexStatus(full.address, { status: 'queued' });
|
|
32
49
|
return full;
|
|
33
50
|
}
|
|
34
51
|
/**
|
|
@@ -47,23 +64,138 @@ export class SelfHostIndexer {
|
|
|
47
64
|
const started = Date.now();
|
|
48
65
|
const factory = reg.factory ? reg.factory : undefined;
|
|
49
66
|
const prior = opts.full ? null : this.store.getProject(address);
|
|
67
|
+
const incremental = !!(prior && prior.deployBlock && prior.events.length > 0);
|
|
68
|
+
const attempts = (this.store.getIndexStatus(address)?.attempts ?? 0) + 1;
|
|
69
|
+
// `backfilling` is for an initial sync or a forced replay — the long ones a client polls. A
|
|
70
|
+
// routine incremental catch-up keeps its current status until it lands, so a live project's
|
|
71
|
+
// status doesn't flicker on every watcher tick.
|
|
72
|
+
if (!incremental) {
|
|
73
|
+
this.store.setIndexStatus(address, { status: 'backfilling', attempts, lastAttemptAt: new Date().toISOString() });
|
|
74
|
+
}
|
|
50
75
|
let state;
|
|
51
76
|
let mode;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
77
|
+
try {
|
|
78
|
+
if (incremental && opts.logs !== undefined) {
|
|
79
|
+
if (opts.toBlock === undefined) {
|
|
80
|
+
throw new Error('reindex({logs}) requires toBlock — the inclusive scan head those logs cover');
|
|
81
|
+
}
|
|
82
|
+
state = await reconstructFromLogs(this.client(reg.chainKey, opts.rpcUrl), prior, opts.logs, {
|
|
83
|
+
factory,
|
|
84
|
+
readUriDocuments: opts.readUriDocuments,
|
|
85
|
+
toBlock: opts.toBlock,
|
|
86
|
+
});
|
|
87
|
+
mode = 'incremental';
|
|
88
|
+
}
|
|
89
|
+
else if (incremental) {
|
|
90
|
+
state = await reconstructIncremental(this.client(reg.chainKey, opts.rpcUrl), prior, { factory, readUriDocuments: opts.readUriDocuments });
|
|
91
|
+
mode = 'incremental';
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
state = await reconstructProject(this.client(reg.chainKey, opts.rpcUrl), {
|
|
95
|
+
address,
|
|
96
|
+
fromBlock: BigInt(reg.fromBlock),
|
|
97
|
+
factory,
|
|
98
|
+
readUriDocuments: opts.readUriDocuments,
|
|
99
|
+
});
|
|
100
|
+
mode = 'full';
|
|
101
|
+
}
|
|
102
|
+
// Self-heal, never loop: an incremental fold that yields FEWER events than what's already
|
|
103
|
+
// stored is the signature of the 2026-08-05 projection memo's (docs/11) war story — a bad fold
|
|
104
|
+
// silently zeroed a live projection, and nothing caught it because the watermark had already
|
|
105
|
+
// advanced past it. `eventCount` can only grow (append-only chain history), so a decrease is
|
|
106
|
+
// never legitimate — discard the bad fold before it's written, and repair with exactly ONE
|
|
107
|
+
// full replay from the deploy block. That result is written unconditionally, even in the
|
|
108
|
+
// (pathological) case where it too looks smaller: a full reconstruct from chain is
|
|
109
|
+
// definitionally correct, so there is nothing left to fall back to and no second attempt.
|
|
110
|
+
if (mode === 'incremental' && prior && state.eventCount < prior.eventCount) {
|
|
111
|
+
console.error(`[indexer] ${address}: an incremental fold produced ${state.eventCount} events, fewer than the ` +
|
|
112
|
+
`${prior.eventCount} already stored — discarding it and falling back to one full reconstruct.`);
|
|
113
|
+
state = await reconstructProject(this.client(reg.chainKey, opts.rpcUrl), {
|
|
114
|
+
address,
|
|
115
|
+
fromBlock: BigInt(reg.fromBlock),
|
|
116
|
+
factory,
|
|
117
|
+
readUriDocuments: opts.readUriDocuments,
|
|
118
|
+
});
|
|
119
|
+
mode = 'full';
|
|
120
|
+
}
|
|
55
121
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
122
|
+
catch (err) {
|
|
123
|
+
// Record WHY, as a closed credential-free class — a rate-limited RPC and a broken service are
|
|
124
|
+
// the same 500 to a caller otherwise, and only one of them means "wait".
|
|
125
|
+
this.store.setIndexStatus(address, {
|
|
126
|
+
status: 'failed',
|
|
127
|
+
error: classifyIndexError(err),
|
|
128
|
+
attempts,
|
|
129
|
+
lastAttemptAt: new Date().toISOString(),
|
|
61
130
|
});
|
|
62
|
-
|
|
131
|
+
throw err;
|
|
63
132
|
}
|
|
64
|
-
|
|
133
|
+
// A full replay is the repair path — it purges + rebuilds the append-only event log so a
|
|
134
|
+
// reorg-replaced event can't survive as a stale row (incremental writes never delete).
|
|
135
|
+
this.store.putProject(state, { fullReplay: mode === 'full' });
|
|
136
|
+
const now = new Date().toISOString();
|
|
137
|
+
this.store.setIndexStatus(address, { status: 'live', error: null, attempts: 0, lastAttemptAt: now, lastIndexedAt: now });
|
|
65
138
|
return { state, elapsedMs: Date.now() - started, mode };
|
|
66
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* {@link reindex}, but concurrent calls for the same project COALESCE into one run.
|
|
142
|
+
*
|
|
143
|
+
* Catch-up is the expensive, RPC-bound operation, and several triggers can point at one project at
|
|
144
|
+
* once: a re-POST arriving while a first backfill is still running, a watcher tick landing
|
|
145
|
+
* mid-catch-up. Starting a second reconstruct there doubles the load on the RPC that was already
|
|
146
|
+
* the bottleneck — so the second caller joins the first run instead. A caller that needs a *full*
|
|
147
|
+
* replay while an incremental is in flight gets its replay queued after it, never dropped.
|
|
148
|
+
*/
|
|
149
|
+
reindexShared(address, opts = {}) {
|
|
150
|
+
const key = address.toLowerCase();
|
|
151
|
+
const running = this.inFlight.get(key);
|
|
152
|
+
if (running) {
|
|
153
|
+
if (!opts.full || running.full)
|
|
154
|
+
return running.promise;
|
|
155
|
+
// A forced replay can't be satisfied by an in-flight incremental — chain it on.
|
|
156
|
+
const chained = running.promise.catch(() => undefined).then(() => this.reindex(address, opts));
|
|
157
|
+
return this.track(key, chained, true);
|
|
158
|
+
}
|
|
159
|
+
return this.track(key, this.reindex(address, opts), !!opts.full);
|
|
160
|
+
}
|
|
161
|
+
/** Is a catch-up for this project running right now? (Lets a caller answer "still backfilling"
|
|
162
|
+
* without starting more work.) */
|
|
163
|
+
isCatchingUp(address) {
|
|
164
|
+
return this.inFlight.has(address.toLowerCase());
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* A project's lifecycle row, with the default for a store that predates the lifecycle: an existing
|
|
168
|
+
* projection is already being served, so it reads `live` (freshness is what `toBlock` vs head is
|
|
169
|
+
* for) — reporting `queued` there would tell every client on an upgraded node that its serving
|
|
170
|
+
* projects are pending. A registration with no projection is genuinely `queued`.
|
|
171
|
+
*/
|
|
172
|
+
indexStatus(address) {
|
|
173
|
+
const row = this.store.getIndexStatus(address);
|
|
174
|
+
if (row)
|
|
175
|
+
return row;
|
|
176
|
+
return {
|
|
177
|
+
address: address.toLowerCase(),
|
|
178
|
+
status: this.store.getProject(address) ? 'live' : 'queued',
|
|
179
|
+
attempts: 0,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
track(key, promise, full) {
|
|
183
|
+
// settle() must run whether the run resolves or rejects, and must NOT swallow the rejection —
|
|
184
|
+
// every caller of the shared promise still sees the error.
|
|
185
|
+
const settle = () => {
|
|
186
|
+
if (this.inFlight.get(key)?.promise === tracked)
|
|
187
|
+
this.inFlight.delete(key);
|
|
188
|
+
};
|
|
189
|
+
const tracked = promise.then((r) => {
|
|
190
|
+
settle();
|
|
191
|
+
return r;
|
|
192
|
+
}, (e) => {
|
|
193
|
+
settle();
|
|
194
|
+
throw e;
|
|
195
|
+
});
|
|
196
|
+
this.inFlight.set(key, { promise: tracked, full });
|
|
197
|
+
return tracked;
|
|
198
|
+
}
|
|
67
199
|
/** Re-index every registered project. */
|
|
68
200
|
async reindexAll(opts = {}) {
|
|
69
201
|
const out = [];
|
package/dist/indexer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,GAInB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,GAInB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,WAAW,EAA4D,MAAM,YAAY,CAAC;AAoBlG;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IACjB,KAAK,CAAQ;IACd,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IAClD,mFAAmF;IAC3E,QAAQ,GAAG,IAAI,GAAG,EAA0D,CAAC;IAErF,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAI,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;;;;OASG;IACK,MAAM,CAAC,QAAgB,EAAE,MAAe;QAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,I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CAAC,CAAC;QAC7E,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAC1B,CAAC,CAAC,EAAE,EAAE;YACJ,MAAM,EAAE,CAAC;YACT,OAAO,CAAC,CAAC;QACX,CAAC,EACD,CAAC,CAAC,EAAE,EAAE;YACJ,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,CAAC;QACV,CAAC,CACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,EAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QACjD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,yCAAyC;IACzC,KAAK,CAAC,UAAU,CAAC,OAAuB,EAAE;QACxC,MAAM,GAAG,GAAkB,EAAE,CAAC;QAC9B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;YACjD,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAkB,EAAE,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,UAAU,CAAC,OAAgB;QACzB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;0GAEsG;IACtG,cAAc,CAAC,OAAgB;QAC7B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACnC,CAAC;CACF"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProjectState } from '@artblocks/abx-sdk';
|
|
1
|
+
import type { IndexError, IndexErrorClass, IndexStatus, ProjectState } from '@artblocks/abx-sdk';
|
|
2
2
|
/** How a project was registered for indexing — the minimum to replay it. */
|
|
3
3
|
export interface ProjectRegistration {
|
|
4
4
|
address: string;
|
|
@@ -25,8 +25,9 @@ export interface ProjectRegistration {
|
|
|
25
25
|
* (`specs/protocol/data-plane.md`). The resolver lists a token's rows and keeps only those whose
|
|
26
26
|
* `key` matches the recomputed address at the CURRENT settled inputsHash, so stale rows go
|
|
27
27
|
* silently unlisted (self-invalidation). `locator === null` means the bytes live in custody
|
|
28
|
-
* (the shared backend at `key`, or
|
|
29
|
-
* chain-derived: rows survive a projection wipe and self-heal from a
|
|
28
|
+
* (a co-located producer's bytes in the shared backend at `key`, or a bound output's `bytes` below).
|
|
29
|
+
* Producer-registered, NOT chain-derived: rows survive a projection wipe and self-heal from a
|
|
30
|
+
* runner's next sweep. */
|
|
30
31
|
export interface EffectArtifactRow {
|
|
31
32
|
/** renderArtifactKey (keccak hex; encodes effectKey + settled inputsHash). */
|
|
32
33
|
key: string;
|
|
@@ -38,8 +39,57 @@ export interface EffectArtifactRow {
|
|
|
38
39
|
/** The effect's DECLARED output mimeType — what the manifest and byte route serve. */
|
|
39
40
|
contentType: string | null;
|
|
40
41
|
locator: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* A **bound** output's content (`specs/protocol/effects.md → Bound vs referenced`): the bytes that
|
|
44
|
+
* stitch into the metadata JSON — `render/traits` today. Capped at
|
|
45
|
+
* {@link BOUND_ARTIFACT_MAX_BYTES}; `null` for every **referenced** output, whose bytes stay with
|
|
46
|
+
* the producer and reach us only as `locator`.
|
|
47
|
+
*
|
|
48
|
+
* These live HERE, next to the row, and deliberately not in a `StorageBackend`: byte custody holds
|
|
49
|
+
* *source* bytes an on-chain keccak commits to (switchable, never lapsable), while these are
|
|
50
|
+
* re-creatable projection state whose loss is a re-render. One write instead of two also removes a
|
|
51
|
+
* way for the row and its content to disagree.
|
|
52
|
+
*/
|
|
53
|
+
bytes?: Uint8Array | null;
|
|
41
54
|
updatedAt?: string;
|
|
42
55
|
}
|
|
56
|
+
/** The cap a serving node MUST accept per bound output, and MUST refuse above
|
|
57
|
+
* (`specs/self-host-toolkit/remote-services.md → The mode is decided by the binding`). ~100× a real
|
|
58
|
+
* traits payload: generous for what it is for, far too small to become blob storage. */
|
|
59
|
+
export declare const BOUND_ARTIFACT_MAX_BYTES: number;
|
|
60
|
+
/**
|
|
61
|
+
* Where one project sits in the indexing lifecycle (`specs/self-host-toolkit/remote-services.md` →
|
|
62
|
+
* The indexing lifecycle) — what the control plane's `status`/list routes report and what
|
|
63
|
+
* `abx status` prints, for a managed provider and for your own node in the same words.
|
|
64
|
+
*
|
|
65
|
+
* Deliberately its OWN table, not columns on `registrations`: `register()` is a full-column upsert,
|
|
66
|
+
* so a re-add would silently reset the lifecycle (the clobber class). Registrations are operator
|
|
67
|
+
* *input*; this is operational history — it survives a projection wipe (a replay's whole point is
|
|
68
|
+
* that it doesn't lose where you were) and dies with `deregister()`.
|
|
69
|
+
*/
|
|
70
|
+
export interface IndexStatusRow {
|
|
71
|
+
address: string;
|
|
72
|
+
status: IndexStatus;
|
|
73
|
+
/** Set on `stale`/`failed`, cleared on success. Credential-free by contract. */
|
|
74
|
+
errorClass?: IndexErrorClass | null;
|
|
75
|
+
errorMessage?: string | null;
|
|
76
|
+
/** Catch-up attempts since the last success. */
|
|
77
|
+
attempts: number;
|
|
78
|
+
lastAttemptAt?: string | null;
|
|
79
|
+
/** When catch-up last COMPLETED (distinct from the projection's `reconstructedAt`, which a
|
|
80
|
+
* failed attempt leaves untouched). */
|
|
81
|
+
lastIndexedAt?: string | null;
|
|
82
|
+
updatedAt?: string;
|
|
83
|
+
}
|
|
84
|
+
/** A patch to {@link IndexStatusRow}: omitted fields are preserved, an explicit `null` clears —
|
|
85
|
+
* the same preserve-on-omit / clear-on-null rule the off-chain registration fields follow. */
|
|
86
|
+
export interface IndexStatusPatch {
|
|
87
|
+
status?: IndexStatus;
|
|
88
|
+
error?: IndexError | null;
|
|
89
|
+
attempts?: number;
|
|
90
|
+
lastAttemptAt?: string | null;
|
|
91
|
+
lastIndexedAt?: string | null;
|
|
92
|
+
}
|
|
43
93
|
/** Transient per-(artifact key) effect observability — `rendering`/`failed` between triggers.
|
|
44
94
|
* Rebuildable state ONLY: "up to date" is always artifact-presence at the current settled
|
|
45
95
|
* inputsHash, never a row here; a lost table costs history, not correctness. */
|
|
@@ -86,6 +136,27 @@ export interface Store {
|
|
|
86
136
|
/** Every registered artifact row for (project, token) — the manifest's effect-source listing.
|
|
87
137
|
* Callers filter by recomputing the current-inputsHash key per row (stale rows unlisted). */
|
|
88
138
|
listEffectArtifacts(address: string, tokenId: string): EffectArtifactRow[];
|
|
139
|
+
/**
|
|
140
|
+
* Drop the **bound** content of every superseded row for (project, token, effectKey, outputKey) —
|
|
141
|
+
* everything whose `inputs_hash` isn't `currentHash`.
|
|
142
|
+
*
|
|
143
|
+
* The spec makes this a **MAY**, not a MUST (`specs/protocol/effects.md → Bound vs referenced`):
|
|
144
|
+
* what's normative is that superseded content is never *served* or stitched, which leaves it with
|
|
145
|
+
* no legal reader. Dropping it is therefore free of consequence, and this node drops eagerly — on
|
|
146
|
+
* each bound registration — because that is what turns "held bytes" into
|
|
147
|
+
* `cap × minted × bound outputs` rather than a number that grows with every param change. A node
|
|
148
|
+
* that chose to keep history would be equally conforming and simply carry the cost.
|
|
149
|
+
*
|
|
150
|
+
* The rows themselves survive as provenance; only the unreadable content goes.
|
|
151
|
+
*/
|
|
152
|
+
pruneBoundArtifactBytes(address: string, tokenId: string, effectKey: string, outputKey: string, currentHash: string): void;
|
|
153
|
+
/** Merge a lifecycle patch for one project (preserve-on-omit, clear-on-`null`) and return the
|
|
154
|
+
* stored row. Creates the row on first write. */
|
|
155
|
+
setIndexStatus(address: string, patch: IndexStatusPatch): IndexStatusRow;
|
|
156
|
+
/** One project's lifecycle row, or null when nothing has stamped it yet. */
|
|
157
|
+
getIndexStatus(address: string): IndexStatusRow | null;
|
|
158
|
+
/** Every lifecycle row (the list route's status column, in one read). */
|
|
159
|
+
listIndexStatuses(): IndexStatusRow[];
|
|
89
160
|
/** Node-level key/value metadata (e.g. the chain watcher's persisted watermark). */
|
|
90
161
|
putMeta(key: string, value: string): void;
|
|
91
162
|
getMeta(key: string): string | null;
|
|
@@ -94,7 +165,12 @@ export interface Store {
|
|
|
94
165
|
/** Clear one artifact key's status — the run finished; artifact presence takes over as truth. */
|
|
95
166
|
clearEffectStatus(key: string): void;
|
|
96
167
|
listEffectStatuses(address: string): EffectStatusRow[];
|
|
97
|
-
|
|
168
|
+
/** Persist a folded projection. `fullReplay: true` (the repair path — `abx index --full`) purges
|
|
169
|
+
* the project's append-only event log first, so a reorg-replaced event can't survive as a stale
|
|
170
|
+
* row; routine incremental writes leave the log append-only. */
|
|
171
|
+
putProject(state: ProjectState, opts?: {
|
|
172
|
+
fullReplay?: boolean;
|
|
173
|
+
}): void;
|
|
98
174
|
getProject(address: string): ProjectState | null;
|
|
99
175
|
listProjects(): ProjectState[];
|
|
100
176
|
/** Drop the rebuildable projection (keeps registrations). Proves replay. */
|
|
@@ -127,24 +203,76 @@ export declare class SqliteStore implements Store {
|
|
|
127
203
|
/** Idempotently add columns introduced after a DB was first created (CREATE IF NOT
|
|
128
204
|
* EXISTS won't backfill them). Keeps an existing projection working across upgrades. */
|
|
129
205
|
private migrate;
|
|
206
|
+
/**
|
|
207
|
+
* One-time data migration, gated on `PRAGMA user_version` (unused before this — starts at 0 on
|
|
208
|
+
* every existing store). `migrate()` above only ever ADDs columns; recomputing `seq` rewrites
|
|
209
|
+
* VALUES in an existing column, which a `PRAGMA table_info` presence check can't gate — hence a
|
|
210
|
+
* separate versioned step.
|
|
211
|
+
*
|
|
212
|
+
* `events.seq` used to be the array index at write time (positional — renumbers on every re-fold).
|
|
213
|
+
* This recomputes every existing row to the chain-derived value `(block_number << 32) | log_index`
|
|
214
|
+
* — the same formula {@link eventSeq} uses going forward — so an upgraded store's history becomes
|
|
215
|
+
* append-only-compatible without re-indexing from chain. No collisions are possible: `(block,
|
|
216
|
+
* logIndex)` is already unique per project (the table's own history proves it — it was a valid
|
|
217
|
+
* event log before this ran), and the shift preserves that uniqueness.
|
|
218
|
+
*
|
|
219
|
+
* A fresh install has no rows yet, so the `UPDATE` is a no-op — but `user_version` still advances,
|
|
220
|
+
* so this never re-scans an empty table on every open. Wrapped in a transaction: a crash mid-way
|
|
221
|
+
* leaves `user_version` at 0 and retries the whole thing next open, never a half-migrated table.
|
|
222
|
+
*/
|
|
223
|
+
private migrateSeq;
|
|
130
224
|
register(reg: ProjectRegistration): void;
|
|
131
225
|
listRegistrations(): ProjectRegistration[];
|
|
132
226
|
getRegistration(address: string): ProjectRegistration | null;
|
|
133
227
|
dropProjection(address: string): void;
|
|
134
228
|
deregister(address: string): void;
|
|
135
229
|
putEffectArtifact(row: EffectArtifactRow): void;
|
|
230
|
+
pruneBoundArtifactBytes(address: string, tokenId: string, effectKey: string, outputKey: string, currentHash: string): void;
|
|
136
231
|
getEffectArtifact(key: string): EffectArtifactRow | null;
|
|
137
232
|
listEffectArtifacts(address: string, tokenId: string): EffectArtifactRow[];
|
|
138
233
|
putMeta(key: string, value: string): void;
|
|
139
234
|
getMeta(key: string): string | null;
|
|
235
|
+
/**
|
|
236
|
+
* Read-modify-write so a caller can advance ONE field without knowing the rest: the watcher marks
|
|
237
|
+
* `stale` without touching `attempts`, a failure records the error without inventing a
|
|
238
|
+
* `lastIndexedAt`. Omitted = preserved, explicit `null` = cleared (the same rule the off-chain
|
|
239
|
+
* registration fields follow). Single writer per node, so a read-then-write is safe here.
|
|
240
|
+
*/
|
|
241
|
+
setIndexStatus(address: string, patch: IndexStatusPatch): IndexStatusRow;
|
|
242
|
+
getIndexStatus(address: string): IndexStatusRow | null;
|
|
243
|
+
listIndexStatuses(): IndexStatusRow[];
|
|
140
244
|
putEffectStatus(row: EffectStatusRow): void;
|
|
141
245
|
clearEffectStatus(key: string): void;
|
|
142
246
|
listEffectStatuses(address: string): EffectStatusRow[];
|
|
143
|
-
|
|
247
|
+
/**
|
|
248
|
+
* Persist a reconstructed `ProjectState`. O(delta), not O(history): the routine case — one new
|
|
249
|
+
* mint on an otherwise-unchanged project — writes one project row and one token row, appends
|
|
250
|
+
* whatever events are new, and touches nothing else. Contrast with the old delete-and-reinsert,
|
|
251
|
+
* which rewrote the entire projection (every token, every event) on every call
|
|
252
|
+
* (2026-08-05 projection memo, `docs/11`, finding #2).
|
|
253
|
+
*
|
|
254
|
+
* `contract_uri`/`token_uri` are bound NULL unconditionally regardless of what `state` carries —
|
|
255
|
+
* see the schema comments on those columns. This is deliberate even when a caller passed populated
|
|
256
|
+
* values (e.g. a reconstruct run with `readUriDocuments: true`): the store's job is never to cache
|
|
257
|
+
* a value with no settled state, only to serve it live when asked (finding #3, same memo).
|
|
258
|
+
*/
|
|
259
|
+
putProject(state: ProjectState, opts?: {
|
|
260
|
+
fullReplay?: boolean;
|
|
261
|
+
}): void;
|
|
144
262
|
getProject(address: string): ProjectState | null;
|
|
145
263
|
listProjects(): ProjectState[];
|
|
146
264
|
wipeProjections(): void;
|
|
147
265
|
destroy(): void;
|
|
266
|
+
/**
|
|
267
|
+
* Drop one project's projection — `extensions` / `tokens` / `projects` — but deliberately NOT
|
|
268
|
+
* `events`. The event log is append-only and chain-derived (`seq` is `(block << 32) | logIndex`,
|
|
269
|
+
* so a re-fold always lands on the same rows): a re-index after this re-derives the identical
|
|
270
|
+
* event set from chain and re-inserts it as a no-op (`ON CONFLICT DO NOTHING`), so nothing is lost
|
|
271
|
+
* by leaving the rows in place, and `abx demo`'s "drop + replay" proof doesn't depend on the log
|
|
272
|
+
* being gone. `deregister`/forget-the-project-entirely paths delete events explicitly — this
|
|
273
|
+
* helper is for `dropProjection`, which keeps the registration precisely so the next reindex can
|
|
274
|
+
* rebuild from it.
|
|
275
|
+
*/
|
|
148
276
|
private deleteProjection;
|
|
149
277
|
private hydrate;
|
|
150
278
|
}
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts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,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAMzC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAMnC;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,cAAc;IAoCxE,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI;IAKtD,iBAAiB,IAAI,cAAc,EAAE;IAQrC,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAqB3C,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIpC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE;IAiBtD;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,IAAI;IA2JpE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAKhD,YAAY,IAAI,YAAY,EAAE;IAO9B,eAAe,IAAI,IAAI;IAIvB,OAAO,IAAI,IAAI;IAQf;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,OAAO;CAmFhB"}
|
package/dist/store.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { DatabaseSync } from 'node:sqlite';
|
|
2
2
|
import { existsSync, mkdirSync, rmSync } from 'node:fs';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
|
+
/** The cap a serving node MUST accept per bound output, and MUST refuse above
|
|
5
|
+
* (`specs/self-host-toolkit/remote-services.md → The mode is decided by the binding`). ~100× a real
|
|
6
|
+
* traits payload: generous for what it is for, far too small to become blob storage. */
|
|
7
|
+
export const BOUND_ARTIFACT_MAX_BYTES = 64 * 1024;
|
|
4
8
|
// The data plane's effect-artifact registry (`specs/protocol/data-plane.md`): one row per declared
|
|
5
9
|
// output a runner produced, keyed by renderArtifactKey at the CURRENT settled inputsHash (a param
|
|
6
10
|
// change re-addresses → old rows go silently unlisted). Effect-agnostic — producers declare the
|
|
7
|
-
// (effect_key, output_key, content_type); the store never interprets them. locator NULL =
|
|
8
|
-
//
|
|
11
|
+
// (effect_key, output_key, content_type); the store never interprets them. locator NULL = nothing to
|
|
12
|
+
// redirect to: a BOUND output (content in `bytes`) or a co-located producer's bytes at `key` in the
|
|
13
|
+
// shared backend. Producer-registered, NOT chain-
|
|
9
14
|
// derived, so like registrations rows survive a projection wipe/replay — and a lost table self-heals
|
|
10
|
-
// from a runner's next sweep (record-on-skip /
|
|
15
|
+
// from a runner's next sweep (record-on-skip / re-register).
|
|
11
16
|
const EFFECT_ARTIFACTS_DDL = `
|
|
12
17
|
CREATE TABLE IF NOT EXISTS effect_artifacts (
|
|
13
18
|
key TEXT PRIMARY KEY, -- renderArtifactKey (keccak hex; encodes effectKey + settled inputsHash)
|
|
@@ -16,20 +21,32 @@ CREATE TABLE IF NOT EXISTS effect_artifacts (
|
|
|
16
21
|
effect_key TEXT NOT NULL, -- 'render' | any registered effect
|
|
17
22
|
output_key TEXT NOT NULL, -- 'image' | 'traits' | any declared output
|
|
18
23
|
inputs_hash TEXT NOT NULL, -- the settled inputsHash this row was produced at
|
|
19
|
-
locator TEXT, -- ipfs://<cid> | ar://<txid> | https://… | NULL (bytes
|
|
24
|
+
locator TEXT, -- ipfs://<cid> | ar://<txid> | https://… | NULL (referenced bytes stay with the producer; or co-located custody at \`key\`)
|
|
20
25
|
content_type TEXT, -- the effect's DECLARED output mimeType
|
|
26
|
+
bytes BLOB, -- BOUND output content only (≤64KB, stitches into the JSON); NULL for referenced
|
|
21
27
|
updated_at TEXT NOT NULL
|
|
22
28
|
);
|
|
23
29
|
CREATE INDEX IF NOT EXISTS idx_effect_artifacts_token ON effect_artifacts(address, token_id);
|
|
24
30
|
`;
|
|
25
31
|
const SCHEMA = `
|
|
26
|
-
PRAGMA journal_mode = WAL;
|
|
27
|
-
PRAGMA foreign_keys = ON;
|
|
28
32
|
-- Cross-process co-located writes (a local effect runner records artifact rows into this same
|
|
29
33
|
-- file while the resolver serves): wait out a writer instead of failing fast. WAL keeps readers
|
|
30
34
|
-- unblocked; artifact writes are rare (one per rendered output) and touch a table the indexer
|
|
31
35
|
-- never writes.
|
|
36
|
+
--
|
|
37
|
+
-- FIRST, before anything else: a timeout only protects the statements that come AFTER it. With this
|
|
38
|
+
-- third in the list (as it was), the WAL switch and the DDL below it had no timeout at all — so two
|
|
39
|
+
-- processes opening the same store at once (parallel CLI invocations, or a co-located runner starting
|
|
40
|
+
-- alongside the resolver) could fail outright with "database is locked" instead of waiting the moment
|
|
41
|
+
-- out. Setting the journal mode itself takes a write lock, which is exactly the collision.
|
|
32
42
|
PRAGMA busy_timeout = 5000;
|
|
43
|
+
PRAGMA journal_mode = WAL;
|
|
44
|
+
PRAGMA foreign_keys = ON;
|
|
45
|
+
-- Lets SQLite reclaim freed pages incrementally (via \`PRAGMA incremental_vacuum\`) instead of only on
|
|
46
|
+
-- a full VACUUM. Must precede the first CREATE TABLE — auto_vacuum only takes effect on a database
|
|
47
|
+
-- with no tables yet, so this is a no-op for a store opened from an existing file (deliberately: a
|
|
48
|
+
-- one-time \`VACUUM\` to convert an existing store is deferred — docs/10-backlog.md B29).
|
|
49
|
+
PRAGMA auto_vacuum = INCREMENTAL;
|
|
33
50
|
|
|
34
51
|
CREATE TABLE IF NOT EXISTS registrations (
|
|
35
52
|
address TEXT PRIMARY KEY, -- lowercased
|
|
@@ -58,7 +75,12 @@ CREATE TABLE IF NOT EXISTS projects (
|
|
|
58
75
|
name TEXT,
|
|
59
76
|
symbol TEXT,
|
|
60
77
|
owner TEXT,
|
|
61
|
-
contract_uri TEXT,
|
|
78
|
+
contract_uri TEXT, -- ALWAYS NULL as of the 2026-08-05 projection memo (docs/11):
|
|
79
|
+
-- the composed ERC-7572 document is a live read, never
|
|
80
|
+
-- projected (no settled value — a renderer can change it with
|
|
81
|
+
-- no log at all). Column kept for schema stability; nothing
|
|
82
|
+
-- writes it non-null. See token_uri_renderer/_locked below for
|
|
83
|
+
-- the settled scalars that DO stay projected.
|
|
62
84
|
token_uri_renderer TEXT, -- non-null => tokenURI resolves on-chain
|
|
63
85
|
token_uri_locked INTEGER, -- 0 | 1 | NULL
|
|
64
86
|
contract_uri_renderer TEXT,
|
|
@@ -67,7 +89,7 @@ CREATE TABLE IF NOT EXISTS projects (
|
|
|
67
89
|
royalty_bps INTEGER,
|
|
68
90
|
collection_fields TEXT, -- JSON MetadataField[] (collection scope)
|
|
69
91
|
locked_collection_fields TEXT, -- JSON string[]
|
|
70
|
-
contract_type TEXT, -- '1of1' | 'series'
|
|
92
|
+
contract_type TEXT, -- '1of1' | 'series' | 'code' | '1of1-edition' | 'edition' | 'edition-code'
|
|
71
93
|
max_invocations TEXT, -- Series supply cap (decimal string) or NULL
|
|
72
94
|
minter TEXT, -- the single authorized minter or NULL
|
|
73
95
|
paused INTEGER, -- Paused extension: 1 | 0 | NULL (NULL/0 ⇒ unpaused)
|
|
@@ -84,7 +106,10 @@ CREATE TABLE IF NOT EXISTS tokens (
|
|
|
84
106
|
token_id TEXT NOT NULL,
|
|
85
107
|
minted INTEGER NOT NULL DEFAULT 0,
|
|
86
108
|
owner TEXT,
|
|
87
|
-
token_uri TEXT,
|
|
109
|
+
token_uri TEXT, -- ALWAYS NULL as of the 2026-08-05 projection memo (docs/11):
|
|
110
|
+
-- the composed tokenURI/uri(id) document is a live read,
|
|
111
|
+
-- never projected — same reasoning as contract_uri above.
|
|
112
|
+
-- Column kept for schema stability; nothing writes it non-null.
|
|
88
113
|
fields TEXT, -- JSON MetadataField[] (on-chain token fields)
|
|
89
114
|
locked_fields TEXT, -- JSON string[] (locked field names)
|
|
90
115
|
PRIMARY KEY (project_address, token_id)
|
|
@@ -138,9 +163,45 @@ CREATE TABLE IF NOT EXISTS effect_status (
|
|
|
138
163
|
updated_at TEXT NOT NULL
|
|
139
164
|
);
|
|
140
165
|
CREATE INDEX IF NOT EXISTS idx_effect_status_address ON effect_status(address);
|
|
166
|
+
|
|
167
|
+
-- Where each project sits in the indexing lifecycle (queued | backfilling | live | stale | failed).
|
|
168
|
+
-- Operational history, NOT chain-derived and NOT operator input: it survives a projection wipe (the
|
|
169
|
+
-- replay must not lose where you were) and dies with deregister(). Kept OFF the registrations table
|
|
170
|
+
-- on purpose: register() is a full-column upsert, so a re-add would silently reset it.
|
|
171
|
+
CREATE TABLE IF NOT EXISTS index_status (
|
|
172
|
+
address TEXT PRIMARY KEY, -- lowercased
|
|
173
|
+
status TEXT NOT NULL, -- IndexStatus
|
|
174
|
+
error_class TEXT, -- IndexErrorClass, on stale/failed
|
|
175
|
+
error_message TEXT, -- credential-free hint (closed set — never an upstream message)
|
|
176
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
177
|
+
last_attempt_at TEXT,
|
|
178
|
+
last_indexed_at TEXT, -- when catch-up last COMPLETED
|
|
179
|
+
updated_at TEXT NOT NULL
|
|
180
|
+
);
|
|
141
181
|
`;
|
|
142
182
|
const b = (v) => v === null || v === undefined ? null : v ? 1 : 0;
|
|
143
183
|
const lc = (address) => address.toLowerCase();
|
|
184
|
+
/**
|
|
185
|
+
* The event table's chain-derived sort key: `(blockNumber << 32) | logIndex`. Matches the schema
|
|
186
|
+
* comment (`seq INTEGER NOT NULL, -- chain order (block, logIndex)`), which the writer used to
|
|
187
|
+
* violate by storing the array index instead (positional — renumbers on every re-fold, so
|
|
188
|
+
* delete-and-reinsert was the only correct write). Encoding the real chain position makes `seq`
|
|
189
|
+
* stable across re-folds: the SAME event always computes the SAME seq, so appending is an
|
|
190
|
+
* `ON CONFLICT DO NOTHING` no-op rather than a rewrite (see {@link putProject}).
|
|
191
|
+
*
|
|
192
|
+
* A block's log index fits comfortably under 2^32 (a block would need billions of logs to
|
|
193
|
+
* overflow it), so the shift never collides. The result routinely EXCEEDS
|
|
194
|
+
* `Number.MAX_SAFE_INTEGER` — a Base Sepolia block height today already pushes `seq` past 2^53 —
|
|
195
|
+
* so this returns a `bigint`, bound directly (`node:sqlite`'s `DatabaseSync` accepts `bigint`
|
|
196
|
+
* params natively). Never round-trip this value through a JS `number`: reading an INTEGER column
|
|
197
|
+
* that large back with the driver's default (`readBigInts` off) throws
|
|
198
|
+
* `RangeError: Value is too large to be represented as a JavaScript number` — which is exactly why
|
|
199
|
+
* every reader below either selects an explicit column list that excludes `seq`, or (the migration)
|
|
200
|
+
* never materializes it in JS at all.
|
|
201
|
+
*/
|
|
202
|
+
function eventSeq(ev) {
|
|
203
|
+
return (BigInt(ev.blockNumber) << 32n) | BigInt(ev.logIndex);
|
|
204
|
+
}
|
|
144
205
|
/**
|
|
145
206
|
* The reference store: a single SQLite file (`.abx-self-host/index.db`).
|
|
146
207
|
*
|
|
@@ -165,6 +226,7 @@ export class SqliteStore {
|
|
|
165
226
|
this.premigrate();
|
|
166
227
|
this.db.exec(SCHEMA);
|
|
167
228
|
this.migrate();
|
|
229
|
+
this.migrateSeq();
|
|
168
230
|
}
|
|
169
231
|
/** Shape changes that must land BEFORE the schema exec (its indexes reference new columns).
|
|
170
232
|
* effect_artifacts pre-data-plane shape (key/address/locator only) → drop; the schema recreates
|
|
@@ -210,6 +272,54 @@ export class SqliteStore {
|
|
|
210
272
|
// one JSON column; the shape is the ProjectState fields, spread back on hydrate.
|
|
211
273
|
add('projects', 'code_state TEXT');
|
|
212
274
|
add('tokens', 'params TEXT');
|
|
275
|
+
// bound-output content (`effects.md → Bound vs referenced`): traits used to land in the
|
|
276
|
+
// StorageBackend beside the referenced bytes; they belong with the row instead.
|
|
277
|
+
add('effect_artifacts', 'bytes BLOB');
|
|
278
|
+
// ERC-1155 editions: per-id supply + cap (decimal strings) and current holder balances (JSON
|
|
279
|
+
// object address→balance, folded from TransferSingle/TransferBatch — see TokenState.holders).
|
|
280
|
+
// Text columns like their 721-token siblings above; absent for a 721 token, so NULL is the
|
|
281
|
+
// honest default rather than a fabricated '0'/'{}'.
|
|
282
|
+
add('tokens', 'supply TEXT');
|
|
283
|
+
add('tokens', 'max_supply TEXT');
|
|
284
|
+
add('tokens', 'holders TEXT');
|
|
285
|
+
// The collection-wide per-id default (`DefaultMaxSupplySet`) — the 1155 analogue of
|
|
286
|
+
// `max_invocations` above, and what makes a stored `max_supply` of '0' readable: with the
|
|
287
|
+
// override flag beside it, '0' is "closed forever" rather than "open".
|
|
288
|
+
add('projects', 'default_max_supply TEXT');
|
|
289
|
+
add('tokens', 'max_supply_overridden INTEGER');
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* One-time data migration, gated on `PRAGMA user_version` (unused before this — starts at 0 on
|
|
293
|
+
* every existing store). `migrate()` above only ever ADDs columns; recomputing `seq` rewrites
|
|
294
|
+
* VALUES in an existing column, which a `PRAGMA table_info` presence check can't gate — hence a
|
|
295
|
+
* separate versioned step.
|
|
296
|
+
*
|
|
297
|
+
* `events.seq` used to be the array index at write time (positional — renumbers on every re-fold).
|
|
298
|
+
* This recomputes every existing row to the chain-derived value `(block_number << 32) | log_index`
|
|
299
|
+
* — the same formula {@link eventSeq} uses going forward — so an upgraded store's history becomes
|
|
300
|
+
* append-only-compatible without re-indexing from chain. No collisions are possible: `(block,
|
|
301
|
+
* logIndex)` is already unique per project (the table's own history proves it — it was a valid
|
|
302
|
+
* event log before this ran), and the shift preserves that uniqueness.
|
|
303
|
+
*
|
|
304
|
+
* A fresh install has no rows yet, so the `UPDATE` is a no-op — but `user_version` still advances,
|
|
305
|
+
* so this never re-scans an empty table on every open. Wrapped in a transaction: a crash mid-way
|
|
306
|
+
* leaves `user_version` at 0 and retries the whole thing next open, never a half-migrated table.
|
|
307
|
+
*/
|
|
308
|
+
migrateSeq() {
|
|
309
|
+
const CURRENT = 1;
|
|
310
|
+
const { user_version: version } = this.db.prepare(`PRAGMA user_version`).get();
|
|
311
|
+
if (version >= CURRENT)
|
|
312
|
+
return;
|
|
313
|
+
this.db.exec('BEGIN');
|
|
314
|
+
try {
|
|
315
|
+
this.db.exec(`UPDATE events SET seq = (CAST(block_number AS INTEGER) << 32) | CAST(log_index AS INTEGER)`);
|
|
316
|
+
this.db.exec(`PRAGMA user_version = ${CURRENT}`);
|
|
317
|
+
this.db.exec('COMMIT');
|
|
318
|
+
}
|
|
319
|
+
catch (err) {
|
|
320
|
+
this.db.exec('ROLLBACK');
|
|
321
|
+
throw err;
|
|
322
|
+
}
|
|
213
323
|
}
|
|
214
324
|
// ── registrations ──────────────────────────────────────────────────────────
|
|
215
325
|
register(reg) {
|
|
@@ -241,20 +351,33 @@ export class SqliteStore {
|
|
|
241
351
|
deregister(address) {
|
|
242
352
|
const key = lc(address);
|
|
243
353
|
this.deleteProjection(key);
|
|
354
|
+
// `deleteProjection` deliberately spares `events` (append-only, chain-derived — see its
|
|
355
|
+
// docstring); forgetting a project entirely must still remove them, or a re-`abx add` at a
|
|
356
|
+
// later block would resurrect old rows underneath a fresh registration.
|
|
357
|
+
this.db.prepare(`DELETE FROM events WHERE project_address = ?`).run(key);
|
|
244
358
|
this.db.prepare(`DELETE FROM effect_artifacts WHERE address = ?`).run(key);
|
|
245
359
|
this.db.prepare(`DELETE FROM effect_status WHERE address = ?`).run(key);
|
|
360
|
+
this.db.prepare(`DELETE FROM index_status WHERE address = ?`).run(key);
|
|
246
361
|
this.db.prepare(`DELETE FROM registrations WHERE address = ?`).run(key);
|
|
247
362
|
}
|
|
248
363
|
// ── effect artifacts (the data plane's registry; producer-published) ──────────
|
|
249
364
|
putEffectArtifact(row) {
|
|
250
365
|
this.db
|
|
251
|
-
.prepare(`INSERT INTO effect_artifacts (key, address, token_id, effect_key, output_key, inputs_hash, locator, content_type, updated_at)
|
|
252
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
366
|
+
.prepare(`INSERT INTO effect_artifacts (key, address, token_id, effect_key, output_key, inputs_hash, locator, content_type, bytes, updated_at)
|
|
367
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
253
368
|
ON CONFLICT(key) DO UPDATE SET
|
|
254
369
|
address=excluded.address, token_id=excluded.token_id, effect_key=excluded.effect_key,
|
|
255
370
|
output_key=excluded.output_key, inputs_hash=excluded.inputs_hash,
|
|
256
|
-
locator=excluded.locator, content_type=excluded.content_type,
|
|
257
|
-
|
|
371
|
+
locator=excluded.locator, content_type=excluded.content_type,
|
|
372
|
+
bytes=excluded.bytes, updated_at=excluded.updated_at`)
|
|
373
|
+
.run(row.key.toLowerCase(), lc(row.address), row.tokenId, row.effectKey, row.outputKey, row.inputsHash.toLowerCase(), row.locator, row.contentType, row.bytes ?? null, row.updatedAt ?? new Date().toISOString());
|
|
374
|
+
}
|
|
375
|
+
pruneBoundArtifactBytes(address, tokenId, effectKey, outputKey, currentHash) {
|
|
376
|
+
this.db
|
|
377
|
+
.prepare(`UPDATE effect_artifacts SET bytes = NULL
|
|
378
|
+
WHERE address = ? AND token_id = ? AND effect_key = ? AND output_key = ?
|
|
379
|
+
AND inputs_hash <> ? AND bytes IS NOT NULL`)
|
|
380
|
+
.run(lc(address), tokenId, effectKey, outputKey, currentHash.toLowerCase());
|
|
258
381
|
}
|
|
259
382
|
getEffectArtifact(key) {
|
|
260
383
|
const row = this.db
|
|
@@ -277,6 +400,46 @@ export class SqliteStore {
|
|
|
277
400
|
const row = this.db.prepare(`SELECT value FROM meta WHERE key = ?`).get(key);
|
|
278
401
|
return row?.value ?? null;
|
|
279
402
|
}
|
|
403
|
+
// ── indexing lifecycle (queued | backfilling | live | stale | failed) ────────
|
|
404
|
+
/**
|
|
405
|
+
* Read-modify-write so a caller can advance ONE field without knowing the rest: the watcher marks
|
|
406
|
+
* `stale` without touching `attempts`, a failure records the error without inventing a
|
|
407
|
+
* `lastIndexedAt`. Omitted = preserved, explicit `null` = cleared (the same rule the off-chain
|
|
408
|
+
* registration fields follow). Single writer per node, so a read-then-write is safe here.
|
|
409
|
+
*/
|
|
410
|
+
setIndexStatus(address, patch) {
|
|
411
|
+
const key = lc(address);
|
|
412
|
+
const prior = this.getIndexStatus(key);
|
|
413
|
+
const merged = {
|
|
414
|
+
address: key,
|
|
415
|
+
status: patch.status ?? prior?.status ?? 'queued',
|
|
416
|
+
errorClass: patch.error === undefined ? prior?.errorClass ?? null : patch.error === null ? null : patch.error.class,
|
|
417
|
+
errorMessage: patch.error === undefined ? prior?.errorMessage ?? null : patch.error === null ? null : patch.error.message ?? null,
|
|
418
|
+
attempts: patch.attempts ?? prior?.attempts ?? 0,
|
|
419
|
+
lastAttemptAt: patch.lastAttemptAt === undefined ? prior?.lastAttemptAt ?? null : patch.lastAttemptAt,
|
|
420
|
+
lastIndexedAt: patch.lastIndexedAt === undefined ? prior?.lastIndexedAt ?? null : patch.lastIndexedAt,
|
|
421
|
+
updatedAt: new Date().toISOString(),
|
|
422
|
+
};
|
|
423
|
+
this.db
|
|
424
|
+
.prepare(`INSERT INTO index_status (address, status, error_class, error_message, attempts, last_attempt_at, last_indexed_at, updated_at)
|
|
425
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
426
|
+
ON CONFLICT(address) DO UPDATE SET
|
|
427
|
+
status=excluded.status, error_class=excluded.error_class, error_message=excluded.error_message,
|
|
428
|
+
attempts=excluded.attempts, last_attempt_at=excluded.last_attempt_at,
|
|
429
|
+
last_indexed_at=excluded.last_indexed_at, updated_at=excluded.updated_at`)
|
|
430
|
+
.run(merged.address, merged.status, merged.errorClass ?? null, merged.errorMessage ?? null, merged.attempts, merged.lastAttemptAt ?? null, merged.lastIndexedAt ?? null, merged.updatedAt);
|
|
431
|
+
return merged;
|
|
432
|
+
}
|
|
433
|
+
getIndexStatus(address) {
|
|
434
|
+
const row = this.db.prepare(`SELECT * FROM index_status WHERE address = ?`).get(lc(address));
|
|
435
|
+
return row ? rowToIndexStatus(row) : null;
|
|
436
|
+
}
|
|
437
|
+
listIndexStatuses() {
|
|
438
|
+
return this.db
|
|
439
|
+
.prepare(`SELECT * FROM index_status`)
|
|
440
|
+
.all()
|
|
441
|
+
.map((r) => rowToIndexStatus(r));
|
|
442
|
+
}
|
|
280
443
|
// ── transient effect status (runner-reported observability; rebuildable) ─────
|
|
281
444
|
putEffectStatus(row) {
|
|
282
445
|
this.db
|
|
@@ -306,21 +469,53 @@ export class SqliteStore {
|
|
|
306
469
|
}));
|
|
307
470
|
}
|
|
308
471
|
// ── projection ───────────────────────────────────────────────────────────--
|
|
309
|
-
|
|
472
|
+
/**
|
|
473
|
+
* Persist a reconstructed `ProjectState`. O(delta), not O(history): the routine case — one new
|
|
474
|
+
* mint on an otherwise-unchanged project — writes one project row and one token row, appends
|
|
475
|
+
* whatever events are new, and touches nothing else. Contrast with the old delete-and-reinsert,
|
|
476
|
+
* which rewrote the entire projection (every token, every event) on every call
|
|
477
|
+
* (2026-08-05 projection memo, `docs/11`, finding #2).
|
|
478
|
+
*
|
|
479
|
+
* `contract_uri`/`token_uri` are bound NULL unconditionally regardless of what `state` carries —
|
|
480
|
+
* see the schema comments on those columns. This is deliberate even when a caller passed populated
|
|
481
|
+
* values (e.g. a reconstruct run with `readUriDocuments: true`): the store's job is never to cache
|
|
482
|
+
* a value with no settled state, only to serve it live when asked (finding #3, same memo).
|
|
483
|
+
*/
|
|
484
|
+
putProject(state, opts) {
|
|
310
485
|
const key = lc(state.address);
|
|
311
486
|
this.db.exec('BEGIN');
|
|
312
487
|
try {
|
|
313
|
-
|
|
488
|
+
// project row: full-column upsert, not delete-then-insert.
|
|
314
489
|
this.db
|
|
315
490
|
.prepare(`INSERT INTO projects (
|
|
316
491
|
address, address_original, chain_id, abx_version, deploy_block, deploy_tx,
|
|
317
492
|
factory, implementation, is_canonical, name, symbol, owner, contract_uri,
|
|
318
493
|
token_uri_renderer, token_uri_locked, contract_uri_renderer, contract_uri_locked,
|
|
319
494
|
royalty_receiver, royalty_bps, collection_fields, locked_collection_fields,
|
|
320
|
-
contract_type, max_invocations, minter, paused, primary_payee,
|
|
321
|
-
from_block, to_block, event_count, reconstructed_at, rpc_url
|
|
322
|
-
) VALUES (
|
|
323
|
-
|
|
495
|
+
contract_type, max_invocations, default_max_supply, minter, paused, primary_payee,
|
|
496
|
+
code_state, from_block, to_block, event_count, reconstructed_at, rpc_url
|
|
497
|
+
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
|
498
|
+
ON CONFLICT(address) DO UPDATE SET
|
|
499
|
+
address_original=excluded.address_original, chain_id=excluded.chain_id,
|
|
500
|
+
abx_version=excluded.abx_version, deploy_block=excluded.deploy_block,
|
|
501
|
+
deploy_tx=excluded.deploy_tx, factory=excluded.factory,
|
|
502
|
+
implementation=excluded.implementation, is_canonical=excluded.is_canonical,
|
|
503
|
+
name=excluded.name, symbol=excluded.symbol, owner=excluded.owner,
|
|
504
|
+
contract_uri=excluded.contract_uri, token_uri_renderer=excluded.token_uri_renderer,
|
|
505
|
+
token_uri_locked=excluded.token_uri_locked,
|
|
506
|
+
contract_uri_renderer=excluded.contract_uri_renderer,
|
|
507
|
+
contract_uri_locked=excluded.contract_uri_locked,
|
|
508
|
+
royalty_receiver=excluded.royalty_receiver, royalty_bps=excluded.royalty_bps,
|
|
509
|
+
collection_fields=excluded.collection_fields,
|
|
510
|
+
locked_collection_fields=excluded.locked_collection_fields,
|
|
511
|
+
contract_type=excluded.contract_type, max_invocations=excluded.max_invocations,
|
|
512
|
+
default_max_supply=excluded.default_max_supply,
|
|
513
|
+
minter=excluded.minter, paused=excluded.paused, primary_payee=excluded.primary_payee,
|
|
514
|
+
code_state=excluded.code_state, from_block=excluded.from_block,
|
|
515
|
+
to_block=excluded.to_block, event_count=excluded.event_count,
|
|
516
|
+
reconstructed_at=excluded.reconstructed_at, rpc_url=excluded.rpc_url`)
|
|
517
|
+
.run(key, state.address, state.chainId, state.abxVersion, state.deployBlock, state.deployTx, state.factory, state.implementation, b(state.isCanonical), state.name, state.symbol, state.owner, null, // contract_uri — always NULL; see the schema comment
|
|
518
|
+
state.tokenURIRenderer, b(state.tokenURILocked), state.contractURIRenderer, b(state.contractURILocked), state.royalty?.receiver ?? null, state.royalty?.bps ?? null, JSON.stringify(state.collectionFields), JSON.stringify(state.lockedCollectionFields), state.contractType ?? null, state.maxInvocations ?? null, state.defaultMaxSupply ?? null, state.minter ?? null, b(state.paused), state.primaryPayee ?? null, JSON.stringify({
|
|
324
519
|
contractParams: state.contractParams ?? null,
|
|
325
520
|
paramSchemas: state.paramSchemas ?? null,
|
|
326
521
|
paramHooks: state.paramHooks ?? null,
|
|
@@ -329,19 +524,56 @@ export class SqliteStore {
|
|
|
329
524
|
script: state.script ?? null,
|
|
330
525
|
dependencies: state.dependencies ?? null,
|
|
331
526
|
}), state.fromBlock, state.toBlock, state.eventCount, state.reconstructedAt, state.rpcUrl ?? null);
|
|
332
|
-
|
|
333
|
-
|
|
527
|
+
// tokens: upsert every token in the new state, then delete any id that's no longer present
|
|
528
|
+
// (a burn, or a re-fold dropping a placeholder — rare). Diffing against the STORED id list
|
|
529
|
+
// rather than binding the whole new-id list into a big `NOT IN (...)` keeps the delete set to
|
|
530
|
+
// exactly what actually vanished (usually nothing) instead of one parameter per surviving
|
|
531
|
+
// token, which would also risk SQLite's bound-parameter ceiling on a large collection.
|
|
532
|
+
const existingIds = this.db.prepare(`SELECT token_id FROM tokens WHERE project_address = ?`).all(key).map((r) => r.token_id);
|
|
533
|
+
const newIdSet = new Set(state.tokens.map((t) => t.tokenId));
|
|
534
|
+
const removedIds = existingIds.filter((id) => !newIdSet.has(id));
|
|
535
|
+
if (removedIds.length) {
|
|
536
|
+
const delToken = this.db.prepare(`DELETE FROM tokens WHERE project_address = ? AND token_id = ?`);
|
|
537
|
+
for (const id of removedIds)
|
|
538
|
+
delToken.run(key, id);
|
|
539
|
+
}
|
|
540
|
+
const upsertToken = this.db.prepare(`INSERT INTO tokens (project_address, token_id, minted, owner, token_uri, fields, locked_fields, params, supply, max_supply, max_supply_overridden, holders)
|
|
541
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
|
|
542
|
+
ON CONFLICT(project_address, token_id) DO UPDATE SET
|
|
543
|
+
minted=excluded.minted, owner=excluded.owner, token_uri=excluded.token_uri,
|
|
544
|
+
fields=excluded.fields, locked_fields=excluded.locked_fields, params=excluded.params,
|
|
545
|
+
supply=excluded.supply, max_supply=excluded.max_supply,
|
|
546
|
+
max_supply_overridden=excluded.max_supply_overridden, holders=excluded.holders`);
|
|
334
547
|
for (const t of state.tokens) {
|
|
335
|
-
|
|
548
|
+
upsertToken.run(key, t.tokenId, b(t.minted), t.owner, null, // token_uri — always NULL; see the schema comment
|
|
549
|
+
JSON.stringify(t.fields), JSON.stringify(t.lockedFields), t.params?.length ? JSON.stringify(t.params) : null,
|
|
550
|
+
// editions only; absent (undefined) for a 721 token stays NULL, never a fabricated '0'/'{}'.
|
|
551
|
+
t.supply ?? null, t.maxSupply ?? null,
|
|
552
|
+
// `undefined` (a 721 token) stays NULL; only an id with its own MaxSupplyUpdated writes 1.
|
|
553
|
+
t.maxSupplyOverridden === undefined ? null : b(t.maxSupplyOverridden), t.holders && Object.keys(t.holders).length ? JSON.stringify(t.holders) : null);
|
|
336
554
|
}
|
|
555
|
+
// extensions: a handful of rows per project — delete+reinsert stays simple and cheap; not
|
|
556
|
+
// worth an upsert.
|
|
557
|
+
this.db.prepare(`DELETE FROM extensions WHERE project_address = ?`).run(key);
|
|
337
558
|
const insExt = this.db.prepare(`INSERT INTO extensions (project_address, id, name, version) VALUES (?,?,?,?)`);
|
|
338
559
|
for (const e of state.extensions)
|
|
339
560
|
insExt.run(key, e.id, e.name, e.version);
|
|
561
|
+
// events: append-only. `seq` is chain-derived (see {@link eventSeq}), so the SAME event always
|
|
562
|
+
// lands on the SAME row — a re-fold that re-derives the whole log from chain is a no-op here
|
|
563
|
+
// (every insert conflicts and is skipped), not a rewrite of however many thousand rows came
|
|
564
|
+
// before it. The one exception is a FULL replay: it is the documented repair path (a reorg can
|
|
565
|
+
// replace the event at a given (block, logIndex) with different content, and DO NOTHING would
|
|
566
|
+
// preserve the stale row forever), so a full replay purges this project's log first and
|
|
567
|
+
// rebuilds it from the fresh fold — restoring exactly the guarantee `abx index --full` claims.
|
|
568
|
+
if (opts?.fullReplay) {
|
|
569
|
+
this.db.prepare(`DELETE FROM events WHERE project_address = ?`).run(key);
|
|
570
|
+
}
|
|
340
571
|
const insEvent = this.db.prepare(`INSERT INTO events (project_address, seq, name, register, what, block_number, log_index, tx_hash, args)
|
|
341
|
-
VALUES (?,?,?,?,?,?,?,?,?)
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
572
|
+
VALUES (?,?,?,?,?,?,?,?,?)
|
|
573
|
+
ON CONFLICT(project_address, seq) DO NOTHING`);
|
|
574
|
+
for (const ev of state.events) {
|
|
575
|
+
insEvent.run(key, eventSeq(ev), ev.name, ev.register, ev.what, ev.blockNumber, ev.logIndex, ev.txHash, JSON.stringify(ev.args));
|
|
576
|
+
}
|
|
345
577
|
this.db.exec('COMMIT');
|
|
346
578
|
}
|
|
347
579
|
catch (err) {
|
|
@@ -370,8 +602,18 @@ export class SqliteStore {
|
|
|
370
602
|
rmSync(f);
|
|
371
603
|
}
|
|
372
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* Drop one project's projection — `extensions` / `tokens` / `projects` — but deliberately NOT
|
|
607
|
+
* `events`. The event log is append-only and chain-derived (`seq` is `(block << 32) | logIndex`,
|
|
608
|
+
* so a re-fold always lands on the same rows): a re-index after this re-derives the identical
|
|
609
|
+
* event set from chain and re-inserts it as a no-op (`ON CONFLICT DO NOTHING`), so nothing is lost
|
|
610
|
+
* by leaving the rows in place, and `abx demo`'s "drop + replay" proof doesn't depend on the log
|
|
611
|
+
* being gone. `deregister`/forget-the-project-entirely paths delete events explicitly — this
|
|
612
|
+
* helper is for `dropProjection`, which keeps the registration precisely so the next reindex can
|
|
613
|
+
* rebuild from it.
|
|
614
|
+
*/
|
|
373
615
|
deleteProjection(key) {
|
|
374
|
-
for (const table of ['
|
|
616
|
+
for (const table of ['extensions', 'tokens', 'projects']) {
|
|
375
617
|
this.db.prepare(`DELETE FROM ${table} WHERE ${table === 'projects' ? 'address' : 'project_address'} = ?`).run(key);
|
|
376
618
|
}
|
|
377
619
|
}
|
|
@@ -385,9 +627,24 @@ export class SqliteStore {
|
|
|
385
627
|
fields: JSON.parse(t.fields ?? '[]'),
|
|
386
628
|
lockedFields: JSON.parse(t.locked_fields ?? '[]'),
|
|
387
629
|
...(t.params ? { params: JSON.parse(t.params) } : {}),
|
|
630
|
+
// editions only — NULL stays absent (never fabricated as '0'/'{}'), mirroring `params` above.
|
|
631
|
+
...(t.supply !== null && t.supply !== undefined ? { supply: t.supply } : {}),
|
|
632
|
+
...(t.max_supply !== null && t.max_supply !== undefined ? { maxSupply: t.max_supply } : {}),
|
|
633
|
+
...(t.max_supply_overridden !== null && t.max_supply_overridden !== undefined
|
|
634
|
+
? { maxSupplyOverridden: !!t.max_supply_overridden }
|
|
635
|
+
: {}),
|
|
636
|
+
...(t.holders ? { holders: JSON.parse(t.holders) } : {}),
|
|
388
637
|
}));
|
|
389
638
|
const extensions = this.db.prepare(`SELECT * FROM extensions WHERE project_address = ? ORDER BY name`).all(key).map((e) => ({ id: e.id, name: e.name, version: e.version }));
|
|
390
|
-
|
|
639
|
+
// Explicit column list — deliberately excludes `seq`. `seq` can exceed
|
|
640
|
+
// `Number.MAX_SAFE_INTEGER` (see {@link eventSeq}), and this driver throws a RangeError
|
|
641
|
+
// materializing an INTEGER that large as a plain JS number unless the statement opts into
|
|
642
|
+
// `setReadBigInts(true)`. `ORDER BY seq` still sorts correctly with the column left out of the
|
|
643
|
+
// SELECT list — SQLite orders before projecting — and nothing downstream needs the raw value:
|
|
644
|
+
// `SpineEvent` orders itself by `(blockNumber, logIndex)` (see `byOrder` in the SDK), not by seq.
|
|
645
|
+
const events = this.db
|
|
646
|
+
.prepare(`SELECT name, register, what, block_number, log_index, tx_hash, args FROM events WHERE project_address = ? ORDER BY seq`)
|
|
647
|
+
.all(key).map((e) => ({
|
|
391
648
|
name: e.name,
|
|
392
649
|
register: e.register,
|
|
393
650
|
what: e.what,
|
|
@@ -418,6 +675,7 @@ export class SqliteStore {
|
|
|
418
675
|
lockedCollectionFields: JSON.parse(p.locked_collection_fields ?? '[]'),
|
|
419
676
|
contractType: p.contract_type ?? undefined,
|
|
420
677
|
maxInvocations: p.max_invocations ?? null,
|
|
678
|
+
defaultMaxSupply: p.default_max_supply ?? null,
|
|
421
679
|
minter: p.minter ?? null,
|
|
422
680
|
paused: !!p.paused,
|
|
423
681
|
primaryPayee: p.primary_payee ?? null,
|
|
@@ -465,6 +723,19 @@ function rowToArtifact(row) {
|
|
|
465
723
|
inputsHash: row.inputs_hash,
|
|
466
724
|
contentType: row.content_type ?? null,
|
|
467
725
|
locator: row.locator ?? null,
|
|
726
|
+
bytes: row.bytes ?? null,
|
|
727
|
+
updatedAt: row.updated_at,
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
function rowToIndexStatus(row) {
|
|
731
|
+
return {
|
|
732
|
+
address: row.address,
|
|
733
|
+
status: row.status,
|
|
734
|
+
errorClass: row.error_class ?? null,
|
|
735
|
+
errorMessage: row.error_message ?? null,
|
|
736
|
+
attempts: row.attempts ?? 0,
|
|
737
|
+
lastAttemptAt: row.last_attempt_at ?? null,
|
|
738
|
+
lastIndexedAt: row.last_indexed_at ?? null,
|
|
468
739
|
updatedAt: row.updated_at,
|
|
469
740
|
};
|
|
470
741
|
}
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AACtD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA4HlC,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CAAC,YAAY,IAAI,SAAS;QACxC,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,SAAS;QACrC,eAAe,EAAE,CAAC,CAAC,gBAAgB,IAAI,SAAS;QAChD,eAAe,EAAE,CAAC,CAAC,gBAAgB,IAAI,SAAS;QAChD,YAAY,EAAE,CAAC,CAAC,aAAa;KAC9B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artblocks/abx-indexer",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ABX Self-Host Toolkit (Layer 3) — the reference indexer. Replays the event spine from chain into a disposable, rebuildable projection. The canonical re-index.",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"viem": "^2.21.0",
|
|
41
|
-
"@artblocks/abx-sdk": "0.1.0-alpha.
|
|
41
|
+
"@artblocks/abx-sdk": "0.1.0-alpha.19"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc -b tsconfig.build.json"
|