@secondlayer/cli 5.4.10 → 5.5.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.
package/dist/cli.js CHANGED
@@ -32321,7 +32321,7 @@ var {
32321
32321
  // package.json
32322
32322
  var package_default = {
32323
32323
  name: "@secondlayer/cli",
32324
- version: "5.4.10",
32324
+ version: "5.5.0",
32325
32325
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32326
32326
  type: "module",
32327
32327
  bin: {
@@ -35712,12 +35712,40 @@ Synced — exiting watch.`));
35712
35712
  process.exit(1);
35713
35713
  }
35714
35714
  });
35715
- subgraphs.command("reindex <name>").description("Reindex a subgraph from historical blocks").option("--from <block>", "Start block height").option("--to <block>", "End block height").action(async (name, options2) => {
35715
+ subgraphs.command("reindex <name>").description("Reindex a subgraph from historical blocks (drops + reprocesses)").option("--from <block>", "Start block height").option("--to <block>", "End block height").option("-y, --yes", "Skip confirmation").action(async (name, options2) => {
35716
35716
  try {
35717
+ const fromBlock = options2.from ? Number.parseInt(options2.from, 10) : undefined;
35718
+ const toBlock = options2.to ? Number.parseInt(options2.to, 10) : undefined;
35719
+ if (!options2.yes) {
35720
+ if (!process.stdin.isTTY) {
35721
+ error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
35722
+ process.exit(1);
35723
+ }
35724
+ const { confirm: confirm4 } = await import("@inquirer/prompts");
35725
+ const range = fromBlock !== undefined && toBlock !== undefined ? ` for blocks [${fromBlock}, ${toBlock}]` : fromBlock !== undefined ? ` from block ${fromBlock}` : toBlock !== undefined ? ` up to block ${toBlock}` : "";
35726
+ let ok = false;
35727
+ try {
35728
+ ok = await confirm4({
35729
+ message: `Reindex subgraph "${name}"${range}? Existing rows in this range will be dropped and reprocessed.`,
35730
+ default: false
35731
+ });
35732
+ } catch (promptErr) {
35733
+ const m = promptErr instanceof Error ? promptErr.message : String(promptErr);
35734
+ if (m.includes("ExitPromptError") || m.includes("force closed")) {
35735
+ error("Interactive prompt unavailable. Re-run with -y to skip confirmation.");
35736
+ process.exit(1);
35737
+ }
35738
+ throw promptErr;
35739
+ }
35740
+ if (!ok) {
35741
+ info("Cancelled.");
35742
+ return;
35743
+ }
35744
+ }
35717
35745
  info(`Reindexing subgraph "${name}"...`);
35718
35746
  const result = await reindexSubgraphApi(name, {
35719
- fromBlock: options2.from ? Number.parseInt(options2.from, 10) : undefined,
35720
- toBlock: options2.to ? Number.parseInt(options2.to, 10) : undefined
35747
+ fromBlock,
35748
+ toBlock
35721
35749
  });
35722
35750
  success(result.message);
35723
35751
  info(`From block ${result.fromBlock} to ${result.toBlock}`);
@@ -37141,5 +37169,5 @@ registerAccountCommand(program);
37141
37169
  registerBillingCommand(program);
37142
37170
  program.parse();
37143
37171
 
37144
- //# debugId=A0A9A1B14EDB1F2464756E2164756E21
37172
+ //# debugId=0A4938B14DE3510164756E2164756E21
37145
37173
  //# sourceMappingURL=cli.js.map