@secondlayer/cli 19.1.1 → 19.1.3
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 +34 -13
- package/dist/cli.js.map +4 -4
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -2142,6 +2142,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2142
2142
|
});
|
|
2143
2143
|
|
|
2144
2144
|
// src/lib/api-url.ts
|
|
2145
|
+
import { isHostedApiUrl } from "@secondlayer/sdk";
|
|
2145
2146
|
function resolveApiUrl() {
|
|
2146
2147
|
return (process.env.SECONDLAYER_API_URL ?? process.env.SL_PLATFORM_API_URL ?? LOCAL_API_URL).replace(/\/+$/, "");
|
|
2147
2148
|
}
|
|
@@ -2149,11 +2150,7 @@ function resolveArchiveOpsUrl() {
|
|
|
2149
2150
|
return (process.env.SL_CREDITS_API_URL ?? ARCHIVE_OPS_API_URL).replace(/\/+$/, "");
|
|
2150
2151
|
}
|
|
2151
2152
|
function isMerchantUrl(url = resolveApiUrl()) {
|
|
2152
|
-
|
|
2153
|
-
return new URL(url).hostname === "api.secondlayer.tools";
|
|
2154
|
-
} catch {
|
|
2155
|
-
return false;
|
|
2156
|
-
}
|
|
2153
|
+
return isHostedApiUrl(url);
|
|
2157
2154
|
}
|
|
2158
2155
|
function assertInstanceUrl(url = resolveApiUrl()) {
|
|
2159
2156
|
if (!isMerchantUrl(url))
|
|
@@ -2162,6 +2159,7 @@ function assertInstanceUrl(url = resolveApiUrl()) {
|
|
|
2162
2159
|
unset SECONDLAYER_API_URL, or pass --api-url http://127.0.0.1:3800`);
|
|
2163
2160
|
}
|
|
2164
2161
|
var LOCAL_API_URL = "http://127.0.0.1:3800", ARCHIVE_OPS_API_URL = "https://api.secondlayer.tools";
|
|
2162
|
+
var init_api_url = () => {};
|
|
2165
2163
|
|
|
2166
2164
|
// src/lib/session.ts
|
|
2167
2165
|
import {
|
|
@@ -2239,6 +2237,7 @@ async function clearSession(apiUrl = resolveApiUrl(), path = getSessionPath()) {
|
|
|
2239
2237
|
}
|
|
2240
2238
|
var SessionSchema, SessionFileSchema;
|
|
2241
2239
|
var init_session = __esm(() => {
|
|
2240
|
+
init_api_url();
|
|
2242
2241
|
SessionSchema = z.object({
|
|
2243
2242
|
token: z.string().min(1),
|
|
2244
2243
|
email: z.string().email(),
|
|
@@ -2306,7 +2305,9 @@ function assertInstanceOrAccountKey(url = resolveApiUrl()) {
|
|
|
2306
2305
|
assertInstanceUrl(url);
|
|
2307
2306
|
}
|
|
2308
2307
|
var init_resolve_auth = __esm(() => {
|
|
2308
|
+
init_api_url();
|
|
2309
2309
|
init_session();
|
|
2310
|
+
init_api_url();
|
|
2310
2311
|
});
|
|
2311
2312
|
|
|
2312
2313
|
// src/lib/http.ts
|
|
@@ -2389,8 +2390,10 @@ async function httpArchiveOps(path, opts = {}) {
|
|
|
2389
2390
|
}
|
|
2390
2391
|
var CliHttpError, REQUEST_TIMEOUT_MS = 30000, ARCHIVE_LOGIN_COMMAND = "secondlayer login --credits", ARCHIVE_CREDENTIAL_RE;
|
|
2391
2392
|
var init_http = __esm(() => {
|
|
2393
|
+
init_api_url();
|
|
2392
2394
|
init_resolve_auth();
|
|
2393
2395
|
init_session();
|
|
2396
|
+
init_api_url();
|
|
2394
2397
|
CliHttpError = class CliHttpError extends Error {
|
|
2395
2398
|
status;
|
|
2396
2399
|
code;
|
|
@@ -198795,6 +198798,9 @@ import {
|
|
|
198795
198798
|
generatePrintSchemaSubgraph as generatePrintSchemaSubgraph2,
|
|
198796
198799
|
generateTraitSubgraph as generateTraitSubgraph2
|
|
198797
198800
|
} from "@secondlayer/scaffold";
|
|
198801
|
+
import {
|
|
198802
|
+
billingPausedCode
|
|
198803
|
+
} from "@secondlayer/shared/schemas";
|
|
198798
198804
|
import { TRAIT_STANDARDS } from "@secondlayer/stacks/clarity";
|
|
198799
198805
|
function webhookHint(apiUrl, name, firstTable) {
|
|
198800
198806
|
if (!firstTable || isMerchantUrl(apiUrl))
|
|
@@ -199147,6 +199153,10 @@ function formatOperationRange(op) {
|
|
|
199147
199153
|
return "whole subgraph";
|
|
199148
199154
|
return `${op.fromBlock ?? "start"} → ${op.toBlock ?? "tip"}`;
|
|
199149
199155
|
}
|
|
199156
|
+
function formatSubgraphStatus(status, lastError) {
|
|
199157
|
+
const code = billingPausedCode(lastError);
|
|
199158
|
+
return code ? `${status} (paused: ${code.replace(/_/g, " ")})` : status;
|
|
199159
|
+
}
|
|
199150
199160
|
function formatOperationProgress(progress) {
|
|
199151
199161
|
if (progress === null)
|
|
199152
199162
|
return "—";
|
|
@@ -199230,7 +199240,7 @@ function formatSubgraphSync(sync) {
|
|
|
199230
199240
|
};
|
|
199231
199241
|
}
|
|
199232
199242
|
function registerSubgraphsCommand(program) {
|
|
199233
|
-
const subgraphs = program.command("subgraphs").description("Manage materialized subgraphs");
|
|
199243
|
+
const subgraphs = program.command("subgraphs").description("Manage materialized subgraphs (self-hosted, or hosted on api.secondlayer.tools with SECONDLAYER_API_KEY)");
|
|
199234
199244
|
subgraphs.hook("preAction", () => assertInstanceOrAccountKey());
|
|
199235
199245
|
subgraphs.command("create <name>").description("Start here: create a new subgraph definition file (see also: subgraphs scaffold)").option("--from-contract <contractId>", "Generate sources/schema/handlers from the contract's observed print events (requires network)").option("--trait <std>", "Trait-scoped source (sip-009|sip-010|sip-013) — no contract id").option("--blank", "Write a minimal stx_transfer starter (native STX, not every FT)").option("--table-per-topic", "With --from-contract: one table per print topic instead of a single wide table").addHelpText("after", `
|
|
199236
199246
|
create requires one of --from-contract, --trait, or --blank. Prefer
|
|
@@ -199416,7 +199426,12 @@ Stopped watching.`);
|
|
|
199416
199426
|
subgraphs.command("deploy <file>").alias("update").description("Deploy a subgraph definition file (alias: update — deploy is create-or-update)").option("--start-block <n>", "Override the subgraph definition startBlock for this deploy").option("--tip-first", "Go live at chain tip immediately; history backfills in the background (handlers may only insert, upsert and delete; update, increment and row reads are refused)").option("--dry-run", "Validate and preview deploy without writing changes").option("-y, --yes", "Skip the reindex confirmation prompt").option("--strict", "Run `tsc --noEmit` against the handler before deploy (slower; catches TS type errors)").option("--allow-uncommitted", "Deploy even though the source file is not staged or committed in git (the deployed definition will exist only in the database)").addHelpText("after", `
|
|
199417
199427
|
By default the source file must be staged or committed in git (\`git add <file>\`),
|
|
199418
199428
|
otherwise the deployed definition's only copy is the row in the database. Pass
|
|
199419
|
-
--allow-uncommitted to deploy anyway
|
|
199429
|
+
--allow-uncommitted to deploy anyway.
|
|
199430
|
+
|
|
199431
|
+
Hosted: set SECONDLAYER_API_KEY and SECONDLAYER_API_URL=https://api.secondlayer.tools.
|
|
199432
|
+
Hostable sources are event filters and contract_call/contract_deploy; anything else
|
|
199433
|
+
returns 422 SOURCE_NOT_HOSTABLE. Set startBlock (or --start-block) so the first
|
|
199434
|
+
deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
199420
199435
|
try {
|
|
199421
199436
|
const absPath = resolve5(file);
|
|
199422
199437
|
if (!options.dryRun) {
|
|
@@ -199660,7 +199675,10 @@ ${data.length} subgraph(s) total`));
|
|
|
199660
199675
|
console.log(formatKeyValue([
|
|
199661
199676
|
["Name", subgraph.name],
|
|
199662
199677
|
["Version", subgraph.version],
|
|
199663
|
-
[
|
|
199678
|
+
[
|
|
199679
|
+
"Status",
|
|
199680
|
+
formatSubgraphStatus(subgraph.status, subgraph.health.lastError)
|
|
199681
|
+
],
|
|
199664
199682
|
["Sync", syncDisplay.line],
|
|
199665
199683
|
[syncDisplay.remainingLabel, syncDisplay.remaining],
|
|
199666
199684
|
["Integrity", integrity],
|
|
@@ -200183,6 +200201,7 @@ var init_subgraphs2 = __esm(() => {
|
|
|
200183
200201
|
init_subgraphs();
|
|
200184
200202
|
init_api_client();
|
|
200185
200203
|
init_derive_abi();
|
|
200204
|
+
init_api_url();
|
|
200186
200205
|
init_config2();
|
|
200187
200206
|
init_filter_params();
|
|
200188
200207
|
init_fs();
|
|
@@ -202507,7 +202526,7 @@ var {
|
|
|
202507
202526
|
// package.json
|
|
202508
202527
|
var package_default = {
|
|
202509
202528
|
name: "@secondlayer/cli",
|
|
202510
|
-
version: "19.1.
|
|
202529
|
+
version: "19.1.3",
|
|
202511
202530
|
description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
|
|
202512
202531
|
repository: {
|
|
202513
202532
|
type: "git",
|
|
@@ -202546,10 +202565,10 @@ var package_default = {
|
|
|
202546
202565
|
"@inquirer/prompts": "^8.2.0",
|
|
202547
202566
|
"@secondlayer/bundler": "^0.6.1",
|
|
202548
202567
|
"@secondlayer/scaffold": "^1.6.1",
|
|
202549
|
-
"@secondlayer/sdk": "^14.
|
|
202550
|
-
"@secondlayer/shared": "^11.19.
|
|
202568
|
+
"@secondlayer/sdk": "^14.2.0",
|
|
202569
|
+
"@secondlayer/shared": "^11.19.3",
|
|
202551
202570
|
"@secondlayer/stacks": "^6.1.1",
|
|
202552
|
-
"@secondlayer/subgraphs": "^6.3.
|
|
202571
|
+
"@secondlayer/subgraphs": "^6.3.6",
|
|
202553
202572
|
esbuild: "^0.28.2",
|
|
202554
202573
|
"smol-toml": "^1.8.0",
|
|
202555
202574
|
zod: "^4.3.6"
|
|
@@ -207339,6 +207358,7 @@ async function runLocalDoctor(jsonOutput) {
|
|
|
207339
207358
|
console.log("");
|
|
207340
207359
|
}
|
|
207341
207360
|
// src/commands/whoami.ts
|
|
207361
|
+
init_api_url();
|
|
207342
207362
|
init_config2();
|
|
207343
207363
|
init_http();
|
|
207344
207364
|
init_output();
|
|
@@ -207449,6 +207469,7 @@ function registerWhoamiCommand(program) {
|
|
|
207449
207469
|
});
|
|
207450
207470
|
}
|
|
207451
207471
|
// src/commands/login.ts
|
|
207472
|
+
init_api_url();
|
|
207452
207473
|
init_http();
|
|
207453
207474
|
init_output();
|
|
207454
207475
|
init_session();
|
|
@@ -209287,5 +209308,5 @@ registerCreditsCommand(program);
|
|
|
209287
209308
|
registerArchiveCommand(program);
|
|
209288
209309
|
program.parse();
|
|
209289
209310
|
|
|
209290
|
-
//# debugId=
|
|
209311
|
+
//# debugId=14D458833783D3C664756E2164756E21
|
|
209291
209312
|
//# sourceMappingURL=cli.js.map
|