@secondlayer/subgraphs 3.0.0 → 3.1.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 +130 -109
- package/dist/src/runtime/block-processor.d.ts +8 -0
- package/dist/src/runtime/catchup.d.ts +8 -0
- package/dist/src/runtime/reindex.d.ts +8 -0
- package/dist/src/runtime/reorg.d.ts +8 -0
- package/dist/src/runtime/runner.d.ts +8 -0
- package/dist/src/runtime/source-matcher.d.ts +10 -0
- package/dist/src/schema/index.d.ts +8 -0
- package/dist/src/triggers/index.d.ts +10 -0
- package/dist/src/types.d.ts +8 -0
- package/dist/src/validate.d.ts +8 -0
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -137,6 +137,14 @@ interface PrintEventFilter {
|
|
|
137
137
|
type: "print_event";
|
|
138
138
|
contractId?: string;
|
|
139
139
|
topic?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
142
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
143
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
144
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
145
|
+
* Type-level only — not validated at runtime.
|
|
146
|
+
*/
|
|
147
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
140
148
|
}
|
|
141
149
|
/** All subgraph filter types — discriminated on `type` */
|
|
142
150
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -246,114 +254,6 @@ declare function backfillSubgraph(def: SubgraphDefinition, opts: {
|
|
|
246
254
|
}): Promise<{
|
|
247
255
|
processed: number
|
|
248
256
|
}>;
|
|
249
|
-
interface FtTransferPayload {
|
|
250
|
-
sender: string;
|
|
251
|
-
recipient: string;
|
|
252
|
-
amount: bigint;
|
|
253
|
-
assetIdentifier: string;
|
|
254
|
-
tx: TxMeta;
|
|
255
|
-
}
|
|
256
|
-
interface FtMintPayload {
|
|
257
|
-
recipient: string;
|
|
258
|
-
amount: bigint;
|
|
259
|
-
assetIdentifier: string;
|
|
260
|
-
tx: TxMeta;
|
|
261
|
-
}
|
|
262
|
-
interface FtBurnPayload {
|
|
263
|
-
sender: string;
|
|
264
|
-
amount: bigint;
|
|
265
|
-
assetIdentifier: string;
|
|
266
|
-
tx: TxMeta;
|
|
267
|
-
}
|
|
268
|
-
interface NftTransferPayload {
|
|
269
|
-
sender: string;
|
|
270
|
-
recipient: string;
|
|
271
|
-
tokenId: unknown;
|
|
272
|
-
assetIdentifier: string;
|
|
273
|
-
tx: TxMeta;
|
|
274
|
-
}
|
|
275
|
-
interface NftMintPayload {
|
|
276
|
-
recipient: string;
|
|
277
|
-
tokenId: unknown;
|
|
278
|
-
assetIdentifier: string;
|
|
279
|
-
tx: TxMeta;
|
|
280
|
-
}
|
|
281
|
-
interface NftBurnPayload {
|
|
282
|
-
sender: string;
|
|
283
|
-
tokenId: unknown;
|
|
284
|
-
assetIdentifier: string;
|
|
285
|
-
tx: TxMeta;
|
|
286
|
-
}
|
|
287
|
-
interface StxTransferPayload {
|
|
288
|
-
sender: string;
|
|
289
|
-
recipient: string;
|
|
290
|
-
amount: bigint;
|
|
291
|
-
/** Memo string, or "" when none was attached. */
|
|
292
|
-
memo: string;
|
|
293
|
-
tx: TxMeta;
|
|
294
|
-
}
|
|
295
|
-
interface StxMintPayload {
|
|
296
|
-
recipient: string;
|
|
297
|
-
amount: bigint;
|
|
298
|
-
tx: TxMeta;
|
|
299
|
-
}
|
|
300
|
-
interface StxBurnPayload {
|
|
301
|
-
sender: string;
|
|
302
|
-
amount: bigint;
|
|
303
|
-
tx: TxMeta;
|
|
304
|
-
}
|
|
305
|
-
interface StxLockPayload {
|
|
306
|
-
lockedAddress: string;
|
|
307
|
-
lockedAmount: bigint;
|
|
308
|
-
unlockHeight: bigint;
|
|
309
|
-
tx: TxMeta;
|
|
310
|
-
}
|
|
311
|
-
interface PrintEventPayload {
|
|
312
|
-
contractId: string;
|
|
313
|
-
/** Decoded print topic (the Clarity tuple's `topic` field), or "". */
|
|
314
|
-
topic: string;
|
|
315
|
-
/**
|
|
316
|
-
* Remaining decoded tuple fields, camelCased. Empty object when the print
|
|
317
|
-
* value isn't a tuple. Narrow per `topic` to access typed fields.
|
|
318
|
-
*/
|
|
319
|
-
data: Record<string, unknown>;
|
|
320
|
-
tx: TxMeta;
|
|
321
|
-
}
|
|
322
|
-
interface ContractDeployPayload {
|
|
323
|
-
contractId: string;
|
|
324
|
-
deployer: string;
|
|
325
|
-
tx: TxMeta;
|
|
326
|
-
}
|
|
327
|
-
/** The event payload a handler receives for a given source filter. */
|
|
328
|
-
type EventForFilter<F extends SubgraphFilter> = F extends {
|
|
329
|
-
type: "print_event"
|
|
330
|
-
} ? PrintEventPayload : F extends {
|
|
331
|
-
type: "ft_transfer"
|
|
332
|
-
} ? FtTransferPayload : F extends {
|
|
333
|
-
type: "ft_mint"
|
|
334
|
-
} ? FtMintPayload : F extends {
|
|
335
|
-
type: "ft_burn"
|
|
336
|
-
} ? FtBurnPayload : F extends {
|
|
337
|
-
type: "nft_transfer"
|
|
338
|
-
} ? NftTransferPayload : F extends {
|
|
339
|
-
type: "nft_mint"
|
|
340
|
-
} ? NftMintPayload : F extends {
|
|
341
|
-
type: "nft_burn"
|
|
342
|
-
} ? NftBurnPayload : F extends {
|
|
343
|
-
type: "stx_transfer"
|
|
344
|
-
} ? StxTransferPayload : F extends {
|
|
345
|
-
type: "stx_mint"
|
|
346
|
-
} ? StxMintPayload : F extends {
|
|
347
|
-
type: "stx_burn"
|
|
348
|
-
} ? StxBurnPayload : F extends {
|
|
349
|
-
type: "stx_lock"
|
|
350
|
-
} ? StxLockPayload : F extends {
|
|
351
|
-
type: "contract_call"
|
|
352
|
-
} ? ContractCallEvent : F extends {
|
|
353
|
-
type: "contract_deploy"
|
|
354
|
-
} ? ContractDeployPayload : never;
|
|
355
|
-
/** Union of every event payload — the `"*"` catch-all handler receives this. */
|
|
356
|
-
type AnyEvent = FtTransferPayload | FtMintPayload | FtBurnPayload | NftTransferPayload | NftMintPayload | NftBurnPayload | StxTransferPayload | StxMintPayload | StxBurnPayload | StxLockPayload | PrintEventPayload | ContractCallEvent | ContractDeployPayload;
|
|
357
257
|
/** Maps a ColumnType string literal to its TypeScript equivalent */
|
|
358
258
|
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;
|
|
359
259
|
/** Infer TS type for a single column definition, respecting nullable */
|
|
@@ -461,6 +361,127 @@ interface TypedSubgraphContext<S extends SubgraphSchema> {
|
|
|
461
361
|
type InferSubgraphClient<T> = T extends {
|
|
462
362
|
schema: infer S
|
|
463
363
|
} ? { [K in keyof S] : S[K] extends SubgraphTable ? SubgraphTableClient<InferTableRow<S[K]>> : never } : never;
|
|
364
|
+
interface FtTransferPayload {
|
|
365
|
+
sender: string;
|
|
366
|
+
recipient: string;
|
|
367
|
+
amount: bigint;
|
|
368
|
+
assetIdentifier: string;
|
|
369
|
+
tx: TxMeta;
|
|
370
|
+
}
|
|
371
|
+
interface FtMintPayload {
|
|
372
|
+
recipient: string;
|
|
373
|
+
amount: bigint;
|
|
374
|
+
assetIdentifier: string;
|
|
375
|
+
tx: TxMeta;
|
|
376
|
+
}
|
|
377
|
+
interface FtBurnPayload {
|
|
378
|
+
sender: string;
|
|
379
|
+
amount: bigint;
|
|
380
|
+
assetIdentifier: string;
|
|
381
|
+
tx: TxMeta;
|
|
382
|
+
}
|
|
383
|
+
interface NftTransferPayload {
|
|
384
|
+
sender: string;
|
|
385
|
+
recipient: string;
|
|
386
|
+
tokenId: unknown;
|
|
387
|
+
assetIdentifier: string;
|
|
388
|
+
tx: TxMeta;
|
|
389
|
+
}
|
|
390
|
+
interface NftMintPayload {
|
|
391
|
+
recipient: string;
|
|
392
|
+
tokenId: unknown;
|
|
393
|
+
assetIdentifier: string;
|
|
394
|
+
tx: TxMeta;
|
|
395
|
+
}
|
|
396
|
+
interface NftBurnPayload {
|
|
397
|
+
sender: string;
|
|
398
|
+
tokenId: unknown;
|
|
399
|
+
assetIdentifier: string;
|
|
400
|
+
tx: TxMeta;
|
|
401
|
+
}
|
|
402
|
+
interface StxTransferPayload {
|
|
403
|
+
sender: string;
|
|
404
|
+
recipient: string;
|
|
405
|
+
amount: bigint;
|
|
406
|
+
/** Memo string, or "" when none was attached. */
|
|
407
|
+
memo: string;
|
|
408
|
+
tx: TxMeta;
|
|
409
|
+
}
|
|
410
|
+
interface StxMintPayload {
|
|
411
|
+
recipient: string;
|
|
412
|
+
amount: bigint;
|
|
413
|
+
tx: TxMeta;
|
|
414
|
+
}
|
|
415
|
+
interface StxBurnPayload {
|
|
416
|
+
sender: string;
|
|
417
|
+
amount: bigint;
|
|
418
|
+
tx: TxMeta;
|
|
419
|
+
}
|
|
420
|
+
interface StxLockPayload {
|
|
421
|
+
lockedAddress: string;
|
|
422
|
+
lockedAmount: bigint;
|
|
423
|
+
unlockHeight: bigint;
|
|
424
|
+
tx: TxMeta;
|
|
425
|
+
}
|
|
426
|
+
interface PrintEventPayload {
|
|
427
|
+
contractId: string;
|
|
428
|
+
/** Decoded print topic (the Clarity tuple's `topic` field), or "". */
|
|
429
|
+
topic: string;
|
|
430
|
+
/**
|
|
431
|
+
* Remaining decoded tuple fields, camelCased. Empty object when the print
|
|
432
|
+
* value isn't a tuple. Narrow per `topic` to access typed fields.
|
|
433
|
+
*/
|
|
434
|
+
data: Record<string, unknown>;
|
|
435
|
+
tx: TxMeta;
|
|
436
|
+
}
|
|
437
|
+
interface ContractDeployPayload {
|
|
438
|
+
contractId: string;
|
|
439
|
+
deployer: string;
|
|
440
|
+
tx: TxMeta;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Print event typed per topic. When a `print_event` source declares a `prints`
|
|
444
|
+
* map, the payload is a discriminated union keyed by `topic` with `data` typed
|
|
445
|
+
* per topic; otherwise it falls back to the untyped {@link PrintEventPayload}.
|
|
446
|
+
*/
|
|
447
|
+
type PrintEventFor<F> = F extends {
|
|
448
|
+
prints: infer P extends Record<string, Record<string, ColumnType>>
|
|
449
|
+
} ? { [K in keyof P] : {
|
|
450
|
+
contractId: string
|
|
451
|
+
topic: K
|
|
452
|
+
data: { [Field in keyof P[K]] : ColumnToTS<P[K][Field]> }
|
|
453
|
+
tx: TxMeta
|
|
454
|
+
} }[keyof P] : PrintEventPayload;
|
|
455
|
+
/** The event payload a handler receives for a given source filter. */
|
|
456
|
+
type EventForFilter<F extends SubgraphFilter> = F extends {
|
|
457
|
+
type: "print_event"
|
|
458
|
+
} ? PrintEventFor<F> : F extends {
|
|
459
|
+
type: "ft_transfer"
|
|
460
|
+
} ? FtTransferPayload : F extends {
|
|
461
|
+
type: "ft_mint"
|
|
462
|
+
} ? FtMintPayload : F extends {
|
|
463
|
+
type: "ft_burn"
|
|
464
|
+
} ? FtBurnPayload : F extends {
|
|
465
|
+
type: "nft_transfer"
|
|
466
|
+
} ? NftTransferPayload : F extends {
|
|
467
|
+
type: "nft_mint"
|
|
468
|
+
} ? NftMintPayload : F extends {
|
|
469
|
+
type: "nft_burn"
|
|
470
|
+
} ? NftBurnPayload : F extends {
|
|
471
|
+
type: "stx_transfer"
|
|
472
|
+
} ? StxTransferPayload : F extends {
|
|
473
|
+
type: "stx_mint"
|
|
474
|
+
} ? StxMintPayload : F extends {
|
|
475
|
+
type: "stx_burn"
|
|
476
|
+
} ? StxBurnPayload : F extends {
|
|
477
|
+
type: "stx_lock"
|
|
478
|
+
} ? StxLockPayload : F extends {
|
|
479
|
+
type: "contract_call"
|
|
480
|
+
} ? ContractCallEvent : F extends {
|
|
481
|
+
type: "contract_deploy"
|
|
482
|
+
} ? ContractDeployPayload : never;
|
|
483
|
+
/** Union of every event payload — the `"*"` catch-all handler receives this. */
|
|
484
|
+
type AnyEvent = FtTransferPayload | FtMintPayload | FtBurnPayload | NftTransferPayload | NftMintPayload | NftBurnPayload | StxTransferPayload | StxMintPayload | StxBurnPayload | StxLockPayload | PrintEventPayload | ContractCallEvent | ContractDeployPayload;
|
|
464
485
|
/**
|
|
465
486
|
* Handlers keyed by source name. Each handler's `event` is typed from the
|
|
466
487
|
* matching source's filter `type` (e.g. a `print_event` source → `event.topic`
|
|
@@ -567,4 +588,4 @@ declare function deploySchema(db: AnyDb, def: SubgraphDefinition, handlerPath: s
|
|
|
567
588
|
version: string
|
|
568
589
|
diff?: DeployDiff
|
|
569
590
|
}>;
|
|
570
|
-
export { validateSubgraphDefinition, resumeReindex, reindexSubgraph, pgSchemaName, generateSubgraphSQL, diffSchema, deploySchema, defineSubgraph, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, RowValue, ReindexOptions, PrintEventPayload, PrintEventFilter, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, InferTableRow, InferSubgraphClient, InferColumnType, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, EventForFilter, ContractDeployPayload, ContractDeployFilter, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, AnyEvent };
|
|
591
|
+
export { validateSubgraphDefinition, resumeReindex, reindexSubgraph, pgSchemaName, generateSubgraphSQL, diffSchema, deploySchema, defineSubgraph, backfillSubgraph, WriteRow, WhereInput, TypedSubgraphDefinition, TypedSubgraphContext, TypedHandlers, TxMeta, TableDiff, SystemRow, SubgraphTableClient, SubgraphTable, SubgraphSchema, SubgraphHandler, SubgraphFilter, SubgraphDefinition, SubgraphContext, SubgraphColumn, StxTransferPayload, StxTransferFilter, StxMintPayload, StxMintFilter, StxLockPayload, StxLockFilter, StxBurnPayload, StxBurnFilter, RowValue, ReindexOptions, PrintEventPayload, PrintEventFor, PrintEventFilter, NftTransferPayload, NftTransferFilter, NftMintPayload, NftMintFilter, NftBurnPayload, NftBurnFilter, InferTableRow, InferSubgraphClient, InferColumnType, GeneratedSQL, FtTransferPayload, FtTransferFilter, FtMintPayload, FtMintFilter, FtBurnPayload, FtBurnFilter, FindManyOptions, EventForFilter, ContractDeployPayload, ContractDeployFilter, ContractCallFilter, ContractCallEvent, ComputedValue, ComparisonFilter, ColumnType, ColumnToTS, ColumnDiff, AnyEvent };
|
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Supported column types for subgraph schemas */
|
|
2
|
+
type ColumnType = "text" | "uint" | "int" | "principal" | "boolean" | "timestamp" | "jsonb";
|
|
1
3
|
/** STX event filters */
|
|
2
4
|
interface StxTransferFilter {
|
|
3
5
|
type: "stx_transfer";
|
|
@@ -76,6 +78,14 @@ interface PrintEventFilter {
|
|
|
76
78
|
type: "print_event";
|
|
77
79
|
contractId?: string;
|
|
78
80
|
topic?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
83
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
84
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
85
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
86
|
+
* Type-level only — not validated at runtime.
|
|
87
|
+
*/
|
|
88
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
79
89
|
}
|
|
80
90
|
/** All subgraph filter types — discriminated on `type` */
|
|
81
91
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Supported column types for subgraph schemas */
|
|
2
|
+
type ColumnType = "text" | "uint" | "int" | "principal" | "boolean" | "timestamp" | "jsonb";
|
|
1
3
|
/** STX event filters */
|
|
2
4
|
interface StxTransferFilter {
|
|
3
5
|
type: "stx_transfer";
|
|
@@ -76,6 +78,14 @@ interface PrintEventFilter {
|
|
|
76
78
|
type: "print_event";
|
|
77
79
|
contractId?: string;
|
|
78
80
|
topic?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
83
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
84
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
85
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
86
|
+
* Type-level only — not validated at runtime.
|
|
87
|
+
*/
|
|
88
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
79
89
|
}
|
|
80
90
|
/** All subgraph filter types — discriminated on `type` */
|
|
81
91
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -137,6 +137,14 @@ interface PrintEventFilter {
|
|
|
137
137
|
type: "print_event";
|
|
138
138
|
contractId?: string;
|
|
139
139
|
topic?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
142
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
143
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
144
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
145
|
+
* Type-level only — not validated at runtime.
|
|
146
|
+
*/
|
|
147
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
140
148
|
}
|
|
141
149
|
/** All subgraph filter types — discriminated on `type` */
|
|
142
150
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|
package/dist/src/validate.d.ts
CHANGED
|
@@ -96,6 +96,14 @@ interface PrintEventFilter {
|
|
|
96
96
|
type: "print_event";
|
|
97
97
|
contractId?: string;
|
|
98
98
|
topic?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Optional per-topic field schema. When declared, the handler's `event` is
|
|
101
|
+
* a discriminated union keyed by `topic` and `event.data` is typed per topic
|
|
102
|
+
* (e.g. `{ "completed-deposit": { amount: "uint", sender: "principal" } }`).
|
|
103
|
+
* Uses the same `ColumnType` vocab as `schema`; nested fields use `"jsonb"`.
|
|
104
|
+
* Type-level only — not validated at runtime.
|
|
105
|
+
*/
|
|
106
|
+
prints?: Record<string, Record<string, ColumnType>>;
|
|
99
107
|
}
|
|
100
108
|
/** All subgraph filter types — discriminated on `type` */
|
|
101
109
|
type SubgraphFilter = StxTransferFilter | StxMintFilter | StxBurnFilter | StxLockFilter | FtTransferFilter | FtMintFilter | FtBurnFilter | NftTransferFilter | NftMintFilter | NftBurnFilter | ContractCallFilter | ContractDeployFilter | PrintEventFilter;
|