@secondlayer/shared 11.21.0 → 11.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.
Files changed (36) hide show
  1. package/dist/src/archive/range-digest.d.ts +29 -0
  2. package/dist/src/archive/semantic-digest-builder.d.ts +29 -0
  3. package/dist/src/coverage/index.d.ts +29 -0
  4. package/dist/src/db/index.d.ts +29 -0
  5. package/dist/src/db/queries/chain-reorgs.d.ts +29 -0
  6. package/dist/src/db/queries/contracts.d.ts +29 -0
  7. package/dist/src/db/queries/instance.d.ts +29 -0
  8. package/dist/src/db/queries/integrity.d.ts +29 -0
  9. package/dist/src/db/queries/subgraph-gaps.d.ts +29 -0
  10. package/dist/src/db/queries/subgraph-operations.d.ts +29 -0
  11. package/dist/src/db/queries/subgraphs.d.ts +35 -0
  12. package/dist/src/db/queries/subgraphs.js +13 -2
  13. package/dist/src/db/queries/subgraphs.js.map +4 -4
  14. package/dist/src/db/queries/sync-scope.d.ts +29 -0
  15. package/dist/src/db/queries/webhooks.d.ts +29 -0
  16. package/dist/src/db/schema.d.ts +29 -0
  17. package/dist/src/index-http.d.ts +22 -1
  18. package/dist/src/index-http.js +11 -1
  19. package/dist/src/index-http.js.map +3 -3
  20. package/dist/src/index.d.ts +246 -208
  21. package/dist/src/index.js +4 -1
  22. package/dist/src/index.js.map +4 -4
  23. package/dist/src/node/local-client.d.ts +29 -0
  24. package/dist/src/node/tx-summary.d.ts +22 -0
  25. package/dist/src/node/tx-summary.js +194 -0
  26. package/dist/src/node/tx-summary.js.map +12 -0
  27. package/dist/src/schemas/index.d.ts +30 -1
  28. package/dist/src/schemas/index.js.map +2 -2
  29. package/dist/src/schemas/subgraphs.d.ts +30 -1
  30. package/dist/src/schemas/subgraphs.js.map +2 -2
  31. package/dist/src/subgraphs/spec.d.ts +27 -0
  32. package/dist/src/subgraphs/spec.js +4 -1
  33. package/dist/src/subgraphs/spec.js.map +3 -3
  34. package/migrations/0157_subgraph_pin_verification.ts +35 -0
  35. package/migrations/0158_subgraph_pin_preimage.ts +25 -0
  36. package/package.json +6 -2
@@ -18,6 +18,242 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
18
18
  declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
19
19
  type RetryState = (typeof RETRY_STATES)[number];
20
20
  type BootstrapSource = "archive" | "genesis" | "import";
