@secondlayer/subgraphs 0.11.3 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/index.js CHANGED
@@ -257,9 +257,9 @@ class SubgraphContext {
257
257
  prepareInsert(op) {
258
258
  const upsertKeys = op.data._upsert_keys;
259
259
  const data = { ...op.data };
260
- data._upsert_keys = undefined;
261
- data._upsert_fallback_keys = undefined;
262
- data._upsert_fallback_set = undefined;
260
+ delete data._upsert_keys;
261
+ delete data._upsert_fallback_keys;
262
+ delete data._upsert_fallback_set;
263
263
  if (!data._block_height)
264
264
  data._block_height = this.block.height;
265
265
  if (!data._tx_id)
@@ -1115,7 +1115,10 @@ import {
1115
1115
  recordGapBatch,
1116
1116
  resolveGaps
1117
1117
  } from "@secondlayer/shared/db/queries/subgraph-gaps";
1118
- import { updateSubgraphStatus as updateSubgraphStatus2 } from "@secondlayer/shared/db/queries/subgraphs";
1118
+ import {
1119
+ recordSubgraphProcessed as recordSubgraphProcessed2,
1120
+ updateSubgraphStatus as updateSubgraphStatus2
1121
+ } from "@secondlayer/shared/db/queries/subgraphs";
1119
1122
  import { logger as logger4 } from "@secondlayer/shared/logger";
1120
1123
 
1121
1124
  // src/schema/generator.ts
@@ -1317,13 +1320,15 @@ async function processBlockRange(def, opts) {
1317
1320
  preloaded: blockData
1318
1321
  });
1319
1322
  } catch (err) {
1323
+ const errorMsg = err instanceof Error ? err.message : String(err);
1320
1324
  logger4.error("Block processing error", {
1321
1325
  subgraph: subgraphName,
1322
1326
  blockHeight: height,
1323
- error: err instanceof Error ? err.message : String(err)
1327
+ error: errorMsg
1324
1328
  });
1325
1329
  batchFailedBlocks.push({ height, reason: "processing_error" });
1326
1330
  await updateSubgraphStatus2(db, subgraphName, status, height).catch(() => {});
1331
+ await recordSubgraphProcessed2(db, subgraphName, 0, 1, errorMsg).catch(() => {});
1327
1332
  blocksProcessed++;
1328
1333
  totalErrors++;
1329
1334
  continue;
@@ -1437,9 +1442,9 @@ async function reindexSubgraph(def, opts) {
1437
1442
  }
1438
1443
  return { processed: result.blocksProcessed };
1439
1444
  }
1440
- const { recordSubgraphProcessed: recordSubgraphProcessed2 } = await import("@secondlayer/shared/db/queries/subgraphs");
1445
+ const { recordSubgraphProcessed: recordSubgraphProcessed3 } = await import("@secondlayer/shared/db/queries/subgraphs");
1441
1446
  if (result.totalEventsProcessed > 0 || result.totalErrors > 0) {
1442
- await recordSubgraphProcessed2(db, subgraphName, result.totalEventsProcessed, result.totalErrors, result.totalErrors > 0 ? `${result.totalErrors} error(s) during reindex` : undefined);
1447
+ await recordSubgraphProcessed3(db, subgraphName, result.totalEventsProcessed, result.totalErrors, result.totalErrors > 0 ? `${result.totalErrors} error(s) during reindex` : undefined);
1443
1448
  }
1444
1449
  await updateSubgraphStatus2(db, subgraphName, "active", toBlock);
1445
1450
  await clearReindexMetadata(db, subgraphName);
@@ -1517,9 +1522,9 @@ async function resumeReindex(def, opts) {
1517
1522
  }
1518
1523
  return { processed: result.blocksProcessed };
1519
1524
  }
1520
- const { recordSubgraphProcessed: recordSubgraphProcessed2 } = await import("@secondlayer/shared/db/queries/subgraphs");
1525
+ const { recordSubgraphProcessed: recordSubgraphProcessed3 } = await import("@secondlayer/shared/db/queries/subgraphs");
1521
1526
  if (result.totalEventsProcessed > 0 || result.totalErrors > 0) {
1522
- await recordSubgraphProcessed2(db, subgraphName, result.totalEventsProcessed, result.totalErrors, result.totalErrors > 0 ? `${result.totalErrors} error(s) during resumed reindex` : undefined);
1527
+ await recordSubgraphProcessed3(db, subgraphName, result.totalEventsProcessed, result.totalErrors, result.totalErrors > 0 ? `${result.totalErrors} error(s) during resumed reindex` : undefined);
1523
1528
  }
1524
1529
  await updateSubgraphStatus2(db, subgraphName, "active", toBlock);
1525
1530
  await clearReindexMetadata(db, subgraphName);
@@ -1567,9 +1572,9 @@ async function backfillSubgraph(def, opts) {
1567
1572
  resolved
1568
1573
  });
1569
1574
  }
1570
- const { recordSubgraphProcessed: recordSubgraphProcessed2 } = await import("@secondlayer/shared/db/queries/subgraphs");
1575
+ const { recordSubgraphProcessed: recordSubgraphProcessed3 } = await import("@secondlayer/shared/db/queries/subgraphs");
1571
1576
  if (result.totalEventsProcessed > 0 || result.totalErrors > 0) {
1572
- await recordSubgraphProcessed2(db, subgraphName, result.totalEventsProcessed, result.totalErrors, result.totalErrors > 0 ? `${result.totalErrors} error(s) during backfill` : undefined);
1577
+ await recordSubgraphProcessed3(db, subgraphName, result.totalEventsProcessed, result.totalErrors, result.totalErrors > 0 ? `${result.totalErrors} error(s) during backfill` : undefined);
1573
1578
  }
1574
1579
  logger4.info("Backfill complete", {
1575
1580
  subgraph: subgraphName,
@@ -1823,5 +1828,5 @@ export {
1823
1828
  backfillSubgraph
1824
1829
  };
1825
1830
 
1826
- //# debugId=BDEFBE84CC1D9E3564756E2164756E21
1831
+ //# debugId=7F91468F0DB524F164756E2164756E21
1827
1832
  //# sourceMappingURL=index.js.map