@secondlayer/cli 1.6.7 → 1.7.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 +25 -5
- package/dist/cli.js.map +4 -4
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -4567,6 +4567,7 @@ __export(exports_api_client, {
|
|
|
4567
4567
|
deleteSubgraphApi: () => deleteSubgraphApi,
|
|
4568
4568
|
deleteStream: () => deleteStream,
|
|
4569
4569
|
createStream: () => createStream,
|
|
4570
|
+
backfillSubgraphApi: () => backfillSubgraphApi,
|
|
4570
4571
|
authHeaders: () => authHeaders,
|
|
4571
4572
|
assertOk: () => assertOk,
|
|
4572
4573
|
ApiError: () => ApiError
|
|
@@ -4651,6 +4652,9 @@ async function getSubgraphApi(name) {
|
|
|
4651
4652
|
async function reindexSubgraphApi(name, options) {
|
|
4652
4653
|
return (await getClient()).subgraphs.reindex(name, options);
|
|
4653
4654
|
}
|
|
4655
|
+
async function backfillSubgraphApi(name, options) {
|
|
4656
|
+
return (await getClient()).subgraphs.backfill(name, options);
|
|
4657
|
+
}
|
|
4654
4658
|
async function deleteSubgraphApi(name) {
|
|
4655
4659
|
return (await getClient()).subgraphs.delete(name);
|
|
4656
4660
|
}
|
|
@@ -32552,7 +32556,7 @@ var {
|
|
|
32552
32556
|
// package.json
|
|
32553
32557
|
var package_default = {
|
|
32554
32558
|
name: "@secondlayer/cli",
|
|
32555
|
-
version: "1.
|
|
32559
|
+
version: "1.7.0",
|
|
32556
32560
|
description: "CLI for streams, subgraphs, and real-time blockchain indexing on Stacks",
|
|
32557
32561
|
type: "module",
|
|
32558
32562
|
bin: {
|
|
@@ -32593,10 +32597,10 @@ var package_default = {
|
|
|
32593
32597
|
license: "MIT",
|
|
32594
32598
|
dependencies: {
|
|
32595
32599
|
"@inquirer/prompts": "^8.2.0",
|
|
32596
|
-
"@secondlayer/sdk": "^0.
|
|
32597
|
-
"@secondlayer/shared": "^0.
|
|
32600
|
+
"@secondlayer/sdk": "^0.7.0",
|
|
32601
|
+
"@secondlayer/shared": "^0.7.1",
|
|
32598
32602
|
"@secondlayer/stacks": "^0.2.2",
|
|
32599
|
-
"@secondlayer/subgraphs": "^0.
|
|
32603
|
+
"@secondlayer/subgraphs": "^0.6.0",
|
|
32600
32604
|
"@biomejs/js-api": "^0.7.0",
|
|
32601
32605
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
32602
32606
|
esbuild: "^0.19.0",
|
|
@@ -35521,6 +35525,22 @@ Table endpoints:`));
|
|
|
35521
35525
|
handleApiError(err, "reindex subgraph");
|
|
35522
35526
|
}
|
|
35523
35527
|
});
|
|
35528
|
+
subgraphs.command("backfill <name>").description("Backfill a block range without dropping existing data").requiredOption("--from <block>", "Start block height").requiredOption("--to <block>", "End block height").action(async (name, options2) => {
|
|
35529
|
+
try {
|
|
35530
|
+
const fromBlock = parseInt(options2.from, 10);
|
|
35531
|
+
const toBlock = parseInt(options2.to, 10);
|
|
35532
|
+
if (isNaN(fromBlock) || isNaN(toBlock)) {
|
|
35533
|
+
error("--from and --to must be valid block numbers");
|
|
35534
|
+
process.exit(1);
|
|
35535
|
+
}
|
|
35536
|
+
info(`Backfilling subgraph "${name}" from block ${fromBlock} to ${toBlock}...`);
|
|
35537
|
+
const result = await backfillSubgraphApi(name, { fromBlock, toBlock });
|
|
35538
|
+
success(result.message);
|
|
35539
|
+
info(`From block ${result.fromBlock} to ${result.toBlock}`);
|
|
35540
|
+
} catch (err) {
|
|
35541
|
+
handleApiError(err, "backfill subgraph");
|
|
35542
|
+
}
|
|
35543
|
+
});
|
|
35524
35544
|
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").action(async (name, table, options2) => {
|
|
35525
35545
|
try {
|
|
35526
35546
|
const filters = {};
|
|
@@ -36783,5 +36803,5 @@ registerWhoamiCommand(program);
|
|
|
36783
36803
|
registerReceiverCommand(program);
|
|
36784
36804
|
program.parse();
|
|
36785
36805
|
|
|
36786
|
-
//# debugId=
|
|
36806
|
+
//# debugId=25ACF0102B2A97C864756E2164756E21
|
|
36787
36807
|
//# sourceMappingURL=cli.js.map
|