21
+ import { z } from "zod";
22
+ interface DeploySubgraphRequest {
23
+ name: string;
24
+ description?: string;
25
+ sources: Record<string, Record<string, unknown>>;
26
+ schema: Record<string, unknown>;
27
+ handlerCode: string;
28
+ /** Override the definition's startBlock for this deploy only. */
29
+ startBlock?: number;
30
+ /** Original TypeScript source, persisted so chat can read/diff/edit later. */
31
+ sourceCode?: string;
32
+ /** Validate the definition + print the DDL plan without deploying. */
33
+ dryRun?: boolean;
34
+ }
35
+ declare const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest>;
36
+ /**
37
+ * How far a subgraph's rows can be checked without trusting the server,
38
+ * derived from its sources and a scan of its handler. Never configured.
39
+ *
40
+ * - `state`: every input is a named state write, provable from block headers.
41
+ * Handlers run in the deterministic realm. A deployed `state` subgraph is
42
+ * verifiable: one with any reason is refused at deploy.
43
+ * - `events`: an input (events, prints, tx results, `ctx.client`) needs
44
+ * re-execution proofs, which are not served yet.
45
+ * - `none`: a source can never be proven as written (trait scope, tip-first
46
+ * backfill).
47
+ */
48
+ interface SubgraphVerification {
49
+ level: "state" | "events" | "none";
50
+ /** What stands between the subgraph and checkable rows, e.g.
51
+ * `print_event source "swaps" needs event proofs` or
52
+ * `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
53
+ reasons: string[];
54
+ /** What stays unproven even at this level, e.g. tx attribution of writes. */
55
+ unproven: string[];
56
+ }
57
+ interface DeploySubgraphResponse {
58
+ action: "created" | "unchanged" | "handler_updated" | "updated" | "reindexed";
59
+ subgraphId: string;
60
+ version: string;
61
+ message: string;
62
+ /** Effective indexing start height. */
63
+ start_block?: number;
64
+ operationId?: string;
65
+ reindexStarted?: boolean;
66
+ /** Bounded candidate-event denominator for the reindex just started, when the
67
+ * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate
68
+ * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */
69
+ estimatedEvents?: number;
70
+ /** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */
71
+ warnings?: string[];
72
+ /** sha256 identity of what was deployed; absent on unbundled deploys. */
73
+ pin?: string;
74
+ verification?: SubgraphVerification;
75
+ diff?: {
76
+ addedTables: string[]
77
+ removedTables: string[]
78
+ addedColumns: Record<string, string[]>
79
+ breakingChanges: string[]
80
+ };
81
+ }
82
+ /** Prefix of the `last_error` a billing-paused subgraph carries, e.g.
83
+ * `billing_paused: spend_cap_reached`. Stable: the processor writes it and
84
+ * the watchdog and CLI key off it. */
85
+ declare const BILLING_PAUSED_PREFIX = "billing_paused: ";
86
+ /** The billing code in a subgraph's `last_error`, or `null` when it isn't a
87
+ * billing pause. */
88
+ declare function billingPausedCode(lastError: string | null | undefined): string | null;
89
+ interface SubgraphSummary {
90
+ name: string;
91
+ version: string;
92
+ status: string;
93
+ lastProcessedBlock: number;
94
+ totalProcessed: number;
95
+ totalRows?: number;
96
+ totalErrors: number;
97
+ tables: string[];
98
+ chainTip: number;
99
+ sourceChainTip?: number;
100
+ targetBlock?: number;
101
+ progress: number;
102
+ blocksRemaining?: number;
103
+ syncMode?: "sync" | "reindex";
104
+ gapCount: number;
105
+ /** history_filling = expected gaps while a tip-first backfill op runs. */
106
+ integrity: "complete" | "gaps_detected" | "history_filling";
107
+ /** Most recent indexing error reason + when it occurred, if any. */
108
+ lastError?: string | null;
109
+ lastErrorAt?: string | null;
110
+ /** Last row mutation timestamp; powers per-card freshness. */
111
+ updatedAt?: string | null;
112
+ /** Number of webhooks attached to this subgraph. */
113
+ webhookCount?: number;
114
+ createdAt: string;
115
+ }
116
+ interface SubgraphGapRange {
117
+ start: number;
118
+ end: number;
119
+ size: number;
120
+ reason: string;
121
+ }
122
+ interface SubgraphSyncInfo {
123
+ status: "synced" | "catching_up" | "reindexing" | "error";
124
+ mode?: "sync" | "reindex";
125
+ startBlock: number;
126
+ lastProcessedBlock: number;
127
+ /**
128
+ * Backward-compatible denominator for progress displays. During reindexing,
129
+ * this is the reindex target block rather than the live source chain tip.
130
+ */
131
+ chainTip: number;
132
+ sourceChainTip?: number;
133
+ targetBlock?: number;
134
+ blocksRemaining: number;
135
+ processedBlocks?: number;
136
+ totalBlocks?: number;
137
+ progress: number;
138
+ /** Present while the populating operation is queued: approximate claim
139
+ * position + honest event denominator + naive start estimate. */
140
+ queue?: {
141
+ position: number | null
142
+ estimatedEvents: number | null
143
+ estimatedStartSeconds: number | null
144
+ };
145
+ /** Event-based progress for sparse syncs (block pct is meaningless when
146
+ * most heights are skipped). */
147
+ estimatedEvents?: number;
148
+ processedEvents?: number;
149
+ etaSeconds?: number | null;
150
+ gaps: {
151
+ count: number
152
+ totalMissingBlocks: number
153
+ ranges: SubgraphGapRange[]
154
+ };
155
+ /** history_filling = expected gaps while a tip-first backfill op runs. */
156
+ integrity: "complete" | "gaps_detected" | "history_filling";
157
+ }
158
+ interface SubgraphDetail {
159
+ name: string;
160
+ version: string;
161
+ schemaHash?: string;
162
+ /** sha256 over schema, handler bundle, startBlock, network and runtime.
163
+ * Null for subgraphs deployed before pins existed. */
164
+ pin?: string | null;
165
+ /** Null for subgraphs deployed before levels were derived. */
166
+ verification?: SubgraphVerification | null;
167
+ status: string;
168
+ lastProcessedBlock: number;
169
+ description?: string;
170
+ sources?: Record<string, unknown>;
171
+ definition?: Record<string, unknown>;
172
+ health: {
173
+ totalProcessed: number
174
+ totalErrors: number
175
+ errorRate: number
176
+ lastError: string | null
177
+ lastErrorAt: string | null
178
+ /** True after the processor matched work but user tables still have 0 rows. */
179
+ emptyMapping: boolean
180
+ };
181
+ sync: SubgraphSyncInfo;
182
+ tables: Record<string, {
183
+ endpoint: string
184
+ columns: Record<string, {
185
+ type: string
186
+ nullable?: boolean
187
+ indexed?: boolean
188
+ searchable?: boolean
189
+ default?: string | number | boolean
190
+ }>
191
+ rowCount: number
192
+ example: string
193
+ indexes?: readonly (readonly string[])[]
194
+ uniqueKeys?: readonly (readonly string[])[]
195
+ }>;
196
+ createdAt: string;
197
+ updatedAt: string;
198
+ }
199
+ interface SubgraphGapEntry {
200
+ start: number;
201
+ end: number;
202
+ size: number;
203
+ reason: string;
204
+ detectedAt: string;
205
+ resolvedAt: string | null;
206
+ }
207
+ interface SubgraphGapsResponse {
208
+ data: SubgraphGapEntry[];
209
+ meta: {
210
+ total: number
211
+ totalMissingBlocks: number
212
+ limit: number
213
+ offset: number
214
+ };
215
+ }
216
+ interface ReindexResponse {
217
+ message: string;
218
+ fromBlock: number;
219
+ toBlock: number | string;
220
+ operationId?: string;
221
+ status?: "queued" | "running" | "cancel_requested";
222
+ }
223
+ interface SubgraphQueryParams {
224
+ sort?: string;
225
+ order?: string;
226
+ limit?: number;
227
+ offset?: number;
228
+ fields?: string;
229
+ filters?: Record<string, string>;
230
+ }
231
+ /**
232
+ * Request shape for `GET /v1/subgraphs/:subgraphName/:tableName/aggregate`.
233
+ * `filters` reuses the list/count where-surface; the rest name the columns to
234
+ * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).
235
+ */
236
+ interface SubgraphAggregateParams {
237
+ filters?: Record<string, string>;
238
+ count?: boolean;
239
+ countDistinct?: string[];
240
+ sum?: string[];
241
+ min?: string[];
242
+ max?: string[];
243
+ }
244
+ /**
245
+ * Aggregate response. Keys are present only for requested aggregates.
246
+ * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`
247
+ * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `"0"`;
248
+ * `min`/`max` are `null` when the filtered set is empty or all-null.
249
+ */
250
+ interface SubgraphAggregateResponse {
251
+ count?: number;
252
+ countDistinct?: Record<string, number>;
253
+ sum?: Record<string, string>;
254
+ min?: Record<string, string | null>;
255
+ max?: Record<string, string | null>;
256
+ }
21
257
  interface BlocksTable {
22
258
  height: number;
23
259
  hash: string;
@@ -178,6 +414,14 @@ interface SubgraphsTable {
178
414
  expires_at: Date | null;
179
415
  /** (event type, contract) probe pairs persisted at deploy for weight classification. */
180
416
  sparse_probe_targets: unknown | null;
417
+ /** sha256 over everything that shapes rows (schema, handler bundle,
418
+ * startBlock, network, runtime). NULL for unbundled or older deploys. */
419
+ pin: string | null;
420
+ /** The canonical JSON `pin` hashes, so a client can recompute it. NULL
421
+ * wherever `pin` is, and for deploys before migration 0158. */
422
+ pin_preimage: string | null;
423
+ /** Level derived at deploy. NULL (older deploys) = not verifiable. */
424
+ verification: SubgraphVerification | null;
181
425
  created_at: Generated<Date>;
182
426
  updated_at: Generated<Date>;
183
427
  }
@@ -2449,213 +2693,6 @@ declare class Logger {
2449
2693
  error(message: string, meta?: Record<string, any>): void;
2450
2694
  }
2451
2695
  declare const logger: Logger;
2452
- import { z as z2 } from "zod";
2453
- interface DeploySubgraphRequest {
2454
- name: string;
2455
- description?: string;
2456
- sources: Record<string, Record<string, unknown>>;
2457
- schema: Record<string, unknown>;
2458
- handlerCode: string;
2459
- /** Override the definition's startBlock for this deploy only. */
2460
- startBlock?: number;
2461
- /** Original TypeScript source, persisted so chat can read/diff/edit later. */
2462
- sourceCode?: string;
2463
- /** Validate the definition + print the DDL plan without deploying. */
2464
- dryRun?: boolean;
2465
- }
2466
- declare const DeploySubgraphRequestSchema: z2.ZodType<DeploySubgraphRequest>;
2467
- interface DeploySubgraphResponse {
2468
- action: "created" | "unchanged" | "handler_updated" | "updated" | "reindexed";
2469
- subgraphId: string;
2470
- version: string;
2471
- message: string;
2472
- /** Effective indexing start height. */
2473
- start_block?: number;
2474
- operationId?: string;
2475
- reindexStarted?: boolean;
2476
- /** Bounded candidate-event denominator for the reindex just started, when the
2477
- * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate
2478
- * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */
2479
- estimatedEvents?: number;
2480
- /** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */
2481
- warnings?: string[];
2482
- diff?: {
2483
- addedTables: string[]
2484
- removedTables: string[]
2485
- addedColumns: Record<string, string[]>
2486
- breakingChanges: string[]
2487
- };
2488
- }
2489
- /** Prefix of the `last_error` a billing-paused subgraph carries, e.g.
2490
- * `billing_paused: spend_cap_reached`. Stable: the processor writes it and
2491
- * the watchdog and CLI key off it. */
2492
- declare const BILLING_PAUSED_PREFIX = "billing_paused: ";
2493
- /** The billing code in a subgraph's `last_error`, or `null` when it isn't a
2494
- * billing pause. */
2495
- declare function billingPausedCode(lastError: string | null | undefined): string | null;
2496
- interface SubgraphSummary {
2497
- name: string;
2498
- version: string;
2499
- status: string;
2500
- lastProcessedBlock: number;
2501
- totalProcessed: number;
2502
- totalRows?: number;
2503
- totalErrors: number;
2504
- tables: string[];
2505
- chainTip: number;
2506
- sourceChainTip?: number;
2507
- targetBlock?: number;
2508
- progress: number;
2509
- blocksRemaining?: number;
2510
- syncMode?: "sync" | "reindex";
2511
- gapCount: number;
2512
- /** history_filling = expected gaps while a tip-first backfill op runs. */
2513
- integrity: "complete" | "gaps_detected" | "history_filling";
2514
- /** Most recent indexing error reason + when it occurred, if any. */
2515
- lastError?: string | null;
2516
- lastErrorAt?: string | null;
2517
- /** Last row mutation timestamp; powers per-card freshness. */
2518
- updatedAt?: string | null;
2519
- /** Number of webhooks attached to this subgraph. */
2520
- webhookCount?: number;
2521
- createdAt: string;
2522
- }
2523
- interface SubgraphGapRange {
2524
- start: number;
2525
- end: number;
2526
- size: number;
2527
- reason: string;
2528
- }
2529
- interface SubgraphSyncInfo {
2530
- status: "synced" | "catching_up" | "reindexing" | "error";
2531
- mode?: "sync" | "reindex";
2532
- startBlock: number;
2533
- lastProcessedBlock: number;
2534
- /**
2535
- * Backward-compatible denominator for progress displays. During reindexing,
2536
- * this is the reindex target block rather than the live source chain tip.
2537
- */
2538
- chainTip: number;
2539
- sourceChainTip?: number;
2540
- targetBlock?: number;
2541
- blocksRemaining: number;
2542
- processedBlocks?: number;
2543
- totalBlocks?: number;
2544
- progress: number;
2545
- /** Present while the populating operation is queued: approximate claim
2546
- * position + honest event denominator + naive start estimate. */
2547
- queue?: {
2548
- position: number | null
2549
- estimatedEvents: number | null
2550
- estimatedStartSeconds: number | null
2551
- };
2552
- /** Event-based progress for sparse syncs (block pct is meaningless when
2553
- * most heights are skipped). */
2554
- estimatedEvents?: number;
2555
- processedEvents?: number;
2556
- etaSeconds?: number | null;
2557
- gaps: {
2558
- count: number
2559
- totalMissingBlocks: number
2560
- ranges: SubgraphGapRange[]
2561
- };
2562
- /** history_filling = expected gaps while a tip-first backfill op runs. */
2563
- integrity: "complete" | "gaps_detected" | "history_filling";
2564
- }
2565
- interface SubgraphDetail {
2566
- name: string;
2567
- version: string;
2568
- schemaHash?: string;
2569
- status: string;
2570
- lastProcessedBlock: number;
2571
- description?: string;
2572
- sources?: Record<string, unknown>;
2573
- definition?: Record<string, unknown>;
2574
- health: {
2575
- totalProcessed: number
2576
- totalErrors: number
2577
- errorRate: number
2578
- lastError: string | null
2579
- lastErrorAt: string | null
2580
- /** True after the processor matched work but user tables still have 0 rows. */
2581
- emptyMapping: boolean
2582
- };
2583
- sync: SubgraphSyncInfo;
2584
- tables: Record<string, {
2585
- endpoint: string
2586
- columns: Record<string, {
2587
- type: string
2588
- nullable?: boolean
2589
- indexed?: boolean
2590
- searchable?: boolean
2591
- default?: string | number | boolean
2592
- }>
2593
- rowCount: number
2594
- example: string
2595
- indexes?: readonly (readonly string[])[]
2596
- uniqueKeys?: readonly (readonly string[])[]
2597
- }>;
2598
- createdAt: string;
2599
- updatedAt: string;
2600
- }
2601
- interface SubgraphGapEntry {
2602
- start: number;
2603
- end: number;
2604
- size: number;
2605
- reason: string;
2606
- detectedAt: string;
2607
- resolvedAt: string | null;
2608
- }
2609
- interface SubgraphGapsResponse {
2610
- data: SubgraphGapEntry[];
2611
- meta: {
2612
- total: number
2613
- totalMissingBlocks: number
2614
- limit: number
2615
- offset: number
2616
- };
2617
- }
2618
- interface ReindexResponse {
2619
- message: string;
2620
- fromBlock: number;
2621
- toBlock: number | string;
2622
- operationId?: string;
2623
- status?: "queued" | "running" | "cancel_requested";
2624
- }
2625
- interface SubgraphQueryParams {
2626
- sort?: string;
2627
- order?: string;
2628
- limit?: number;
2629
- offset?: number;
2630
- fields?: string;
2631
- filters?: Record<string, string>;
2632
- }
2633
- /**
2634
- * Request shape for `GET /v1/subgraphs/:subgraphName/:tableName/aggregate`.
2635
- * `filters` reuses the list/count where-surface; the rest name the columns to
2636
- * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).
2637
- */
2638
- interface SubgraphAggregateParams {
2639
- filters?: Record<string, string>;
2640
- count?: boolean;
2641
- countDistinct?: string[];
2642
- sum?: string[];
2643
- min?: string[];
2644
- max?: string[];
2645
- }
2646
- /**
2647
- * Aggregate response. Keys are present only for requested aggregates.
2648
- * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`
2649
- * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `"0"`;
2650
- * `min`/`max` are `null` when the filtered set is empty or all-null.
2651
- */
2652
- interface SubgraphAggregateResponse {
2653
- count?: number;
2654
- countDistinct?: Record<string, number>;
2655
- sum?: Record<string, string>;
2656
- min?: Record<string, string | null>;
2657
- max?: Record<string, string | null>;
2658
- }
2659
2696
  import { z as z3 } from "zod";
2660
2697
  declare const WEBHOOK_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
2661
2698
  declare const WEBHOOK_RUNTIMES: readonly ["inngest", "trigger", "cloudflare", "node"];
@@ -2990,6 +3027,7 @@ interface SubgraphAgentSchema {
2990
3027
  version: string;
2991
3028
  description?: string;
2992
3029
  schemaHash?: string;
3030
+ pin?: string;
2993
3031
  generatedAt: string;
2994
3032
  serverUrl: string;
2995
3033
  sources?: Record<string, unknown>;
@@ -3406,4 +3444,4 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
3406
3444
  declare function ed25519KeyId(publicKeyPem: string): string;
3407
3445
  declare function signEd25519(payload: string, privateKey: KeyObject): string;
3408
3446
  declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
3409
- export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ArchiveFetch, ArchiveFetchesTable, AuthenticationError, AuthorizationError, BILLING_PAUSED_PREFIX, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, CHAIN_TRIGGER_FIELDS, CHAIN_TRIGGER_TYPES, CODE_TO_STATUS, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReadCacheTable, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainReorgsTable, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTxLevelEvent, ChainWebhookDelivery, ChainWebhookEnvelope, Contract, ContractsTable, CoverageSegmentsTable, CreateWebhookRequest, CreateWebhookRequestSchema, CreateWebhookResponse, DB_TO_STREAMS_EVENT_TYPE, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DEFAULT_BTC_CONFIRMATIONS, Database, DatabaseError, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadRow, DecodedEventType2 as DecodedEventType, DecodedEventsTable, DecoderCheckpointsTable, DeliveryRow, DeploySubgraphRequest, DeploySubgraphRequestSchema, DeploySubgraphResponse, EMPTY_RANGE_EVENT_INDEX_SENTINEL, Env, ErrorCode, ErrorCodes, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, ForbiddenError, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertArchiveFetch, InsertBlock, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InstancesTable, KeyRotatedError, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NotFoundError, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, ParsedCreateWebhookRequest, ParsedReplayWebhookRequest, ParsedUpdateWebhookRequest, PaymentRequiredError, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RUNE_EVENT_TYPES, RateLimitError, ReindexResponse, RepairMode, ReplayResult, ReplayWebhookRequest, ReplayWebhookRequestSchema, RetryState, RotateSecretResponse, RunStatus, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneEventType, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, STREAMS_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_TO_DB_EVENT_TYPES, SbtcDepositEvent, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SbtcWithdrawalEvent, SbtcWithdrawalSweptConfirmedEvent, SecondLayerError, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, StreamsCursor, StreamsDbEventType, StreamsEventType, Subgraph, SubgraphAgentSchema, SubgraphAggregateParams, SubgraphAggregateResponse, SubgraphDetail, SubgraphGap, SubgraphGapEntry, SubgraphGapRange, SubgraphGapsResponse, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphQueryParams, SubgraphSpecFormat, SubgraphSpecOptions, SubgraphSummary, SubgraphSyncInfo, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, TenantSuspendedError, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UpdateWebhookRequest, UpdateWebhookRequestSchema, UsageLedgerRow, UsageLedgerTable, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_STORED_TO_NODE_TYPE, ValidationError, VersionConflictError, VmEvent, VmEventType, VmEventsArchiveTable, VmEventsTable, VmNodeEventType, WEBHOOK_FILTER_OPERATORS, WEBHOOK_FORMATS, WEBHOOK_RUNTIMES, WEBHOOK_STATUSES, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDetail, WebhookFilter, WebhookFilterClause, WebhookFilterClauseSchema, WebhookFilterOperator, WebhookFilterOperatorSchema, WebhookFilterPrimitive, WebhookFilterPrimitiveSchema, WebhookFilterSchema, WebhookFormat, WebhookFormatSchema, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookRuntime, WebhookRuntimeSchema, WebhookSchemaColumn, WebhookSchemaTable, WebhookSchemaTables, WebhookStatus, WebhookStatusSchema, WebhookSummary, WebhooksTable, applicationDatabaseUrl, assertDbSplit, billingPausedCode, blockEndCursor, closeDb, closeDbOrTimeout, committedHeight, compareStreamsCursor, exports_hmac as crypto, decodeStreamsCursor, describeDbUrl, exports_ed25519 as ed25519, encodeStreamsCursor, finalizedBurnHeight, formatWebhookSchemaErrors, generateSubgraphAgentSchema, generateSubgraphMarkdown, generateSubgraphOpenApi, generateSubgraphSpec, getDb, getDbSplitStatus, getEnv, getErrorMessage, getMigrationRole, getRawClient, getRawClientFor, getSourceDb, getTargetDb, isBnsDecoderEnabled, isEmptyRangeCursor, isPox4DecoderEnabled, isPox5DecoderEnabled, isSbtcDecoderEnabled, jsonb, logger, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql, validateWebhookFilterForTable };
3447
+ export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeysTable, ArchiveFetch, ArchiveFetchesTable, AuthenticationError, AuthorizationError, BILLING_PAUSED_PREFIX, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, CHAIN_TRIGGER_FIELDS, CHAIN_TRIGGER_TYPES, CODE_TO_STATUS, ChainApplyDeliveryOf, ChainApplyEnvelope, ChainApplyEnvelopeOf, ChainEventEnvelope, ChainFtBurnData, ChainFtMintData, ChainFtTransferData, ChainNftBurnData, ChainNftMintData, ChainNftTransferData, ChainPrintEventData, ChainReadCacheTable, ChainReorgOrphanedEntry, ChainReorgRollbackDelivery, ChainReorgRollbackEnvelope, ChainReorgsTable, ChainStxBurnData, ChainStxLockData, ChainStxMintData, ChainStxTransferData, ChainTestDelivery, ChainTxLevelEvent, ChainWebhookDelivery, ChainWebhookEnvelope, Contract, ContractsTable, CoverageSegmentsTable, CreateWebhookRequest, CreateWebhookRequestSchema, CreateWebhookResponse, DB_TO_STREAMS_EVENT_TYPE, DECODED_EVENT_TYPES2 as DECODED_EVENT_TYPES, DEFAULT_BTC_CONFIRMATIONS, Database, DatabaseError, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadRow, DecodedEventType2 as DecodedEventType, DecodedEventsTable, DecoderCheckpointsTable, DeliveryRow, DeploySubgraphRequest, DeploySubgraphRequestSchema, DeploySubgraphResponse, EMPTY_RANGE_EVENT_INDEX_SENTINEL, Env, ErrorCode, ErrorCodes, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, ForbiddenError, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertArchiveFetch, InsertBlock, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InstancesTable, KeyRotatedError, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NotFoundError, NumericAsText, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, ParsedCreateWebhookRequest, ParsedReplayWebhookRequest, ParsedUpdateWebhookRequest, PaymentRequiredError, PendingForkBlocksTable, Pox4CallsTable, Pox4FunctionName, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, RUNE_EVENT_TYPES, RateLimitError, ReindexResponse, RepairMode, ReplayResult, ReplayWebhookRequest, ReplayWebhookRequestSchema, RetryState, RotateSecretResponse, RunStatus, RuneApplyDeliveryOf, RuneApplyEnvelope, RuneEventType, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, STREAMS_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_TO_DB_EVENT_TYPES, SbtcDepositEvent, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SbtcTokenEventType, SbtcTokenEventsTable, SbtcWithdrawalEvent, SbtcWithdrawalSweptConfirmedEvent, SecondLayerError, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageBlockReceiptsTable, StageFailuresTable, StageKind, StageRegistryTable, StageRunsTable, StateWrite, StateWritesArchiveTable, StateWritesTable, StreamsCursor, StreamsDbEventType, StreamsEventType, Subgraph, SubgraphAgentSchema, SubgraphAggregateParams, SubgraphAggregateResponse, SubgraphDetail, SubgraphGap, SubgraphGapEntry, SubgraphGapRange, SubgraphGapsResponse, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphQueryParams, SubgraphSpecFormat, SubgraphSpecOptions, SubgraphSummary, SubgraphSyncInfo, SubgraphVerification, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, TenantSuspendedError, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSubgraph, UpdateSubgraphOperation, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UpdateWebhookRequest, UpdateWebhookRequestSchema, UsageLedgerRow, UsageLedgerTable, VM_EVENT_TYPES, VM_NODE_TO_STORED_TYPE2 as VM_NODE_TO_STORED_TYPE, VM_STORED_TO_NODE_TYPE, ValidationError, VersionConflictError, VmEvent, VmEventType, VmEventsArchiveTable, VmEventsTable, VmNodeEventType, WEBHOOK_FILTER_OPERATORS, WEBHOOK_FORMATS, WEBHOOK_RUNTIMES, WEBHOOK_STATUSES, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDetail, WebhookFilter, WebhookFilterClause, WebhookFilterClauseSchema, WebhookFilterOperator, WebhookFilterOperatorSchema, WebhookFilterPrimitive, WebhookFilterPrimitiveSchema, WebhookFilterSchema, WebhookFormat, WebhookFormatSchema, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookRuntime, WebhookRuntimeSchema, WebhookSchemaColumn, WebhookSchemaTable, WebhookSchemaTables, WebhookStatus, WebhookStatusSchema, WebhookSummary, WebhooksTable, applicationDatabaseUrl, assertDbSplit, billingPausedCode, blockEndCursor, closeDb, closeDbOrTimeout, committedHeight, compareStreamsCursor, exports_hmac as crypto, decodeStreamsCursor, describeDbUrl, exports_ed25519 as ed25519, encodeStreamsCursor, finalizedBurnHeight, formatWebhookSchemaErrors, generateSubgraphAgentSchema, generateSubgraphMarkdown, generateSubgraphOpenApi, generateSubgraphSpec, getDb, getDbSplitStatus, getEnv, getErrorMessage, getMigrationRole, getRawClient, getRawClientFor, getSourceDb, getTargetDb, isBnsDecoderEnabled, isEmptyRangeCursor, isPox4DecoderEnabled, isPox5DecoderEnabled, isSbtcDecoderEnabled, jsonb, logger, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql, validateWebhookFilterForTable };
package/dist/src/index.js CHANGED
@@ -1939,6 +1939,7 @@ function generateSubgraphAgentSchema(detail, options = {}) {
1939
1939
  version: detail.version,
1940
1940
  ...detail.description ? { description: detail.description } : {},
1941
1941
  ...detail.schemaHash ? { schemaHash: detail.schemaHash } : {},
1942
+ ...detail.pin ? { pin: detail.pin } : {},
1942
1943
  generatedAt: generatedAt(options),
1943
1944
  serverUrl,
1944
1945
  ...detail.sources ? { sources: detail.sources } : {},
@@ -2035,6 +2036,7 @@ function generateSubgraphOpenApi(detail, options = {}) {
2035
2036
  "x-secondlayer-subgraph": detail.name,
2036
2037
  "x-secondlayer-version": detail.version,
2037
2038
  "x-secondlayer-schema-hash": detail.schemaHash,
2039
+ ...detail.pin ? { "x-secondlayer-pin": detail.pin } : {},
2038
2040
  "x-secondlayer-generated-at": generatedAt(options),
2039
2041
  "x-secondlayer-sources": detail.sources ?? {},
2040
2042
  "x-secondlayer-tables": Object.keys(detail.tables)
@@ -2047,6 +2049,7 @@ function generateSubgraphMarkdown(detail, options = {}) {
2047
2049
  "",
2048
2050
  `Version: ${detail.version}`,
2049
2051
  detail.schemaHash ? `Schema hash: ${detail.schemaHash}` : undefined,
2052
+ detail.pin ? `Pin: ${detail.pin}` : undefined,
2050
2053
  `Server: ${agent.serverUrl}`,
2051
2054
  "Responses use the `{ rows, next_cursor, tip }` envelope; paginate with `?cursor=<next_cursor>` and `_order=asc|desc` (`_offset` is rejected).",
2052
2055
  "",
@@ -2274,5 +2277,5 @@ export {
2274
2277
  validateWebhookFilterForTable
2275
2278
  };
2276
2279
 
2277
- //# debugId=3D443FA10F99DD7264756E2164756E21
2280
+ //# debugId=77D2A28970490BCD64756E2164756E21
2278
2281
  //# sourceMappingURL=index.js.map