@secondlayer/cli 19.1.1 → 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 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
- try {
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;
@@ -199230,7 +199233,7 @@ function formatSubgraphSync(sync) {
199230
199233
  };
199231
199234
  }
199232
199235
  function registerSubgraphsCommand(program) {
199233
- 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)");
199234
199237
  subgraphs.hook("preAction", () => assertInstanceOrAccountKey());
199235
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", `
199236
199239
  create requires one of --from-contract, --trait, or --blank. Prefer
@@ -199416,7 +199419,12 @@ Stopped watching.`);
199416
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", `
199417
199420
  By default the source file must be staged or committed in git (\`git add <file>\`),
199418
199421
  otherwise the deployed definition's only copy is the row in the database. Pass
199419
- --allow-uncommitted to deploy anyway.`).action(async (file, options) => {
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) => {
199420
199428
  try {
199421
199429
  const absPath = resolve5(file);
199422
199430
  if (!options.dryRun) {
@@ -200183,6 +200191,7 @@ var init_subgraphs2 = __esm(() => {
200183
200191
  init_subgraphs();
200184
200192
  init_api_client();
200185
200193
  init_derive_abi();
200194
+ init_api_url();
200186
200195
  init_config2();
200187
200196
  init_filter_params();
200188
200197
  init_fs();
@@ -202507,7 +202516,7 @@ var {
202507
202516
  // package.json
202508
202517
  var package_default = {
202509
202518
  name: "@secondlayer/cli",
202510
- version: "19.1.1",
202519
+ version: "19.1.2",
202511
202520
  description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
202512
202521
  repository: {
202513
202522
  type: "git",
@@ -202546,10 +202555,10 @@ var package_default = {
202546
202555
  "@inquirer/prompts": "^8.2.0",
202547
202556
  "@secondlayer/bundler": "^0.6.1",
202548
202557
  "@secondlayer/scaffold": "^1.6.1",
202549
- "@secondlayer/sdk": "^14.0.0",
202558
+ "@secondlayer/sdk": "^14.2.0",
202550
202559
  "@secondlayer/shared": "^11.19.2",
202551
202560
  "@secondlayer/stacks": "^6.1.1",
202552
- "@secondlayer/subgraphs": "^6.3.4",
202561
+ "@secondlayer/subgraphs": "^6.3.5",
202553
202562
  esbuild: "^0.28.2",
202554
202563
  "smol-toml": "^1.8.0",
202555
202564
  zod: "^4.3.6"
@@ -207339,6 +207348,7 @@ async function runLocalDoctor(jsonOutput) {
207339
207348
  console.log("");
207340
207349
  }
207341
207350
  // src/commands/whoami.ts
207351
+ init_api_url();
207342
207352
  init_config2();
207343
207353
  init_http();
207344
207354
  init_output();
@@ -207449,6 +207459,7 @@ function registerWhoamiCommand(program) {
207449
207459
  });
207450
207460
  }
207451
207461
  // src/commands/login.ts
207462
+ init_api_url();
207452
207463
  init_http();
207453
207464
  init_output();
207454
207465
  init_session();
@@ -209287,5 +209298,5 @@ registerCreditsCommand(program);
209287
209298
  registerArchiveCommand(program);
209288
209299
  program.parse();
209289
209300
 
209290
- //# debugId=F9E4373E66C7156964756E2164756E21
209301
+ //# debugId=09267A0D0DFF448064756E2164756E21
209291
209302
  //# sourceMappingURL=cli.js.map