@secondlayer/shared 11.20.0 → 11.22.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 (43) hide show
  1. package/dist/src/archive/range-digest.d.ts +65 -0
  2. package/dist/src/archive/semantic-digest-builder.d.ts +65 -0
  3. package/dist/src/classify/index.d.ts +83 -0
  4. package/dist/src/classify/index.js +464 -0
  5. package/dist/src/classify/index.js.map +18 -0
  6. package/dist/src/coverage/index.d.ts +65 -0
  7. package/dist/src/db/index.d.ts +72 -1
  8. package/dist/src/db/index.js +3 -1
  9. package/dist/src/db/index.js.map +3 -3
  10. package/dist/src/db/queries/chain-reorgs.d.ts +65 -0
  11. package/dist/src/db/queries/chain-reorgs.js +3 -1
  12. package/dist/src/db/queries/chain-reorgs.js.map +3 -3
  13. package/dist/src/db/queries/contracts.d.ts +65 -0
  14. package/dist/src/db/queries/instance.d.ts +65 -0
  15. package/dist/src/db/queries/integrity.d.ts +65 -0
  16. package/dist/src/db/queries/subgraph-gaps.d.ts +65 -0
  17. package/dist/src/db/queries/subgraph-operations.d.ts +65 -0
  18. package/dist/src/db/queries/subgraphs.d.ts +69 -0
  19. package/dist/src/db/queries/subgraphs.js +10 -2
  20. package/dist/src/db/queries/subgraphs.js.map +4 -4
  21. package/dist/src/db/queries/sync-scope.d.ts +65 -0
  22. package/dist/src/db/queries/webhooks.d.ts +65 -0
  23. package/dist/src/db/schema.d.ts +70 -1
  24. package/dist/src/error-envelope.d.ts +48 -0
  25. package/dist/src/error-envelope.js +76 -0
  26. package/dist/src/error-envelope.js.map +10 -0
  27. package/dist/src/index.d.ts +288 -208
  28. package/dist/src/index.js +6 -1
  29. package/dist/src/index.js.map +5 -5
  30. package/dist/src/node/local-client.d.ts +65 -0
  31. package/dist/src/queue/listener.js +3 -1
  32. package/dist/src/queue/listener.js.map +3 -3
  33. package/dist/src/schemas/index.d.ts +30 -1
  34. package/dist/src/schemas/index.js.map +2 -2
  35. package/dist/src/schemas/subgraphs.d.ts +30 -1
  36. package/dist/src/schemas/subgraphs.js.map +2 -2
  37. package/dist/src/subgraphs/spec.d.ts +27 -0
  38. package/dist/src/subgraphs/spec.js +4 -1
  39. package/dist/src/subgraphs/spec.js.map +3 -3
  40. package/migrations/0155_api_failed_requests.ts +37 -0
  41. package/migrations/0156_feedback_tickets.ts +47 -0
  42. package/migrations/0157_subgraph_pin_verification.ts +35 -0
  43. package/package.json +17 -1
@@ -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,11 @@ 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
+ /** Level derived at deploy. NULL (older deploys) = not verifiable. */
421
+ verification: SubgraphVerification | null;
181
422
  created_at: Generated<Date>;
182
423
  updated_at: Generated<Date>;
183
424
  }
@@ -846,6 +1087,8 @@ interface Database {
846
1087
  sentinel_accounts: SentinelAccountsTable;
847
1088
  waitlists: WaitlistsTable;
848
1089
  waitlist_signups: WaitlistSignupsTable;
1090
+ api_failed_requests: ApiFailedRequestsTable;
1091
+ feedback_tickets: FeedbackTicketsTable;
849
1092
  }
