@secondlayer/subgraphs 4.4.1 → 5.0.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.
Files changed (64) hide show
  1. package/README.md +13 -21
  2. package/dist/{src/index.d.ts → index.d.ts} +59 -189
  3. package/dist/index.js +2151 -0
  4. package/dist/index.js.map +24 -0
  5. package/dist/{src/runtime → runtime}/emitter.d.ts +1 -1
  6. package/dist/{src/runtime → runtime}/emitter.js +8 -12
  7. package/dist/{src/runtime → runtime}/emitter.js.map +3 -3
  8. package/dist/{src/runtime → runtime}/replay.d.ts +1 -1
  9. package/dist/{src/runtime → runtime}/replay.js +342 -683
  10. package/dist/{src/runtime → runtime}/replay.js.map +5 -5
  11. package/dist/{src/schema → schema}/index.d.ts +10 -69
  12. package/dist/{src/schema → schema}/index.js +188 -281
  13. package/dist/schema/index.js.map +13 -0
  14. package/dist/{src/testing → testing}/index.d.ts +65 -115
  15. package/dist/{src/testing → testing}/index.js +554 -968
  16. package/dist/testing/index.js.map +21 -0
  17. package/dist/{src/types.d.ts → types.d.ts} +10 -66
  18. package/dist/{src/validate.d.ts → validate.d.ts} +11 -69
  19. package/dist/{src/validate.js → validate.js} +18 -98
  20. package/dist/validate.js.map +10 -0
  21. package/package.json +18 -26
  22. package/dist/src/index.js +0 -6081
  23. package/dist/src/index.js.map +0 -44
  24. package/dist/src/runtime/block-processor.d.ts +0 -559
  25. package/dist/src/runtime/block-processor.js +0 -3810
  26. package/dist/src/runtime/block-processor.js.map +0 -31
  27. package/dist/src/runtime/catchup.d.ts +0 -473
  28. package/dist/src/runtime/catchup.js +0 -4228
  29. package/dist/src/runtime/catchup.js.map +0 -35
  30. package/dist/src/runtime/clarity.d.ts +0 -15
  31. package/dist/src/runtime/clarity.js +0 -41
  32. package/dist/src/runtime/clarity.js.map +0 -10
  33. package/dist/src/runtime/context.d.ts +0 -325
  34. package/dist/src/runtime/context.js +0 -936
  35. package/dist/src/runtime/context.js.map +0 -13
  36. package/dist/src/runtime/processor.d.ts +0 -11
  37. package/dist/src/runtime/processor.js +0 -5372
  38. package/dist/src/runtime/processor.js.map +0 -40
  39. package/dist/src/runtime/reindex.d.ts +0 -539
  40. package/dist/src/runtime/reindex.js +0 -4802
  41. package/dist/src/runtime/reindex.js.map +0 -37
  42. package/dist/src/runtime/reorg.d.ts +0 -432
  43. package/dist/src/runtime/reorg.js +0 -4355
  44. package/dist/src/runtime/reorg.js.map +0 -36
  45. package/dist/src/runtime/runner.d.ts +0 -719
  46. package/dist/src/runtime/runner.js +0 -1332
  47. package/dist/src/runtime/runner.js.map +0 -16
  48. package/dist/src/runtime/source-matcher.d.ts +0 -304
  49. package/dist/src/runtime/source-matcher.js +0 -335
  50. package/dist/src/runtime/source-matcher.js.map +0 -10
  51. package/dist/src/runtime/stats.d.ts +0 -23
  52. package/dist/src/runtime/stats.js +0 -71
  53. package/dist/src/runtime/stats.js.map +0 -10
  54. package/dist/src/schema/index.js.map +0 -13
  55. package/dist/src/service.d.ts +0 -0
  56. package/dist/src/service.js +0 -5398
  57. package/dist/src/service.js.map +0 -41
  58. package/dist/src/testing/index.js.map +0 -22
  59. package/dist/src/triggers/index.d.ts +0 -381
  60. package/dist/src/triggers/index.js +0 -31
  61. package/dist/src/triggers/index.js.map +0 -10
  62. package/dist/src/validate.js.map +0 -10
  63. /package/dist/{src/types.js → types.js} +0 -0
  64. /package/dist/{src/types.js.map → types.js.map} +0 -0
