@secondlayer/shared 6.24.0 → 6.26.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.
@@ -977,6 +977,733 @@ declare const SOURCE_READ_COLUMNS: {
977
977
  readonly events: readonly ["block_height", "data", "event_index", "tx_id", "type"]
978
978
  readonly chain_reorgs: readonly ["detected_at"]
979
979
  };
980
+ /** Portable column type for the Index read domain (a lean, ORM-agnostic vocab). */
981
+ type IndexColumnType = "text" | "int" | "boolean" | "timestamp" | "jsonb";
982
+ interface IndexColumn {
983
+ type: IndexColumnType;
984
+ /** SELECT type includes `| null`. Omitted = NOT NULL. */
985
+ nullable?: boolean;
986
+ }
987
+ declare const SOURCE_READ_TYPES: {
988
+ readonly blocks: {
989
+ readonly burn_block_hash: {
990
+ readonly type: "text"
991
+ readonly nullable: true
992
+ }
993
+ readonly burn_block_height: {
994
+ readonly type: "int"
995
+ }
996
+ readonly canonical: {
997
+ readonly type: "boolean"
998
+ }
999
+ readonly hash: {
1000
+ readonly type: "text"
1001
+ }
1002
+ readonly height: {
1003
+ readonly type: "int"
1004
+ }
1005
+ readonly parent_hash: {
1006
+ readonly type: "text"
1007
+ }
1008
+ readonly timestamp: {
1009
+ readonly type: "int"
1010
+ }
1011
+ }
1012
+ readonly decoded_events: {
1013
+ readonly amount: {
1014
+ readonly type: "text"
1015
+ readonly nullable: true
1016
+ }
1017
+ readonly asset_identifier: {
1018
+ readonly type: "text"
1019
+ readonly nullable: true
1020
+ }
1021
+ readonly block_height: {
1022
+ readonly type: "int"
1023
+ }
1024
+ readonly canonical: {
1025
+ readonly type: "boolean"
1026
+ }
1027
+ readonly contract_id: {
1028
+ readonly type: "text"
1029
+ readonly nullable: true
1030
+ }
1031
+ readonly cursor: {
1032
+ readonly type: "text"
1033
+ }
1034
+ readonly event_index: {
1035
+ readonly type: "int"
1036
+ }
1037
+ readonly event_type: {
1038
+ readonly type: "text"
1039
+ }
1040
+ readonly memo: {
1041
+ readonly type: "text"
1042
+ readonly nullable: true
1043
+ }
1044
+ readonly payload: {
1045
+ readonly type: "jsonb"
1046
+ readonly nullable: true
1047
+ }
1048
+ readonly recipient: {
1049
+ readonly type: "text"
1050
+ readonly nullable: true
1051
+ }
1052
+ readonly sender: {
1053
+ readonly type: "text"
1054
+ readonly nullable: true
1055
+ }
1056
+ readonly tx_id: {
1057
+ readonly type: "text"
1058
+ }
1059
+ readonly tx_index: {
1060
+ readonly type: "int"
1061
+ }
1062
+ readonly value: {
1063
+ readonly type: "text"
1064
+ readonly nullable: true
1065
+ }
1066
+ }
1067
+ readonly transactions: {
1068
+ readonly block_height: {
1069
+ readonly type: "int"
1070
+ }
1071
+ readonly contract_id: {
1072
+ readonly type: "text"
1073
+ readonly nullable: true
1074
+ }
1075
+ readonly function_args: {
1076
+ readonly type: "jsonb"
1077
+ readonly nullable: true
1078
+ }
1079
+ readonly function_name: {
1080
+ readonly type: "text"
1081
+ readonly nullable: true
1082
+ }
1083
+ readonly raw_result: {
1084
+ readonly type: "text"
1085
+ readonly nullable: true
1086
+ }
1087
+ readonly raw_tx: {
1088
+ readonly type: "text"
1089
+ }
1090
+ readonly sender: {
1091
+ readonly type: "text"
1092
+ }
1093
+ readonly status: {
1094
+ readonly type: "text"
1095
+ }
1096
+ readonly tx_id: {
1097
+ readonly type: "text"
1098
+ }
1099
+ readonly tx_index: {
1100
+ readonly type: "int"
1101
+ }
1102
+ readonly type: {
1103
+ readonly type: "text"
1104
+ }
1105
+ }
1106
+ readonly mempool_transactions: {
1107
+ readonly contract_id: {
1108
+ readonly type: "text"
1109
+ readonly nullable: true
1110
+ }
1111
+ readonly function_args: {
1112
+ readonly type: "jsonb"
1113
+ readonly nullable: true
1114
+ }
1115
+ readonly function_name: {
1116
+ readonly type: "text"
1117
+ readonly nullable: true
1118
+ }
1119
+ readonly raw_tx: {
1120
+ readonly type: "text"
1121
+ }
1122
+ readonly received_at: {
1123
+ readonly type: "timestamp"
1124
+ }
1125
+ readonly sender: {
1126
+ readonly type: "text"
1127
+ }
1128
+ readonly seq: {
1129
+ readonly type: "text"
1130
+ }
1131
+ readonly tx_id: {
1132
+ readonly type: "text"
1133
+ }
1134
+ readonly type: {
1135
+ readonly type: "text"
1136
+ }
1137
+ }
1138
+ readonly pox4_calls: {
1139
+ readonly aggregated_amount_ustx: {
1140
+ readonly type: "text"
1141
+ readonly nullable: true
1142
+ }
1143
+ readonly aggregated_signer_index: {
1144
+ readonly type: "int"
1145
+ readonly nullable: true
1146
+ }
1147
+ readonly amount_ustx: {
1148
+ readonly type: "text"
1149
+ readonly nullable: true
1150
+ }
1151
+ readonly auth_allowed: {
1152
+ readonly type: "boolean"
1153
+ readonly nullable: true
1154
+ }
1155
+ readonly auth_id: {
1156
+ readonly type: "text"
1157
+ readonly nullable: true
1158
+ }
1159
+ readonly auth_period: {
1160
+ readonly type: "int"
1161
+ readonly nullable: true
1162
+ }
1163
+ readonly auth_topic: {
1164
+ readonly type: "text"
1165
+ readonly nullable: true
1166
+ }
1167
+ readonly block_height: {
1168
+ readonly type: "int"
1169
+ }
1170
+ readonly block_time: {
1171
+ readonly type: "timestamp"
1172
+ }
1173
+ readonly burn_block_height: {
1174
+ readonly type: "int"
1175
+ }
1176
+ readonly caller: {
1177
+ readonly type: "text"
1178
+ }
1179
+ readonly canonical: {
1180
+ readonly type: "boolean"
1181
+ }
1182
+ readonly cursor: {
1183
+ readonly type: "text"
1184
+ }
1185
+ readonly delegate_to: {
1186
+ readonly type: "text"
1187
+ readonly nullable: true
1188
+ }
1189
+ readonly end_cycle: {
1190
+ readonly type: "int"
1191
+ readonly nullable: true
1192
+ }
1193
+ readonly function_name: {
1194
+ readonly type: "text"
1195
+ }
1196
+ readonly lock_period: {
1197
+ readonly type: "int"
1198
+ readonly nullable: true
1199
+ }
1200
+ readonly max_amount: {
1201
+ readonly type: "text"
1202
+ readonly nullable: true
1203
+ }
1204
+ readonly pox_addr_btc: {
1205
+ readonly type: "text"
1206
+ readonly nullable: true
1207
+ }
1208
+ readonly pox_addr_hashbytes: {
1209
+ readonly type: "text"
1210
+ readonly nullable: true
1211
+ }
1212
+ readonly pox_addr_version: {
1213
+ readonly type: "int"
1214
+ readonly nullable: true
1215
+ }
1216
+ readonly result_ok: {
1217
+ readonly type: "boolean"
1218
+ }
1219
+ readonly reward_cycle: {
1220
+ readonly type: "int"
1221
+ readonly nullable: true
1222
+ }
1223
+ readonly signer_key: {
1224
+ readonly type: "text"
1225
+ readonly nullable: true
1226
+ }
1227
+ readonly signer_signature: {
1228
+ readonly type: "text"
1229
+ readonly nullable: true
1230
+ }
1231
+ readonly source_cursor: {
1232
+ readonly type: "text"
1233
+ }
1234
+ readonly stacker: {
1235
+ readonly type: "text"
1236
+ readonly nullable: true
1237
+ }
1238
+ readonly start_cycle: {
1239
+ readonly type: "int"
1240
+ readonly nullable: true
1241
+ }
1242
+ readonly tx_id: {
1243
+ readonly type: "text"
1244
+ }
1245
+ readonly tx_index: {
1246
+ readonly type: "int"
1247
+ }
1248
+ }
1249
+ readonly sbtc_events: {
1250
+ readonly amount: {
1251
+ readonly type: "text"
1252
+ readonly nullable: true
1253
+ }
1254
+ readonly bitcoin_txid: {
1255
+ readonly type: "text"
1256
+ readonly nullable: true
1257
+ }
1258
+ readonly block_height: {
1259
+ readonly type: "int"
1260
+ }
1261
+ readonly block_time: {
1262
+ readonly type: "timestamp"
1263
+ }
1264
+ readonly burn_hash: {
1265
+ readonly type: "text"
1266
+ readonly nullable: true
1267
+ }
1268
+ readonly burn_height: {
1269
+ readonly type: "int"
1270
+ readonly nullable: true
1271
+ }
1272
+ readonly canonical: {
1273
+ readonly type: "boolean"
1274
+ }
1275
+ readonly cursor: {
1276
+ readonly type: "text"
1277
+ }
1278
+ readonly event_index: {
1279
+ readonly type: "int"
1280
+ }
1281
+ readonly fee: {
1282
+ readonly type: "text"
1283
+ readonly nullable: true
1284
+ }
1285
+ readonly governance_contract_type: {
1286
+ readonly type: "int"
1287
+ readonly nullable: true
1288
+ }
1289
+ readonly governance_new_contract: {
1290
+ readonly type: "text"
1291
+ readonly nullable: true
1292
+ }
1293
+ readonly max_fee: {
1294
+ readonly type: "text"
1295
+ readonly nullable: true
1296
+ }
1297
+ readonly output_index: {
1298
+ readonly type: "int"
1299
+ readonly nullable: true
1300
+ }
1301
+ readonly recipient_btc_hashbytes: {
1302
+ readonly type: "text"
1303
+ readonly nullable: true
1304
+ }
1305
+ readonly recipient_btc_version: {
1306
+ readonly type: "int"
1307
+ readonly nullable: true
1308
+ }
1309
+ readonly request_id: {
1310
+ readonly type: "int"
1311
+ readonly nullable: true
1312
+ }
1313
+ readonly sender: {
1314
+ readonly type: "text"
1315
+ readonly nullable: true
1316
+ }
1317
+ readonly signer_address: {
1318
+ readonly type: "text"
1319
+ readonly nullable: true
1320
+ }
1321
+ readonly signer_aggregate_pubkey: {
1322
+ readonly type: "text"
1323
+ readonly nullable: true
1324
+ }
1325
+ readonly signer_bitmap: {
1326
+ readonly type: "text"
1327
+ readonly nullable: true
1328
+ }
1329
+ readonly signer_keys_count: {
1330
+ readonly type: "int"
1331
+ readonly nullable: true
1332
+ }
1333
+ readonly signer_threshold: {
1334
+ readonly type: "int"
1335
+ readonly nullable: true
1336
+ }
1337
+ readonly sweep_txid: {
1338
+ readonly type: "text"
1339
+ readonly nullable: true
1340
+ }
1341
+ readonly topic: {
1342
+ readonly type: "text"
1343
+ }
1344
+ readonly tx_id: {
1345
+ readonly type: "text"
1346
+ }
1347
+ readonly tx_index: {
1348
+ readonly type: "int"
1349
+ }
1350
+ }
1351
+ readonly sbtc_token_events: {
1352
+ readonly amount: {
1353
+ readonly type: "text"
1354
+ }
1355
+ readonly block_height: {
1356
+ readonly type: "int"
1357
+ }
1358
+ readonly block_time: {
1359
+ readonly type: "timestamp"
1360
+ }
1361
+ readonly canonical: {
1362
+ readonly type: "boolean"
1363
+ }
1364
+ readonly cursor: {
1365
+ readonly type: "text"
1366
+ }
1367
+ readonly event_index: {
1368
+ readonly type: "int"
1369
+ }
1370
+ readonly event_type: {
1371
+ readonly type: "text"
1372
+ }
1373
+ readonly memo: {
1374
+ readonly type: "text"
1375
+ readonly nullable: true
1376
+ }
1377
+ readonly recipient: {
1378
+ readonly type: "text"
1379
+ readonly nullable: true
1380
+ }
1381
+ readonly sender: {
1382
+ readonly type: "text"
1383
+ readonly nullable: true
1384
+ }
1385
+ readonly tx_id: {
1386
+ readonly type: "text"
1387
+ }
1388
+ readonly tx_index: {
1389
+ readonly type: "int"
1390
+ }
1391
+ }
1392
+ readonly bns_name_events: {
1393
+ readonly block_height: {
1394
+ readonly type: "int"
1395
+ }
1396
+ readonly block_time: {
1397
+ readonly type: "timestamp"
1398
+ }
1399
+ readonly bns_id: {
1400
+ readonly type: "text"
1401
+ }
1402
+ readonly canonical: {
1403
+ readonly type: "boolean"
1404
+ }
1405
+ readonly cursor: {
1406
+ readonly type: "text"
1407
+ }
1408
+ readonly event_index: {
1409
+ readonly type: "int"
1410
+ }
1411
+ readonly fqn: {
1412
+ readonly type: "text"
1413
+ }
1414
+ readonly hashed_salted_fqn_preorder: {
1415
+ readonly type: "text"
1416
+ readonly nullable: true
1417
+ }
1418
+ readonly imported_at: {
1419
+ readonly type: "int"
1420
+ readonly nullable: true
1421
+ }
1422
+ readonly name: {
1423
+ readonly type: "text"
1424
+ }
1425
+ readonly namespace: {
1426
+ readonly type: "text"
1427
+ }
1428
+ readonly owner: {
1429
+ readonly type: "text"
1430
+ readonly nullable: true
1431
+ }
1432
+ readonly preordered_by: {
1433
+ readonly type: "text"
1434
+ readonly nullable: true
1435
+ }
1436
+ readonly registered_at: {
1437
+ readonly type: "int"
1438
+ readonly nullable: true
1439
+ }
1440
+ readonly renewal_height: {
1441
+ readonly type: "int"
1442
+ readonly nullable: true
1443
+ }
1444
+ readonly stx_burn: {
1445
+ readonly type: "text"
1446
+ readonly nullable: true
1447
+ }
1448
+ readonly topic: {
1449
+ readonly type: "text"
1450
+ }
1451
+ readonly tx_id: {
1452
+ readonly type: "text"
1453
+ }
1454
+ readonly tx_index: {
1455
+ readonly type: "int"
1456
+ }
1457
+ }
1458
+ readonly bns_namespace_events: {
1459
+ readonly block_height: {
1460
+ readonly type: "int"
1461
+ }
1462
+ readonly block_time: {
1463
+ readonly type: "timestamp"
1464
+ }
1465
+ readonly canonical: {
1466
+ readonly type: "boolean"
1467
+ }
1468
+ readonly cursor: {
1469
+ readonly type: "text"
1470
+ }
1471
+ readonly event_index: {
1472
+ readonly type: "int"
1473
+ }
1474
+ readonly launched_at: {
1475
+ readonly type: "int"
1476
+ readonly nullable: true
1477
+ }
1478
+ readonly lifetime: {
1479
+ readonly type: "int"
1480
+ readonly nullable: true
1481
+ }
1482
+ readonly manager: {
1483
+ readonly type: "text"
1484
+ readonly nullable: true
1485
+ }
1486
+ readonly manager_frozen: {
1487
+ readonly type: "boolean"
1488
+ readonly nullable: true
1489
+ }
1490
+ readonly manager_transfers_disabled: {
1491
+ readonly type: "boolean"
1492
+ readonly nullable: true
1493
+ }
1494
+ readonly namespace: {
1495
+ readonly type: "text"
1496
+ }
1497
+ readonly price_frozen: {
1498
+ readonly type: "boolean"
1499
+ readonly nullable: true
1500
+ }
1501
+ readonly price_function: {
1502
+ readonly type: "text"
1503
+ readonly nullable: true
1504
+ }
1505
+ readonly revealed_at: {
1506
+ readonly type: "int"
1507
+ readonly nullable: true
1508
+ }
1509
+ readonly status: {
1510
+ readonly type: "text"
1511
+ }
1512
+ readonly tx_id: {
1513
+ readonly type: "text"
1514
+ }
1515
+ readonly tx_index: {
1516
+ readonly type: "int"
1517
+ }
1518
+ }
1519
+ readonly bns_marketplace_events: {
1520
+ readonly action: {
1521
+ readonly type: "text"
1522
+ }
1523
+ readonly block_height: {
1524
+ readonly type: "int"
1525
+ }
1526
+ readonly block_time: {
1527
+ readonly type: "timestamp"
1528
+ }
1529
+ readonly bns_id: {
1530
+ readonly type: "text"
1531
+ }
1532
+ readonly canonical: {
1533
+ readonly type: "boolean"
1534
+ }
1535
+ readonly commission: {
1536
+ readonly type: "text"
1537
+ readonly nullable: true
1538
+ }
1539
+ readonly cursor: {
1540
+ readonly type: "text"
1541
+ }
1542
+ readonly event_index: {
1543
+ readonly type: "int"
1544
+ }
1545
+ readonly price_ustx: {
1546
+ readonly type: "text"
1547
+ readonly nullable: true
1548
+ }
1549
+ readonly tx_id: {
1550
+ readonly type: "text"
1551
+ }
1552
+ readonly tx_index: {
1553
+ readonly type: "int"
1554
+ }
1555
+ }
1556
+ readonly bns_names: {
1557
+ readonly bns_id: {
1558
+ readonly type: "text"
1559
+ }
1560
+ readonly fqn: {
1561
+ readonly type: "text"
1562
+ }
1563
+ readonly last_event_at: {
1564
+ readonly type: "timestamp"
1565
+ }
1566
+ readonly last_event_cursor: {
1567
+ readonly type: "text"
1568
+ }
1569
+ readonly name: {
1570
+ readonly type: "text"
1571
+ }
1572
+ readonly namespace: {
1573
+ readonly type: "text"
1574
+ }
1575
+ readonly owner: {
1576
+ readonly type: "text"
1577
+ }
1578
+ readonly registered_at: {
1579
+ readonly type: "int"
1580
+ readonly nullable: true
1581
+ }
1582
+ readonly renewal_height: {
1583
+ readonly type: "int"
1584
+ readonly nullable: true
1585
+ }
1586
+ }
1587
+ readonly bns_namespaces: {
1588
+ readonly last_event_at: {
1589
+ readonly type: "timestamp"
1590
+ }
1591
+ readonly last_event_cursor: {
1592
+ readonly type: "text"
1593
+ }
1594
+ readonly launched_at: {
1595
+ readonly type: "int"
1596
+ readonly nullable: true
1597
+ }
1598
+ readonly lifetime: {
1599
+ readonly type: "int"
1600
+ readonly nullable: true
1601
+ }
1602
+ readonly manager: {
1603
+ readonly type: "text"
1604
+ readonly nullable: true
1605
+ }
1606
+ readonly manager_frozen: {
1607
+ readonly type: "boolean"
1608
+ }
1609
+ readonly name_count: {
1610
+ readonly type: "int"
1611
+ }
1612
+ readonly namespace: {
1613
+ readonly type: "text"
1614
+ }
1615
+ readonly price_frozen: {
1616
+ readonly type: "boolean"
1617
+ }
1618
+ }
1619
+ readonly burn_block_rewards: {
1620
+ readonly amount_sats: {
1621
+ readonly type: "text"
1622
+ }
1623
+ readonly burn_amount: {
1624
+ readonly type: "text"
1625
+ }
1626
+ readonly burn_block_hash: {
1627
+ readonly type: "text"
1628
+ }
1629
+ readonly burn_block_height: {
1630
+ readonly type: "int"
1631
+ }
1632
+ readonly canonical: {
1633
+ readonly type: "boolean"
1634
+ }
1635
+ readonly cursor: {
1636
+ readonly type: "text"
1637
+ }
1638
+ readonly recipient_btc: {
1639
+ readonly type: "text"
1640
+ }
1641
+ readonly reward_index: {
1642
+ readonly type: "int"
1643
+ }
1644
+ }
1645
+ readonly burn_block_reward_slots: {
1646
+ readonly burn_block_hash: {
1647
+ readonly type: "text"
1648
+ }
1649
+ readonly burn_block_height: {
1650
+ readonly type: "int"
1651
+ }
1652
+ readonly canonical: {
1653
+ readonly type: "boolean"
1654
+ }
1655
+ readonly cursor: {
1656
+ readonly type: "text"
1657
+ }
1658
+ readonly holder_btc: {
1659
+ readonly type: "text"
1660
+ }
1661
+ readonly slot_index: {
1662
+ readonly type: "int"
1663
+ }
1664
+ }
1665
+ readonly events: {
1666
+ readonly block_height: {
1667
+ readonly type: "int"
1668
+ }
1669
+ readonly data: {
1670
+ readonly type: "jsonb"
1671
+ }
1672
+ readonly event_index: {
1673
+ readonly type: "int"
1674
+ }
1675
+ readonly tx_id: {
1676
+ readonly type: "text"
1677
+ }
1678
+ readonly type: {
1679
+ readonly type: "text"
1680
+ }
1681
+ }
1682
+ readonly chain_reorgs: {
1683
+ readonly detected_at: {
1684
+ readonly type: "timestamp"
1685
+ }
1686
+ }
1687
+ };
1688
+ type IndexPrimaryKey = readonly string[] | null;
1689
+ declare const SOURCE_READ_PKS: {
1690
+ readonly blocks: readonly ["height"]
1691
+ readonly decoded_events: readonly ["cursor"]
1692
+ readonly transactions: readonly ["tx_id"]
1693
+ readonly mempool_transactions: readonly ["seq"]
1694
+ readonly pox4_calls: readonly ["cursor"]
1695
+ readonly sbtc_events: readonly ["cursor"]
1696
+ readonly sbtc_token_events: readonly ["cursor"]
1697
+ readonly bns_name_events: readonly ["cursor"]
1698
+ readonly bns_namespace_events: readonly ["cursor"]
1699
+ readonly bns_marketplace_events: readonly ["cursor"]
1700
+ readonly bns_names: readonly ["fqn"]
1701
+ readonly bns_namespaces: readonly ["namespace"]
1702
+ readonly burn_block_rewards: readonly ["cursor"]
1703
+ readonly burn_block_reward_slots: readonly ["cursor"]
1704
+ readonly events: readonly ["tx_id", "event_index"]
1705
+ readonly chain_reorgs: null
1706
+ };
980
1707
  /**
981
1708
  * Per-migration DB-plane gating for the source/target split.
982
1709
  *
@@ -1170,13 +1897,16 @@ type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
1170
1897
  declare class SecondLayerError extends Error {
1171
1898
  code: ErrorCode;
1172
1899
  cause?: unknown;
1173
- constructor(code: ErrorCode, message: string, cause?: unknown);
1900
+ /** Optional structured payload merged into the HTTP error body (machine-readable hints). */
1901
+ details?: Record<string, unknown>;
1902
+ constructor(code: ErrorCode, message: string, cause?: unknown, details?: Record<string, unknown>);
1174
1903
  toJSON(): {
1175
1904
  name: string
1176
1905
  code: string
1177
1906
  message: string
1178
1907
  stack: string | undefined
1179
1908
  cause: unknown
1909
+ details: Record<string, unknown> | undefined
1180
1910
  };
