@secondlayer/subgraphs 3.21.0 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.d.ts +238 -17
- package/dist/src/index.js +389 -52
- package/dist/src/index.js.map +12 -11
- package/dist/src/runtime/block-processor.d.ts +111 -10
- package/dist/src/runtime/block-processor.js +263 -31
- package/dist/src/runtime/block-processor.js.map +9 -8
- package/dist/src/runtime/catchup.d.ts +111 -10
- package/dist/src/runtime/catchup.js +263 -31
- package/dist/src/runtime/catchup.js.map +9 -8
- package/dist/src/runtime/context.d.ts +111 -11
- package/dist/src/runtime/context.js +166 -12
- package/dist/src/runtime/context.js.map +7 -6
- package/dist/src/runtime/processor.js +272 -35
- package/dist/src/runtime/processor.js.map +10 -9
- package/dist/src/runtime/reindex.d.ts +111 -10
- package/dist/src/runtime/reindex.js +263 -31
- package/dist/src/runtime/reindex.js.map +9 -8
- package/dist/src/runtime/reorg.d.ts +111 -10
- package/dist/src/runtime/reorg.js +268 -31
- package/dist/src/runtime/reorg.js.map +10 -9
- package/dist/src/runtime/replay.d.ts +3 -3
- package/dist/src/runtime/replay.js +30 -6
- package/dist/src/runtime/replay.js.map +4 -4
- package/dist/src/runtime/runner.d.ts +191 -17
- package/dist/src/runtime/source-matcher.d.ts +68 -8
- package/dist/src/runtime/source-matcher.js +30 -6
- package/dist/src/runtime/source-matcher.js.map +3 -3
- package/dist/src/runtime/stats.d.ts +3 -3
- package/dist/src/schema/index.d.ts +114 -13
- package/dist/src/schema/index.js +133 -20
- package/dist/src/schema/index.js.map +5 -5
- package/dist/src/service.js +272 -35
- package/dist/src/service.js.map +10 -9
- package/dist/src/testing/index.d.ts +667 -0
- package/dist/src/testing/index.js +1463 -0
- package/dist/src/testing/index.js.map +17 -0
- package/dist/src/triggers/index.d.ts +57 -6
- package/dist/src/types.d.ts +112 -11
- package/dist/src/validate.d.ts +129 -11
- package/dist/src/validate.js +117 -18
- package/dist/src/validate.js.map +3 -3
- package/package.json +9 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,91 @@
|
|
|
1
|
-
import { AbiContract } from "@secondlayer/stacks/clarity";
|
|
1
|
+
import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
|
|
2
|
+
import { UnwrapResponse } from "@secondlayer/stacks/actions";
|
|
3
|
+
import { AbiContract, ExtractFunctionArgs, ExtractFunctionOutput, ExtractReadOnlyFunctions, ToCamelCase } from "@secondlayer/stacks/clarity";
|
|
4
|
+
/**
|
|
5
|
+
* How long a read stays valid.
|
|
6
|
+
*
|
|
7
|
+
* - `per-block` (default): pinned to the block being processed, cached under
|
|
8
|
+
* its `index_block_hash`. Sound for any read-only function — reindexing the
|
|
9
|
+
* same block always returns the same value, and a reorg-replaced block has a
|
|
10
|
+
* different id so it can't inherit the orphaned answer.
|
|
11
|
+
* - `contract-constant`: the caller asserts the value cannot change for this
|
|
12
|
+
* contract and these args (SIP-010 `get-decimals`/`get-symbol`), so it is
|
|
13
|
+
* resolved ONCE instead of once per block. This is the mode that makes a
|
|
14
|
+
* backfill affordable — under `per-block` every block is a distinct key and
|
|
15
|
+
* therefore a distinct RPC. Declaring it on a value that does change pins the
|
|
16
|
+
* first answer forever, so it is opt-in and never inferred.
|
|
17
|
+
*/
|
|
18
|
+
type ChainReadCacheMode = "per-block" | "contract-constant";
|
|
19
|
+
type ChainReadOptions = {
|
|
20
|
+
cache?: ChainReadCacheMode
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The chain-read surface, fully typed by an ABI.
|
|
24
|
+
*
|
|
25
|
+
* Shaped like `getContract` from `@secondlayer/stacks` — the same ABI in, the
|
|
26
|
+
* same camelCased read methods out — minus `call`/`buildCall`: a handler
|
|
27
|
+
* indexes the chain, it never writes to it.
|
|
28
|
+
*
|
|
29
|
+
* Reached through {@link readContractAt} rather than off `ctx.client`
|
|
30
|
+
* directly: an ABI-generic method living on the context interface makes every
|
|
31
|
+
* structural comparison of a subgraph definition instantiate it, which exceeds
|
|
32
|
+
* TS's depth budget. At a call site the ABI is already concrete and it costs
|
|
33
|
+
* nothing.
|
|
34
|
+
*/
|
|
35
|
+
interface ChainReadClient {
|
|
36
|
+
/**
|
|
37
|
+
* Read-only methods of a contract, evaluated against the exact block being
|
|
38
|
+
* processed.
|
|
39
|
+
*
|
|
40
|
+
* Every call is pinned to the block's `index_block_hash`, so a handler is a
|
|
41
|
+
* pure function of its block: reindexing a range produces byte-identical
|
|
42
|
+
* rows. Reading at the node's tip instead would make the same reindex
|
|
43
|
+
* return different values — that is the corruption this refuses to allow,
|
|
44
|
+
* so a block whose id was never persisted throws rather than falling back.
|
|
45
|
+
*
|
|
46
|
+
* Results are memoized in Postgres, so a value is fetched once per block
|
|
47
|
+
* rather than once per event (or once per contract with
|
|
48
|
+
* `cache: "contract-constant"`).
|
|
49
|
+
*/
|
|
50
|
+
contract<const C extends AbiContract>(contractId: string, abi: C, options?: ChainReadOptions): {
|
|
51
|
+
read: ChainReadMethods<C>
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The camelCased read methods of an ABI. Spelled out rather than reused from
|
|
56
|
+
* `ContractInstance<C>["read"]`: that type is a conditional over the codegen
|
|
57
|
+
* brand, and evaluating it wherever a subgraph definition is structurally
|
|
58
|
+
* compared pushes TS past its instantiation depth.
|
|
59
|
+
*/
|
|
60
|
+
type ChainReadMethods<C extends AbiContract> = { [N in ExtractReadOnlyFunctions<C> as ToCamelCase<N>] : (args: ExtractFunctionArgs<C, N>) => Promise<UnwrapResponse<ExtractFunctionOutput<C, N>>> };
|
|
61
|
+
/**
|
|
62
|
+
* `ChainReadClient` with the ABI generic erased. Structurally cheap, so the
|
|
63
|
+
* base `SubgraphContext` can carry it; `TypedSubgraphContext` uses the real
|
|
64
|
+
* one and handlers get full inference.
|
|
65
|
+
*/
|
|
66
|
+
interface ErasedChainReadClient {
|
|
67
|
+
contract(contractId: string, abi: unknown, options?: ChainReadOptions): {
|
|
68
|
+
read: Record<string, (args?: Record<string, unknown>) => Promise<unknown>>
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Typed read methods for one contract, from a handler.
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* const token = readContractAt(ctx, contractId, SIP010_ABI, {
|
|
76
|
+
* cache: "contract-constant",
|
|
77
|
+
* });
|
|
78
|
+
* const decimals = await token.read.getDecimals({}); // bigint
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
declare function readContractAt<const C extends AbiContract>(ctx: {
|
|
82
|
+
client: ErasedChainReadClient
|
|
83
|
+
}, contractId: string, abi: C, options?: ChainReadOptions): {
|
|
84
|
+
read: ChainReadMethods<C>
|
|
85
|
+
};
|
|
86
|
+
declare class ChainReadError extends Error {
|
|
87
|
+
name: string;
|
|
88
|
+
}
|
|
2
89
|
/** Supported column types for subgraph schemas */
|
|
3
90
|
type ColumnType = "text" | "uint" | "int" | "principal" | "boolean" | "timestamp" | "jsonb";
|
|
4
91
|
/** Column definition in a subgraph table */
|
|
@@ -25,15 +112,24 @@ interface SubgraphRelation {
|
|
|
25
112
|
/** Target column(s) the fields point at (a uniqueKeys entry on the target). */
|
|
26
113
|
referencedColumns: string[];
|
|
27
114
|
}
|
|
28
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Table definition within a subgraph schema.
|
|
117
|
+
*
|
|
118
|
+
* The array fields are `readonly` so a schema literal can be hoisted out of
|
|
119
|
+
* the `defineSubgraph()` call with `as const` (or {@link defineSchema}) and
|
|
120
|
+
* still typecheck — `as const` produces `readonly [readonly ["holder"]]`,
|
|
121
|
+
* which a mutable `string[][]` rejects. Without that, extracting a helper
|
|
122
|
+
* that takes `ctx` meant losing the entire typed surface, which is why the
|
|
123
|
+
* shipped starter reached for `ctx: any`.
|
|
124
|
+
*/
|
|
29
125
|
interface SubgraphTable {
|
|
30
126
|
columns: Record<string, SubgraphColumn>;
|
|
31
127
|
/** Composite indexes (each entry is an array of column names) */
|
|
32
|
-
indexes?: string[][];
|
|
128
|
+
indexes?: readonly (readonly string[])[];
|
|
33
129
|
/** Unique key constraints (each entry is an array of column names). Required for upsert. */
|
|
34
|
-
uniqueKeys?: string[][];
|
|
130
|
+
uniqueKeys?: readonly (readonly string[])[];
|
|
35
131
|
/** Foreign-key relations to other tables (for typed ORM joins). */
|
|
36
|
-
relations?: SubgraphRelation[];
|
|
132
|
+
relations?: readonly SubgraphRelation[];
|
|
37
133
|
}
|
|
38
134
|
/** Subgraph schema — maps table names to table definitions */
|
|
39
135
|
type SubgraphSchema = Record<string, SubgraphTable>;
|
|
@@ -68,6 +164,45 @@ interface StxLockFilter {
|
|
|
68
164
|
type TraitScope = {
|
|
69
165
|
trait?: string
|
|
70
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Scope a source to a DYNAMIC address set discovered from another source's
|
|
169
|
+
* events, instead of a fixed contract list.
|
|
170
|
+
*
|
|
171
|
+
* The standard shape it unlocks: a router plus pools created after you
|
|
172
|
+
* deploy. `contractId` arrays cover a set you know at authoring time; a
|
|
173
|
+
* factory covers the set that grows. It is deliberately NOT tied to contract
|
|
174
|
+
* deployment — the address can come from any field of any event, so it also
|
|
175
|
+
* covers launchpad-minted tokens, DAO extension allowlists, and registry
|
|
176
|
+
* entries.
|
|
177
|
+
*
|
|
178
|
+
* ```ts
|
|
179
|
+
* sources: {
|
|
180
|
+
* registry: { type: "print_event", contractId: REGISTRY, topic: "pool-created" },
|
|
181
|
+
* swaps: {
|
|
182
|
+
* type: "print_event",
|
|
183
|
+
* topic: "swap",
|
|
184
|
+
* // every pool the registry has ever announced, including new ones
|
|
185
|
+
* factory: { from: "registry", field: "data.pool" },
|
|
186
|
+
* },
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* Two guarantees the runtime provides:
|
|
191
|
+
* - **Same-block ordering** — a contract discovered in block N receives its
|
|
192
|
+
* own block-N events. Discovery runs before matching, within the block.
|
|
193
|
+
* - **Reorg-scoped** — the discovered set is stamped with the block that
|
|
194
|
+
* revealed it and rolled back with everything else on a fork, so an address
|
|
195
|
+
* announced on an orphaned chain does not linger forever.
|
|
196
|
+
*/
|
|
197
|
+
interface FactoryScope {
|
|
198
|
+
factory?: {
|
|
199
|
+
/** Source name whose events reveal the addresses. */
|
|
200
|
+
from: string
|
|
201
|
+
/** Dotted path to the address on that source's payload
|
|
202
|
+
* (e.g. `"data.pool"`, `"contractId"`, `"data.token.id"`). */
|
|
203
|
+
field: string
|
|
204
|
+
};
|
|
205
|
+
}
|
|
71
206
|
/** FT event filters */
|
|
72
207
|
interface FtTransferFilter extends TraitScope {
|
|
73
208
|
type: "ft_transfer";
|
|
@@ -147,9 +282,19 @@ interface ContractCallEvent {
|
|
|
147
282
|
};
|
|
148
283
|
}
|
|
149
284
|
/** Contract event filters */
|
|
150
|
-
interface ContractCallFilter extends TraitScope {
|
|
285
|
+
interface ContractCallFilter extends TraitScope, FactoryScope {
|
|
151
286
|
type: "contract_call";
|
|
152
|
-
|
|
287
|
+
/**
|
|
288
|
+
* One contract id, or a SET of them (max 20) — the standard DeFi shape is
|
|
289
|
+
* a router plus N pools, which used to cost N near-identical sources and
|
|
290
|
+
* handlers, or the `"*"` catch-all that erases per-source typing. Payload
|
|
291
|
+
* types are identical per `type`, so one handler serves the set and
|
|
292
|
+
* `event.contractId` disambiguates.
|
|
293
|
+
*
|
|
294
|
+
* Supports `*` wildcards (e.g. `"SP1ABC….pool-*"`). Mutually exclusive
|
|
295
|
+
* with `trait`, which resolves its own set per block.
|
|
296
|
+
*/
|
|
297
|
+
contractId?: string | readonly string[];
|
|
153
298
|
functionName?: string;
|
|
154
299
|
caller?: string;
|
|
155
300
|
/**
|
|
@@ -158,7 +303,7 @@ interface ContractCallFilter extends TraitScope {
|
|
|
158
303
|
* definition and used at runtime to decode args by name. Omit to keep
|
|
159
304
|
* `event.args` as a positional `unknown[]`.
|
|
160
305
|
*/
|
|
161
|
-
abi?:
|
|
306
|
+
abi?: AbiContract2;
|
|
162
307
|
}
|
|
163
308
|
interface ContractDeployFilter {
|
|
164
309
|
type: "contract_deploy";
|
|
@@ -187,9 +332,11 @@ type PrintField = ColumnType | {
|
|
|
187
332
|
} | {
|
|
188
333
|
list: PrintField
|
|
189
334
|
};
|
|
190
|
-
interface PrintEventFilter extends TraitScope {
|
|
335
|
+
interface PrintEventFilter extends TraitScope, FactoryScope {
|
|
191
336
|
type: "print_event";
|
|
192
|
-
|
|
337
|
+
/** One contract id, or a set of them (max 20). Supports `*` wildcards.
|
|
338
|
+
* Mutually exclusive with `trait`. */
|
|
339
|
+
contractId?: string | readonly string[];
|
|
193
340
|
topic?: string;
|
|
194
341
|
/**
|
|
195
342
|
* Per-topic field schema. When declared, the handler's `event` is a
|
|
@@ -227,8 +374,21 @@ interface SubgraphContext {
|
|
|
227
374
|
hash: string
|
|
228
375
|
timestamp: number
|
|
229
376
|
burnBlockHeight: number
|
|
377
|
+
/** Nakamoto StacksBlockId, when the block row carries one. */
|
|
378
|
+
indexBlockHash?: string | null
|
|
230
379
|
};
|
|
231
380
|
tx: TxMeta;
|
|
381
|
+
/**
|
|
382
|
+
* Read-only contract calls pinned to this block. Cached, so the same
|
|
383
|
+
* (contract, function, args) is fetched once per block rather than once
|
|
384
|
+
* per event.
|
|
385
|
+
*
|
|
386
|
+
* Erased here on purpose: this interface is compared structurally wherever
|
|
387
|
+
* a subgraph definition is passed around, and carrying an ABI-generic
|
|
388
|
+
* method pushes those comparisons past TS's instantiation depth. Handlers
|
|
389
|
+
* receive `TypedSubgraphContext`, which exposes the fully typed version.
|
|
390
|
+
*/
|
|
391
|
+
client: ErasedChainReadClient;
|
|
232
392
|
insert(table: string, row: Record<string, unknown>): void;
|
|
233
393
|
update(table: string, where: Record<string, unknown>, set: Record<string, unknown>): void;
|
|
234
394
|
upsert(table: string, key: Record<string, unknown>, row: Record<string, unknown>): void;
|
|
@@ -285,6 +445,16 @@ interface SubgraphDefinition {
|
|
|
285
445
|
* Validates a subgraph definition, returning the parsed result or throwing on failure.
|
|
286
446
|
*/
|
|
287
447
|
declare function validateSubgraphDefinition(def: unknown): SubgraphDefinition;
|
|
448
|
+
/**
|
|
449
|
+
* Per-source-type field vocabulary, DERIVED from
|
|
450
|
+
* {@link SubgraphFilterSchema}. Agent-facing surfaces (the MCP filters
|
|
451
|
+
* reference) used to hand-maintain a parallel copy of this list; deriving it
|
|
452
|
+
* means adding a field to a filter can never leave the documentation behind.
|
|
453
|
+
*/
|
|
454
|
+
declare function filterFieldsByType(): Array<{
|
|
455
|
+
type: string
|
|
456
|
+
fields: string[]
|
|
457
|
+
}>;
|
|
288
458
|
interface ReindexOptions {
|
|
289
459
|
fromBlock?: number;
|
|
290
460
|
toBlock?: number;
|
|
@@ -327,7 +497,7 @@ declare function backfillSubgraph(def: SubgraphDefinition, opts: {
|
|
|
327
497
|
}): Promise<{
|
|
328
498
|
processed: number
|
|
329
499
|
}>;
|
|
330
|
-
import { AbiContract as
|
|
500
|
+
import { AbiContract as AbiContract3, ExtractFunctionArgs as ExtractFunctionArgs2, ExtractFunctionNames } from "@secondlayer/stacks/clarity";
|
|
331
501
|
/** Maps a ColumnType string literal to its TypeScript equivalent */
|
|
332
502
|
type ColumnToTS<T extends string> = T extends "uint" | "int" ? bigint : T extends "text" | "principal" | "timestamp" ? string : T extends "boolean" ? boolean : T extends "jsonb" ? Record<string, unknown> : unknown;
|
|
333
503
|
/** Infer TS type for a single column definition, respecting nullable */
|
|
@@ -504,8 +674,17 @@ interface TypedSubgraphContext<S extends SubgraphSchema> {
|
|
|
504
674
|
hash: string
|
|
505
675
|
timestamp: number
|
|
506
676
|
burnBlockHeight: number
|
|
677
|
+
/** Nakamoto StacksBlockId, when the block row carries one. */
|
|
678
|
+
indexBlockHash?: string | null
|
|
507
679
|
};
|
|
508
680
|
tx: TxMeta;
|
|
681
|
+
/**
|
|
682
|
+
* Read-only contract calls pinned to this block. Erased here for the same
|
|
683
|
+
* reason as on `SubgraphContext`: an ABI-generic method on a structurally
|
|
684
|
+
* compared interface exceeds TS's instantiation budget. Wrap it with
|
|
685
|
+
* `readContractAt(ctx, id, abi)` for full ABI typing at the call site.
|
|
686
|
+
*/
|
|
687
|
+
client: ErasedChainReadClient;
|
|
509
688
|
insert<T extends TableName<S>>(table: T, row: WriteRow<S[T]>): void;
|
|
510
689
|
update<T extends TableName<S>>(table: T, where: RowWhere<S, T>, set: Partial<WriteRow<S[T]>>): void;
|
|
511
690
|
upsert<
|
|
@@ -620,10 +799,10 @@ interface ContractDeployPayload {
|
|
|
620
799
|
* present for back-compat. Without an `abi`, the payload is {@link ContractCallEvent}.
|
|
621
800
|
*/
|
|
622
801
|
type ContractCallPayload<F> = F extends {
|
|
623
|
-
abi: infer A extends
|
|
802
|
+
abi: infer A extends AbiContract3
|
|
624
803
|
functionName: infer N extends string
|
|
625
804
|
} ? N extends ExtractFunctionNames<A> ? ContractCallEvent & {
|
|
626
|
-
input:
|
|
805
|
+
input: ExtractFunctionArgs2<A, N>
|
|
627
806
|
} : ContractCallEvent : ContractCallEvent;
|
|
628
807
|
/**
|
|
629
808
|
* Print event typed per topic. When a `print_event` source declares a `prints`
|
|
@@ -737,6 +916,48 @@ declare function defineSubgraph<
|
|
|
737
916
|
const Sources extends Record<string, SubgraphFilter>,
|
|
738
917
|
const S extends SubgraphSchema
|
|
739
918
|
>(def: TypedSubgraphDefinition<Sources, S>): TypedSubgraphDefinition<Sources, S>;
|
|
919
|
+
/**
|
|
920
|
+
* Identity helper that preserves a schema literal's exact types so it can be
|
|
921
|
+
* HOISTED out of the `defineSubgraph()` call and reused:
|
|
922
|
+
*
|
|
923
|
+
* ```ts
|
|
924
|
+
* const schema = defineSchema({
|
|
925
|
+
* balances: {
|
|
926
|
+
* columns: { holder: { type: "principal" }, amount: { type: "uint" } },
|
|
927
|
+
* uniqueKeys: [["holder"]],
|
|
928
|
+
* },
|
|
929
|
+
* });
|
|
930
|
+
*
|
|
931
|
+
* // An extracted helper keeps the full typed surface — table names and row
|
|
932
|
+
* // columns are still checked:
|
|
933
|
+
* function credit(ctx: TypedSubgraphContext<typeof schema>, holder: string) {
|
|
934
|
+
* ctx.increment("balances", { holder }, { amount: 1n });
|
|
935
|
+
* }
|
|
936
|
+
*
|
|
937
|
+
* defineSubgraph({ name: "balances", schema, sources, handlers });
|
|
938
|
+
* ```
|
|
939
|
+
*
|
|
940
|
+
* `as const` alone does not work here (it produces `readonly` arrays that a
|
|
941
|
+
* mutable `uniqueKeys` rejected) and a bare literal widens `type` to `string`.
|
|
942
|
+
* That gap is why the shipped starter typed its helper `ctx: any` — and in
|
|
943
|
+
* doing so modelled a non-commutative read-modify-write the docs warn against.
|
|
944
|
+
*/
|
|
945
|
+
declare function defineSchema<const S extends SubgraphSchema>(schema: S): S;
|
|
946
|
+
/**
|
|
947
|
+
* The typed handler context for a subgraph definition — for annotating
|
|
948
|
+
* helpers extracted out of a handler:
|
|
949
|
+
*
|
|
950
|
+
* ```ts
|
|
951
|
+
* const def = defineSubgraph({ … });
|
|
952
|
+
* function credit(ctx: InferContext<typeof def>) { … }
|
|
953
|
+
* ```
|
|
954
|
+
*
|
|
955
|
+
* Prefer `TypedSubgraphContext<typeof schema>` when the schema is hoisted;
|
|
956
|
+
* this is the form for when only the definition is in scope.
|
|
957
|
+
*/
|
|
958
|
+
type InferContext<D> = D extends {
|
|
959
|
+
schema: infer S extends SubgraphSchema
|
|
960
|
+
} ? TypedSubgraphContext<S> : never;
|
|
740
961
|
type PrintValidationResult = {
|
|
741
962
|
ok: true
|
|
742
963
|
} | {
|
|
@@ -851,10 +1072,10 @@ declare function generateIndexSchema(target: IndexCodegenTarget, opts?: IndexCod
|
|
|
851
1072
|
/** Index tables available to codegen, for help text and validation. */
|
|
852
1073
|
declare const INDEX_CODEGEN_TABLES: readonly string[];
|
|
853
1074
|
import { pgSchemaName } from "@secondlayer/shared/db/queries/subgraphs";
|
|
854
|
-
import { Database } from "@secondlayer/shared/db";
|
|
1075
|
+
import { Database as Database2 } from "@secondlayer/shared/db";
|
|
855
1076
|
import { ByoBreakingChangeDetails } from "@secondlayer/shared/errors";
|
|
856
|
-
import { Kysely } from "kysely";
|
|
857
|
-
type AnyDb =
|
|
1077
|
+
import { Kysely as Kysely2 } from "kysely";
|
|
1078
|
+
type AnyDb = Kysely2<Database2>;
|
|
858
1079
|
interface TableDiff {
|
|
859
1080
|
/** Tables added to the schema */
|
|
860
1081
|
addedTables: string[];
|
|
@@ -988,4 +1209,4 @@ type SparseProbeTarget = {
|
|
|
988
1209
|
declare function canSparseScan(subgraph: SubgraphDefinition): boolean;
|
|
989
1210
|
/** Probe targets for a subgraph's filters: decoded type + contract scope when\\n* the filter pins one (assetIdentifier "SP….contract::asset" or contractId). */
|
|
990
1211
|
declare function sparseProbeTargets(subgraph: SubgraphDefinition): SparseProbeTarget[];
|
|
991
|
-
export { validateSubgraphDefinition, validatePrintPayload, sparseProbeTargets, resumeReindex, renderDeployPlan, reindexSubgraph, pgSchemaName, inferPrintTopics, hasBreakingChanges, generateSubgraphSQL, generatePrismaSchema, generateKyselySchema, generateIndexSchema, generateDrizzleSchema, diffSchema, deploySchema, defineSubgraph, canSparseScan, camelizeDataKey, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubscribeOptions, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, SparseProbeTarget, RowValue, ReindexOptions, PrismaGenOptions, PrintValidationResult, PrintSample, PrintFieldToTS, PrintField, PrintEventPayload, PrintEventFor, PrintEventFilter, PrintDataOf, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, KyselyGenOptions, InferredTopicSchema, InferredPrintField, InferTableRow, InferSubgraphClient, InferColumnType, IndexCodegenTarget, IndexCodegenOptions, INDEX_CODEGEN_TABLES, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, EventForFilter, DrizzleGenOptions, DeployPlan, DeployDiff, ContractDeployPayload, ContractDeployFilter, ContractCallPayload, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, ByoMigrationPlan, ByoBreakingChangeError, AnyEvent, AggregateSpec, AggregateResult };
|
|
1212
|
+
export { validateSubgraphDefinition, validatePrintPayload, sparseProbeTargets, resumeReindex, renderDeployPlan, reindexSubgraph, readContractAt, pgSchemaName, inferPrintTopics, hasBreakingChanges, generateSubgraphSQL, generatePrismaSchema, generateKyselySchema, generateIndexSchema, generateDrizzleSchema, filterFieldsByType, diffSchema, deploySchema, defineSubgraph, defineSchema, canSparseScan, camelizeDataKey, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubscribeOptions, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, SparseProbeTarget, RowValue, ReindexOptions, PrismaGenOptions, PrintValidationResult, PrintSample, PrintFieldToTS, PrintField, PrintEventPayload, PrintEventFor, PrintEventFilter, PrintDataOf, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, KyselyGenOptions, InferredTopicSchema, InferredPrintField, InferTableRow, InferSubgraphClient, InferContext, InferColumnType, IndexCodegenTarget, IndexCodegenOptions, INDEX_CODEGEN_TABLES, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, FactoryScope, EventForFilter, ErasedChainReadClient, DrizzleGenOptions, DeployPlan, DeployDiff, ContractDeployPayload, ContractDeployFilter, ContractCallPayload, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, ChainReadOptions, ChainReadMethods, ChainReadError, ChainReadClient, ChainReadCacheMode, ByoMigrationPlan, ByoBreakingChangeError, AnyEvent, AggregateSpec, AggregateResult };
|