@secondlayer/cli 19.1.0 → 19.1.2
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 +31 -15
- 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;
|
|
@@ -198796,6 +198799,11 @@ import {
|
|
|
198796
198799
|
generateTraitSubgraph as generateTraitSubgraph2
|
|
198797
198800
|
} from "@secondlayer/scaffold";
|
|
198798
198801
|
import { TRAIT_STANDARDS } from "@secondlayer/stacks/clarity";
|
|
198802
|
+
function webhookHint(apiUrl, name, firstTable) {
|
|
198803
|
+
if (!firstTable || isMerchantUrl(apiUrl))
|
|
198804
|
+
return null;
|
|
198805
|
+
return `secondlayer webhooks create ${name}-hook --subgraph ${name} --table ${firstTable} --url <your-endpoint>`;
|
|
198806
|
+
}
|
|
198799
198807
|
async function loadSubgraphWithDepCheck(absPath) {
|
|
198800
198808
|
try {
|
|
198801
198809
|
return await import(absPath);
|
|
@@ -199225,7 +199233,7 @@ function formatSubgraphSync(sync) {
|
|
|
199225
199233
|
};
|
|
199226
199234
|
}
|
|
199227
199235
|
function registerSubgraphsCommand(program) {
|
|
199228
|
-
const subgraphs = program.command("subgraphs").description("Manage materialized subgraphs");
|
|
199236
|
+
const subgraphs = program.command("subgraphs").description("Manage materialized subgraphs (self-hosted, or hosted on api.secondlayer.tools with SECONDLAYER_API_KEY)");
|
|
199229
199237
|
subgraphs.hook("preAction", () => assertInstanceOrAccountKey());
|
|
199230
199238
|
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", `
|
|
199231
199239
|
create requires one of --from-contract, --trait, or --blank. Prefer
|
|
@@ -199411,7 +199419,12 @@ Stopped watching.`);
|
|
|
199411
199419
|
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", `
|
|
199412
199420
|
By default the source file must be staged or committed in git (\`git add <file>\`),
|
|
199413
199421
|
otherwise the deployed definition's only copy is the row in the database. Pass
|
|
199414
|
-
--allow-uncommitted to deploy anyway
|
|
199422
|
+
--allow-uncommitted to deploy anyway.
|
|
199423
|
+
|
|
199424
|
+
Hosted: set SECONDLAYER_API_KEY and SECONDLAYER_API_URL=https://api.secondlayer.tools.
|
|
199425
|
+
Hostable sources are event filters and contract_call/contract_deploy; anything else
|
|
199426
|
+
returns 422 SOURCE_NOT_HOSTABLE. Set startBlock (or --start-block) so the first
|
|
199427
|
+
deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
199415
199428
|
try {
|
|
199416
199429
|
const absPath = resolve5(file);
|
|
199417
199430
|
if (!options.dryRun) {
|
|
@@ -199536,9 +199549,9 @@ otherwise the deployed definition's only copy is the row in the database. Pass
|
|
|
199536
199549
|
info(` Reindex: ${denom} started in the background — check status in ~30s for an ETA`);
|
|
199537
199550
|
}
|
|
199538
199551
|
info(` Watch: secondlayer subgraphs status ${effectiveDef.name}`);
|
|
199539
|
-
|
|
199540
|
-
|
|
199541
|
-
|
|
199552
|
+
const hint = webhookHint(apiUrl, effectiveDef.name, firstTable);
|
|
199553
|
+
if (hint)
|
|
199554
|
+
info(` Webhook: ${hint}`);
|
|
199542
199555
|
} catch {}
|
|
199543
199556
|
};
|
|
199544
199557
|
if (result.action === "unchanged") {
|
|
@@ -200178,6 +200191,7 @@ var init_subgraphs2 = __esm(() => {
|
|
|
200178
200191
|
init_subgraphs();
|
|
200179
200192
|
init_api_client();
|
|
200180
200193
|
init_derive_abi();
|
|
200194
|
+
init_api_url();
|
|
200181
200195
|
init_config2();
|
|
200182
200196
|
init_filter_params();
|
|
200183
200197
|
init_fs();
|
|
@@ -202502,7 +202516,7 @@ var {
|
|
|
202502
202516
|
// package.json
|
|
202503
202517
|
var package_default = {
|
|
202504
202518
|
name: "@secondlayer/cli",
|
|
202505
|
-
version: "19.1.
|
|
202519
|
+
version: "19.1.2",
|
|
202506
202520
|
description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
|
|
202507
202521
|
repository: {
|
|
202508
202522
|
type: "git",
|
|
@@ -202541,10 +202555,10 @@ var package_default = {
|
|
|
202541
202555
|
"@inquirer/prompts": "^8.2.0",
|
|
202542
202556
|
"@secondlayer/bundler": "^0.6.1",
|
|
202543
202557
|
"@secondlayer/scaffold": "^1.6.1",
|
|
202544
|
-
"@secondlayer/sdk": "^14.
|
|
202545
|
-
"@secondlayer/shared": "^11.19.
|
|
202558
|
+
"@secondlayer/sdk": "^14.2.0",
|
|
202559
|
+
"@secondlayer/shared": "^11.19.2",
|
|
202546
202560
|
"@secondlayer/stacks": "^6.1.1",
|
|
202547
|
-
"@secondlayer/subgraphs": "^6.3.
|
|
202561
|
+
"@secondlayer/subgraphs": "^6.3.5",
|
|
202548
202562
|
esbuild: "^0.28.2",
|
|
202549
202563
|
"smol-toml": "^1.8.0",
|
|
202550
202564
|
zod: "^4.3.6"
|
|
@@ -207334,6 +207348,7 @@ async function runLocalDoctor(jsonOutput) {
|
|
|
207334
207348
|
console.log("");
|
|
207335
207349
|
}
|
|
207336
207350
|
// src/commands/whoami.ts
|
|
207351
|
+
init_api_url();
|
|
207337
207352
|
init_config2();
|
|
207338
207353
|
init_http();
|
|
207339
207354
|
init_output();
|
|
@@ -207444,6 +207459,7 @@ function registerWhoamiCommand(program) {
|
|
|
207444
207459
|
});
|
|
207445
207460
|
}
|
|
207446
207461
|
// src/commands/login.ts
|
|
207462
|
+
init_api_url();
|
|
207447
207463
|
init_http();
|
|
207448
207464
|
init_output();
|
|
207449
207465
|
init_session();
|
|
@@ -209282,5 +209298,5 @@ registerCreditsCommand(program);
|
|
|
209282
209298
|
registerArchiveCommand(program);
|
|
209283
209299
|
program.parse();
|
|
209284
209300
|
|
|
209285
|
-
//# debugId=
|
|
209301
|
+
//# debugId=09267A0D0DFF448064756E2164756E21
|
|
209286
209302
|
//# sourceMappingURL=cli.js.map
|