@secondlayer/cli 16.1.0 → 16.2.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
@@ -29057,11 +29057,11 @@ async function deleteSubgraphApi(name, options) {
29057
29057
  async function deploySubgraphApi(data) {
29058
29058
  return (await getPlatformClient()).subgraphs.deploy(data);
29059
29059
  }
29060
- async function querySubgraphTable(name, table, params = {}) {
29061
- return (await getPlatformClient()).subgraphs.queryTable(name, table, params);
29060
+ async function querySubgraphTableRows(name, table, params = {}) {
29061
+ return (await getPlatformClient()).subgraphs.rows(name, table, params);
29062
29062
  }
29063
29063
  async function querySubgraphTableCount(name, table, params = {}) {
29064
- return (await getPlatformClient()).subgraphs.queryTableCount(name, table, params);
29064
+ return (await getPlatformClient()).subgraphs.count(name, table, params);
29065
29065
  }
29066
29066
  async function getSubgraphGaps(name, opts) {
29067
29067
  return (await getPlatformClient()).subgraphs.gaps(name, opts);
@@ -200022,7 +200022,7 @@ ${result.meta.total} gap(s), ${result.meta.totalMissingBlocks} total missing blo
200022
200022
  handleApiError(err, "get subgraph gaps");
200023
200023
  }
200024
200024
  });
200025
- subgraphs.command("query <name> <table>").description("Query a subgraph table").option("--sort <column>", "Sort by column").option("--order <dir>", "Sort direction (asc|desc)", "asc").option("--limit <n>", "Max rows to return", "20").option("--offset <n>", "Skip first N rows").option("--fields <cols>", "Comma-separated columns to include").option("--filter <kv...>", "Filter as key=value (supports .gte/.lte/.gt/.lt/.neq suffixes)").option("--count", "Return row count only").option("--json", "Output as JSON").addHelpText("after", `
200025
+ subgraphs.command("query <name> <table>").description("Query a subgraph table").option("--sort <column>", "Sort by column").option("--order <dir>", "Sort direction (asc|desc)", "asc").option("--limit <n>", "Max rows to return", "20").option("--cursor <token>", "Resume from a previous page's next_cursor").option("--fields <cols>", "Comma-separated columns to include").option("--filter <kv...>", "Filter as key=value (supports .gte/.lte/.gt/.lt/.neq suffixes)").option("--count", "Return row count only").option("--json", "Output as JSON").addHelpText("after", `
200026
200026
  Examples:
200027
200027
  $ secondlayer subgraphs query my-graph balances --filter holder=SP2J6ZY... --limit 50
200028
200028
  $ secondlayer subgraphs query my-graph transfers --filter amount.gte=1000 --sort _block_height --order desc
@@ -200035,16 +200035,10 @@ Examples:
200035
200035
  error(err instanceof Error ? err.message : String(err));
200036
200036
  process.exit(1);
200037
200037
  }
200038
- const params = {
200039
- sort: options.sort,
200040
- order: options.sort ? options.order : undefined,
200041
- limit: Number.parseInt(options.limit, 10),
200042
- offset: options.offset ? Number.parseInt(options.offset, 10) : undefined,
200043
- fields: options.fields,
200044
- filters
200045
- };
200046
200038
  if (options.count) {
200047
- const result = await querySubgraphTableCount(name, table, params);
200039
+ const result = await querySubgraphTableCount(name, table, {
200040
+ filters
200041
+ });
200048
200042
  if (options.json) {
200049
200043
  console.log(JSON.stringify(result, null, 2));
200050
200044
  } else {
@@ -200052,20 +200046,28 @@ Examples:
200052
200046
  }
200053
200047
  return;
200054
200048
  }
200055
- const rows = await querySubgraphTable(name, table, params);
200049
+ const params = {
200050
+ sort: options.sort,
200051
+ order: options.sort ? options.order : undefined,
200052
+ limit: Number.parseInt(options.limit, 10),
200053
+ fields: options.fields,
200054
+ filters,
200055
+ cursor: options.cursor
200056
+ };
200057
+ const { rows: resultRows, next_cursor } = await querySubgraphTableRows(name, table, params);
200056
200058
  if (options.json) {
200057
- console.log(JSON.stringify(rows, null, 2));
200059
+ console.log(JSON.stringify({ rows: resultRows, next_cursor }, null, 2));
200058
200060
  return;
200059
200061
  }