850
1093
  interface ServiceHeartbeatsTable {
851
1094
  name: string;
@@ -1119,6 +1362,47 @@ interface WaitlistSignupsTable {
1119
1362
  answers: Record<string, unknown>;
1120
1363
  created_at: Generated<Date>;
1121
1364
  }
1365
+ /**
1366
+ * 24h hosted record of a failed API request, keyed by `request_id` and
1367
+ * scoped to the account that made it. `query` is redacted before insert.
1368
+ */
1369
+ interface ApiFailedRequestsTable {
1370
+ request_id: string;
1371
+ account_id: string;
1372
+ method: string;
1373
+ path: string;
1374
+ status: number;
1375
+ code: string;
1376
+ message: Generated<string>;
1377
+ query: Record<string, unknown>;
1378
+ origin: string | null;
1379
+ created_at: Generated<Date>;
1380
+ }
1381
+ type ApiFailedRequest = Selectable<ApiFailedRequestsTable>;
1382
+ type InsertApiFailedRequest = Insertable<ApiFailedRequestsTable>;
1383
+ /**
1384
+ * Hosted problem report. `attempted` is the server's own copy of the failed
1385
+ * request (never caller-supplied); `status` starts `new` until classified.
1386
+ */
1387
+ interface FeedbackTicketsTable {
1388
+ id: Generated<string>;
1389
+ account_id: string;
1390
+ idempotency_key: string | null;
1391
+ request_id: string | null;
1392
+ intent: string;
1393
+ expected: Record<string, unknown> | null;
1394
+ kind_hint: string | null;
1395
+ evidence: Record<string, unknown> | null;
1396
+ attempted: Record<string, unknown> | null;
1397
+ origin: string;
1398
+ status: Generated<"new" | "classified">;
1399
+ route: string | null;
1400
+ classification: Record<string, unknown> | null;
1401
+ classified_at: Date | null;
1402
+ created_at: Generated<Date>;
1403
+ }
1404
+ type FeedbackTicket = Selectable<FeedbackTicketsTable>;
1405
+ type InsertFeedbackTicket = Insertable<FeedbackTicketsTable>;
1122
1406
  type Waitlist = Selectable<WaitlistsTable>;
1123
1407
  type WaitlistSignup = Selectable<WaitlistSignupsTable>;
1124
1408
  type InsertWaitlistSignup = Insertable<WaitlistSignupsTable>;
@@ -2152,6 +2436,8 @@ declare const TABLE_TO_DB: {
2152
2436
  sentinel_accounts: string
2153
2437
  waitlists: string
2154
2438
  waitlist_signups: string
2439
+ api_failed_requests: string
2440
+ feedback_tickets: string
2155
2441
  service_heartbeats: string
2156
2442
  };
2157
2443
  /** OSS: one application URL. SOURCE_/TARGET_ are hosted split only. */
@@ -2404,213 +2690,6 @@ declare class Logger {
2404
2690
  error(message: string, meta?: Record<string, any>): void;
2405
2691
  }
2406
2692
  declare const logger: Logger;
2407
- import { z as z2 } from "zod";
2408
- interface DeploySubgraphRequest {
2409
- name: string;
2410
- description?: string;
2411
- sources: Record<string, Record<string, unknown>>;
2412
- schema: Record<string, unknown>;
2413
- handlerCode: string;
2414
- /** Override the definition's startBlock for this deploy only. */
2415
- startBlock?: number;
2416
- /** Original TypeScript source, persisted so chat can read/diff/edit later. */
2417
- sourceCode?: string;
2418
- /** Validate the definition + print the DDL plan without deploying. */
2419
- dryRun?: boolean;
2420
- }
2421
- declare const DeploySubgraphRequestSchema: z2.ZodType<DeploySubgraphRequest>;
2422
- interface DeploySubgraphResponse {
2423
- action: "created" | "unchanged" | "handler_updated" | "updated" | "reindexed";
2424
- subgraphId: string;
2425
- version: string;
2426
- message: string;
2427
- /** Effective indexing start height. */
2428
- start_block?: number;
2429
- operationId?: string;
2430
- reindexStarted?: boolean;
2431
- /** Bounded candidate-event denominator for the reindex just started, when the
2432
- * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate
2433
- * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */
2434
- estimatedEvents?: number;
2435
- /** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */
2436
- warnings?: string[];
2437
- diff?: {
2438
- addedTables: string[]
2439
- removedTables: string[]
2440
- addedColumns: Record<string, string[]>
2441
- breakingChanges: string[]
2442
- };
2443
- }
2444
- /** Prefix of the `last_error` a billing-paused subgraph carries, e.g.
2445
- * `billing_paused: spend_cap_reached`. Stable: the processor writes it and
2446
- * the watchdog and CLI key off it. */
2447
- declare const BILLING_PAUSED_PREFIX = "billing_paused: ";
2448
- /** The billing code in a subgraph's `last_error`, or `null` when it isn't a
2449
- * billing pause. */
2450
- declare function billingPausedCode(lastError: string | null | undefined): string | null;
2451
- interface SubgraphSummary {
2452
- name: string;
2453
- version: string;
2454
- status: string;
2455
- lastProcessedBlock: number;
2456
- totalProcessed: number;
2457
- totalRows?: number;
2458
- totalErrors: number;
2459
- tables: string[];
2460
- chainTip: number;
2461
- sourceChainTip?: number;
2462
- targetBlock?: number;
2463
- progress: number;
2464
- blocksRemaining?: number;
2465
- syncMode?: "sync" | "reindex";
2466
- gapCount: number;
2467
- /** history_filling = expected gaps while a tip-first backfill op runs. */
2468
- integrity: "complete" | "gaps_detected" | "history_filling";
2469
- /** Most recent indexing error reason + when it occurred, if any. */
2470
- lastError?: string | null;
2471
- lastErrorAt?: string | null;
2472
- /** Last row mutation timestamp; powers per-card freshness. */
2473
- updatedAt?: string | null;
2474
- /** Number of webhooks attached to this subgraph. */
2475
- webhookCount?: number;
2476
- createdAt: string;
2477
- }
2478
- interface SubgraphGapRange {
2479
- start: number;
2480
- end: number;
2481
- size: number;
2482
- reason: string;
2483
- }
2484
- interface SubgraphSyncInfo {
2485
- status: "synced" | "catching_up" | "reindexing" | "error";
2486
- mode?: "sync" | "reindex";
2487
- startBlock: number;
2488
- lastProcessedBlock: number;
2489
- /**
2490
- * Backward-compatible denominator for progress displays. During reindexing,
2491
- * this is the reindex target block rather than the live source chain tip.
2492
- */
2493
- chainTip: number;
2494
- sourceChainTip?: number;
2495
- targetBlock?: number;
2496
- blocksRemaining: number;
2497
- processedBlocks?: number;
2498
- totalBlocks?: number;
2499
- progress: number;
2500
- /** Present while the populating operation is queued: approximate claim
2501
- * position + honest event denominator + naive start estimate. */
2502
- queue?: {
2503
- position: number | null
2504
- estimatedEvents: number | null
2505
- estimatedStartSeconds: number | null
2506
- };
2507
- /** Event-based progress for sparse syncs (block pct is meaningless when
2508
- * most heights are skipped). */
2509
- estimatedEvents?: number;
2510
- processedEvents?: number;
2511
- etaSeconds?: number | null;
2512
- gaps: {
2513
- count: number
2514
- totalMissingBlocks: number
2515
- ranges: SubgraphGapRange[]
2516
- };
2517
- /** history_filling = expected gaps while a tip-first backfill op runs. */
2518
- integrity: "complete" | "gaps_detected" | "history_filling";
2519
- }
2520
- interface SubgraphDetail {
2521
- name: string;
2522
- version: string;
2523
- schemaHash?: string;
2524
- status: string;
2525
- lastProcessedBlock: number;
2526
- description?: string;
2527
- sources?: Record<string, unknown>;
2528
- definition?: Record<string, unknown>;
2529
- health: {
2530
- totalProcessed: number
2531
- totalErrors: number
2532
- errorRate: number
2533
- lastError: string | null
2534
- lastErrorAt: string | null
2535
- /** True after the processor matched work but user tables still have 0 rows. */
2536
- emptyMapping: boolean
2537
- };
2538
- sync: SubgraphSyncInfo;
2539
- tables: Record<string, {
2540
- endpoint: string
2541
- columns: Record<string, {
2542
- type: string
2543
- nullable?: boolean
2544
- indexed?: boolean
2545
- searchable?: boolean
2546
- default?: string | number | boolean
2547
- }>
2548
- rowCount: number
2549
- example: string
2550
- indexes?: readonly (readonly string[])[]
2551
- uniqueKeys?: readonly (readonly string[])[]
2552
- }>;
2553
- createdAt: string;
2554
- updatedAt: string;
2555
- }
2556
- interface SubgraphGapEntry {
2557
- start: number;
2558
- end: number;
2559
- size: number;
2560
- reason: string;
2561
- detectedAt: string;
2562
- resolvedAt: string | null;
2563
- }
2564
- interface SubgraphGapsResponse {
2565
- data: SubgraphGapEntry[];
2566
- meta: {
2567
- total: number
2568
- totalMissingBlocks: number
2569
- limit: number
2570
- offset: number
2571
- };
2572
- }
2573
- interface ReindexResponse {
2574
- message: string;
2575
- fromBlock: number;
2576
- toBlock: number | string;
2577
- operationId?: string;
2578
- status?: "queued" | "running" | "cancel_requested";
2579
- }
2580
- interface SubgraphQueryParams {
2581
- sort?: string;
2582
- order?: string;
2583
- limit?: number;
2584
- offset?: number;
2585
- fields?: string;
2586
- filters?: Record<string, string>;
2587
- }
2588
- /**
2589
- * Request shape for `GET /v1/subgraphs/:subgraphName/:tableName/aggregate`.
2590
- * `filters` reuses the list/count where-surface; the rest name the columns to
2591
- * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).
2592
- */
2593
- interface SubgraphAggregateParams {
2594
- filters?: Record<string, string>;
2595
- count?: boolean;
2596
- countDistinct?: string[];
2597
- sum?: string[];
2598
- min?: string[];
2599
- max?: string[];
2600
- }
2601
- /**
2602
- * Aggregate response. Keys are present only for requested aggregates.
2603
- * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`
2604
- * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `"0"`;
2605
- * `min`/`max` are `null` when the filtered set is empty or all-null.
2606
- */
2607
- interface SubgraphAggregateResponse {
2608
- count?: number;
2609
- countDistinct?: Record<string, number>;
2610
- sum?: Record<string, string>;
2611
- min?: Record<string, string | null>;
2612
- max?: Record<string, string | null>;
2613
- }
2614
2693
  import { z as z3 } from "zod";
2615
2694
  declare const WEBHOOK_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
2616
2695
  declare const WEBHOOK_RUNTIMES: readonly ["inngest", "trigger", "cloudflare", "node"];
@@ -2945,6 +3024,7 @@ interface SubgraphAgentSchema {
2945
3024
  version: string;
2946
3025
  description?: string;
2947
3026
  schemaHash?: string;
3027
+ pin?: string;
2948
3028
  generatedAt: string;
2949
3029
  serverUrl: string;
2950
3030
  sources?: Record<string, unknown>;
@@ -3361,4 +3441,4 @@ declare function publicKeyPemFromPrivate(privateKeyPem: string): string;
3361
3441
  declare function ed25519KeyId(publicKeyPem: string): string;
3362
3442
  declare function signEd25519(payload: string, privateKey: KeyObject): string;
3363
3443
  declare function verifyEd25519(payload: string, signatureBase64: string, publicKey: KeyObject): boolean;
3364
- export { Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, 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, ForbiddenError, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiKey, InsertArchiveFetch, InsertBlock, InsertContract, InsertEvent, 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 };
3444
+ 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
@@ -862,6 +862,8 @@ var TABLE_TO_DB = {
862
862
  sentinel_accounts: "target",
863
863
  waitlists: "target",
864
864
  waitlist_signups: "target",
865
+ api_failed_requests: "target",
866
+ feedback_tickets: "target",
865
867
  service_heartbeats: "both"
866
868
  };
867
869
 
@@ -1937,6 +1939,7 @@ function generateSubgraphAgentSchema(detail, options = {}) {
1937
1939
  version: detail.version,
1938
1940
  ...detail.description ? { description: detail.description } : {},
1939
1941
  ...detail.schemaHash ? { schemaHash: detail.schemaHash } : {},
1942
+ ...detail.pin ? { pin: detail.pin } : {},
1940
1943
  generatedAt: generatedAt(options),
1941
1944
  serverUrl,
1942
1945
  ...detail.sources ? { sources: detail.sources } : {},
@@ -2033,6 +2036,7 @@ function generateSubgraphOpenApi(detail, options = {}) {
2033
2036
  "x-secondlayer-subgraph": detail.name,
2034
2037
  "x-secondlayer-version": detail.version,
2035
2038
  "x-secondlayer-schema-hash": detail.schemaHash,
2039
+ ...detail.pin ? { "x-secondlayer-pin": detail.pin } : {},
2036
2040
  "x-secondlayer-generated-at": generatedAt(options),
2037
2041
  "x-secondlayer-sources": detail.sources ?? {},
2038
2042
  "x-secondlayer-tables": Object.keys(detail.tables)
@@ -2045,6 +2049,7 @@ function generateSubgraphMarkdown(detail, options = {}) {
2045
2049
  "",
2046
2050
  `Version: ${detail.version}`,
2047
2051
  detail.schemaHash ? `Schema hash: ${detail.schemaHash}` : undefined,
2052
+ detail.pin ? `Pin: ${detail.pin}` : undefined,
2048
2053
  `Server: ${agent.serverUrl}`,
2049
2054
  "Responses use the `{ rows, next_cursor, tip }` envelope; paginate with `?cursor=<next_cursor>` and `_order=asc|desc` (`_offset` is rejected).",
2050
2055
  "",
@@ -2272,5 +2277,5 @@ export {
2272
2277
  validateWebhookFilterForTable
2273
2278
  };
2274
2279
 
2275
- //# debugId=7E87D9FDD1A5A0B364756E2164756E21
2280
+ //# debugId=77D2A28970490BCD64756E2164756E21
2276
2281
  //# sourceMappingURL=index.js.map