@secondlayer/cli 1.11.1 → 1.12.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 +60 -31
- package/dist/cli.js.map +3 -3
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -14161,7 +14161,7 @@ __export(exports_node_impl, {
|
|
|
14161
14161
|
runSetupWizard: () => runSetupWizard,
|
|
14162
14162
|
restartNode: () => restartNode
|
|
14163
14163
|
});
|
|
14164
|
-
import { confirm as
|
|
14164
|
+
import { confirm as confirm7, input as input3, select as select3 } from "@inquirer/prompts";
|
|
14165
14165
|
async function runSetupWizard() {
|
|
14166
14166
|
console.log("");
|
|
14167
14167
|
console.log(blue("Stacks Node Setup Wizard"));
|
|
@@ -14198,13 +14198,13 @@ async function runSetupWizard() {
|
|
|
14198
14198
|
],
|
|
14199
14199
|
default: "mainnet"
|
|
14200
14200
|
});
|
|
14201
|
-
const autoStartIndexer = await
|
|
14201
|
+
const autoStartIndexer = await confirm7({
|
|
14202
14202
|
message: "Auto-start streams indexer when node starts?",
|
|
14203
14203
|
default: true
|
|
14204
14204
|
});
|
|
14205
14205
|
let indexerPort = 3700;
|
|
14206
14206
|
if (autoStartIndexer) {
|
|
14207
|
-
const customPort = await
|
|
14207
|
+
const customPort = await confirm7({
|
|
14208
14208
|
message: "Use default indexer port (3700)?",
|
|
14209
14209
|
default: true
|
|
14210
14210
|
});
|
|
@@ -14310,7 +14310,7 @@ async function stopNode(_pathOverride, force, wait) {
|
|
|
14310
14310
|
return;
|
|
14311
14311
|
}
|
|
14312
14312
|
if (!force) {
|
|
14313
|
-
const proceed = await
|
|
14313
|
+
const proceed = await confirm7({
|
|
14314
14314
|
message: "Stop the Stacks node?",
|
|
14315
14315
|
default: false
|
|
14316
14316
|
});
|
|
@@ -14343,7 +14343,7 @@ async function restartNode(pathOverride, force, wait) {
|
|
|
14343
14343
|
const wasRunning = await isNodeRunning();
|
|
14344
14344
|
if (wasRunning) {
|
|
14345
14345
|
if (!force) {
|
|
14346
|
-
const proceed = await
|
|
14346
|
+
const proceed = await confirm7({
|
|
14347
14347
|
message: "Restart the Stacks node?",
|
|
14348
14348
|
default: false
|
|
14349
14349
|
});
|
|
@@ -24532,7 +24532,7 @@ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter so
|
|
|
24532
24532
|
}
|
|
24533
24533
|
function requireConfirm() {
|
|
24534
24534
|
if (hasRequiredConfirm)
|
|
24535
|
-
return
|
|
24535
|
+
return confirm8;
|
|
24536
24536
|
hasRequiredConfirm = 1;
|
|
24537
24537
|
const color = requireKleur();
|
|
24538
24538
|
const Prompt = requirePrompt();
|
|
@@ -24605,8 +24605,8 @@ function requireConfirm() {
|
|
|
24605
24605
|
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
|
24606
24606
|
}
|
|
24607
24607
|
}
|
|
24608
|
-
|
|
24609
|
-
return
|
|
24608
|
+
confirm8 = ConfirmPrompt;
|
|
24609
|
+
return confirm8;
|
|
24610
24610
|
}
|
|
24611
24611
|
function requireElements() {
|
|
24612
24612
|
if (hasRequiredElements)
|
|
@@ -25286,7 +25286,7 @@ async function detect2({ autoInstall, programmatic, cwd } = {}) {
|
|
|
25286
25286
|
}
|
|
25287
25287
|
return agent;
|
|
25288
25288
|
}
|
|
25289
|
-
var ini$1, hasRequiredIni, iniExports, prompts$2, kleur, hasRequiredKleur, action, hasRequiredAction, strip, hasRequiredStrip, src, hasRequiredSrc, clear, hasRequiredClear, figures_1, hasRequiredFigures, style, hasRequiredStyle, lines, hasRequiredLines, wrap, hasRequiredWrap, entriesToDisplay, hasRequiredEntriesToDisplay, util, hasRequiredUtil, prompt, hasRequiredPrompt, text, hasRequiredText, select4, hasRequiredSelect, toggle, hasRequiredToggle, datepart, hasRequiredDatepart, meridiem, hasRequiredMeridiem, day, hasRequiredDay, hours, hasRequiredHours, milliseconds, hasRequiredMilliseconds, minutes, hasRequiredMinutes, month, hasRequiredMonth, seconds, hasRequiredSeconds, year, hasRequiredYear, dateparts, hasRequiredDateparts, date, hasRequiredDate, number, hasRequiredNumber, multiselect, hasRequiredMultiselect, autocomplete, hasRequiredAutocomplete, autocompleteMultiselect, hasRequiredAutocompleteMultiselect,
|
|
25289
|
+
var ini$1, hasRequiredIni, iniExports, prompts$2, kleur, hasRequiredKleur, action, hasRequiredAction, strip, hasRequiredStrip, src, hasRequiredSrc, clear, hasRequiredClear, figures_1, hasRequiredFigures, style, hasRequiredStyle, lines, hasRequiredLines, wrap, hasRequiredWrap, entriesToDisplay, hasRequiredEntriesToDisplay, util, hasRequiredUtil, prompt, hasRequiredPrompt, text, hasRequiredText, select4, hasRequiredSelect, toggle, hasRequiredToggle, datepart, hasRequiredDatepart, meridiem, hasRequiredMeridiem, day, hasRequiredDay, hours, hasRequiredHours, milliseconds, hasRequiredMilliseconds, minutes, hasRequiredMinutes, month, hasRequiredMonth, seconds, hasRequiredSeconds, year, hasRequiredYear, dateparts, hasRequiredDateparts, date, hasRequiredDate, number, hasRequiredNumber, multiselect, hasRequiredMultiselect, autocomplete, hasRequiredAutocomplete, autocompleteMultiselect, hasRequiredAutocompleteMultiselect, confirm8, hasRequiredConfirm, elements, hasRequiredElements, hasRequiredPrompts$1, lib$1, hasRequiredLib$1, prompts$1, hasRequiredPrompts, promptsExports, prompts, isBrowser, platform, OSC = "\x1B]", BEL = "\x07", SEP = ";", link = (text2, url) => [
|
|
25290
25290
|
OSC,
|
|
25291
25291
|
"8",
|
|
25292
25292
|
SEP,
|
|
@@ -32678,7 +32678,7 @@ var {
|
|
|
32678
32678
|
// package.json
|
|
32679
32679
|
var package_default = {
|
|
32680
32680
|
name: "@secondlayer/cli",
|
|
32681
|
-
version: "1.
|
|
32681
|
+
version: "1.12.0",
|
|
32682
32682
|
description: "CLI for streams, subgraphs, and real-time blockchain indexing on Stacks",
|
|
32683
32683
|
type: "module",
|
|
32684
32684
|
bin: {
|
|
@@ -32719,11 +32719,11 @@ var package_default = {
|
|
|
32719
32719
|
license: "MIT",
|
|
32720
32720
|
dependencies: {
|
|
32721
32721
|
"@inquirer/prompts": "^8.2.0",
|
|
32722
|
-
"@secondlayer/sdk": "^0.10.
|
|
32723
|
-
"@secondlayer/shared": "^0.
|
|
32722
|
+
"@secondlayer/sdk": "^0.10.2",
|
|
32723
|
+
"@secondlayer/shared": "^0.12.0",
|
|
32724
32724
|
"@secondlayer/stacks": "^0.2.2",
|
|
32725
|
-
"@secondlayer/subgraphs": "^0.
|
|
32726
|
-
"@secondlayer/workflows": "^0.0.
|
|
32725
|
+
"@secondlayer/subgraphs": "^0.11.0",
|
|
32726
|
+
"@secondlayer/workflows": "^0.0.3",
|
|
32727
32727
|
"@biomejs/js-api": "^0.7.0",
|
|
32728
32728
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
32729
32729
|
esbuild: "^0.19.0",
|
|
@@ -35484,6 +35484,7 @@ init_config();
|
|
|
35484
35484
|
init_fs();
|
|
35485
35485
|
init_output();
|
|
35486
35486
|
init_clarity();
|
|
35487
|
+
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
35487
35488
|
|
|
35488
35489
|
// src/templates/subgraph.ts
|
|
35489
35490
|
function generateSubgraphTemplate(name) {
|
|
@@ -35618,7 +35619,7 @@ Stopped watching.`);
|
|
|
35618
35619
|
});
|
|
35619
35620
|
await new Promise(() => {});
|
|
35620
35621
|
});
|
|
35621
|
-
subgraphs.command("deploy <file>").description("Deploy a subgraph definition file").option("--
|
|
35622
|
+
subgraphs.command("deploy <file>").description("Deploy a subgraph definition file").option("--version <semver>", "Explicit version (default: auto-increment patch)").option("--force", "Skip confirmation prompt for reindex operations").action(async (file, options2) => {
|
|
35622
35623
|
try {
|
|
35623
35624
|
const absPath = resolve(file);
|
|
35624
35625
|
const config = await loadConfig();
|
|
@@ -35641,34 +35642,62 @@ Stopped watching.`);
|
|
|
35641
35642
|
const handlerCode = new TextDecoder().decode(buildResult.outputFiles[0].contents);
|
|
35642
35643
|
const result = await deploySubgraphApi({
|
|
35643
35644
|
name: def.name,
|
|
35644
|
-
version:
|
|
35645
|
+
version: options2.version,
|
|
35645
35646
|
description: def.description,
|
|
35646
35647
|
sources: def.sources,
|
|
35647
35648
|
schema: def.schema,
|
|
35648
|
-
handlerCode
|
|
35649
|
-
reindex: options2.reindex
|
|
35649
|
+
handlerCode
|
|
35650
35650
|
});
|
|
35651
35651
|
if (result.action === "unchanged") {
|
|
35652
|
-
info(`Subgraph "${def.name}" is up to date (no
|
|
35652
|
+
info(`Subgraph "${def.name}" is up to date (v${result.version} — no changes)`);
|
|
35653
|
+
} else if (result.action === "created" || result.action === "reindexed") {
|
|
35654
|
+
if (result.diff) {
|
|
35655
|
+
const { addedTables, addedColumns, breakingChanges } = result.diff;
|
|
35656
|
+
if (breakingChanges.length > 0) {
|
|
35657
|
+
warn(`Breaking changes detected:`);
|
|
35658
|
+
for (const r of breakingChanges)
|
|
35659
|
+
warn(` ✗ ${r}`);
|
|
35660
|
+
}
|
|
35661
|
+
if (addedTables.length > 0)
|
|
35662
|
+
info(` + tables: ${addedTables.join(", ")}`);
|
|
35663
|
+
for (const [t, cols] of Object.entries(addedColumns)) {
|
|
35664
|
+
info(` + columns: ${t}.${cols.join(", ")}`);
|
|
35665
|
+
}
|
|
35666
|
+
}
|
|
35667
|
+
const confirmed = options2.force || await confirm6({
|
|
35668
|
+
message: `⚠ This will drop all data and reindex from scratch. Continue?`
|
|
35669
|
+
});
|
|
35670
|
+
if (!confirmed) {
|
|
35671
|
+
info("Aborted.");
|
|
35672
|
+
process.exit(0);
|
|
35673
|
+
}
|
|
35674
|
+
success(result.action === "created" ? `Subgraph "${def.name}" created → v${result.version}` : `Subgraph "${def.name}" updated → v${result.version} (reindexing)`);
|
|
35653
35675
|
} else {
|
|
35654
|
-
|
|
35676
|
+
if (result.diff) {
|
|
35677
|
+
const { addedTables, addedColumns } = result.diff;
|
|
35678
|
+
if (addedTables.length > 0)
|
|
35679
|
+
info(` + tables: ${addedTables.join(", ")}`);
|
|
35680
|
+
for (const [t, cols] of Object.entries(addedColumns)) {
|
|
35681
|
+
info(` + columns: ${t}.${cols.join(", ")}`);
|
|
35682
|
+
}
|
|
35683
|
+
}
|
|
35684
|
+
success(`Subgraph "${def.name}" updated → v${result.version}`);
|
|
35655
35685
|
}
|
|
35656
35686
|
} else {
|
|
35657
35687
|
const { deploySchema } = await import("@secondlayer/subgraphs");
|
|
35658
35688
|
const { getDb: getDb3, closeDb } = await import("@secondlayer/shared/db");
|
|
35659
35689
|
const db = getDb3();
|
|
35660
35690
|
const result = await deploySchema(db, def, absPath, {
|
|
35661
|
-
|
|
35691
|
+
version: options2.version
|
|
35662
35692
|
});
|
|
35663
35693
|
if (result.action === "unchanged") {
|
|
35664
|
-
info(`Subgraph "${def.name}" is up to date (no
|
|
35694
|
+
info(`Subgraph "${def.name}" is up to date (v${result.version} — no changes)`);
|
|
35665
35695
|
} else if (result.action === "created") {
|
|
35666
|
-
success(`Subgraph "${def.name}" created
|
|
35696
|
+
success(`Subgraph "${def.name}" created → v${result.version}`);
|
|
35667
35697
|
} else if (result.action === "reindexed") {
|
|
35668
|
-
success(`Subgraph "${def.name}"
|
|
35669
|
-
info(`Reindexing will begin when subgraph processor starts.`);
|
|
35698
|
+
success(`Subgraph "${def.name}" updated → v${result.version} (reindexing)`);
|
|
35670
35699
|
} else {
|
|
35671
|
-
success(`Subgraph "${def.name}" updated
|
|
35700
|
+
success(`Subgraph "${def.name}" updated → v${result.version}`);
|
|
35672
35701
|
}
|
|
35673
35702
|
await closeDb();
|
|
35674
35703
|
}
|
|
@@ -35884,8 +35913,8 @@ ${rows.length} row(s)`));
|
|
|
35884
35913
|
subgraphs.command("delete <name>").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").action(async (name, options2) => {
|
|
35885
35914
|
try {
|
|
35886
35915
|
if (!options2.yes) {
|
|
35887
|
-
const { confirm:
|
|
35888
|
-
const ok = await
|
|
35916
|
+
const { confirm: confirm7 } = await import("@inquirer/prompts");
|
|
35917
|
+
const ok = await confirm7({
|
|
35889
35918
|
message: `Delete subgraph "${name}" and all its data? This cannot be undone.`
|
|
35890
35919
|
});
|
|
35891
35920
|
if (!ok) {
|
|
@@ -37429,8 +37458,8 @@ ${runs.length} run(s)`));
|
|
|
37429
37458
|
workflows.command("delete <name>").description("Delete a workflow").option("-y, --yes", "Skip confirmation").action(async (name, options2) => {
|
|
37430
37459
|
try {
|
|
37431
37460
|
if (!options2.yes) {
|
|
37432
|
-
const { confirm:
|
|
37433
|
-
const ok = await
|
|
37461
|
+
const { confirm: confirm8 } = await import("@inquirer/prompts");
|
|
37462
|
+
const ok = await confirm8({
|
|
37434
37463
|
message: `Delete workflow "${name}"? This cannot be undone.`
|
|
37435
37464
|
});
|
|
37436
37465
|
if (!ok) {
|
|
@@ -37487,5 +37516,5 @@ registerWhoamiCommand(program);
|
|
|
37487
37516
|
registerReceiverCommand(program);
|
|
37488
37517
|
program.parse();
|
|
37489
37518
|
|
|
37490
|
-
//# debugId=
|
|
37519
|
+
//# debugId=684F7B52D8A7982E64756E2164756E21
|
|
37491
37520
|
//# sourceMappingURL=cli.js.map
|