@secondlayer/subgraphs 3.23.0 → 3.23.2

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.
@@ -1,4 +1,5 @@
1
1
  import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
2
+ import { AssetIdentifier } from "@secondlayer/stacks/filters";
2
3
  /**
3
4
  * How long a read stays valid.
4
5
  *
@@ -147,38 +148,38 @@ interface FactoryScope {
147
148
  /** FT event filters */
148
149
  interface FtTransferFilter extends TraitScope {
149
150
  type: "ft_transfer";
150
- assetIdentifier?: string;
151
+ assetIdentifier?: AssetIdentifier;
151
152
  sender?: string;
152
153
  recipient?: string;
153
154
  minAmount?: bigint;
154
155
  }
155
156
  interface FtMintFilter extends TraitScope {
156
157
  type: "ft_mint";
157
- assetIdentifier?: string;
158
+ assetIdentifier?: AssetIdentifier;
158
159
  recipient?: string;
159
160
  minAmount?: bigint;
160
161
  }
161
162
  interface FtBurnFilter extends TraitScope {
162
163
  type: "ft_burn";
163
- assetIdentifier?: string;
164
+ assetIdentifier?: AssetIdentifier;
164
165
  sender?: string;
165
166
  minAmount?: bigint;
166
167
  }
167
168
  /** NFT event filters */
168
169
  interface NftTransferFilter extends TraitScope {
169
170
  type: "nft_transfer";
170
- assetIdentifier?: string;
171
+ assetIdentifier?: AssetIdentifier;
171
172
  sender?: string;
172
173
  recipient?: string;
173
174
  }
174
175
  interface NftMintFilter extends TraitScope {
175
176
  type: "nft_mint";
176
- assetIdentifier?: string;
177
+ assetIdentifier?: AssetIdentifier;
177
178
  recipient?: string;
178
179
  }
179
180
  interface NftBurnFilter extends TraitScope {
180
181
  type: "nft_burn";
181
- assetIdentifier?: string;
182
+ assetIdentifier?: AssetIdentifier;
182
183
  sender?: string;
183
184
  }
184
185
  /** Contract event filters */
