@secondlayer/subgraphs 4.1.2 → 4.1.3

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
@@ -3421,6 +3421,9 @@ function decoderNamesForIndexEventTypes(eventTypes) {
3421
3421
  function decoderNamesForSubgraph(subgraph) {
3422
3422
  return decoderNamesForIndexEventTypes(referencedIndexEventTypes(subgraph));
3423
3423
  }
3424
+ function usesDecodedIndexPlane(subgraph) {
3425
+ return process.env.SUBGRAPH_SOURCE === "streams-index" && isStreamsIndexEligible(subgraph);
3426
+ }
3424
3427
  function committedHeight(cursor) {
3425
3428
  if (!cursor)
3426
3429
  return null;
@@ -3579,25 +3582,28 @@ async function catchUpSubgraph(subgraph, subgraphName) {
3579
3582
  const rawTip = await source.getTip();
3580
3583
  if (rawTip <= 0)
3581
3584
  return 0;
3582
- const bound = await boundSourceTip(rawTip, decoderNamesForSubgraph(subgraph));
3583
- if (!bound.ok) {
3584
- logger8.warn("Subgraph catch-up stalled: missing decoder checkpoint", {
3585
- event: "subgraph_catchup_decoder_stall",
3586
- subgraph: subgraphName,
3587
- missing: bound.missing
3588
- });
3589
- return 0;
3590
- }
3591
- if (bound.floor !== null && bound.floor < rawTip) {
3592
- logger8.debug("Subgraph catch-up tip bounded by decoder progress", {
3593
- event: "subgraph_catchup_decoder_floor",
3594
- subgraph: subgraphName,
3595
- rawTip,
3596
- floor: bound.floor,
3597
- tip: bound.tip
3598
- });
3585
+ let chainTip = rawTip;
3586
+ if (usesDecodedIndexPlane(subgraph)) {
3587
+ const bound = await boundSourceTip(rawTip, decoderNamesForSubgraph(subgraph));
3588
+ if (!bound.ok) {
3589
+ logger8.warn("Subgraph catch-up stalled: missing decoder checkpoint", {
3590
+ event: "subgraph_catchup_decoder_stall",
3591
+ subgraph: subgraphName,
3592
+ missing: bound.missing
3593
+ });
3594
+ return 0;
3595
+ }
3596
+ if (bound.floor !== null && bound.floor < rawTip) {
3597
+ logger8.debug("Subgraph catch-up tip bounded by decoder progress", {
3598
+ event: "subgraph_catchup_decoder_floor",
3599
+ subgraph: subgraphName,
3600
+ rawTip,
3601
+ floor: bound.floor,
3602
+ tip: bound.tip
3603
+ });
3604
+ }
3605
+ chainTip = bound.tip;
3599
3606
  }
3600
- const chainTip = bound.tip;
3601
3607
  if (chainTip <= 0 || lastProcessedBlock >= chainTip)
3602
3608
  return 0;
3603
3609
  const subgraphStart = Number(subgraphRow.start_block) || 1;
@@ -4061,6 +4067,9 @@ async function resolveBlockRange(source, def, opts) {
4061
4067
  const definitionStart = def.startBlock ?? 1;
4062
4068
  const fromBlock = opts?.startBlockFloor != null ? Math.max(definitionStart, opts.startBlockFloor) : definitionStart;
4063
4069
  const rawTip = await source.getTip();
4070
+ if (!usesDecodedIndexPlane(def)) {
4071
+ return { fromBlock, toBlock: rawTip };
4072
+ }
4064
4073
  const bound = await boundSourceTip(rawTip, decoderNamesForSubgraph(def));
4065
4074
  if (!bound.ok) {
4066
4075
  logger10.warn("Reindex stalled: missing decoder checkpoint", {
@@ -5537,5 +5546,5 @@ export {
5537
5546
  ChainReadError
5538
5547
  };
5539
5548
 
5540
- //# debugId=514A04CE6E76132964756E2164756E21
5549
+ //# debugId=5A8D4A3C8F2C6DFE64756E2164756E21
5541
5550
  //# sourceMappingURL=index.js.map