1181
1911
  }
1182
1912
  declare class NotFoundError extends SecondLayerError {
@@ -1192,7 +1922,7 @@ declare class AuthenticationError extends SecondLayerError {
1192
1922
  constructor(message: string);
1193
1923
  }
1194
1924
  declare class AuthorizationError extends SecondLayerError {
1195
- constructor(message: string);
1925
+ constructor(message: string, details?: Record<string, unknown>);
1196
1926
  }
1197
1927
  declare class RateLimitError extends SecondLayerError {
1198
1928
  constructor(message: string);
@@ -1482,6 +2212,32 @@ interface SubgraphQueryParams {
1482
2212
  fields?: string;
1483
2213
  filters?: Record<string, string>;
1484
2214
  }
2215
+ /**
2216
+ * Request shape for `GET /api/subgraphs/:subgraphName/:tableName/aggregate`.
2217
+ * `filters` reuses the list/count where-surface; the rest name the columns to
2218
+ * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).
2219
+ */
2220
+ interface SubgraphAggregateParams {
2221
+ filters?: Record<string, string>;
2222
+ count?: boolean;
2223
+ countDistinct?: string[];
2224
+ sum?: string[];
2225
+ min?: string[];
2226
+ max?: string[];
2227
+ }
2228
+ /**
2229
+ * Aggregate response. Keys are present only for requested aggregates.
2230
+ * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`
2231
+ * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `"0"`;
2232
+ * `min`/`max` are `null` when the filtered set is empty or all-null.
2233
+ */
2234
+ interface SubgraphAggregateResponse {
2235
+ count?: number;
2236
+ countDistinct?: Record<string, number>;
2237
+ sum?: Record<string, string>;
2238
+ min?: Record<string, string | null>;
2239
+ max?: Record<string, string | null>;
2240
+ }
1485
2241
  import { z as z4 } from "zod/v4";
1486
2242
  declare const SUBSCRIPTION_FORMATS: readonly ["standard-webhooks", "inngest", "trigger", "cloudflare", "cloudevents", "raw"];
1487
2243
  declare const SUBSCRIPTION_RUNTIMES: readonly ["inngest", "trigger", "cloudflare", "node"];
@@ -1852,4 +2608,41 @@ type StreamsCursor = {
1852
2608
  declare const EMPTY_RANGE_EVENT_INDEX_SENTINEL = 2147483647;
1853
2609
  declare function encodeStreamsCursor(cursor: StreamsCursor): string;
1854
2610
  declare function decodeStreamsCursor(cursor: string): StreamsCursor;
1855
- export { validateSubscriptionFilterForTable, sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, logger, jsonb, isPox4DecoderEnabled, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getErrorMessage, getEnv, getDbSplitStatus, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, exports_hmac as crypto, closeDb, assertDbSplit, VersionConflictError, ValidationError, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantSuspendedError, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, TABLE_TO_DB, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionKind, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphResourceWarning, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAgentSchema, Subgraph, StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, StreamsEventType, StreamsDbEventType, StreamsCursor, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, STREAMS_TO_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_DB_EVENT_TYPES, SOURCE_READ_COLUMNS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, RateLimitError, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, PrintEventFilterSchema, PrintEventFilter, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, NumericAsText, NotFoundError, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventsArchiveTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DecodedEventType, DeadRow, DeadLetterEventsTable, DbSplitStatus, DbReadRow, DbPlane, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, DECODED_EVENT_TYPES, DB_TO_STREAMS_EVENT_TYPE, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, ContractsTable, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, CODE_TO_STATUS, CHAIN_TRIGGER_TYPES, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
2611
+ /**
2612
+ * Delivered when a matched chain event lands in a canonical block
2613
+ * (`event_type: "chain.<trigger>.apply"`). Tx-level triggers (contract_call /
2614
+ * contract_deploy) carry the tx as `event`; event-level triggers carry the event.
2615
+ */
2616
+ interface ChainApplyEnvelope {
2617
+ action: "apply";
2618
+ /** Canonical block hash this delivery is anchored to. */
2619
+ block_hash: string;
2620
+ block_height: number;
2621
+ tx_id: string;
2622
+ /** Always true — only canonical applies are delivered. */
2623
+ canonical: true;
2624
+ /** The chain-trigger type that matched. */
2625
+ trigger: ChainTrigger["type"];
2626
+ event: Record<string, unknown>;
2627
+ }
2628
+ /** One orphaned delivery recalled by a reorg rollback. */
2629
+ interface ChainReorgOrphanedEntry {
2630
+ tx_id: string | null;
2631
+ /** The event body from the original `apply` delivery. */
2632
+ event: unknown;
2633
+ }
2634
+ /**
2635
+ * Delivered once per affected subscription on a reorg
2636
+ * (`event_type: "chain.reorg.rollback"`). Lists the previously-delivered applies
2637
+ * at or above `fork_point_height` that are now orphaned, so the consumer can undo
2638
+ * them precisely. `orphaned` is capped (currently 500); `truncated` flags overflow.
2639
+ */
2640
+ interface ChainReorgRollbackEnvelope {
2641
+ action: "rollback";
2642
+ fork_point_height: number;
2643
+ orphaned: ChainReorgOrphanedEntry[];
2644
+ truncated: boolean;
2645
+ }
2646
+ /** Any chain-subscription webhook body. Discriminate on `action`. */
2647
+ type ChainWebhookEnvelope = ChainApplyEnvelope | ChainReorgRollbackEnvelope;
2648
+ export { validateSubscriptionFilterForTable, sql, setMigrationRole, parseJsonb, onControlPlane, onChainPlane, logger, jsonb, isPox4DecoderEnabled, getTargetDb, getSourceDb, getRawClientFor, getRawClient, getMigrationRole, getErrorMessage, getEnv, getDbSplitStatus, getDb, generateSubgraphSpec, generateSubgraphOpenApi, generateSubgraphMarkdown, generateSubgraphAgentSchema, formatSubscriptionSchemaErrors, finalizedBurnHeight, encodeStreamsCursor, exports_ed25519 as ed25519, decodeStreamsCursor, exports_hmac as crypto, closeDb, assertDbSplit, VersionConflictError, ValidationError, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionRequestSchema, UpdateSubscriptionRequest, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateContract, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TriggerEvaluatorStateTable, TriggerEvaluatorState, TransactionsTable, TransactionsArchiveTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantSuspendedError, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, TABLE_TO_DB, SubscriptionsTable, SubscriptionSummary, SubscriptionStatusSchema, SubscriptionStatus, SubscriptionSchemaTables, SubscriptionSchemaTable, SubscriptionSchemaColumn, SubscriptionRuntimeSchema, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionKind, SubscriptionFormatSchema, SubscriptionFormat, SubscriptionFilterSchema, SubscriptionFilterPrimitiveSchema, SubscriptionFilterPrimitive, SubscriptionFilterOperatorSchema, SubscriptionFilterOperator, SubscriptionFilterClauseSchema, SubscriptionFilterClause, SubscriptionFilter, SubscriptionDetail, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphSyncInfo, SubgraphSummary, SubgraphSpecOptions, SubgraphSpecFormat, SubgraphResourceWarning, SubgraphQueryParams, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGapsResponse, SubgraphGapRange, SubgraphGapEntry, SubgraphGap, SubgraphDetail, SubgraphAggregateResponse, SubgraphAggregateParams, SubgraphAgentSchema, Subgraph, StxTransferFilterSchema, StxTransferFilter, StxMintFilterSchema, StxMintFilter, StxLockFilterSchema, StxLockFilter, StxBurnFilterSchema, StxBurnFilter, StreamsEventType, StreamsDbEventType, StreamsCursor, SessionsTable, Session, ServiceHeartbeatsTable, SecondLayerError, SbtcTokenEventsTable, SbtcTokenEventType, SbtcSupplySnapshotsTable, SbtcEventsTable, SbtcEventTopic, SUBSCRIPTION_STATUSES, SUBSCRIPTION_RUNTIMES, SUBSCRIPTION_FORMATS, SUBSCRIPTION_FILTER_OPERATORS, STREAMS_TO_DB_EVENT_TYPES, STREAMS_EVENT_TYPES, STREAMS_DB_EVENT_TYPES, SOURCE_READ_TYPES, SOURCE_READ_PKS, SOURCE_READ_COLUMNS, RotateSecretResponse, ReplaySubscriptionRequestSchema, ReplaySubscriptionRequest, ReplayResult, ReindexResponse, RateLimitError, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, PrintEventFilterSchema, PrintEventFilter, Pox4SignersDailyTable, Pox4FunctionName, Pox4CyclesDailyTable, Pox4CallsTable, ParsedUpdateSubscriptionRequest, ParsedReplaySubscriptionRequest, ParsedCreateSubscriptionRequest, OutboxStatus, NumericAsText, NotFoundError, NftTransferFilterSchema, NftTransferFilter, NftMintFilterSchema, NftMintFilter, NftBurnFilterSchema, NftBurnFilter, MigrationRole, MempoolTransactionsTable, MempoolTransaction, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, KeyRotatedError, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMempoolTransaction, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertContract, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, IndexPrimaryKey, IndexColumnType, IndexColumn, FtTransferFilterSchema, FtTransferFilter, FtMintFilterSchema, FtMintFilter, FtBurnFilterSchema, FtBurnFilter, ForbiddenError, EventsTable, EventsArchiveTable, EventFilterSchema, EventFilter, Event, ErrorCodes, ErrorCode, Env, EMPTY_RANGE_EVENT_INDEX_SENTINEL, DeploySubgraphResponse, DeploySubgraphRequestSchema, DeploySubgraphRequest, DeliveryRow, DecodedEventsTable, DecodedEventType, DeadRow, DeadLetterEventsTable, DbSplitStatus, DbReadRow, DbPlane, DatabaseError, Database, DEFAULT_BTC_CONFIRMATIONS, DECODED_EVENT_TYPES, DB_TO_STREAMS_EVENT_TYPE, CreateSubscriptionResponse, CreateSubscriptionRequestSchema, CreateSubscriptionRequest, ContractsTable, ContractDeployFilterSchema, ContractDeployFilter, ContractCallFilterSchema, ContractCallFilter, Contract, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainWebhookEnvelope, ChainReorgsTable, ChainReorgRollbackEnvelope, ChainReorgOrphanedEntry, ChainApplyEnvelope, CODE_TO_STATUS, CHAIN_TRIGGER_TYPES, BurnBlockRewardsTable, BurnBlockRewardSlotsTable, BnsNamespacesTable, BnsNamespaceEventsTable, BnsNamespaceEventStatus, BnsNamesTable, BnsNameEventsTable, BnsNameEventTopic, BnsMarketplaceEventsTable, BnsMarketplaceAction, BlocksTable, Block, AuthorizationError, AuthenticationError, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };