@secondlayer/cli 8.8.0 → 8.9.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/README.md CHANGED
@@ -104,8 +104,8 @@ scoped reads and cannot mint (403). Minted keys inherit your plan's tier.
104
104
 
105
105
  | Command | What it does |
106
106
  |---|---|
107
- | `sl index ft-transfers` / `nft-transfers` / `events --event-type <t>` / `contract-calls` | Decoded L2 layer. Anonymous reads OK; free-tier keys rejected (Build+ for keyed) |
108
- | `sl streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `pull` | Raw L1 event firehose. **Requires `SL_API_KEY`** |
107
+ | `sl index ft-transfers` / `nft-transfers` / `events --event-type <t>` / `contract-calls` | Decoded Index layer. Anonymous reads OK; free-tier keys rejected (Build+ for keyed) |
108
+ | `sl streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `pull` | Raw chain event firehose. **Requires `SL_API_KEY`** |
109
109
 
110
110
  Reads emit JSON to stdout (`--json` accepted across all read commands); `-o/--output` is a file path, not a format.
111
111
 
package/dist/cli.js CHANGED
@@ -31811,7 +31811,7 @@ var {
31811
31811
  // package.json
31812
31812
  var package_default = {
31813
31813
  name: "@secondlayer/cli",
31814
- version: "8.8.0",
31814
+ version: "8.9.0",
31815
31815
  repository: {
31816
31816
  type: "git",
31817
31817
  url: "git+https://github.com/ryanwaits/secondlayer.git",
@@ -31861,10 +31861,10 @@ var package_default = {
31861
31861
  "@inquirer/prompts": "^8.2.0",
31862
31862
  "@secondlayer/bundler": "^0.3.7",
31863
31863
  "@secondlayer/scaffold": "^1.2.0",
31864
- "@secondlayer/sdk": "^6.21.1",
31865
- "@secondlayer/shared": "^6.30.0",
31864
+ "@secondlayer/sdk": "^6.21.2",
31865
+ "@secondlayer/shared": "^6.31.0",
31866
31866
  "@secondlayer/stacks": "^2.5.1",
31867
- "@secondlayer/subgraphs": "^3.11.0",
31867
+ "@secondlayer/subgraphs": "^3.12.0",
31868
31868
  "@biomejs/js-api": "^0.7.0",
31869
31869
  "@biomejs/wasm-nodejs": "^1.9.0",
31870
31870
  esbuild: "^0.19.0",
@@ -35175,11 +35175,37 @@ Grant (first deploy only):`);
35175
35175
  ${yellow("This DROPS all rows in that schema, then rebuilds it. Re-deploy after.")}`);
35176
35176
  console.log(dim("(--force destructive rebuild not yet supported — manual DROP required.)"));
35177
35177
  }
35178
+ function formatDuration(seconds) {
35179
+ if (seconds < 90)
35180
+ return `${Math.max(1, Math.round(seconds))}s`;
35181
+ if (seconds < 5400)
35182
+ return `${Math.round(seconds / 60)}m`;
35183
+ return `${(seconds / 3600).toFixed(1)}h`;
35184
+ }
35178
35185
  function formatSubgraphSync(sync) {
35179
35186
  const targetBlock = sync.targetBlock ?? sync.chainTip;
35180
35187
  const totalBlocks = sync.totalBlocks;
35181
35188
  const processedBlocks = sync.processedBlocks;
35182
35189
  const progress = `${(sync.progress * 100).toFixed(1)}%`;
35190
+ if (sync.queue) {
35191
+ const pos = sync.queue.position != null ? `position ~${sync.queue.position}` : "queued";
35192
+ const est = sync.queue.estimatedStartSeconds != null ? `, est. start ~${formatDuration(sync.queue.estimatedStartSeconds)}` : "";
35193
+ const denom = sync.queue.estimatedEvents != null ? ` · ~${sync.queue.estimatedEvents.toLocaleString()} events to sync` : "";
35194
+ return {
35195
+ line: `queued — ${pos}${est}${denom}`,
35196
+ remainingLabel: "Queue",
35197
+ remaining: sync.queue.position != null ? `~${sync.queue.position} ahead` : "N/A"
35198
+ };
35199
+ }
35200
+ if (sync.estimatedEvents != null && sync.estimatedEvents > 0 && sync.processedEvents != null) {
35201
+ const pct = `${(sync.processedEvents / sync.estimatedEvents * 100).toFixed(1)}%`;
35202
+ const eta = sync.etaSeconds != null ? ` · est ${formatDuration(sync.etaSeconds)}` : "";
35203
+ return {
35204
+ line: `${sync.status} — ${pct} of ~${sync.estimatedEvents.toLocaleString()} events${eta}`,
35205
+ remainingLabel: "Events Remaining",
35206
+ remaining: `${Math.max(0, sync.estimatedEvents - sync.processedEvents).toLocaleString()}`
35207
+ };
35208
+ }
35183
35209
  if (sync.status === "reindexing" || sync.mode === "reindex") {
35184
35210
  if (targetBlock <= 0) {
35185
35211
  return {
@@ -35203,7 +35229,7 @@ function formatSubgraphSync(sync) {
35203
35229
  }
35204
35230
  function registerSubgraphsCommand(program2) {
35205
35231
  const subgraphs = program2.command("subgraphs").description("Manage materialized subgraphs");
35206
- subgraphs.command("create <name>").description("Create a new subgraph definition file").option("--template <slug>", `Foundation Dataset starter (one of: ${SUBGRAPH_TEMPLATE_SLUGS.join(", ")})`).addHelpText("after", `
35232
+ subgraphs.command("create <name>").description("Create a new subgraph definition file").option("--template <slug>", `Starter template (one of: ${SUBGRAPH_TEMPLATE_SLUGS.join(", ")})`).addHelpText("after", `
35207
35233
  Examples:
35208
35234
  $ sl subgraphs create my-graph
35209
35235
  $ sl subgraphs create token-balances --template sip-010-balances`).action(async (name, opts) => {
@@ -35292,7 +35318,7 @@ Stopped watching.`);
35292
35318
  });
35293
35319
  await new Promise(() => {});
35294
35320
  });
35295
- 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("--dry-run", "Validate and preview deploy without writing changes").option("-y, --yes", "Skip the reindex confirmation prompt").option("--database-url <url>", "BYO data plane: write the subgraph's schema/rows to your own Postgres. With --dry-run, prints the DDL + grant script and verifies the connection.").option("--strict", "Run `tsc --noEmit` against the handler before deploy (slower; catches TS type errors)").option("--visibility <visibility>", "Read visibility: public (anon /v1 reads, global name claim) or private (your key only). Defaults: managed → public, BYO → private.").action(async (file, options2) => {
35321
+ 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 (requires order-tolerant handlers — commutative or insert-only writes)").option("--dry-run", "Validate and preview deploy without writing changes").option("-y, --yes", "Skip the reindex confirmation prompt").option("--database-url <url>", "BYO data plane: write the subgraph's schema/rows to your own Postgres. With --dry-run, prints the DDL + grant script and verifies the connection.").option("--strict", "Run `tsc --noEmit` against the handler before deploy (slower; catches TS type errors)").option("--visibility <visibility>", "Read visibility: public (anon /v1 reads, global name claim) or private (your key only). Defaults: managed → public, BYO → private.").action(async (file, options2) => {
35296
35322
  try {
35297
35323
  const absPath = resolve2(file);
35298
35324
  const config = await loadConfig();
@@ -35321,7 +35347,10 @@ Stopped watching.`);
35321
35347
  info(`Loading subgraph from ${absPath}`);
35322
35348
  const mod = await loadSubgraphWithDepCheck(absPath);
35323
35349
  const def = mod.default ?? mod;
35324
- const effectiveDef = startBlock === undefined ? def : { ...def, startBlock };
35350
+ const effectiveDef = {
35351
+ ...startBlock === undefined ? def : { ...def, startBlock },
35352
+ ...options2.tipFirst ? { backfillMode: "concurrent" } : {}
35353
+ };
35325
35354
  const { validateSubgraphDefinition } = await import("@secondlayer/subgraphs/validate");
35326
35355
  const validated = validateSubgraphDefinition(effectiveDef);
35327
35356
  if (config.network !== "local") {
@@ -36228,7 +36257,7 @@ function emitOne(doc, label, json) {
36228
36257
  });
36229
36258
  }
36230
36259
  function registerIndexCommand(program2) {
36231
- const index = program2.command("index").description("Query the decoded Index layer (L2 events + contract calls)");
36260
+ const index = program2.command("index").description("Query the decoded Index layer (events + contract calls)");
36232
36261
  index.command("codegen").description("Generate a typed schema (Prisma, Kysely, Drizzle, or JSON-Schema) for the Index domain tables — point it at your BYO database mirror").option("--target <orm>", "prisma | kysely | drizzle | json-schema", "kysely").option("--schema <name>", "Postgres schema to qualify table names with").option("--tables <list>", "Comma-separated subset of Index tables (default: all)").option("--env <var>", "Prisma datasource url env var", "DATABASE_URL").option("-o, --output <path>", "Write to a file (defaults to stdout)").action(async (o) => {
36233
36262
  try {
36234
36263
  const target = o.target ?? "kysely";
@@ -37934,5 +37963,5 @@ registerAccountCommand(program);
37934
37963
  registerKeysCommand(program);
37935
37964
  program.parse();
37936
37965
 
37937
- //# debugId=B164F591CA98B53C64756E2164756E21
37966
+ //# debugId=C1F218ABB7E9AF8864756E2164756E21
37938
37967
  //# sourceMappingURL=cli.js.map