200060
- if (rows.length === 0) {
200062
+ if (resultRows.length === 0) {
200061
200063
  console.log(dim("No rows found"));
200062
200064
  return;
200063
200065
  }
200064
- const firstRow = rows[0];
200066
+ const firstRow = resultRows[0];
200065
200067
  if (!firstRow)
200066
200068
  return;
200067
200069
  const columns = Object.keys(firstRow);
200068
- const tableRows = rows.map((row) => columns.map((col) => {
200070
+ const tableRows = resultRows.map((row) => columns.map((col) => {
200069
200071
  const val = row[col];
200070
200072
  if (val === null || val === undefined)
200071
200073
  return dim("-");
@@ -200075,7 +200077,10 @@ Examples:
200075
200077
  }));
200076
200078
  console.log(formatTable(columns, tableRows));
200077
200079
  console.log(dim(`
200078
- ${rows.length} row(s)`));
200080
+ ${resultRows.length} row(s)`));
200081
+ if (next_cursor) {
200082
+ console.log(dim(`next_cursor: ${next_cursor}`));
200083
+ }
200079
200084
  } catch (err) {
200080
200085
  handleApiError(err, "query subgraph");
200081
200086
  }
@@ -204289,7 +204294,7 @@ var {
204289
204294
  // package.json
204290
204295
  var package_default = {
204291
204296
  name: "@secondlayer/cli",
204292
- version: "16.1.0",
204297
+ version: "16.2.0",
204293
204298
  description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
204294
204299
  repository: {
204295
204300
  type: "git",
@@ -204328,12 +204333,12 @@ var package_default = {
204328
204333
  "@inquirer/prompts": "^8.2.0",
204329
204334
  "@opentui/core": "^0.5.3",
204330
204335
  "@opentui/react": "^0.5.3",
204331
- "@secondlayer/bundler": "^0.6.0",
204332
- "@secondlayer/scaffold": "^1.6.0",
204333
- "@secondlayer/sdk": "^10.6.0",
204334
- "@secondlayer/shared": "^11.8.0",
204336
+ "@secondlayer/bundler": "^0.6.1",
204337
+ "@secondlayer/scaffold": "^1.6.1",
204338
+ "@secondlayer/sdk": "^11.0.0",
204339
+ "@secondlayer/shared": "^11.8.1",
204335
204340
  "@secondlayer/stacks": "^6.1.0",
204336
- "@secondlayer/subgraphs": "^5.0.0",
204341
+ "@secondlayer/subgraphs": "^6.0.0",
204337
204342
  esbuild: "^0.28.2",
204338
204343
  react: "^19.1.0",
204339
204344
  "smol-toml": "^1.8.0",
@@ -206954,6 +206959,9 @@ function buildDoctorReport(input) {
206954
206959
  integrity: input.subgraph.sync.integrity
206955
206960
  } : null;
206956
206961
  const hints = [];
206962
+ if (input.webhook.warning) {
206963
+ hints.push(input.webhook.warning);
206964
+ }
206957
206965
  if (input.webhook.status === "paused") {
206958
206966
  hints.push(`Resume when the receiver is healthy: secondlayer webhooks resume ${input.webhook.id}`);
206959
206967
  }
@@ -207124,13 +207132,14 @@ async function representativeRow(client, sub, subgraph) {
207124
207132
  };
207125
207133
  }
207126
207134
  try {
207127
- const rows = await client.subgraphs.queryTable(sub.subgraphName, sub.tableName, {
207135
+ const { rows } = await client.subgraphs.rows(sub.subgraphName, sub.tableName, {
207128
207136
  sort: "_block_height",
207129
207137
  order: "desc",
207130
207138
  limit: 1
207131
207139
  });
207132
- if (rows[0] && typeof rows[0] === "object")
207133
- return rows[0];
207140
+ const row = rows[0];
207141
+ if (row && typeof row === "object")
207142
+ return row;
207134
207143
  } catch {}
207135
207144
  return buildSyntheticRow(subgraph, sub.tableName);
207136
207145
  }
@@ -207854,8 +207863,8 @@ async function renderStatus(limit) {
207854
207863
  const rows = [];
207855
207864
  for (const sg of subs) {
207856
207865
  for (const table of sg.tables ?? []) {
207857
- const res = await jget(`${API_URL}/api/subgraphs/${sg.name}/${table}?_limit=${limit}&_sort=_block_height&_order=desc`);
207858
- for (const row of res?.data ?? []) {
207866
+ const res = await jget(`${API_URL}/v1/subgraphs/${sg.name}/${table}?_limit=${limit}&_sort=_block_height&_order=desc`);
207867
+ for (const row of res?.rows ?? []) {
207859
207868
  const summary = Object.entries(row).filter(([k]) => !SYS_COLS.has(k)).map(([, v]) => shortVal(v)).join(" ");
207860
207869
  rows.push({ block: Number(row._block_height ?? 0), table, summary });
207861
207870
  }
@@ -209663,5 +209672,5 @@ registerCreditsCommand(program);
209663
209672
  registerArchiveCommand(program);
209664
209673
  program.parse();
209665
209674
 
209666
- //# debugId=D065FAB5BD697E9764756E2164756E21
209675
+ //# debugId=8F597010AF7694DA64756E2164756E21
209667
209676
  //# sourceMappingURL=cli.js.map