@@ -235,7 +236,10 @@ type PrintField = ColumnType | {
235
236
  interface PrintEventFilter extends TraitScope, FactoryScope {
236
237
  type: "print_event";
237
238
  /** One contract id, or a set of them (max 20). Supports `*` wildcards.
238
- * Mutually exclusive with `trait`. */
239
+ * COMPOSES with `trait` — the matcher ANDs them, so the pair means
240
+ * "contracts conforming to this trait, narrowed to these ids". (The Index
241
+ * read API refuses the combination, but that is its query planner's
242
+ * constraint, not a semantic one.) */
239
243
  contractId?: string | readonly string[];
240
244
  topic?: string;
241
245
  /**
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
2
2
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
3
 
4
4
  // src/runtime/context.ts
5
- import { logger } from "@secondlayer/shared/logger";
5
+ import { logger as logger2 } from "@secondlayer/shared/logger";
6
6
  import { formatUnits } from "@secondlayer/stacks/utils";
7
7
  import { sql } from "kysely";
8
8
 
@@ -147,6 +147,7 @@ function generateSubgraphSQL(def, schemaNameOverride) {
147
147
 
148
148
  // src/runtime/chain-read.ts
149
149
  import { getSourceDb } from "@secondlayer/shared/db";
150
+ import { logger } from "@secondlayer/shared/logger";
150
151
  import { http, createPublicClient } from "@secondlayer/stacks";
151
152
  import {
152
153
  ContractResponseError,
@@ -232,6 +233,14 @@ function createChainReadClient(ctx) {
232
233
  const pinnedTo = constant ? null : ctx.indexBlockHash;
233
234
  const cached = await db.selectFrom("chain_read_cache").select("result_hex").where("contract_id", "=", contractId).where("function_name", "=", fn.name).where("args_hash", "=", argsHash).where((eb) => pinnedTo === null ? eb("index_block_hash", "is", null) : eb("index_block_hash", "=", pinnedTo)).executeTakeFirst();
234
235
  const resultHex = cached?.result_hex ?? await gate.run(async () => {
236
+ if (!ctx.indexBlockHash) {
237
+ logger.warn("Chain read is not pinned to a block (no index_block_hash)", {
238
+ contractId,
239
+ functionName: fn.name,
240
+ blockHeight: ctx.blockHeight,
241
+ note: 'cache: "contract-constant" asserts this value cannot change; the node answered at its own tip'
242
+ });
243
+ }
235
244
  const value2 = await readContract(nodeClient(rpcUrl), {
236
245
  contract: contractId,
237
246
  functionName: fn.name,
@@ -346,7 +355,7 @@ class SubgraphContext {
346
355
  data: { ...key, ...row, ...meta, _upsert_keys: keyColumns }
347
356
  });
348
357
  } else {
349
- logger.warn("upsert called without matching uniqueKeys constraint, using fallback", {
358
+ logger2.warn("upsert called without matching uniqueKeys constraint, using fallback", {
350
359
  table,
351
360
  keys: keyColumns
352
361
  });
@@ -906,7 +915,7 @@ function decodeFunctionArgs(args) {
906
915
 
907
916
  // src/runtime/runner.ts
908
917
  import { getErrorMessage } from "@secondlayer/shared";
909
- import { logger as logger2 } from "@secondlayer/shared/logger";
918
+ import { logger as logger3 } from "@secondlayer/shared/logger";
910
919
  import {
911
920
  clarityValueToJS,
912
921
  deserializeCV as deserializeCV3,
@@ -1257,7 +1266,7 @@ async function runHandlers(subgraph, matched, ctx, opts) {
1257
1266
  units.sort((a, b) => (a.tx.tx_index ?? 0) - (b.tx.tx_index ?? 0) || (a.event?.event_index ?? -1) - (b.event?.event_index ?? -1));
1258
1267
  for (const { tx, event, sourceName } of units) {
1259
1268
  if (errors >= threshold) {
1260
- logger2.error("Subgraph error threshold reached, skipping remaining events", {
1269
+ logger3.error("Subgraph error threshold reached, skipping remaining events", {
1261
1270
  subgraph: subgraph.name,
1262
1271
  errors,
1263
1272
  threshold
@@ -1266,7 +1275,7 @@ async function runHandlers(subgraph, matched, ctx, opts) {
1266
1275
  }
1267
1276
  const handler = subgraph.handlers[sourceName] ?? subgraph.handlers["*"] ?? null;
1268
1277
  if (!handler) {
1269
- logger2.warn("No handler found for source", {
1278
+ logger3.warn("No handler found for source", {
1270
1279
  subgraph: subgraph.name,
1271
1280
  sourceName,
1272
1281
  txId: tx.tx_id
@@ -1323,7 +1332,7 @@ async function runHandlers(subgraph, matched, ctx, opts) {
1323
1332
  const verdict = validatePrintPayload(filter.prints, printPayload.topic ?? "", printPayload.data ?? {});
1324
1333
  if (!verdict.ok) {
1325
1334
  skipped++;
1326
- logger2.warn("Print payload does not match declared prints schema", {
1335
+ logger3.warn("Print payload does not match declared prints schema", {
1327
1336
  subgraph: subgraph.name,
1328
1337
  sourceName,
1329
1338
  topic: printPayload.topic,
@@ -1338,7 +1347,7 @@ async function runHandlers(subgraph, matched, ctx, opts) {
1338
1347
  } catch (err) {
1339
1348
  ctx.rollbackTo(checkpoint);
1340
1349
  errors++;
1341
- logger2.error("Subgraph handler error", {
1350
+ logger3.error("Subgraph handler error", {
1342
1351
  subgraph: subgraph.name,
1343
1352
  sourceName,
1344
1353
  txId: tx.tx_id,
@@ -1623,7 +1632,7 @@ import {
1623
1632
  resolveSubgraphDb,
1624
1633
  updateSubgraphStatus
1625
1634
  } from "@secondlayer/shared/db/queries/subgraphs";
1626
- import { logger as logger5 } from "@secondlayer/shared/logger";
1635
+ import { logger as logger6 } from "@secondlayer/shared/logger";
1627
1636
  import { sql as sql3 } from "kysely";
1628
1637
 
1629
1638
  // src/runtime/block-source.ts
@@ -1631,7 +1640,7 @@ import { getSourceDb as getSourceDb2 } from "@secondlayer/shared/db";
1631
1640
  import {
1632
1641
  IndexHttpClient
1633
1642
  } from "@secondlayer/shared/index-http";
1634
- import { logger as logger3 } from "@secondlayer/shared/logger";
1643
+ import { logger as logger4 } from "@secondlayer/shared/logger";
1635
1644
 
1636
1645
  // src/runtime/batch-loader.ts
1637
1646
  async function loadBlockRange(db, fromHeight, toHeight) {
@@ -1955,7 +1964,7 @@ class FallbackBlockSource {
1955
1964
  try {
1956
1965
  return await this.primary.getTip();
1957
1966
  } catch (err) {
1958
- logger3.warn("block source primary getTip failed — using DB tap", {
1967
+ logger4.warn("block source primary getTip failed — using DB tap", {
1959
1968
  error: err instanceof Error ? err.message : String(err)
1960
1969
  });
1961
1970
  return this.fallback.getTip();
@@ -1965,7 +1974,7 @@ class FallbackBlockSource {
1965
1974
  try {
1966
1975
  return await this.primary.loadBlockRange(fromHeight, toHeight);
1967
1976
  } catch (err) {
1968
- logger3.warn("block source primary loadBlockRange failed — using DB tap", {
1977
+ logger4.warn("block source primary loadBlockRange failed — using DB tap", {
1969
1978
  from: fromHeight,
1970
1979
  to: toHeight,
1971
1980
  error: err instanceof Error ? err.message : String(err)
@@ -1997,7 +2006,7 @@ function resolveBlockSource(subgraph) {
1997
2006
  return new FallbackBlockSource(new PublicApiBlockSource(buildHttpClient(), referencedIndexEventTypes(subgraph), canSparseScan(subgraph) ? sparseProbeTargets(subgraph) : undefined, needsTransactionData(subgraph)), postgresBlockSource);
1998
2007
  }
1999
2008
  if (process.env.SUBGRAPH_SOURCE === "streams-index" && subgraph) {
2000
- logger3.debug("Subgraph not streams-index eligible, using DB tap", {
2009
+ logger4.debug("Subgraph not streams-index eligible, using DB tap", {
2001
2010
  subgraph: subgraph.name
2002
2011
  });
2003
2012
  }
@@ -2006,7 +2015,7 @@ function resolveBlockSource(subgraph) {
2006
2015
 
2007
2016
  // src/runtime/outbox-emit.ts
2008
2017
  import { createHash as createHash2 } from "node:crypto";
2009
- import { logger as logger4 } from "@secondlayer/shared/logger";
2018
+ import { logger as logger5 } from "@secondlayer/shared/logger";
2010
2019
  var loggedKillSwitch = false;
2011
2020
  var OP_VERB = {
2012
2021
  insert: "created",
@@ -2030,7 +2039,7 @@ function stableStringify(obj) {
2030
2039
  async function emitSubscriptionOutbox(tx, subgraphName, manifest, matcher, blockHeight) {
2031
2040
  if (!isEmitOutboxEnabled()) {
2032
2041
  if (!loggedKillSwitch) {
2033
- logger4.warn("SECONDLAYER_EMIT_OUTBOX=false — outbox emission bypassed");
2042
+ logger5.warn("SECONDLAYER_EMIT_OUTBOX=false — outbox emission bypassed");
2034
2043
  loggedKillSwitch = true;
2035
2044
  }
2036
2045
  return 0;
@@ -2350,7 +2359,7 @@ async function processBlockWithRetry(subgraph, subgraphName, blockHeight, opts,
2350
2359
  const delay = retryDelaysMs[attempt];
2351
2360
  if (delay === undefined)
2352
2361
  break;
2353
- logger5.warn("Block processing failed, retrying", {
2362
+ logger6.warn("Block processing failed, retrying", {
2354
2363
  subgraph: subgraphName,
2355
2364
  blockHeight,
2356
2365
  attempt: attempt + 1,
@@ -2382,7 +2391,7 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
2382
2391
  } else {
2383
2392
  const data = (await resolveBlockSource(subgraph).loadBlockRange(blockHeight, blockHeight)).get(blockHeight);
2384
2393
  if (!data) {
2385
- logger5.debug("Block not found or non-canonical for subgraph processing", {
2394
+ logger6.debug("Block not found or non-canonical for subgraph processing", {
2386
2395
  subgraph: subgraphName,
2387
2396
  blockHeight
2388
2397
  });
@@ -2523,7 +2532,7 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
2523
2532
  });
2524
2533
  } catch (err) {
2525
2534
  if (err instanceof CursorRaceLostError) {
2526
- logger5.warn("cursor race lost — block already covered", {
2535
+ logger6.warn("cursor race lost — block already covered", {
2527
2536
  subgraph: subgraphName,
2528
2537
  blockHeight,
2529
2538
  error: err.message
@@ -2547,7 +2556,7 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
2547
2556
  const { rows } = await sql3.raw(`SELECT n_live_tup AS count FROM pg_stat_user_tables WHERE schemaname = '${schemaName}' AND relname = '${table}'`).execute(route.dataDb);
2548
2557
  const count = Number(rows[0]?.count ?? 0);
2549
2558
  if (count >= 1e7) {
2550
- logger5.warn("Subgraph table exceeds 10M rows (estimate)", {
2559
+ logger6.warn("Subgraph table exceeds 10M rows (estimate)", {
2551
2560
  subgraph: subgraphName,
2552
2561
  table,
2553
2562
  count
@@ -2555,7 +2564,7 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
2555
2564
  }
2556
2565
  }
2557
2566
  } catch (err) {
2558
- logger5.debug("Row count sample failed", {
2567
+ logger6.debug("Row count sample failed", {
2559
2568
  subgraph: subgraphName,
2560
2569
  error: err instanceof Error ? err.message : String(err)
2561
2570
  });
@@ -2645,11 +2654,11 @@ import {
2645
2654
  recordSubgraphProcessed as recordSubgraphProcessed2,
2646
2655
  updateSubgraphStatus as updateSubgraphStatus2
2647
2656
  } from "@secondlayer/shared/db/queries/subgraphs";
2648
- import { logger as logger7 } from "@secondlayer/shared/logger";
2657
+ import { logger as logger8 } from "@secondlayer/shared/logger";
2649
2658
 
2650
2659
  // src/runtime/reindex-notify.ts
2651
2660
  import { getErrorMessage as getErrorMessage2 } from "@secondlayer/shared";
2652
- import { logger as logger6 } from "@secondlayer/shared/logger";
2661
+ import { logger as logger7 } from "@secondlayer/shared/logger";
2653
2662
  async function notifyReindexComplete(db, subgraphName, stats) {
2654
2663
  try {
2655
2664
  const subgraph = await db.selectFrom("subgraphs").select(["account_id"]).where("name", "=", subgraphName).executeTakeFirst();
@@ -2660,7 +2669,7 @@ async function notifyReindexComplete(db, subgraphName, stats) {
2660
2669
  return;
2661
2670
  const resendKey = process.env.RESEND_API_KEY;
2662
2671
  if (!resendKey) {
2663
- logger6.warn("RESEND_API_KEY unset — skipping reindex-complete email", {
2672
+ logger7.warn("RESEND_API_KEY unset — skipping reindex-complete email", {
2664
2673
  subgraph: subgraphName
2665
2674
  });
2666
2675
  return;
@@ -2682,14 +2691,14 @@ async function notifyReindexComplete(db, subgraphName, stats) {
2682
2691
  });
2683
2692
  if (!res.ok) {
2684
2693
  const text = await res.text().catch(() => "");
2685
- logger6.warn("reindex-complete email failed", {
2694
+ logger7.warn("reindex-complete email failed", {
2686
2695
  subgraph: subgraphName,
2687
2696
  status: res.status,
2688
2697
  body: text.slice(0, 200)
2689
2698
  });
2690
2699
  }
2691
2700
  } catch (err) {
2692
- logger6.warn("reindex-complete email threw", {
2701
+ logger7.warn("reindex-complete email threw", {
2693
2702
  subgraph: subgraphName,
2694
2703
  error: getErrorMessage2(err)
2695
2704
  });
@@ -2801,7 +2810,7 @@ async function processBlockRange(def, opts) {
2801
2810
  while (currentHeight <= toBlock) {
2802
2811
  if (opts.signal?.aborted) {
2803
2812
  aborted = true;
2804
- logger7.info("Block processing aborted", {
2813
+ logger8.info("Block processing aborted", {
2805
2814
  subgraph: subgraphName,
2806
2815
  currentBlock: currentHeight,
2807
2816
  reason: String(opts.signal.reason ?? "unknown")
@@ -2850,7 +2859,7 @@ async function processBlockRange(def, opts) {
2850
2859
  });
2851
2860
  } catch (err) {
2852
2861
  const errorMsg = getErrorMessage3(err);
2853
- logger7.error("Block processing failed persistently", {
2862
+ logger8.error("Block processing failed persistently", {
2854
2863
  subgraph: subgraphName,
2855
2864
  blockHeight: height,
2856
2865
  error: errorMsg
@@ -2896,7 +2905,7 @@ async function processBlockRange(def, opts) {
2896
2905
  lastProgressFlushAt = now;
2897
2906
  }
2898
2907
  if (blocksProcessed % LOG_INTERVAL === 0) {
2899
- logger7.info(`${status === "reindexing" ? "Reindex" : "Backfill"} progress`, {
2908
+ logger8.info(`${status === "reindexing" ? "Reindex" : "Backfill"} progress`, {
2900
2909
  subgraph: subgraphName,
2901
2910
  processed: blocksProcessed,
2902
2911
  total: totalBlocks,
@@ -2916,7 +2925,7 @@ async function processBlockRange(def, opts) {
2916
2925
  if (batchFailedBlocks.length > 0 && opts.subgraphId) {
2917
2926
  const gaps = coalesceFailedBlocks(batchFailedBlocks);
2918
2927
  await recordGapBatch(targetDb, opts.subgraphId, subgraphName, gaps).catch((err) => {
2919
- logger7.warn("Failed to record subgraph gaps", {
2928
+ logger8.warn("Failed to record subgraph gaps", {
2920
2929
  subgraph: subgraphName,
2921
2930
  error: err instanceof Error ? err.message : String(err)
2922
2931
  });
@@ -2933,7 +2942,7 @@ async function processBlockRange(def, opts) {
2933
2942
  } else {
2934
2943
  await updateSubgraphStatus2(targetDb, subgraphName, status, jumpTo - 1);
2935
2944
  }
2936
- logger7.info("Sparse skip", {
2945
+ logger8.info("Sparse skip", {
2937
2946
  subgraph: subgraphName,
2938
2947
  from: batchEnd + 1,
2939
2948
  to: jumpTo - 1,
@@ -2973,11 +2982,11 @@ async function reindexSubgraph(def, opts) {
2973
2982
  const subgraphName = def.name;
2974
2983
  const schemaName = opts?.schemaName ?? pgSchemaName(subgraphName);
2975
2984
  await updateSubgraphStatus2(targetDb, subgraphName, "reindexing");
2976
- logger7.info("Reindex starting", { subgraph: subgraphName });
2985
+ logger8.info("Reindex starting", { subgraph: subgraphName });
2977
2986
  try {
2978
2987
  const { fromBlock, toBlock } = await resolveBlockRange(source, def, opts);
2979
2988
  if (fromBlock > toBlock) {
2980
- logger7.info("No blocks to reindex", {
2989
+ logger8.info("No blocks to reindex", {
2981
2990
  subgraph: subgraphName,
2982
2991
  fromBlock,
2983
2992
  toBlock
@@ -2991,7 +3000,7 @@ async function reindexSubgraph(def, opts) {
2991
3000
  await client.unsafe(stmt);
2992
3001
  }
2993
3002
  await updateSubgraphStatus2(targetDb, subgraphName, "reindexing", Math.max(0, fromBlock - 1));
2994
- logger7.info("Schema recreated for reindex", {
3003
+ logger8.info("Schema recreated for reindex", {
2995
3004
  subgraph: subgraphName,
2996
3005
  cursorResetTo: Math.max(0, fromBlock - 1)
2997
3006
  });
@@ -3005,7 +3014,7 @@ async function reindexSubgraph(def, opts) {
3005
3014
  last_error_at: null,
3006
3015
  updated_at: new Date
3007
3016
  }).where("name", "=", subgraphName).execute();
3008
- logger7.info("Reindexing blocks", {
3017
+ logger8.info("Reindexing blocks", {
3009
3018
  subgraph: subgraphName,
3010
3019
  fromBlock,
3011
3020
  toBlock,
@@ -3027,9 +3036,9 @@ async function reindexSubgraph(def, opts) {
3027
3036
  if (reason === "user-cancelled") {
3028
3037
  await updateSubgraphStatus2(targetDb, subgraphName, "active");
3029
3038
  await clearReindexMetadata(targetDb, subgraphName);
3030
- logger7.info("Reindex cancelled by user", { subgraph: subgraphName });
3039
+ logger8.info("Reindex cancelled by user", { subgraph: subgraphName });
3031
3040
  } else {
3032
- logger7.info("Reindex interrupted by shutdown, will resume", {
3041
+ logger8.info("Reindex interrupted by shutdown, will resume", {
3033
3042
  subgraph: subgraphName
3034
3043
  });
3035
3044
  }
@@ -3037,7 +3046,7 @@ async function reindexSubgraph(def, opts) {
3037
3046
  }
3038
3047
  await updateSubgraphStatus2(targetDb, subgraphName, "active", toBlock);
3039
3048
  await clearReindexMetadata(targetDb, subgraphName);
3040
- logger7.info("Reindex complete", {
3049
+ logger8.info("Reindex complete", {
3041
3050
  subgraph: subgraphName,
3042
3051
  blocks: result.blocksProcessed,
3043
3052
  events: result.totalEventsProcessed,
@@ -3050,7 +3059,7 @@ async function reindexSubgraph(def, opts) {
3050
3059
  });
3051
3060
  return { processed: result.blocksProcessed };
3052
3061
  } catch (err) {
3053
- logger7.error("Reindex failed", {
3062
+ logger8.error("Reindex failed", {
3054
3063
  subgraph: subgraphName,
3055
3064
  error: getErrorMessage3(err)
3056
3065
  });
@@ -3072,7 +3081,7 @@ async function resumeReindex(def, opts) {
3072
3081
  const fromBlock = resolveReindexResumeBlock(row);
3073
3082
  const toBlock = Number(row.reindex_to_block);
3074
3083
  if (fromBlock == null) {
3075
- logger7.info("No reindex metadata, starting fresh reindex", {
3084
+ logger8.info("No reindex metadata, starting fresh reindex", {
3076
3085
  subgraph: subgraphName
3077
3086
  });
3078
3087
  return reindexSubgraph(def, {
@@ -3081,12 +3090,12 @@ async function resumeReindex(def, opts) {
3081
3090
  });
3082
3091
  }
3083
3092
  if (fromBlock > toBlock) {
3084
- logger7.info("Resume: no remaining blocks", { subgraph: subgraphName });
3093
+ logger8.info("Resume: no remaining blocks", { subgraph: subgraphName });
3085
3094
  await updateSubgraphStatus2(targetDb, subgraphName, "active", toBlock);
3086
3095
  await clearReindexMetadata(targetDb, subgraphName);
3087
3096
  return { processed: 0 };
3088
3097
  }
3089
- logger7.info("Resuming reindex", {
3098
+ logger8.info("Resuming reindex", {
3090
3099
  subgraph: subgraphName,
3091
3100
  fromBlock,
3092
3101
  toBlock,
@@ -3108,9 +3117,9 @@ async function resumeReindex(def, opts) {
3108
3117
  if (reason === "user-cancelled") {
3109
3118
  await updateSubgraphStatus2(targetDb, subgraphName, "active");
3110
3119
  await clearReindexMetadata(targetDb, subgraphName);
3111
- logger7.info("Resume cancelled by user", { subgraph: subgraphName });
3120
+ logger8.info("Resume cancelled by user", { subgraph: subgraphName });
3112
3121
  } else {
3113
- logger7.info("Resume interrupted by shutdown, will resume again", {
3122
+ logger8.info("Resume interrupted by shutdown, will resume again", {
3114
3123
  subgraph: subgraphName
3115
3124
  });
3116
3125
  }
@@ -3118,13 +3127,13 @@ async function resumeReindex(def, opts) {
3118
3127
  }
3119
3128
  await updateSubgraphStatus2(targetDb, subgraphName, "active", toBlock);
3120
3129
  await clearReindexMetadata(targetDb, subgraphName);
3121
- logger7.info("Resumed reindex complete", {
3130
+ logger8.info("Resumed reindex complete", {
3122
3131
  subgraph: subgraphName,
3123
3132
  blocks: result.blocksProcessed
3124
3133
  });
3125
3134
  return { processed: result.blocksProcessed };
3126
3135
  } catch (err) {
3127
- logger7.error("Resumed reindex failed", {
3136
+ logger8.error("Resumed reindex failed", {
3128
3137
  subgraph: subgraphName,
3129
3138
  error: getErrorMessage3(err)
3130
3139
  });
@@ -3135,7 +3144,7 @@ async function resumeReindex(def, opts) {
3135
3144
  async function backfillSubgraph(def, opts) {
3136
3145
  const targetDb = getTargetDb2();
3137
3146
  const subgraphName = def.name;
3138
- logger7.info("Backfill starting", {
3147
+ logger8.info("Backfill starting", {
3139
3148
  subgraph: subgraphName,
3140
3149
  from: opts.fromBlock,
3141
3150
  to: opts.toBlock
@@ -3153,17 +3162,17 @@ async function backfillSubgraph(def, opts) {
3153
3162
  signal: opts.signal
3154
3163
  });
3155
3164
  if (result.aborted) {
3156
- logger7.info("Backfill aborted", { subgraph: subgraphName });
3165
+ logger8.info("Backfill aborted", { subgraph: subgraphName });
3157
3166
  return { processed: result.blocksProcessed };
3158
3167
  }
3159
3168
  const resolved = await resolveGaps(targetDb, subgraphName, opts.fromBlock, opts.toBlock).catch(() => 0);
3160
3169
  if (resolved > 0) {
3161
- logger7.info("Resolved subgraph gaps via backfill", {
3170
+ logger8.info("Resolved subgraph gaps via backfill", {
3162
3171
  subgraph: subgraphName,
3163
3172
  resolved
3164
3173
  });
3165
3174
  }
3166
- logger7.info("Backfill complete", {
3175
+ logger8.info("Backfill complete", {
3167
3176
  subgraph: subgraphName,
3168
3177
  blocks: result.blocksProcessed,
3169
3178
  events: result.totalEventsProcessed,
@@ -3171,7 +3180,7 @@ async function backfillSubgraph(def, opts) {
3171
3180
  });
3172
3181
  return { processed: result.blocksProcessed };
3173
3182
  } catch (err) {
3174
- logger7.error("Backfill failed", {
3183
+ logger8.error("Backfill failed", {
3175
3184
  subgraph: subgraphName,
3176
3185
  error: getErrorMessage3(err)
3177
3186
  });
@@ -3187,5 +3196,5 @@ export {
3187
3196
  backfillSubgraph
3188
3197
  };
3189
3198
 
3190
- //# debugId=5A333EB0868E7D5864756E2164756E21
3199
+ //# debugId=EE6C2B3F17DD60E264756E2164756E21
3191
3200
  //# sourceMappingURL=reindex.js.map