@secondlayer/cli 3.5.0 → 3.5.1

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/cli.js CHANGED
@@ -32437,7 +32437,7 @@ var {
32437
32437
  // package.json
32438
32438
  var package_default = {
32439
32439
  name: "@secondlayer/cli",
32440
- version: "3.5.0",
32440
+ version: "3.5.1",
32441
32441
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32442
32442
  type: "module",
32443
32443
  bin: {
@@ -32481,7 +32481,7 @@ var package_default = {
32481
32481
  "@inquirer/prompts": "^8.2.0",
32482
32482
  "@secondlayer/bundler": "^0.3.2",
32483
32483
  "@secondlayer/sdk": "^3.2.0",
32484
- "@secondlayer/shared": "^4.2.0",
32484
+ "@secondlayer/shared": "^4.3.2",
32485
32485
  "@secondlayer/stacks": "^2.0.0",
32486
32486
  "@secondlayer/subgraphs": "^1.2.1",
32487
32487
  "@biomejs/js-api": "^0.7.0",
@@ -34625,6 +34625,32 @@ ${dim("Columns")}`);
34625
34625
  const deployTarget = context.bundled ? "tenant API" : "local database";
34626
34626
  info(`Dry run only. No ${deployTarget} changes were made.`);
34627
34627
  }
34628
+ function formatSubgraphSync(sync) {
34629
+ const targetBlock = sync.targetBlock ?? sync.chainTip;
34630
+ const totalBlocks = sync.totalBlocks;
34631
+ const processedBlocks = sync.processedBlocks;
34632
+ const progress = `${(sync.progress * 100).toFixed(1)}%`;
34633
+ if (sync.status === "reindexing" || sync.mode === "reindex") {
34634
+ if (targetBlock <= 0) {
34635
+ return {
34636
+ line: `reindexing — cursor #${sync.lastProcessedBlock} (target unavailable from API)`,
34637
+ remainingLabel: "Reindex Remaining",
34638
+ remaining: "N/A"
34639
+ };
34640
+ }
34641
+ const range = processedBlocks !== undefined && totalBlocks !== undefined ? `${processedBlocks} / ${totalBlocks} blocks` : `${sync.lastProcessedBlock} / ${targetBlock}`;
34642
+ return {
34643
+ line: `reindexing — ${progress} (${range}, target #${targetBlock})`,
34644
+ remainingLabel: "Reindex Remaining",
34645
+ remaining: String(sync.blocksRemaining)
34646
+ };
34647
+ }
34648
+ return {
34649
+ line: `${sync.status} — ${progress} (${sync.lastProcessedBlock} / ${targetBlock})`,
34650
+ remainingLabel: "Blocks Remaining",
34651
+ remaining: String(sync.blocksRemaining)
34652
+ };
34653
+ }
34628
34654
  function registerSubgraphsCommand(program2) {
34629
34655
  const subgraphs = program2.command("subgraphs").description("Manage materialized subgraphs");
34630
34656
  subgraphs.command("new <name>").description("Scaffold a new subgraph definition file").action(async (name) => {
@@ -34853,21 +34879,24 @@ ${data.length} subgraph(s) total`));
34853
34879
  const rowCounts = Object.entries(subgraph.tables).map(([t, info2]) => `${t}: ${info2.rowCount}`).join(", ") || "N/A";
34854
34880
  const errorRate = subgraph.health.totalProcessed > 0 ? `${(subgraph.health.errorRate * 100).toFixed(2)}%` : "N/A";
34855
34881
  const sync = subgraph.sync;
34856
- const syncStatus = sync ? `${sync.status} — ${(sync.progress * 100).toFixed(1)}% (${sync.lastProcessedBlock} / ${sync.chainTip})` : "unknown";
34857
- const blocksRemaining = sync ? String(sync.blocksRemaining) : "N/A";
34882
+ const syncDisplay = sync ? formatSubgraphSync(sync) : {
34883
+ line: "unknown",
34884
+ remainingLabel: "Blocks Remaining",
34885
+ remaining: "N/A"
34886
+ };
34858
34887
  const gapSummary = sync && sync.gaps.count > 0 ? `${sync.gaps.count} unresolved (${sync.gaps.totalMissingBlocks} missing blocks)` : "none";
34859
34888
  const integrity = sync?.integrity ?? "unknown";
34860
34889
  console.log(formatKeyValue([
34861
34890
  ["Name", subgraph.name],
34862
34891
  ["Version", subgraph.version],
34863
34892
  ["Status", subgraph.status],
34864
- ["Sync", syncStatus],
34865
- ["Blocks Remaining", blocksRemaining],
34893
+ ["Sync", syncDisplay.line],
34894
+ [syncDisplay.remainingLabel, syncDisplay.remaining],
34866
34895
  ["Integrity", integrity],
34867
34896
  ["Gaps", gapSummary],
34868
34897
  ["Last Block", String(subgraph.lastProcessedBlock)],
34869
34898
  ["Row Count", rowCounts],
34870
- ["Total Processed", String(subgraph.health.totalProcessed)],
34899
+ ["Total Events", String(subgraph.health.totalProcessed)],
34871
34900
  ["Total Errors", String(subgraph.health.totalErrors)],
34872
34901
  ["Error Rate", errorRate],
34873
34902
  ["Last Error", subgraph.health.lastError ?? "none"],
@@ -36423,5 +36452,5 @@ registerLocalCommand(program);
36423
36452
  registerAccountCommand(program);
36424
36453
  program.parse();
36425
36454
 
36426
- //# debugId=02FDB52BEFC9082464756E2164756E21
36455
+ //# debugId=4D8FC47BED33A85764756E2164756E21
36427
36456
  //# sourceMappingURL=cli.js.map