@@ -1,381 +0,0 @@
1
- import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
2
- import { AssetIdentifier } from "@secondlayer/stacks/filters";
3
- /** Supported column types for subgraph schemas */
4
- type ColumnType = "text" | "uint" | "int" | "principal" | "boolean" | "timestamp" | "jsonb";
5
- /** STX event filters */
6
- interface StxTransferFilter {
7
- type: "stx_transfer";
8
- sender?: string;
9
- recipient?: string;
10
- minAmount?: bigint;
11
- maxAmount?: bigint;
12
- }
13
- interface StxMintFilter {
14
- type: "stx_mint";
15
- recipient?: string;
16
- minAmount?: bigint;
17
- }
18
- interface StxBurnFilter {
19
- type: "stx_burn";
20
- sender?: string;
21
- minAmount?: bigint;
22
- }
23
- interface StxLockFilter {
24
- type: "stx_lock";
25
- lockedAddress?: string;
26
- minAmount?: bigint;
27
- }
28
- /**
29
- * Restrict a source to contracts conforming to a trait/standard (e.g. "sip-010")
30
- * instead of a fixed contract — resolved from the contract registry at match time,
31
- * as-of each processed block. Lets a source index "all SIP-010 tokens" etc.
32
- */
33
- type TraitScope = {
34
- trait?: string
35
- };
36
- /**
37
- * Scope a source to a DYNAMIC address set discovered from another source's
38
- * events, instead of a fixed contract list.
39
- *
40
- * The standard shape it unlocks: a router plus pools created after you
41
- * deploy. `contractId` arrays cover a set you know at authoring time; a
42
- * factory covers the set that grows. It is deliberately NOT tied to contract
43
- * deployment — the address can come from any field of any event, so it also
44
- * covers launchpad-minted tokens, DAO extension allowlists, and registry
45
- * entries.
46
- *
47
- * ```ts
48
- * sources: {
49
- * registry: {
50
- * type: "print_event",
51
- * contractId: REGISTRY,
52
- * topic: "pool-created",
53
- * prints: { "pool-created": { pool: "principal" } },
54
- * },
55
- * swaps: {
56
- * type: "print_event",
57
- * topic: "swap",
58
- * // every pool the registry has ever announced, including new ones
59
- * factory: { from: "registry", field: "data.pool" },
60
- * },
61
- * }
62
- * ```
63
- *
64
- * Two guarantees the runtime provides:
65
- * - **Same-block ordering** — a contract discovered in block N receives its
66
- * own block-N events. Discovery runs before matching, within the block.
67
- * - **Reorg-scoped** — the discovered set is stamped with the block that
68
- * revealed it and rolled back with everything else on a fork, so an address
69
- * announced on an orphaned chain does not linger forever.
70
- */
71
- interface FactoryScope {
72
- factory?: {
73
- /** Source name whose events reveal the addresses. */
74
- from: string
75
- /** Dotted path to the address on that source's payload
76
- * (e.g. `"data.pool"`, `"contractId"`, `"data.token.id"`). */
77
- field: string
78
- };
79
- }
80
- /** FT event filters */
81
- interface FtTransferFilter extends TraitScope {
82
- type: "ft_transfer";
83
- assetIdentifier?: AssetIdentifier;
84
- sender?: string;
85
- recipient?: string;
86
- minAmount?: bigint;
87
- }
88
- interface FtMintFilter extends TraitScope {
89
- type: "ft_mint";
90
- assetIdentifier?: AssetIdentifier;
91
- recipient?: string;
92
- minAmount?: bigint;
93
- }
94
- interface FtBurnFilter extends TraitScope {
95
- type: "ft_burn";
96
- assetIdentifier?: AssetIdentifier;
97
- sender?: string;
98
- minAmount?: bigint;
99
- }
100
- /** NFT event filters */
101
- interface NftTransferFilter extends TraitScope {
102
- type: "nft_transfer";
103
- assetIdentifier?: AssetIdentifier;
104
- sender?: string;
105
- recipient?: string;
106
- }
107
- interface NftMintFilter extends TraitScope {
108
- type: "nft_mint";
109
- assetIdentifier?: AssetIdentifier;
110
- recipient?: string;
111
- }
112
- interface NftBurnFilter extends TraitScope {
113
- type: "nft_burn";
114
- assetIdentifier?: AssetIdentifier;
115
- sender?: string;
116
- }
117
- /** Contract event filters */
118
- interface ContractCallFilter extends TraitScope, FactoryScope {
119
- type: "contract_call";
120
- /**
121
- * One contract id, or a SET of them (max 20) — the standard DeFi shape is
122
- * a router plus N pools, which used to cost N near-identical sources and
123
- * handlers, or the `"*"` catch-all that erases per-source typing. Payload
124
- * types are identical per `type`, so one handler serves the set and
125
- * `event.contractId` disambiguates.
126
- *
127
- * Supports `*` wildcards (e.g. `"SP1ABC….pool-*"`). Mutually exclusive
128
- * with `trait`, which resolves its own set per block.
129
- */
130
- contractId?: string | readonly string[];
131
- functionName?: string;
132
- caller?: string;
133
- /**
134
- * Contract ABI (pass it `as const`) used to type `event.input` — the named,
135
- * decoded function arguments. Dev-provided; serialized into the deployed
136
- * definition and used at runtime to decode args by name. Omit to keep
137
- * `event.args` as a positional `unknown[]`.
138
- *
139
- * Deploy validation requires `abi` whenever `functionName` is set
140
- * (`normalizeAbi()` from `@secondlayer/stacks/clarity`).
141
- */
142
- abi?: AbiContract2;
143
- }
144
- interface ContractDeployFilter {
145
- type: "contract_deploy";
146
- deployer?: string;
147
- contractName?: string;
148
- }
149
- interface NestedContractCallFilter extends TraitScope, FactoryScope {
150
- type: "nested_contract_call";
151
- contractId?: string | readonly string[];
152
- functionName?: string;
153
- caller?: string;
154
- sender?: string;
155
- }
156
- interface VarSetFilter extends TraitScope, FactoryScope {
157
- type: "var_set";
158
- contractId?: string | readonly string[];
159
- varName?: string;
160
- }
161
- interface MapWriteFilter extends TraitScope, FactoryScope {
162
- type: "map_set" | "map_insert" | "map_delete";
163
- contractId?: string | readonly string[];
164
- map?: string;
165
- }
166
- /**
167
- * One declared field of a print payload.
168
- *
169
- * A bare {@link ColumnType} is a required scalar (`amount: "uint"`). The
170
- * composite forms exist because real print payloads are not flat: BNS-V2
171
- * emits `name` as a NESTED tuple, and a `prints` vocabulary that could only
172
- * say `"jsonb"` is why a handler reading flat `data.name` type-checked,
173
- * deployed, and then decoded to null on every event.
174
- *
175
- * - `{ type: F, optional: true }` — the KEY becomes optional on `event.data`
176
- * (mirrors `always_present: false` in the inferred schema).
177
- * - `{ tuple: { … } }` — a nested tuple, typed all the way down.
178
- * - `{ list: F }` — a list of `F`.
179
- */
180
- type PrintField = ColumnType | {
181
- type: PrintField
182
- optional: true
183
- } | {
184
- tuple: Record<string, PrintField>
185
- } | {
186
- list: PrintField
187
- };
188
- /**
189
- * Per-topic field schema for a print_event source. When declared, the handler's
190
- * `event` is a discriminated union keyed by `topic` and `event.data` is typed
191
- * per topic. Nested tuples, lists, and optional fields — see {@link PrintField}.
192
- *
193
- * Also opts the source into RUNTIME validation: a payload that does not match
194
- * is skipped and logged rather than written as nulls.
195
- */
196
- type PrintEventPrints = Record<string, Record<string, PrintField>>;
197
- /**
198
- * One column in a static identity map. Literals only — the bundler never
199
- * executes user code, so `{ from: "tokenX" }` is valid and `from("tokenX")`
200
- * is not.
201
- */
202
- type MaterializeColumn = {
203
- from: string
204
- } | {
205
- fromTx: "sender" | "txId"
206
- } | {
207
- fromBlock: "height" | "hash" | "timestamp"
208
- };
209
- /** Static insert from a source event — replaces a 1:1 handler. */
210
- interface MaterializeSpec {
211
- table: string;
212
- /** Keys = schema column names (snake). */
213
- columns: Record<string, MaterializeColumn>;
214
- }
215
- type PrintEventFields = FactoryScope & {
216
- type: "print_event"
217
- topic?: string
218
- /** Identity map: insert without a handler function. XOR with handlers[name]. */
219
- materialize?: MaterializeSpec
220
- };
221
- /**
222
- * Pinned to one or more contract ids with no trait — `prints` is required so
223
- * `event.data` is typed and empty-table handlers cannot typecheck.
224
- */
225
- type PinnedPrintEventFilter = PrintEventFields & {
226
- contractId: string | readonly string[]
227
- trait?: undefined
228
- prints: PrintEventPrints
229
- };
230
- /**
231
- * Trait-scoped print source (optionally narrowed by contractId). No single
232
- * schema — `prints` stays optional.
233
- */
234
- type TraitPrintEventFilter = PrintEventFields & {
235
- contractId?: string | readonly string[]
236
- trait: string
237
- prints?: PrintEventPrints
238
- };
239
- /**
240
- * Unpinned / factory-only print source (no contractId). `prints` optional.
241
- */
242
- type UnpinnedPrintEventFilter = PrintEventFields & {
243
- contractId?: undefined
244
- trait?: string
245
- prints?: PrintEventPrints
246
- };
247
- /**
248
- * Print-event filter. Pinned sources (contractId set, no trait) require
249
- * `prints`; trait and unpinned sources may omit it.
250
- */
251
- type PrintEventFilter = PinnedPrintEventFilter | TraitPrintEventFilter | UnpinnedPrintEventFilter;
252
- /** All subgraph filter types — discriminated on `type` */
253
- type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter | NestedContractCallFilter | VarSetFilter | MapWriteFilter;
254
- interface EventTrigger {
255
- type: "event";
256
- filter: SubgraphFilter;
257
- }
258
- /** Metadata shared by every event. */
259
- interface TxMeta2 {
260
- txId: string;
261
- sender: string;
262
- blockHeight: number;
263
- blockTime: number;
264
- }
265
- interface StxTransferEvent {
266
- sender: string;
267
- recipient: string;
268
- amount: bigint;
269
- memo: string | null;
270
- tx: TxMeta2;
271
- }
272
- interface StxMintEvent {
273
- recipient: string;
274
- amount: bigint;
275
- tx: TxMeta2;
276
- }
277
- interface StxBurnEvent {
278
- sender: string;
279
- amount: bigint;
280
- tx: TxMeta2;
281
- }
282
- interface StxLockEvent {
283
- lockedAddress: string;
284
- amount: bigint;
285
- unlockHeight: number;
286
- tx: TxMeta2;
287
- }
288
- interface FtTransferEvent {
289
- assetIdentifier: string;
290
- sender: string;
291
- recipient: string;
292
- amount: bigint;
293
- tx: TxMeta2;
294
- }
295
- interface FtMintEvent {
296
- assetIdentifier: string;
297
- recipient: string;
298
- amount: bigint;
299
- tx: TxMeta2;
300
- }
301
- interface FtBurnEvent {
302
- assetIdentifier: string;
303
- sender: string;
304
- amount: bigint;
305
- tx: TxMeta2;
306
- }
307
- interface NftTransferEvent {
308
- assetIdentifier: string;
309
- sender: string;
310
- recipient: string;
311
- tokenId: string;
312
- tx: TxMeta2;
313
- }
314
- interface NftMintEvent {
315
- assetIdentifier: string;
316
- recipient: string;
317
- tokenId: string;
318
- tx: TxMeta2;
319
- }
320
- interface NftBurnEvent {
321
- assetIdentifier: string;
322
- sender: string;
323
- tokenId: string;
324
- tx: TxMeta2;
325
- }
326
- interface ContractCallEvent2 {
327
- contractId: string;
328
- functionName: string;
329
- args: unknown[];
330
- caller: string;
331
- tx: TxMeta2;
332
- }
333
- interface ContractDeployEvent {
334
- contractId: string;
335
- deployer: string;
336
- contractName: string;
337
- tx: TxMeta2;
338
- }
339
- interface PrintEventEvent {
340
- contractId: string;
341
- topic: string | null;
342
- value: unknown;
343
- tx: TxMeta2;
344
- }
345
- /**
346
- * Phantom-typed EventTrigger. Runtime shape is identical to `EventTrigger`;
347
- * the `__event` field only exists at the type level, letting webhook
348
- * definitions infer the handler's `event` parameter from the filter.
349
- */
350
- type TypedEventTrigger<TEvent> = EventTrigger & {
351
- readonly __event?: TEvent
352
- };
353
- interface TriggerHelpers {
354
- stxTransfer: (f?: Omit<StxTransferFilter, "type">) => TypedEventTrigger<StxTransferEvent>;
355
- stxMint: (f?: Omit<StxMintFilter, "type">) => TypedEventTrigger<StxMintEvent>;
356
- stxBurn: (f?: Omit<StxBurnFilter, "type">) => TypedEventTrigger<StxBurnEvent>;
357
- stxLock: (f?: Omit<StxLockFilter, "type">) => TypedEventTrigger<StxLockEvent>;
358
- ftTransfer: (f?: Omit<FtTransferFilter, "type">) => TypedEventTrigger<FtTransferEvent>;
359
- ftMint: (f?: Omit<FtMintFilter, "type">) => TypedEventTrigger<FtMintEvent>;
360
- ftBurn: (f?: Omit<FtBurnFilter, "type">) => TypedEventTrigger<FtBurnEvent>;
361
- nftTransfer: (f?: Omit<NftTransferFilter, "type">) => TypedEventTrigger<NftTransferEvent>;
362
- nftMint: (f?: Omit<NftMintFilter, "type">) => TypedEventTrigger<NftMintEvent>;
363
- nftBurn: (f?: Omit<NftBurnFilter, "type">) => TypedEventTrigger<NftBurnEvent>;
364
- contractCall: (f?: Omit<ContractCallFilter, "type">) => TypedEventTrigger<ContractCallEvent2>;
365
- contractDeploy: (f?: Omit<ContractDeployFilter, "type">) => TypedEventTrigger<ContractDeployEvent>;
366
- /** Webhook triggers are not subgraph deploys — prints not required. */
367
- printEvent: (f?: {
368
- contractId?: string | readonly string[]
369
- topic?: string
370
- trait?: string
371
- factory?: {
372
- from: string
373
- field: string
374
- }
375
- prints?: PrintEventPrints
376
- }) => TypedEventTrigger<PrintEventEvent>;
377
- }
378
- declare const on: TriggerHelpers;
379
- /** Extract the event payload type from a trigger. */
380
- type EventOf<T> = T extends TypedEventTrigger<infer E> ? E : never;
381
- export { on, TypedEventTrigger, TxMeta2 as TxMeta, TriggerHelpers, StxTransferEvent, StxMintEvent, StxLockEvent, StxBurnEvent, PrintEventEvent, NftTransferEvent, NftMintEvent, NftBurnEvent, FtTransferEvent, FtMintEvent, FtBurnEvent, EventOf, ContractDeployEvent, ContractCallEvent2 as ContractCallEvent };
@@ -1,31 +0,0 @@
1
- import { createRequire } from "node:module";
2
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
-
4
- // src/triggers/index.ts
5
- function make(filter) {
6
- return { type: "event", filter };
7
- }
8
- var on = {
9
- stxTransfer: (f = {}) => make({ type: "stx_transfer", ...f }),
10
- stxMint: (f = {}) => make({ type: "stx_mint", ...f }),
11
- stxBurn: (f = {}) => make({ type: "stx_burn", ...f }),
12
- stxLock: (f = {}) => make({ type: "stx_lock", ...f }),
13
- ftTransfer: (f = {}) => make({ type: "ft_transfer", ...f }),
14
- ftMint: (f = {}) => make({ type: "ft_mint", ...f }),
15
- ftBurn: (f = {}) => make({ type: "ft_burn", ...f }),
16
- nftTransfer: (f = {}) => make({ type: "nft_transfer", ...f }),
17
- nftMint: (f = {}) => make({ type: "nft_mint", ...f }),
18
- nftBurn: (f = {}) => make({ type: "nft_burn", ...f }),
19
- contractCall: (f = {}) => make({ type: "contract_call", ...f }),
20
- contractDeploy: (f = {}) => make({ type: "contract_deploy", ...f }),
21
- printEvent: (f = {}) => make({
22
- type: "print_event",
23
- ...f
24
- })
25
- };
26
- export {
27
- on
28
- };
29
-
30
- //# debugId=E8A9BFB4916AE4AF64756E2164756E21
31
- //# sourceMappingURL=index.js.map
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/triggers/index.ts"],
4
- "sourcesContent": [
5
- "/**\n * Typed event-trigger helpers. Each helper returns a standard `EventTrigger`\n * plus a phantom `__event` type used for inference at consumer sites. The\n * phantom carries no runtime value.\n */\n\nimport type {\n\tContractCallFilter,\n\tContractDeployFilter,\n\tFtBurnFilter,\n\tFtMintFilter,\n\tFtTransferFilter,\n\tNftBurnFilter,\n\tNftMintFilter,\n\tNftTransferFilter,\n\tPrintEventFilter,\n\tPrintEventPrints,\n\tStxBurnFilter,\n\tStxLockFilter,\n\tStxMintFilter,\n\tStxTransferFilter,\n} from \"../types.ts\";\nimport type { EventTrigger } from \"./types.ts\";\n\n// --- Per-filter event payload shapes ---\n\n/** Metadata shared by every event. */\nexport interface TxMeta {\n\ttxId: string;\n\tsender: string;\n\tblockHeight: number;\n\tblockTime: number;\n}\n\nexport interface StxTransferEvent {\n\tsender: string;\n\trecipient: string;\n\tamount: bigint;\n\tmemo: string | null;\n\ttx: TxMeta;\n}\n\nexport interface StxMintEvent {\n\trecipient: string;\n\tamount: bigint;\n\ttx: TxMeta;\n}\n\nexport interface StxBurnEvent {\n\tsender: string;\n\tamount: bigint;\n\ttx: TxMeta;\n}\n\nexport interface StxLockEvent {\n\tlockedAddress: string;\n\tamount: bigint;\n\tunlockHeight: number;\n\ttx: TxMeta;\n}\n\nexport interface FtTransferEvent {\n\tassetIdentifier: string;\n\tsender: string;\n\trecipient: string;\n\tamount: bigint;\n\ttx: TxMeta;\n}\n\nexport interface FtMintEvent {\n\tassetIdentifier: string;\n\trecipient: string;\n\tamount: bigint;\n\ttx: TxMeta;\n}\n\nexport interface FtBurnEvent {\n\tassetIdentifier: string;\n\tsender: string;\n\tamount: bigint;\n\ttx: TxMeta;\n}\n\nexport interface NftTransferEvent {\n\tassetIdentifier: string;\n\tsender: string;\n\trecipient: string;\n\ttokenId: string;\n\ttx: TxMeta;\n}\n\nexport interface NftMintEvent {\n\tassetIdentifier: string;\n\trecipient: string;\n\ttokenId: string;\n\ttx: TxMeta;\n}\n\nexport interface NftBurnEvent {\n\tassetIdentifier: string;\n\tsender: string;\n\ttokenId: string;\n\ttx: TxMeta;\n}\n\nexport interface ContractCallEvent {\n\tcontractId: string;\n\tfunctionName: string;\n\targs: unknown[];\n\tcaller: string;\n\ttx: TxMeta;\n}\n\nexport interface ContractDeployEvent {\n\tcontractId: string;\n\tdeployer: string;\n\tcontractName: string;\n\ttx: TxMeta;\n}\n\nexport interface PrintEventEvent {\n\tcontractId: string;\n\ttopic: string | null;\n\tvalue: unknown;\n\ttx: TxMeta;\n}\n\n// --- Typed trigger wrapper ---\n\n/**\n * Phantom-typed EventTrigger. Runtime shape is identical to `EventTrigger`;\n * the `__event` field only exists at the type level, letting webhook\n * definitions infer the handler's `event` parameter from the filter.\n */\nexport type TypedEventTrigger<TEvent> = EventTrigger & {\n\treadonly __event?: TEvent;\n};\n\nfunction make<TEvent>(\n\tfilter: EventTrigger[\"filter\"],\n): TypedEventTrigger<TEvent> {\n\treturn { type: \"event\", filter };\n}\n\n// --- `on.*` helpers, 13 total ---\n\nexport interface TriggerHelpers {\n\tstxTransfer: (\n\t\tf?: Omit<StxTransferFilter, \"type\">,\n\t) => TypedEventTrigger<StxTransferEvent>;\n\tstxMint: (f?: Omit<StxMintFilter, \"type\">) => TypedEventTrigger<StxMintEvent>;\n\tstxBurn: (f?: Omit<StxBurnFilter, \"type\">) => TypedEventTrigger<StxBurnEvent>;\n\tstxLock: (f?: Omit<StxLockFilter, \"type\">) => TypedEventTrigger<StxLockEvent>;\n\tftTransfer: (\n\t\tf?: Omit<FtTransferFilter, \"type\">,\n\t) => TypedEventTrigger<FtTransferEvent>;\n\tftMint: (f?: Omit<FtMintFilter, \"type\">) => TypedEventTrigger<FtMintEvent>;\n\tftBurn: (f?: Omit<FtBurnFilter, \"type\">) => TypedEventTrigger<FtBurnEvent>;\n\tnftTransfer: (\n\t\tf?: Omit<NftTransferFilter, \"type\">,\n\t) => TypedEventTrigger<NftTransferEvent>;\n\tnftMint: (f?: Omit<NftMintFilter, \"type\">) => TypedEventTrigger<NftMintEvent>;\n\tnftBurn: (f?: Omit<NftBurnFilter, \"type\">) => TypedEventTrigger<NftBurnEvent>;\n\tcontractCall: (\n\t\tf?: Omit<ContractCallFilter, \"type\">,\n\t) => TypedEventTrigger<ContractCallEvent>;\n\tcontractDeploy: (\n\t\tf?: Omit<ContractDeployFilter, \"type\">,\n\t) => TypedEventTrigger<ContractDeployEvent>;\n\t/** Webhook triggers are not subgraph deploys — prints not required. */\n\tprintEvent: (f?: {\n\t\tcontractId?: string | readonly string[];\n\t\ttopic?: string;\n\t\ttrait?: string;\n\t\tfactory?: { from: string; field: string };\n\t\tprints?: PrintEventPrints;\n\t}) => TypedEventTrigger<PrintEventEvent>;\n}\n\nexport const on: TriggerHelpers = {\n\tstxTransfer: (f = {}) =>\n\t\tmake<StxTransferEvent>({ type: \"stx_transfer\", ...f }),\n\n\tstxMint: (f = {}) => make<StxMintEvent>({ type: \"stx_mint\", ...f }),\n\n\tstxBurn: (f = {}) => make<StxBurnEvent>({ type: \"stx_burn\", ...f }),\n\n\tstxLock: (f = {}) => make<StxLockEvent>({ type: \"stx_lock\", ...f }),\n\n\tftTransfer: (f = {}) => make<FtTransferEvent>({ type: \"ft_transfer\", ...f }),\n\n\tftMint: (f = {}) => make<FtMintEvent>({ type: \"ft_mint\", ...f }),\n\n\tftBurn: (f = {}) => make<FtBurnEvent>({ type: \"ft_burn\", ...f }),\n\n\tnftTransfer: (f = {}) =>\n\t\tmake<NftTransferEvent>({ type: \"nft_transfer\", ...f }),\n\n\tnftMint: (f = {}) => make<NftMintEvent>({ type: \"nft_mint\", ...f }),\n\n\tnftBurn: (f = {}) => make<NftBurnEvent>({ type: \"nft_burn\", ...f }),\n\n\tcontractCall: (f = {}) =>\n\t\tmake<ContractCallEvent>({ type: \"contract_call\", ...f }),\n\n\tcontractDeploy: (f = {}) =>\n\t\tmake<ContractDeployEvent>({ type: \"contract_deploy\", ...f }),\n\n\tprintEvent: (f = {}) =>\n\t\tmake<PrintEventEvent>({\n\t\t\ttype: \"print_event\",\n\t\t\t...f,\n\t\t} as PrintEventFilter),\n};\n\n/** Extract the event payload type from a trigger. */\nexport type EventOf<T> = T extends TypedEventTrigger<infer E> ? E : never;\n"
6
- ],
7
- "mappings": ";;;;AA0IA,SAAS,IAAY,CACpB,QAC4B;AAAA,EAC5B,OAAO,EAAE,MAAM,SAAS,OAAO;AAAA;AAsCzB,IAAM,KAAqB;AAAA,EACjC,aAAa,CAAC,IAAI,CAAC,MAClB,KAAuB,EAAE,MAAM,mBAAmB,EAAE,CAAC;AAAA,EAEtD,SAAS,CAAC,IAAI,CAAC,MAAM,KAAmB,EAAE,MAAM,eAAe,EAAE,CAAC;AAAA,EAElE,SAAS,CAAC,IAAI,CAAC,MAAM,KAAmB,EAAE,MAAM,eAAe,EAAE,CAAC;AAAA,EAElE,SAAS,CAAC,IAAI,CAAC,MAAM,KAAmB,EAAE,MAAM,eAAe,EAAE,CAAC;AAAA,EAElE,YAAY,CAAC,IAAI,CAAC,MAAM,KAAsB,EAAE,MAAM,kBAAkB,EAAE,CAAC;AAAA,EAE3E,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAkB,EAAE,MAAM,cAAc,EAAE,CAAC;AAAA,EAE/D,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAkB,EAAE,MAAM,cAAc,EAAE,CAAC;AAAA,EAE/D,aAAa,CAAC,IAAI,CAAC,MAClB,KAAuB,EAAE,MAAM,mBAAmB,EAAE,CAAC;AAAA,EAEtD,SAAS,CAAC,IAAI,CAAC,MAAM,KAAmB,EAAE,MAAM,eAAe,EAAE,CAAC;AAAA,EAElE,SAAS,CAAC,IAAI,CAAC,MAAM,KAAmB,EAAE,MAAM,eAAe,EAAE,CAAC;AAAA,EAElE,cAAc,CAAC,IAAI,CAAC,MACnB,KAAwB,EAAE,MAAM,oBAAoB,EAAE,CAAC;AAAA,EAExD,gBAAgB,CAAC,IAAI,CAAC,MACrB,KAA0B,EAAE,MAAM,sBAAsB,EAAE,CAAC;AAAA,EAE5D,YAAY,CAAC,IAAI,CAAC,MACjB,KAAsB;AAAA,IACrB,MAAM;AAAA,OACH;AAAA,EACJ,CAAqB;AACvB;",
8
- "debugId": "E8A9BFB4916AE4AF64756E2164756E21",
9
- "names": []
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/validate.ts"],
4
- "sourcesContent": [
5
- "import { z } from \"zod\";\nimport type {\n\tColumnType,\n\tMaterializeSpec,\n\tPrintEventPrints,\n\tSubgraphColumn,\n\tSubgraphDefinition,\n\tSubgraphFilter,\n\tSubgraphSchema,\n\tSubgraphTable,\n} from \"./types.ts\";\n\nexport const SubgraphNameSchema: z.ZodType<string> = z\n\t.string()\n\t.min(1)\n\t.max(63)\n\t.regex(\n\t\t/^[a-z][a-z0-9-]*$/,\n\t\t\"Must start with lowercase letter, contain only lowercase alphanumeric and hyphens\",\n\t);\n\n/**\n * A safe SQL identifier (table or column name). Mirrors the runtime guard in\n * runtime/context.ts (validateColumnName) so the schema validator can never\n * accept a name the runtime would reject — and closes the deploy-time DDL\n * injection path in schema/generator.ts, which interpolates these names raw.\n */\nexport const SqlIdentifierSchema: z.ZodType<string> = z\n\t.string()\n\t.min(1)\n\t.max(63) // Postgres truncates identifiers > 63 bytes; reject rather than collide.\n\t.regex(\n\t\t/^[a-z_][a-z0-9_]*$/i,\n\t\t\"Must be a valid SQL identifier: start with a letter or underscore, then letters/digits/underscores only\",\n\t);\n\nexport const ColumnTypeSchema: z.ZodType<ColumnType> = z.enum([\n\t\"text\",\n\t\"uint\",\n\t\"int\",\n\t\"principal\",\n\t\"boolean\",\n\t\"timestamp\",\n\t\"jsonb\",\n]);\n\n/**\n * One declared print field: a bare column type, or a composite (optional,\n * nested tuple, list). Recursive — real print payloads nest, and a vocabulary\n * that could only say `\"jsonb\"` is what let a flat-field declaration pass\n * while every event decoded to null.\n */\nexport const PrintFieldSchema: z.ZodType<unknown> = z.lazy(() =>\n\tz.union([\n\t\tColumnTypeSchema,\n\t\tz.object({ type: PrintFieldSchema, optional: z.literal(true) }),\n\t\tz.object({ tuple: z.record(z.string(), PrintFieldSchema) }),\n\t\tz.object({ list: PrintFieldSchema }),\n\t]),\n);\n\n/**\n * A Clarity ABI type: a primitive name, or one of the composite shapes.\n * Recursive, so nested tuples/lists/optionals are checked all the way down.\n */\nconst AbiTypeSchema: z.ZodType<unknown> = z.lazy(() =>\n\tz.union([\n\t\tz.string(),\n\t\tz.object({ buff: z.object({ length: z.number() }) }),\n\t\tz.object({ \"string-ascii\": z.object({ length: z.number() }) }),\n\t\tz.object({ \"string-utf8\": z.object({ length: z.number() }) }),\n\t\tz.object({ optional: AbiTypeSchema }),\n\t\tz.object({\n\t\t\tlist: z.object({ type: AbiTypeSchema, length: z.number() }),\n\t\t}),\n\t\tz.object({\n\t\t\ttuple: z.array(z.object({ name: z.string(), type: AbiTypeSchema })),\n\t\t}),\n\t\tz.object({\n\t\t\tresponse: z.object({ ok: AbiTypeSchema, error: AbiTypeSchema }),\n\t\t}),\n\t]),\n);\n\n/**\n * The canonical `AbiContract` shape, validated at deploy time.\n *\n * This used to be `z.record(z.string(), z.any())`, which accepted a raw\n * Hiro/Clarinet ABI (`read_only` access, `buffer` types, outputs wrapped as\n * `{ type: … }`) and let it through — the deploy succeeded and `event.input`\n * then mis-decoded at RUNTIME, per event, forever. Reject it here instead,\n * and name the fix: run it through `normalizeAbi` from\n * `@secondlayer/stacks/clarity`.\n */\nexport const AbiContractSchema: z.ZodType<unknown> = z.object({\n\tfunctions: z.array(\n\t\tz.object({\n\t\t\tname: z.string(),\n\t\t\taccess: z.enum([\"public\", \"read-only\", \"private\"], {\n\t\t\t\tmessage:\n\t\t\t\t\t\"ABI access must be public | read-only | private — a raw Hiro/Clarinet ABI uses `read_only`. Normalize it first: normalizeAbi() from @secondlayer/stacks/clarity.\",\n\t\t\t}),\n\t\t\targs: z.array(z.object({ name: z.string(), type: AbiTypeSchema })),\n\t\t\t// Canonical shape is a bare AbiType; raw ABIs wrap it as `{ type: … }`.\n\t\t\toutputs: AbiTypeSchema,\n\t\t}),\n\t),\n\tmaps: z.array(z.unknown()).optional(),\n\tvariables: z.array(z.unknown()).optional(),\n\tfungible_tokens: z.array(z.unknown()).optional(),\n\tnon_fungible_tokens: z.array(z.unknown()).optional(),\n\timplemented_traits: z.array(z.unknown()).optional(),\n\tdefined_traits: z.array(z.unknown()).optional(),\n});\n\nexport const SubgraphColumnSchema: z.ZodType<SubgraphColumn> = z.object({\n\ttype: ColumnTypeSchema,\n\tnullable: z.boolean().optional(),\n\tindexed: z.boolean().optional(),\n\tsearch: z.boolean().optional(),\n\tdefault: z.union([z.string(), z.number(), z.boolean()]).optional(),\n}) as z.ZodType<SubgraphColumn>;\n\nexport const SubgraphTableSchema: z.ZodType<SubgraphTable> = z.object({\n\tcolumns: z\n\t\t.record(SqlIdentifierSchema, SubgraphColumnSchema)\n\t\t.refine(\n\t\t\t(c) => Object.keys(c).length > 0,\n\t\t\t\"Table must have at least one column\",\n\t\t),\n\tindexes: z.array(z.array(SqlIdentifierSchema)).optional(),\n\tuniqueKeys: z.array(z.array(SqlIdentifierSchema)).optional(),\n\trelations: z\n\t\t.array(\n\t\t\tz.object({\n\t\t\t\tname: SqlIdentifierSchema,\n\t\t\t\treferences: SqlIdentifierSchema,\n\t\t\t\tfields: z.array(SqlIdentifierSchema).min(1),\n\t\t\t\treferencedColumns: z.array(SqlIdentifierSchema).min(1),\n\t\t\t}),\n\t\t)\n\t\t.optional(),\n}) as z.ZodType<SubgraphTable>;\n\nexport const SubgraphSchemaSchema: z.ZodType<Record<string, SubgraphTable>> = z\n\t.record(SqlIdentifierSchema, SubgraphTableSchema)\n\t.refine(\n\t\t(s) => Object.keys(s).length > 0,\n\t\t\"Schema must have at least one table\",\n\t) as z.ZodType<Record<string, SubgraphTable>>;\n\nexport const VALID_FILTER_TYPES = [\n\t\"stx_transfer\",\n\t\"stx_mint\",\n\t\"stx_burn\",\n\t\"stx_lock\",\n\t\"ft_transfer\",\n\t\"ft_mint\",\n\t\"ft_burn\",\n\t\"nft_transfer\",\n\t\"nft_mint\",\n\t\"nft_burn\",\n\t\"contract_call\",\n\t\"contract_deploy\",\n\t\"print_event\",\n\t\"nested_contract_call\",\n\t\"var_set\",\n\t\"map_set\",\n\t\"map_insert\",\n\t\"map_delete\",\n] as const;\n\n/** A contract id, or a set of them (max 20, matching the Index API cap). */\nconst contractIdField = z.union([\n\tz.string(),\n\tz.array(z.string()).min(1).max(20),\n]);\n\n/** Fields shared by the trait-scopable filters. */\nconst traitScope = { trait: z.string().optional() };\n/** Dynamic address set discovered from another source's events. */\nconst factoryScope = {\n\tfactory: z\n\t\t.object({ from: z.string().min(1), field: z.string().min(1) })\n\t\t.strict()\n\t\t.optional(),\n};\nconst amountRange = {\n\tminAmount: z.bigint().optional(),\n\tmaxAmount: z.bigint().optional(),\n};\n\nconst MaterializeColumnSchema = z.union([\n\tz.object({ from: z.string().min(1) }).strict(),\n\tz.object({ fromTx: z.enum([\"sender\", \"txId\"]) }).strict(),\n\tz.object({ fromBlock: z.enum([\"height\", \"hash\", \"timestamp\"]) }).strict(),\n]);\n\nconst MaterializeSpecSchema = z\n\t.object({\n\t\ttable: z.string().min(1),\n\t\tcolumns: z.record(z.string(), MaterializeColumnSchema),\n\t})\n\t.strict();\n\n/**\n * A REAL discriminated union — one member per source type, each `.strict()`\n * with only the fields that type actually supports.\n *\n * It used to be one flat object with every field optional, so\n * `{ type: \"contract_deploy\", assetIdentifier: \"SP…\", minAmount: 1n }`\n * validated clean at deploy and then matched nothing, forever. The runtime\n * union already knew better; only the validator didn't.\n */\nconst SubgraphFilterUnion = z.discriminatedUnion(\"type\", [\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_transfer\"),\n\t\t\tsender: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\t...amountRange,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_mint\"),\n\t\t\trecipient: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_burn\"),\n\t\t\tsender: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"stx_lock\"),\n\t\t\tlockedAddress: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"ft_transfer\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"ft_mint\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"ft_burn\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\tminAmount: z.bigint().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nft_transfer\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nft_mint\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\trecipient: z.string().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nft_burn\"),\n\t\t\tassetIdentifier: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\t...traitScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"contract_call\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tfunctionName: z.string().optional(),\n\t\t\tcaller: z.string().optional(),\n\t\t\tabi: AbiContractSchema.optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"contract_deploy\"),\n\t\t\tdeployer: z.string().optional(),\n\t\t\tcontractName: z.string().optional(),\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"print_event\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\ttopic: z.string().optional(),\n\t\t\tprints: z\n\t\t\t\t.record(z.string(), z.record(z.string(), PrintFieldSchema))\n\t\t\t\t.optional(),\n\t\t\tmaterialize: MaterializeSpecSchema.optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"nested_contract_call\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tfunctionName: z.string().optional(),\n\t\t\tcaller: z.string().optional(),\n\t\t\tsender: z.string().optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"var_set\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tvarName: z.string().optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"map_set\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tmap: z.string().optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"map_insert\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tmap: z.string().optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n\tz\n\t\t.object({\n\t\t\ttype: z.literal(\"map_delete\"),\n\t\t\tcontractId: contractIdField.optional(),\n\t\t\tmap: z.string().optional(),\n\t\t\t...traitScope,\n\t\t\t...factoryScope,\n\t\t})\n\t\t.strict(),\n]);\n\n/**\n * `trait` and `contractId` compose rather than conflict: the matcher ANDs\n * them, so the pair means \"contracts conforming to this trait, narrowed to\n * these ids\". (The Index READ API refuses the combination because its query\n * planner picks one index path — that's an API constraint, not a semantic\n * one, and subgraph sources are not bound by it.)\n */\nexport const SubgraphFilterSchema: z.ZodType<SubgraphFilter> =\n\tSubgraphFilterUnion as unknown as z.ZodType<SubgraphFilter>;\n\n/** Pinned contractId: a non-empty string or a non-empty array of ids. */\nfunction hasPinnedContractId(\n\tcontractId: string | readonly string[] | undefined,\n): boolean {\n\tif (typeof contractId === \"string\") return contractId.length > 0;\n\tif (Array.isArray(contractId)) return contractId.length > 0;\n\treturn false;\n}\n\n/** Camel keys declared across a prints map, plus `topic` (native payload). */\nfunction printMaterializeFromKeys(\n\tprints: PrintEventPrints | undefined,\n): string[] {\n\tconst keys = new Set<string>([\"topic\"]);\n\tif (prints) {\n\t\tfor (const fields of Object.values(prints)) {\n\t\t\tfor (const k of Object.keys(fields)) keys.add(k);\n\t\t}\n\t}\n\treturn [...keys].sort();\n}\n\nfunction refineMaterialize(\n\tname: string,\n\tfilter: SubgraphFilter,\n\tschema: SubgraphSchema,\n\tctx: z.RefinementCtx,\n): void {\n\tif (!(\"materialize\" in filter) || filter.materialize === undefined) return;\n\tconst spec = filter.materialize as MaterializeSpec;\n\tconst table = schema[spec.table];\n\tif (!table) {\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"sources\", name, \"materialize\", \"table\"],\n\t\t\tmessage: `materialize table \"${spec.table}\" is not in schema`,\n\t\t});\n\t\treturn;\n\t}\n\tfor (const col of Object.keys(spec.columns)) {\n\t\tif (!(col in table.columns)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"sources\", name, \"materialize\", \"columns\", col],\n\t\t\t\tmessage: `materialize column \"${col}\" is not on schema table \"${spec.table}\"`,\n\t\t\t});\n\t\t}\n\t}\n\tif (filter.type === \"print_event\") {\n\t\tconst known = printMaterializeFromKeys(filter.prints);\n\t\tconst knownSet = new Set(known);\n\t\tfor (const [col, mapping] of Object.entries(spec.columns)) {\n\t\t\tif (!(\"from\" in mapping)) continue;\n\t\t\tif (!knownSet.has(mapping.from)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [\"sources\", name, \"materialize\", \"columns\", col, \"from\"],\n\t\t\t\t\tmessage: `materialize from \"${mapping.from}\" is not a known print field — known: ${known.join(\", \")}`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deploy gates beyond the per-filter union: pinned print_event needs a\n * non-empty `prints` map, contract_call+functionName needs `abi`, and every\n * source needs a named handler, materialize, or `\"*\"`.\n */\nfunction refineDeployGates(\n\tdef: {\n\t\tsources: Record<string, SubgraphFilter>;\n\t\thandlers: Record<string, unknown>;\n\t\tschema: SubgraphSchema;\n\t},\n\tctx: z.RefinementCtx,\n): void {\n\tfor (const [name, filter] of Object.entries(def.sources)) {\n\t\tif (filter.type === \"print_event\") {\n\t\t\t// Trait / unpinned (no contractId) may omit prints — no single schema.\n\t\t\tconst pinned = hasPinnedContractId(filter.contractId) && !filter.trait;\n\t\t\tif (pinned) {\n\t\t\t\tconst prints = filter.prints;\n\t\t\t\tif (\n\t\t\t\t\tprints === undefined ||\n\t\t\t\t\ttypeof prints !== \"object\" ||\n\t\t\t\t\tObject.keys(prints).length === 0\n\t\t\t\t) {\n\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\tpath: [\"sources\", name, \"prints\"],\n\t\t\t\t\t\tmessage: `print_event source \"${name}\" has no prints map — field names would be untyped and empty tables would typecheck. Declare prints from index_print_schema / create --from-contract.`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (filter.type === \"contract_call\" && filter.functionName !== undefined) {\n\t\t\tif (filter.abi === undefined) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [\"sources\", name, \"abi\"],\n\t\t\t\t\tmessage: `contract_call source \"${name}\" has functionName but no abi — pass a canonical ABI (normalizeAbi() from @secondlayer/stacks/clarity).`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\trefineMaterialize(name, filter, def.schema, ctx);\n\t}\n\n\tconst hasCatchAll = def.handlers[\"*\"] != null;\n\tfor (const [name, filter] of Object.entries(def.sources)) {\n\t\tconst hasMaterialize =\n\t\t\t\"materialize\" in filter && filter.materialize !== undefined;\n\t\tconst hasHandler = def.handlers[name] != null;\n\t\tif (hasMaterialize && hasHandler) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"handlers\", name],\n\t\t\t\tmessage: `source \"${name}\" has both materialize and a handler — use one or the other`,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (!hasHandler && !hasMaterialize && !hasCatchAll) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"handlers\", name],\n\t\t\t\tmessage: `source \"${name}\" has no handler (and no \"*\") — events will be skipped and the table stay empty.`,\n\t\t\t});\n\t\t}\n\t}\n}\n\nexport const SubgraphDefinitionSchema: z.ZodType<SubgraphDefinition> = z\n\t.object({\n\t\tname: SubgraphNameSchema,\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\t// 'concurrent' = tip-first deploy: go live at tip immediately, fill\n\t\t// history via a background backfill. Only safe for order-tolerant\n\t\t// handlers (commutative or insert-only writes).\n\t\tbackfillMode: z.enum([\"blocking\", \"concurrent\"]).optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), SubgraphFilterSchema)\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: SubgraphSchemaSchema,\n\t\thandlers: z.record(z.string(), z.any()),\n\t})\n\t.superRefine((def, ctx) => {\n\t\trefineDeployGates(\n\t\t\tdef as {\n\t\t\t\tsources: Record<string, SubgraphFilter>;\n\t\t\t\thandlers: Record<string, unknown>;\n\t\t\t\tschema: SubgraphSchema;\n\t\t\t},\n\t\t\tctx,\n\t\t);\n\t}) as unknown as z.ZodType<SubgraphDefinition>;\n\n/**\n * Validates a subgraph definition, returning the parsed result or throwing on failure.\n */\nexport function validateSubgraphDefinition(def: unknown): SubgraphDefinition {\n\treturn SubgraphDefinitionSchema.parse(def);\n}\n\n/**\n * Per-source-type field vocabulary, DERIVED from\n * {@link SubgraphFilterSchema}. Agent-facing surfaces (the MCP filters\n * reference) used to hand-maintain a parallel copy of this list; deriving it\n * means adding a field to a filter can never leave the documentation behind.\n */\nexport function filterFieldsByType(): Array<{\n\ttype: string;\n\tfields: string[];\n}> {\n\t// Read the UNION directly (SubgraphFilterSchema wraps it in superRefine).\n\t// biome-ignore lint/suspicious/noExplicitAny: reading zod's internal option shapes\n\tconst options = (SubgraphFilterUnion as any)?._def?.options ?? [];\n\tconst out: Array<{ type: string; fields: string[] }> = [];\n\tfor (const option of options) {\n\t\t// `.superRefine()` wraps the union, so unwrap one level when present.\n\t\tconst shape = option?.shape ?? option?._def?.shape;\n\t\tif (!shape) continue;\n\t\tconst literal =\n\t\t\tshape.type?._def?.values?.[0] ?? shape.type?._def?.value ?? undefined;\n\t\tif (typeof literal !== \"string\") continue;\n\t\tout.push({\n\t\t\ttype: literal,\n\t\t\tfields: Object.keys(shape).filter((k) => k !== \"type\"),\n\t\t});\n\t}\n\treturn out;\n}\n"
6
- ],
7
- "mappings": ";;;;AAAA;AAYO,IAAM,qBAAwC,EACnD,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MACA,qBACA,mFACD;AAQM,IAAM,sBAAyC,EACpD,OAAO,EACP,IAAI,CAAC,EACL,IAAI,EAAE,EACN,MACA,uBACA,yGACD;AAEM,IAAM,mBAA0C,EAAE,KAAK;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAQM,IAAM,mBAAuC,EAAE,KAAK,MAC1D,EAAE,MAAM;AAAA,EACP;AAAA,EACA,EAAE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