@secondlayer/shared 10.0.0 → 11.0.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.
Files changed (44) hide show
  1. package/dist/src/archive/range-digest.d.ts +15 -0
  2. package/dist/src/archive/semantic-digest-builder.d.ts +15 -0
  3. package/dist/src/coverage/index.d.ts +15 -0
  4. package/dist/src/crypto/secrets.js.map +2 -2
  5. package/dist/src/db/index.d.ts +20 -1
  6. package/dist/src/db/index.js +2 -1
  7. package/dist/src/db/index.js.map +5 -5
  8. package/dist/src/db/queries/chain-reorgs.d.ts +15 -0
  9. package/dist/src/db/queries/chain-reorgs.js +2 -1
  10. package/dist/src/db/queries/chain-reorgs.js.map +5 -5
  11. package/dist/src/db/queries/contracts.d.ts +15 -0
  12. package/dist/src/db/queries/instance.d.ts +15 -0
  13. package/dist/src/db/queries/integrity.d.ts +15 -0
  14. package/dist/src/db/queries/subgraph-gaps.d.ts +15 -0
  15. package/dist/src/db/queries/subgraph-operations.d.ts +15 -0
  16. package/dist/src/db/queries/subgraphs.d.ts +16 -8
  17. package/dist/src/db/queries/subgraphs.js +1 -9
  18. package/dist/src/db/queries/subgraphs.js.map +4 -4
  19. package/dist/src/db/queries/subscriptions.d.ts +15 -0
  20. package/dist/src/db/queries/subscriptions.js.map +2 -2
  21. package/dist/src/db/queries/sync-scope.d.ts +15 -0
  22. package/dist/src/db/schema.d.ts +19 -1
  23. package/dist/src/errors.d.ts +5 -2
  24. package/dist/src/errors.js +5 -5
  25. package/dist/src/errors.js.map +3 -3
  26. package/dist/src/index.d.ts +34 -9
  27. package/dist/src/index.js +13 -13
  28. package/dist/src/index.js.map +8 -8
  29. package/dist/src/mode.d.ts +4 -3
  30. package/dist/src/mode.js.map +2 -2
  31. package/dist/src/node/local-client.d.ts +15 -0
  32. package/dist/src/runtime/index.js +2 -2
  33. package/dist/src/runtime/index.js.map +3 -3
  34. package/dist/src/schemas/index.d.ts +0 -6
  35. package/dist/src/schemas/index.js +2 -3
  36. package/dist/src/schemas/index.js.map +3 -3
  37. package/dist/src/schemas/subgraphs.d.ts +0 -6
  38. package/dist/src/schemas/subgraphs.js +2 -3
  39. package/dist/src/schemas/subgraphs.js.map +3 -3
  40. package/dist/src/subgraphs/spec.d.ts +9 -0
  41. package/dist/src/subgraphs/spec.js +7 -7
  42. package/dist/src/subgraphs/spec.js.map +3 -3
  43. package/migrations/0121_archive_fetches.ts +49 -0
  44. package/package.json +1 -1
@@ -5,9 +5,10 @@
5
5
  * (projects, admin). Everything runs against a single `DATABASE_URL`.
6
6
  * Intended for `docker compose up`.
7
7
  *
8
- * - `platform`: control-plane mode. Magic-link auth, API keys, projects,
9
- * admin. Serves the dashboard + CLI against a single shared DB. Post
10
- * 2026-05-14 shared-rip this also serves subgraphs + subscriptions.
8
+ * - `platform`: the metered archive deployment. Magic-link auth, API keys,
9
+ * accounts, credits, and metered `/v1` reads (Index + Streams + subgraphs)
10
+ * against a single shared DB. No paid tier ladder — one metered `free`
11
+ * tier plus first-party internal service credentials.
11
12
  */
12
13
  type InstanceMode = "oss" | "platform";
13
14
  /** What the operator wrote in the env — `archive` is the honest name for the
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/mode.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Instance modes for the Secondlayer platform.\n *\n * - `oss`: self-hosted, single-tenant. No auth middleware, no platform routes\n * (projects, admin). Everything runs against a single `DATABASE_URL`.\n * Intended for `docker compose up`.\n *\n * - `platform`: control-plane mode. Magic-link auth, API keys, projects,\n * admin. Serves the dashboard + CLI against a single shared DB. Post\n * 2026-05-14 shared-rip this also serves subgraphs + subscriptions.\n */\n\nexport type InstanceMode = \"oss\" | \"platform\";\n\n/** What the operator wrote in the env — `archive` is the honest name for the\n * metered public-archive deployment and aliases `platform` behaviorally. */\nexport type DeclaredInstanceMode = InstanceMode | \"archive\";\n\nconst VALID_MODES: readonly DeclaredInstanceMode[] = [\n\t\"oss\",\n\t\"platform\",\n\t\"archive\",\n];\n\nfunction declaredMode(): DeclaredInstanceMode {\n\tconst raw = process.env.INSTANCE_MODE?.trim().toLowerCase();\n\tif (raw && (VALID_MODES as readonly string[]).includes(raw)) {\n\t\treturn raw as DeclaredInstanceMode;\n\t}\n\treturn \"oss\";\n}\n\n/**\n * Resolve the active instance mode from `process.env.INSTANCE_MODE`.\n * Defaults to `\"oss\"` — the safest default for self-hosters who deploy\n * without setting the variable. `archive` normalizes to `platform` here so\n * every behavioral branch stays a two-way choice; use\n * `getDeclaredInstanceMode()` for display surfaces.\n */\nexport function getInstanceMode(): InstanceMode {\n\tconst declared = declaredMode();\n\treturn declared === \"archive\" ? \"platform\" : declared;\n}\n\n/** The mode as declared in the env, for status/identity surfaces. */\nexport function getDeclaredInstanceMode(): DeclaredInstanceMode {\n\treturn declaredMode();\n}\n\n/**\n * True when public reads are credit-metered (the free window, retention, and\n * credits gates arm). Platform/archive deployments meter by default;\n * self-host never does unless the operator explicitly sets\n * `METERED_READS=true`. `METERED_READS=false` disarms a metered deployment.\n */\nexport function isMeteredReads(): boolean {\n\tconst override = process.env.METERED_READS?.trim().toLowerCase();\n\tif (override === \"true\") return true;\n\tif (override === \"false\") return false;\n\treturn getInstanceMode() === \"platform\";\n}\n\n/** True when the active mode is `\"platform\"` (shared multi-tenant). */\nexport function isPlatformMode(): boolean {\n\treturn getInstanceMode() === \"platform\";\n}\n\n/** True when the active mode is `\"oss\"` (self-hosted). */\nexport function isOssMode(): boolean {\n\treturn getInstanceMode() === \"oss\";\n}\n"
5
+ "/**\n * Instance modes for the Secondlayer platform.\n *\n * - `oss`: self-hosted, single-tenant. No auth middleware, no platform routes\n * (projects, admin). Everything runs against a single `DATABASE_URL`.\n * Intended for `docker compose up`.\n *\n * - `platform`: the metered archive deployment. Magic-link auth, API keys,\n * accounts, credits, and metered `/v1` reads (Index + Streams + subgraphs)\n * against a single shared DB. No paid tier ladder — one metered `free`\n * tier plus first-party internal service credentials.\n */\n\nexport type InstanceMode = \"oss\" | \"platform\";\n\n/** What the operator wrote in the env — `archive` is the honest name for the\n * metered public-archive deployment and aliases `platform` behaviorally. */\nexport type DeclaredInstanceMode = InstanceMode | \"archive\";\n\nconst VALID_MODES: readonly DeclaredInstanceMode[] = [\n\t\"oss\",\n\t\"platform\",\n\t\"archive\",\n];\n\nfunction declaredMode(): DeclaredInstanceMode {\n\tconst raw = process.env.INSTANCE_MODE?.trim().toLowerCase();\n\tif (raw && (VALID_MODES as readonly string[]).includes(raw)) {\n\t\treturn raw as DeclaredInstanceMode;\n\t}\n\treturn \"oss\";\n}\n\n/**\n * Resolve the active instance mode from `process.env.INSTANCE_MODE`.\n * Defaults to `\"oss\"` — the safest default for self-hosters who deploy\n * without setting the variable. `archive` normalizes to `platform` here so\n * every behavioral branch stays a two-way choice; use\n * `getDeclaredInstanceMode()` for display surfaces.\n */\nexport function getInstanceMode(): InstanceMode {\n\tconst declared = declaredMode();\n\treturn declared === \"archive\" ? \"platform\" : declared;\n}\n\n/** The mode as declared in the env, for status/identity surfaces. */\nexport function getDeclaredInstanceMode(): DeclaredInstanceMode {\n\treturn declaredMode();\n}\n\n/**\n * True when public reads are credit-metered (the free window, retention, and\n * credits gates arm). Platform/archive deployments meter by default;\n * self-host never does unless the operator explicitly sets\n * `METERED_READS=true`. `METERED_READS=false` disarms a metered deployment.\n */\nexport function isMeteredReads(): boolean {\n\tconst override = process.env.METERED_READS?.trim().toLowerCase();\n\tif (override === \"true\") return true;\n\tif (override === \"false\") return false;\n\treturn getInstanceMode() === \"platform\";\n}\n\n/** True when the active mode is `\"platform\"` (shared multi-tenant). */\nexport function isPlatformMode(): boolean {\n\treturn getInstanceMode() === \"platform\";\n}\n\n/** True when the active mode is `\"oss\"` (self-hosted). */\nexport function isOssMode(): boolean {\n\treturn getInstanceMode() === \"oss\";\n}\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;AAkBA,IAAM,cAA+C;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAC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/D,IAAI,aAAa;AAAA,IAAQ,OAAO;AAAA,EAChC,IAAI,aAAa;AAAA,IAAS,OAAO;AAAA,EACjC,OAAO,gBAAgB,MAAM;AAAA;AAIvB,SAAS,cAAc,GAAY;AAAA,EACzC,OAAO,gBAAgB,MAAM;AAAA;AAIvB,SAAS,SAAS,GAAY;AAAA,EACpC,OAAO,gBAAgB,MAAM;AAAA;",
8
8
  "debugId": "F90A93497EE7AEC664756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -793,6 +793,7 @@ interface Database {
793
793
  stage_block_receipts: StageBlockReceiptsTable;
794
794
  coverage_segments: CoverageSegmentsTable;
795
795
  stage_failures: StageFailuresTable;
796
+ archive_fetches: ArchiveFetchesTable;
796
797
  }
797
798
  /** Prepaid x402 credit — one running USD-micros balance per payer principal. */
798
799
  interface X402BalancesTable {
@@ -857,6 +858,20 @@ interface AccountCreditsTable {
857
858
  refill_last_at: Date | null;
858
859
  updated_at: Generated<Date>;
859
860
  }
861
+ /**
862
+ * Archive fetch charge log (design-f089 gate). Append-only: one row per
863
+ * priced attempt to fetch a partition object. `usd_micros` is 0 for
864
+ * free rows (24h re-issue, monthly repair allowance).
865
+ */
866
+ interface ArchiveFetchesTable {
867
+ id: Generated<string>;
868
+ account_id: string;
869
+ path: string;
870
+ dataset: string;
871
+ usd_micros: string | number | bigint;
872
+ via_allowance: Generated<boolean>;
873
+ charged_at: Generated<Date>;
874
+ }
860
875
  type SubscriptionStatus = "active" | "paused" | "error";
861
876
  /** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
862
877
  * `chain` reacts to raw chain events matched directly off the Index/Streams
@@ -391,7 +391,7 @@ function parseRuntimeConfig(env) {
391
391
  errors.push("NODE_MODE=full requires BITCOIN_RPC_PASSWORD");
392
392
  }
393
393
  if (mode === "stacks" && env.BITCOIN_RPC_PASSWORD) {
394
- errors.push("NODE_MODE=stacks uses public Bitcoin; drop BITCOIN_RPC_PASSWORD");
394
+ errors.push("NODE_MODE=stacks runs no bundled bitcoind; drop BITCOIN_RPC_PASSWORD");
395
395
  }
396
396
  if (errors.length > 0)
397
397
  return { ok: false, errors };
@@ -997,5 +997,5 @@ export {
997
997
  BACKUP_MANIFEST_VERSION
998
998
  };
999
999
 
1000
- //# debugId=57C29D3188B4875364756E2164756E21
1000
+ //# debugId=3BB8F0C6EEDF219364756E2164756E21
1001
1001
  //# sourceMappingURL=index.js.map
@@ -6,7 +6,7 @@
6
6
  "/**\n * Unified supervisor — start a profile, contain per-module faults, aggregate\n * health so unrelated reads stay up when one loop dies.\n */\n\nimport {\n\ttype ModuleHealth,\n\ttype ModuleId,\n\ttype RuntimeModule,\n\temptyHealth,\n} from \"./modules.ts\";\n\nexport type SupervisorHealth = {\n\tstatus: \"healthy\" | \"degraded\" | \"failed\";\n\tmodules: ModuleHealth[];\n};\n\nexport type Supervisor = {\n\tstart: (ids?: readonly ModuleId[]) => Promise<void>;\n\tstop: (id?: ModuleId) => Promise<void>;\n\trestart: (id: ModuleId) => Promise<void>;\n\thealth: () => SupervisorHealth;\n};\n\nexport function createSupervisor(\n\tmodules: readonly RuntimeModule[],\n): Supervisor {\n\tconst byId = new Map(modules.map((m) => [m.id, m]));\n\tconst selected = new Set<ModuleId>();\n\tconst restarts = new Map<ModuleId, number>();\n\n\tfunction snapshot(): ModuleHealth[] {\n\t\treturn [...byId.values()].map((mod) => {\n\t\t\tconst health = selected.has(mod.id) ? mod.health() : emptyHealth(mod.id);\n\t\t\treturn { ...health, restarts: restarts.get(mod.id) ?? health.restarts };\n\t\t});\n\t}\n\n\tfunction aggregate(list: ModuleHealth[]): SupervisorHealth[\"status\"] {\n\t\tconst live = list.filter((m) => selected.has(m.id));\n\t\tif (live.length === 0) return \"failed\";\n\t\tif (live.every((m) => m.state === \"failed\" || m.state === \"stopped\")) {\n\t\t\treturn \"failed\";\n\t\t}\n\t\tif (live.some((m) => m.state === \"failed\" || m.state === \"degraded\")) {\n\t\t\treturn \"degraded\";\n\t\t}\n\t\tif (live.every((m) => m.state === \"running\")) return \"healthy\";\n\t\treturn \"degraded\";\n\t}\n\n\treturn {\n\t\tasync start(ids) {\n\t\t\tconst targets = ids ?? [...byId.keys()];\n\t\t\tfor (const id of targets) {\n\t\t\t\tconst mod = byId.get(id);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tselected.add(id);\n\t\t\t\ttry {\n\t\t\t\t\tawait mod.start();\n\t\t\t\t} catch {\n\t\t\t\t\t// contained — other modules still start\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tasync stop(id) {\n\t\t\tif (id) {\n\t\t\t\tconst mod = byId.get(id);\n\t\t\t\tif (mod && selected.has(id)) await mod.stop();\n\t\t\t\tselected.delete(id);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (const mid of [...selected]) {\n\t\t\t\tconst mod = byId.get(mid);\n\t\t\t\tif (mod) await mod.stop();\n\t\t\t\tselected.delete(mid);\n\t\t\t}\n\t\t},\n\t\tasync restart(id) {\n\t\t\tconst mod = byId.get(id);\n\t\t\tif (!mod) throw new Error(`unknown module ${id}`);\n\t\t\tif (selected.has(id)) await mod.stop();\n\t\t\tselected.add(id);\n\t\t\trestarts.set(id, (restarts.get(id) ?? 0) + 1);\n\t\t\ttry {\n\t\t\t\tawait mod.start();\n\t\t\t} catch {\n\t\t\t\t// contained\n\t\t\t}\n\t\t},\n\t\thealth() {\n\t\t\tconst modules = snapshot();\n\t\t\treturn { status: aggregate(modules), modules };\n\t\t},\n\t};\n}\n",
7
7
  "/**\n * Handler isolation — untrusted subgraph handlers run behind a timeout,\n * optional network deny, and cannot take down the host process.\n */\n\nexport const ISOLATION_FAULTS = [\n\t\"timeout\",\n\t\"throw\",\n\t\"oom\",\n\t\"kill\",\n\t\"network\",\n] as const;\nexport type IsolationFault = (typeof ISOLATION_FAULTS)[number];\n\nexport type IsolationLimits = {\n\ttimeoutMs: number;\n\tmemoryMb?: number;\n\tallowNetwork?: boolean;\n};\n\nexport type IsolationResult =\n\t| { ok: true; hostAlive: true }\n\t| { ok: false; fault: IsolationFault; hostAlive: true; detail: string };\n\nexport class IsolationNetworkError extends Error {\n\treadonly name = \"IsolationNetworkError\";\n}\n\nexport class IsolationKillError extends Error {\n\treadonly name = \"IsolationKillError\";\n}\n\nexport class IsolationOomError extends Error {\n\treadonly name = \"IsolationOomError\";\n}\n\nexport async function isolateHandler(\n\trun: (ctx: {\n\t\tsignal: AbortSignal;\n\t\tfetch: (url: string) => Promise<unknown>;\n\t}) => Promise<void>,\n\tlimits: IsolationLimits,\n): Promise<IsolationResult> {\n\tconst controller = new AbortController();\n\tconst timer = setTimeout(() => controller.abort(), limits.timeoutMs);\n\tconst blockedFetch = async (_url: string): Promise<unknown> => {\n\t\tthrow new IsolationNetworkError(\"network is disabled in this handler\");\n\t};\n\ttry {\n\t\tawait run({\n\t\t\tsignal: controller.signal,\n\t\t\tfetch: limits.allowNetwork ? (url: string) => fetch(url) : blockedFetch,\n\t\t});\n\t\tif (controller.signal.aborted) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfault: \"timeout\",\n\t\t\t\thostAlive: true,\n\t\t\t\tdetail: `exceeded ${limits.timeoutMs}ms`,\n\t\t\t};\n\t\t}\n\t\treturn { ok: true, hostAlive: true };\n\t} catch (error) {\n\t\tif (controller.signal.aborted || isAbort(error)) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfault: \"timeout\",\n\t\t\t\thostAlive: true,\n\t\t\t\tdetail: `exceeded ${limits.timeoutMs}ms`,\n\t\t\t};\n\t\t}\n\t\tif (error instanceof IsolationNetworkError) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfault: \"network\",\n\t\t\t\thostAlive: true,\n\t\t\t\tdetail: error.message,\n\t\t\t};\n\t\t}\n\t\tif (error instanceof IsolationKillError) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfault: \"kill\",\n\t\t\t\thostAlive: true,\n\t\t\t\tdetail: error.message,\n\t\t\t};\n\t\t}\n\t\tif (error instanceof IsolationOomError) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfault: \"oom\",\n\t\t\t\thostAlive: true,\n\t\t\t\tdetail: error.message,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfault: \"throw\",\n\t\t\thostAlive: true,\n\t\t\tdetail: error instanceof Error ? error.message : String(error),\n\t\t};\n\t} finally {\n\t\tclearTimeout(timer);\n\t}\n}\n\nfunction isAbort(error: unknown): boolean {\n\treturn error instanceof Error && error.name === \"AbortError\";\n}\n",
8
8
  "/**\n * Embedded migration — advisory-locked before listeners/workers start.\n * Concurrent boots serialize. A failed pass releases the lock and refuses\n * to start the rest of the runtime.\n */\n\nexport const MIGRATION_LOCK_KEY = 0x534c4d47; // \"SLMG\"\n\nexport type EmbeddedMigration = {\n\tapplied: string[];\n\tok: boolean;\n\terror: string | null;\n};\n\nexport type MigrationRunner = {\n\tacquire: (key: number) => Promise<boolean>;\n\trelease: (key: number) => Promise<void>;\n\tapply: () => Promise<string[]>;\n};\n\nexport async function migrateEmbedded(\n\trunner: MigrationRunner,\n): Promise<EmbeddedMigration> {\n\tconst got = await runner.acquire(MIGRATION_LOCK_KEY);\n\tif (!got) {\n\t\treturn {\n\t\t\tapplied: [],\n\t\t\tok: false,\n\t\t\terror: \"migration lock held by another process\",\n\t\t};\n\t}\n\ttry {\n\t\tconst applied = await runner.apply();\n\t\treturn { applied, ok: true, error: null };\n\t} catch (error) {\n\t\treturn {\n\t\t\tapplied: [],\n\t\t\tok: false,\n\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t};\n\t} finally {\n\t\tawait runner.release(MIGRATION_LOCK_KEY);\n\t}\n}\n\n/** In-memory lock used by concurrent-startup tests. */\nexport function createMemoryMigrationRunner(opts?: {\n\tfail?: boolean;\n\tdelayMs?: number;\n\tsleep?: (ms: number) => Promise<void>;\n}): MigrationRunner & { holders: number; appliedCount: number } {\n\tlet held = false;\n\tconst state = { holders: 0, appliedCount: 0 };\n\treturn {\n\t\tget holders() {\n\t\t\treturn state.holders;\n\t\t},\n\t\tget appliedCount() {\n\t\t\treturn state.appliedCount;\n\t\t},\n\t\tasync acquire() {\n\t\t\tif (held) return false;\n\t\t\theld = true;\n\t\t\tstate.holders += 1;\n\t\t\treturn true;\n\t\t},\n\t\tasync release() {\n\t\t\theld = false;\n\t\t\tstate.holders = Math.max(0, state.holders - 1);\n\t\t},\n\t\tasync apply() {\n\t\t\tif (opts?.delayMs) await (opts.sleep ?? delay)(opts.delayMs);\n\t\t\tif (opts?.fail) throw new Error(\"migration failed\");\n\t\t\tstate.appliedCount += 1;\n\t\t\treturn [\"0116_coverage_schema\"];\n\t\t},\n\t};\n}\n\nfunction delay(ms: number): Promise<void> {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n",
9
- "/**\n * Minimal runtime config — six or fewer required non-secret values.\n * Unknown or contradictory values fail before ingest starts.\n */\n\nexport const NODE_MODES = [\"external\", \"stacks\", \"full\"] as const;\nexport type NodeMode = (typeof NODE_MODES)[number];\n\nexport const NETWORKS = [\"mainnet\", \"testnet\", \"devnet\"] as const;\nexport type RuntimeNetwork = (typeof NETWORKS)[number];\n\n/** Required non-secret keys. Secrets (tokens, signing keys) come from `sl init`. */\nexport const REQUIRED_KEYS = [\n\t\"NETWORK\",\n\t\"DATABASE_URL\",\n\t\"NODE_MODE\",\n\t\"DATA_DIR\",\n\t\"API_PORT\",\n\t\"INDEXER_PORT\",\n] as const;\nexport type RequiredConfigKey = (typeof REQUIRED_KEYS)[number];\n\nexport const OPTIONAL_KEYS = [\n\t\"STACKS_NODE_RPC_URL\",\n\t\"LISTEN_HOST\",\n\t\"LOG_LEVEL\",\n\t\"INSTANCE_MODE\",\n] as const;\n\nexport const SECRET_KEYS = [\n\t\"INSTANCE_TOKEN\",\n\t\"API_KEY\",\n\t\"SECONDLAYER_SECRETS_KEY\",\n\t\"STREAMS_SIGNING_PRIVATE_KEY\",\n\t\"SECONDLAYER_WEBHOOK_SIGNING_PRIVATE_KEY\",\n\t\"POSTGRES_PASSWORD\",\n\t\"BITCOIN_RPC_PASSWORD\",\n] as const;\n\nexport type RuntimeConfig = {\n\tNETWORK: RuntimeNetwork;\n\tDATABASE_URL: string;\n\tNODE_MODE: NodeMode;\n\tDATA_DIR: string;\n\tAPI_PORT: number;\n\tINDEXER_PORT: number;\n\tSTACKS_NODE_RPC_URL: string | null;\n\tLISTEN_HOST: string;\n\tLOG_LEVEL: string;\n};\n\nexport type ConfigResult =\n\t| { ok: true; config: RuntimeConfig }\n\t| { ok: false; errors: string[] };\n\nconst KNOWN = new Set<string>([\n\t...REQUIRED_KEYS,\n\t...OPTIONAL_KEYS,\n\t...SECRET_KEYS,\n\t\"SOURCE_DATABASE_URL\",\n\t\"TARGET_DATABASE_URL\",\n\t\"INSTANCE_MODE\",\n\t\"NODE_ENV\",\n\t\"ALLOW_UNSIGNED_WEBHOOKS\",\n\t\"OBSERVER_JOURNAL_ENABLED\",\n\t\"STACKS_NETWORK\",\n\t// Set by the shipped image/compose (docker/oss/docker-compose.yml).\n\t\"STREAMS_API_URL\",\n\t\"STREAMS_INTERNAL_API_KEY\",\n\t\"SUBGRAPH_SOURCE\",\n\t\"SUBGRAPH_INDEX_API_URL\",\n\t\"SBTC_DECODER_ENABLED\",\n\t\"POX4_DECODER_ENABLED\",\n\t\"BNS_DECODER_ENABLED\",\n\t// Archive publishing. Both sit inside the ARCHIVE_ namespace the refusal\n\t// patrols, so an operator who sets them on a one-box runtime would be told\n\t// their valid config is a typo unless they are named here.\n\t\"ARCHIVE_DIR\",\n\t\"ARCHIVE_PUBLIC_DIR\",\n\t// Escape hatch for the boot-time resource preflight. Setting it is exactly\n\t// the moment an operator must not also be told it is an unknown key.\n\t\"SECONDLAYER_ALLOW_UNDERSIZED\",\n\t// Forward-only instances declare where their history starts; refusing it as\n\t// unknown would block the only way to say \"the prefix is absent on purpose\".\n\t\"SECONDLAYER_SYNC_START_HEIGHT\",\n]);\n\n/**\n * Namespaces the unknown-key refusal patrols. A real container environ\n * carries dozens of ambient ALL_CAPS vars (PATH, HOME, HOSTNAME, PORT,\n * BUN_*, …) that are not config and must not fail the boot — the refusal\n * exists to catch a misspelled *Secondlayer* key, so it only fires inside\n * our own vocabulary. Required keys are validated separately, so a typo'd\n * required key still fails via its missing-value error.\n */\nconst OWN_PREFIXES = [\n\t\"SECONDLAYER_\",\n\t\"STACKS_\",\n\t\"BITCOIN_\",\n\t\"STREAMS_\",\n\t\"SUBGRAPH_\",\n\t\"OBSERVER_\",\n\t\"INSTANCE_\",\n\t\"ARCHIVE_\",\n\t\"X402_\",\n] as const;\n\nfunction isOwnNamespace(key: string): boolean {\n\tif (KNOWN.has(key)) return true;\n\treturn OWN_PREFIXES.some((prefix) => key.startsWith(prefix));\n}\n\nexport function parseRuntimeConfig(\n\tenv: Record<string, string | undefined>,\n): ConfigResult {\n\tconst errors: string[] = [];\n\tfor (const key of Object.keys(env)) {\n\t\tif (env[key] === undefined) continue;\n\t\tif (key.startsWith(\"SL_\") || key.startsWith(\"POSTGRES_\")) continue;\n\t\tif (!KNOWN.has(key) && isRuntimeish(key) && isOwnNamespace(key)) {\n\t\t\terrors.push(`unknown config ${key}`);\n\t\t}\n\t}\n\n\tconst network = (env.NETWORK ?? env.STACKS_NETWORK ?? \"\").trim();\n\tif (!isNetwork(network)) {\n\t\terrors.push(\"NETWORK must be mainnet | testnet | devnet\");\n\t}\n\tconst database = (env.DATABASE_URL ?? \"\").trim();\n\tif (!database) errors.push(\"DATABASE_URL is required\");\n\tconst mode = (env.NODE_MODE ?? \"\").trim();\n\tif (!isNodeMode(mode)) {\n\t\terrors.push(\"NODE_MODE must be external | stacks | full\");\n\t}\n\tconst dataDir = (env.DATA_DIR ?? \"/data\").trim();\n\tconst apiPort = parsePort(env.API_PORT ?? \"3800\", \"API_PORT\", errors);\n\tconst indexerPort = parsePort(\n\t\tenv.INDEXER_PORT ?? \"3700\",\n\t\t\"INDEXER_PORT\",\n\t\terrors,\n\t);\n\n\tif (mode === \"external\" && env.BITCOIN_RPC_PASSWORD) {\n\t\terrors.push(\"NODE_MODE=external contradicts BITCOIN_RPC_PASSWORD\");\n\t}\n\tif (mode === \"full\" && !env.BITCOIN_RPC_PASSWORD) {\n\t\terrors.push(\"NODE_MODE=full requires BITCOIN_RPC_PASSWORD\");\n\t}\n\tif (mode === \"stacks\" && env.BITCOIN_RPC_PASSWORD) {\n\t\terrors.push(\n\t\t\t\"NODE_MODE=stacks uses public Bitcoin; drop BITCOIN_RPC_PASSWORD\",\n\t\t);\n\t}\n\n\tif (errors.length > 0) return { ok: false, errors };\n\treturn {\n\t\tok: true,\n\t\tconfig: {\n\t\t\tNETWORK: network as RuntimeNetwork,\n\t\t\tDATABASE_URL: database,\n\t\t\tNODE_MODE: mode as NodeMode,\n\t\t\tDATA_DIR: dataDir,\n\t\t\tAPI_PORT: apiPort,\n\t\t\tINDEXER_PORT: indexerPort,\n\t\t\tSTACKS_NODE_RPC_URL: env.STACKS_NODE_RPC_URL?.trim() || null,\n\t\t\tLISTEN_HOST: env.LISTEN_HOST?.trim() || \"0.0.0.0\",\n\t\t\tLOG_LEVEL: env.LOG_LEVEL?.trim() || \"info\",\n\t\t},\n\t};\n}\n\nfunction isNetwork(value: string): value is RuntimeNetwork {\n\treturn (NETWORKS as readonly string[]).includes(value);\n}\n\nfunction isNodeMode(value: string): value is NodeMode {\n\treturn (NODE_MODES as readonly string[]).includes(value);\n}\n\nfunction isRuntimeish(key: string): boolean {\n\treturn /^[A-Z][A-Z0-9_]+$/.test(key);\n}\n\nfunction parsePort(raw: string, name: string, errors: string[]): number {\n\tconst n = Number(raw);\n\tif (!Number.isInteger(n) || n < 1 || n > 65535) {\n\t\terrors.push(`${name} must be a TCP port`);\n\t\treturn 0;\n\t}\n\treturn n;\n}\n",
9
+ "/**\n * Minimal runtime config — six or fewer required non-secret values.\n * Unknown or contradictory values fail before ingest starts.\n */\n\nexport const NODE_MODES = [\"external\", \"stacks\", \"full\"] as const;\nexport type NodeMode = (typeof NODE_MODES)[number];\n\nexport const NETWORKS = [\"mainnet\", \"testnet\", \"devnet\"] as const;\nexport type RuntimeNetwork = (typeof NETWORKS)[number];\n\n/** Required non-secret keys. Secrets (tokens, signing keys) come from `sl init`. */\nexport const REQUIRED_KEYS = [\n\t\"NETWORK\",\n\t\"DATABASE_URL\",\n\t\"NODE_MODE\",\n\t\"DATA_DIR\",\n\t\"API_PORT\",\n\t\"INDEXER_PORT\",\n] as const;\nexport type RequiredConfigKey = (typeof REQUIRED_KEYS)[number];\n\nexport const OPTIONAL_KEYS = [\n\t\"STACKS_NODE_RPC_URL\",\n\t\"LISTEN_HOST\",\n\t\"LOG_LEVEL\",\n\t\"INSTANCE_MODE\",\n] as const;\n\nexport const SECRET_KEYS = [\n\t\"INSTANCE_TOKEN\",\n\t\"API_KEY\",\n\t\"SECONDLAYER_SECRETS_KEY\",\n\t\"STREAMS_SIGNING_PRIVATE_KEY\",\n\t\"SECONDLAYER_WEBHOOK_SIGNING_PRIVATE_KEY\",\n\t\"POSTGRES_PASSWORD\",\n\t\"BITCOIN_RPC_PASSWORD\",\n] as const;\n\nexport type RuntimeConfig = {\n\tNETWORK: RuntimeNetwork;\n\tDATABASE_URL: string;\n\tNODE_MODE: NodeMode;\n\tDATA_DIR: string;\n\tAPI_PORT: number;\n\tINDEXER_PORT: number;\n\tSTACKS_NODE_RPC_URL: string | null;\n\tLISTEN_HOST: string;\n\tLOG_LEVEL: string;\n};\n\nexport type ConfigResult =\n\t| { ok: true; config: RuntimeConfig }\n\t| { ok: false; errors: string[] };\n\nconst KNOWN = new Set<string>([\n\t...REQUIRED_KEYS,\n\t...OPTIONAL_KEYS,\n\t...SECRET_KEYS,\n\t\"SOURCE_DATABASE_URL\",\n\t\"TARGET_DATABASE_URL\",\n\t\"INSTANCE_MODE\",\n\t\"NODE_ENV\",\n\t\"ALLOW_UNSIGNED_WEBHOOKS\",\n\t\"OBSERVER_JOURNAL_ENABLED\",\n\t\"STACKS_NETWORK\",\n\t// Set by the shipped image/compose (docker/oss/docker-compose.yml).\n\t\"STREAMS_API_URL\",\n\t\"STREAMS_INTERNAL_API_KEY\",\n\t\"SUBGRAPH_SOURCE\",\n\t\"SUBGRAPH_INDEX_API_URL\",\n\t\"SBTC_DECODER_ENABLED\",\n\t\"POX4_DECODER_ENABLED\",\n\t\"BNS_DECODER_ENABLED\",\n\t// Archive publishing. Both sit inside the ARCHIVE_ namespace the refusal\n\t// patrols, so an operator who sets them on a one-box runtime would be told\n\t// their valid config is a typo unless they are named here.\n\t\"ARCHIVE_DIR\",\n\t\"ARCHIVE_PUBLIC_DIR\",\n\t// Escape hatch for the boot-time resource preflight. Setting it is exactly\n\t// the moment an operator must not also be told it is an unknown key.\n\t\"SECONDLAYER_ALLOW_UNDERSIZED\",\n\t// Forward-only instances declare where their history starts; refusing it as\n\t// unknown would block the only way to say \"the prefix is absent on purpose\".\n\t\"SECONDLAYER_SYNC_START_HEIGHT\",\n]);\n\n/**\n * Namespaces the unknown-key refusal patrols. A real container environ\n * carries dozens of ambient ALL_CAPS vars (PATH, HOME, HOSTNAME, PORT,\n * BUN_*, …) that are not config and must not fail the boot — the refusal\n * exists to catch a misspelled *Secondlayer* key, so it only fires inside\n * our own vocabulary. Required keys are validated separately, so a typo'd\n * required key still fails via its missing-value error.\n */\nconst OWN_PREFIXES = [\n\t\"SECONDLAYER_\",\n\t\"STACKS_\",\n\t\"BITCOIN_\",\n\t\"STREAMS_\",\n\t\"SUBGRAPH_\",\n\t\"OBSERVER_\",\n\t\"INSTANCE_\",\n\t\"ARCHIVE_\",\n\t\"X402_\",\n] as const;\n\nfunction isOwnNamespace(key: string): boolean {\n\tif (KNOWN.has(key)) return true;\n\treturn OWN_PREFIXES.some((prefix) => key.startsWith(prefix));\n}\n\nexport function parseRuntimeConfig(\n\tenv: Record<string, string | undefined>,\n): ConfigResult {\n\tconst errors: string[] = [];\n\tfor (const key of Object.keys(env)) {\n\t\tif (env[key] === undefined) continue;\n\t\tif (key.startsWith(\"SL_\") || key.startsWith(\"POSTGRES_\")) continue;\n\t\tif (!KNOWN.has(key) && isRuntimeish(key) && isOwnNamespace(key)) {\n\t\t\terrors.push(`unknown config ${key}`);\n\t\t}\n\t}\n\n\tconst network = (env.NETWORK ?? env.STACKS_NETWORK ?? \"\").trim();\n\tif (!isNetwork(network)) {\n\t\terrors.push(\"NETWORK must be mainnet | testnet | devnet\");\n\t}\n\tconst database = (env.DATABASE_URL ?? \"\").trim();\n\tif (!database) errors.push(\"DATABASE_URL is required\");\n\tconst mode = (env.NODE_MODE ?? \"\").trim();\n\tif (!isNodeMode(mode)) {\n\t\terrors.push(\"NODE_MODE must be external | stacks | full\");\n\t}\n\tconst dataDir = (env.DATA_DIR ?? \"/data\").trim();\n\tconst apiPort = parsePort(env.API_PORT ?? \"3800\", \"API_PORT\", errors);\n\tconst indexerPort = parsePort(\n\t\tenv.INDEXER_PORT ?? \"3700\",\n\t\t\"INDEXER_PORT\",\n\t\terrors,\n\t);\n\n\tif (mode === \"external\" && env.BITCOIN_RPC_PASSWORD) {\n\t\terrors.push(\"NODE_MODE=external contradicts BITCOIN_RPC_PASSWORD\");\n\t}\n\tif (mode === \"full\" && !env.BITCOIN_RPC_PASSWORD) {\n\t\terrors.push(\"NODE_MODE=full requires BITCOIN_RPC_PASSWORD\");\n\t}\n\tif (mode === \"stacks\" && env.BITCOIN_RPC_PASSWORD) {\n\t\terrors.push(\n\t\t\t\"NODE_MODE=stacks runs no bundled bitcoind; drop BITCOIN_RPC_PASSWORD\",\n\t\t);\n\t}\n\n\tif (errors.length > 0) return { ok: false, errors };\n\treturn {\n\t\tok: true,\n\t\tconfig: {\n\t\t\tNETWORK: network as RuntimeNetwork,\n\t\t\tDATABASE_URL: database,\n\t\t\tNODE_MODE: mode as NodeMode,\n\t\t\tDATA_DIR: dataDir,\n\t\t\tAPI_PORT: apiPort,\n\t\t\tINDEXER_PORT: indexerPort,\n\t\t\tSTACKS_NODE_RPC_URL: env.STACKS_NODE_RPC_URL?.trim() || null,\n\t\t\tLISTEN_HOST: env.LISTEN_HOST?.trim() || \"0.0.0.0\",\n\t\t\tLOG_LEVEL: env.LOG_LEVEL?.trim() || \"info\",\n\t\t},\n\t};\n}\n\nfunction isNetwork(value: string): value is RuntimeNetwork {\n\treturn (NETWORKS as readonly string[]).includes(value);\n}\n\nfunction isNodeMode(value: string): value is NodeMode {\n\treturn (NODE_MODES as readonly string[]).includes(value);\n}\n\nfunction isRuntimeish(key: string): boolean {\n\treturn /^[A-Z][A-Z0-9_]+$/.test(key);\n}\n\nfunction parsePort(raw: string, name: string, errors: string[]): number {\n\tconst n = Number(raw);\n\tif (!Number.isInteger(n) || n < 1 || n > 65535) {\n\t\terrors.push(`${name} must be a TCP port`);\n\t\treturn 0;\n\t}\n\treturn n;\n}\n",
10
10
  "/**\n * Status UX — node, raw, decoder, subgraph, queue, archive import, disk,\n * and coverage, each with a next action.\n */\n\nimport type { CoverageState } from \"../coverage/evaluate.ts\";\nimport type { ModuleHealth, ModuleId } from \"./modules.ts\";\nimport type { SupervisorHealth } from \"./supervisor.ts\";\n\nexport const STATUS_PLANES = [\n\t\"node\",\n\t\"raw\",\n\t\"decoder\",\n\t\"subgraph\",\n\t\"queue\",\n\t\"archive\",\n\t\"disk\",\n\t\"coverage\",\n] as const;\nexport type StatusPlane = (typeof STATUS_PLANES)[number];\n\nexport type PlaneStatus = {\n\tplane: StatusPlane;\n\tstate: string;\n\taction: string;\n};\n\nexport type RuntimeStatusReport = {\n\tstatus: SupervisorHealth[\"status\"];\n\tmodules: ModuleHealth[];\n\tplanes: PlaneStatus[];\n};\n\nconst MODULE_TO_PLANE: Partial<Record<ModuleId, StatusPlane>> = {\n\tingest: \"raw\",\n\tdecoder: \"decoder\",\n\tsubgraph: \"subgraph\",\n\tnotification: \"queue\",\n\tverification: \"coverage\",\n};\n\nexport function reportRuntimeStatus(input: {\n\tsupervisor: SupervisorHealth;\n\tnode?: string;\n\tarchive?: string;\n\tdisk?: string;\n\tcoverage?: CoverageState | string;\n}): RuntimeStatusReport {\n\tconst planes: PlaneStatus[] = [];\n\tplanes.push({\n\t\tplane: \"node\",\n\t\tstate: input.node ?? \"unknown\",\n\t\taction: actionFor(\"node\", input.node ?? \"unknown\"),\n\t});\n\tfor (const mod of input.supervisor.modules) {\n\t\tconst plane = MODULE_TO_PLANE[mod.id];\n\t\tif (!plane) continue;\n\t\tplanes.push({\n\t\t\tplane,\n\t\t\tstate: mod.state,\n\t\t\taction: actionFor(plane, mod.state),\n\t\t});\n\t}\n\tplanes.push({\n\t\tplane: \"archive\",\n\t\tstate: input.archive ?? \"idle\",\n\t\taction: actionFor(\"archive\", input.archive ?? \"idle\"),\n\t});\n\tplanes.push({\n\t\tplane: \"disk\",\n\t\tstate: input.disk ?? \"ok\",\n\t\taction: actionFor(\"disk\", input.disk ?? \"ok\"),\n\t});\n\tplanes.push({\n\t\tplane: \"coverage\",\n\t\tstate: input.coverage ?? \"unknown\",\n\t\taction: actionFor(\"coverage\", String(input.coverage ?? \"unknown\")),\n\t});\n\treturn {\n\t\tstatus: input.supervisor.status,\n\t\tmodules: input.supervisor.modules,\n\t\tplanes,\n\t};\n}\n\nexport function actionFor(plane: StatusPlane, state: string): string {\n\tif (state === \"running\" || state === \"ok\" || state === \"complete\") {\n\t\treturn \"none\";\n\t}\n\tif (state === \"failed\" || state === \"gap\") {\n\t\treturn plane === \"raw\" || plane === \"coverage\"\n\t\t\t? \"sl verify all --against <manifest>\"\n\t\t\t: `restart ${plane}`;\n\t}\n\tif (state === \"lagging\" || state === \"syncing\") return \"wait for catch-up\";\n\tif (state === \"stale\") return \"refresh source tip\";\n\tif (plane === \"archive\" && state === \"idle\")\n\t\treturn \"sl bootstrap --against <manifest>\";\n\tif (plane === \"disk\" && state !== \"ok\") return \"free disk and retry\";\n\tif (plane === \"node\" && state === \"unknown\") return \"sl observer\";\n\treturn \"inspect logs\";\n}\n",
11
11
  "/**\n * Backup bundle — the index, the operator's keys, and the scope they cover.\n *\n * This file holds the pure parts: manifest shape, validation, bundle\n * encryption, and the key canary. The IO (pg_dump, pg_restore, reading and\n * writing bundle files) lives in the CLI command, so everything here stays\n * testable without a database or a filesystem.\n *\n * ## Why there is a canary\n *\n * `SECONDLAYER_SECRETS_KEY` encrypts columns in the database — subgraph\n * connection strings, subscription signing secrets. In OSS mode, if that key is\n * missing when something first needs it, the runtime GENERATES A NEW ONE and\n * persists it (see `crypto/secrets.ts`). That behaviour is right for a fresh\n * install and catastrophic for a restore: bring the database back without its\n * original key and the runtime quietly mints a different one, leaving every\n * encrypted column permanently unreadable. Nothing errors. You find out later.\n *\n * So a backup seals a known plaintext under the live key and stores the\n * ciphertext in the manifest. Restore opens it with the key it is about to\n * install, and refuses if it does not match. That converts a silent, permanent\n * data loss into a loud failure before anything is written.\n */\nimport {\n\tcreateCipheriv,\n\tcreateDecipheriv,\n\trandomBytes,\n\tscryptSync,\n\ttimingSafeEqual,\n} from \"node:crypto\";\n\nexport const BACKUP_MANIFEST_VERSION = 1;\n\nexport const BACKUP_PARTS = [\n\t\"db\",\n\t\"config\",\n\t\"keys\",\n\t\"handlers\",\n\t\"scope\",\n] as const;\nexport type BackupPart = (typeof BACKUP_PARTS)[number];\n\n/**\n * Sealed under the secrets key at backup time and opened at restore time. The\n * value is arbitrary; only the round-trip matters.\n */\nconst CANARY_PLAINTEXT = \"secondlayer-secrets-key-canary-v1\";\n\nconst IV_LEN = 12;\nconst TAG_LEN = 16;\nconst SALT_LEN = 16;\n/** Deliberately expensive: bundle passphrases are chosen by humans. */\nconst SCRYPT_COST = 2 ** 15;\n/**\n * scrypt needs ~128 * N * r bytes (r defaults to 8), which is just over Node's\n * 32 MB default cap at this cost. Raising the ceiling rather than weakening the\n * KDF — the whole point of the cost is that it is uncomfortable.\n */\nconst SCRYPT_MAXMEM = 64 * 1024 * 1024;\nconst SCRYPT_OPTS = { N: SCRYPT_COST, maxmem: SCRYPT_MAXMEM } as const;\n\nexport type BackupManifest = {\n\tschema_version: number;\n\tcreated_at: string;\n\tnetwork: string;\n\tparts: BackupPart[];\n\tencrypted: boolean;\n\tscope: { from_height: number; to_height: number | null };\n\tdb: {\n\t\tfile: string;\n\t\tsha256: string;\n\t\tbytes: number;\n\t\tformat: string;\n\t} | null;\n\t/** Never the secrets themselves — only how to check them. */\n\tsecrets: {\n\t\tfile: string;\n\t\tencrypted: boolean;\n\t\tcanary: string;\n\t} | null;\n\tsignature?: string;\n\tkey_id?: string;\n};\n\nexport type BackupPlan =\n\t| { ok: true; manifest: BackupManifest }\n\t| { ok: false; reason: string };\n\n/**\n * Validate a backup before any bytes are written. Refusing early is the whole\n * point: a bundle that omits the keys looks like a backup and is not one.\n */\nexport function planBackup(input: {\n\tnetwork: string;\n\tfromHeight: number;\n\ttoHeight?: number | null;\n\tincludeSecrets: boolean;\n\tsecretsEncrypted: boolean;\n\tcanary?: string;\n\tnow?: string;\n}): BackupPlan {\n\tif (input.fromHeight < 0) {\n\t\treturn { ok: false, reason: \"scope from_height must be >= 0\" };\n\t}\n\tif (\n\t\tinput.toHeight !== null &&\n\t\tinput.toHeight !== undefined &&\n\t\tinput.toHeight < input.fromHeight\n\t) {\n\t\treturn { ok: false, reason: \"scope to_height is below from_height\" };\n\t}\n\tif (input.includeSecrets && !input.secretsEncrypted) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason:\n\t\t\t\t\"refusing to write plaintext secrets; supply a passphrase or pass the explicit plaintext override\",\n\t\t};\n\t}\n\tif (input.includeSecrets && !input.canary) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason:\n\t\t\t\t\"secrets bundle requires a key canary so a restore can prove the key matches\",\n\t\t};\n\t}\n\n\tconst parts: BackupPart[] = input.includeSecrets\n\t\t? [...BACKUP_PARTS]\n\t\t: BACKUP_PARTS.filter((p) => p !== \"keys\");\n\n\treturn {\n\t\tok: true,\n\t\tmanifest: {\n\t\t\tschema_version: BACKUP_MANIFEST_VERSION,\n\t\t\tcreated_at: input.now ?? new Date().toISOString(),\n\t\t\tnetwork: input.network,\n\t\t\tparts,\n\t\t\tencrypted: input.secretsEncrypted,\n\t\t\tscope: {\n\t\t\t\tfrom_height: input.fromHeight,\n\t\t\t\tto_height: input.toHeight ?? null,\n\t\t\t},\n\t\t\tdb: null,\n\t\t\tsecrets: null,\n\t\t},\n\t};\n}\n\nfunction secretsKeyBuffer(hexKey: string): Buffer {\n\tconst key = Buffer.from(hexKey.trim(), \"hex\");\n\tif (key.length !== 32) {\n\t\tthrow new Error(\"SECONDLAYER_SECRETS_KEY must be 32 bytes hex\");\n\t}\n\treturn key;\n}\n\n/**\n * Seal the canary under an EXPLICIT key.\n *\n * Deliberately not reusing `crypto/secrets.ts`: that module resolves the key\n * from the ambient environment and, in OSS mode, generates and persists one as\n * a side effect when it is missing. Calling it here would mean a backup could\n * mint the very key it is supposed to be preserving.\n */\nexport function sealKeyCanary(secretsKeyHex: string): string {\n\tconst key = secretsKeyBuffer(secretsKeyHex);\n\tconst iv = randomBytes(IV_LEN);\n\tconst cipher = createCipheriv(\"aes-256-gcm\", key, iv);\n\tconst ciphertext = Buffer.concat([\n\t\tcipher.update(CANARY_PLAINTEXT, \"utf8\"),\n\t\tcipher.final(),\n\t]);\n\treturn Buffer.concat([iv, cipher.getAuthTag(), ciphertext]).toString(\n\t\t\"base64\",\n\t);\n}\n\n/** True only when `secretsKeyHex` is the key the canary was sealed with. */\nexport function keyMatchesCanary(\n\tcanaryBase64: string,\n\tsecretsKeyHex: string,\n): boolean {\n\ttry {\n\t\tconst key = secretsKeyBuffer(secretsKeyHex);\n\t\tconst envelope = Buffer.from(canaryBase64, \"base64\");\n\t\tconst iv = envelope.subarray(0, IV_LEN);\n\t\tconst tag = envelope.subarray(IV_LEN, IV_LEN + TAG_LEN);\n\t\tconst ciphertext = envelope.subarray(IV_LEN + TAG_LEN);\n\t\tconst decipher = createDecipheriv(\"aes-256-gcm\", key, iv);\n\t\tdecipher.setAuthTag(tag);\n\t\tconst plaintext = Buffer.concat([\n\t\t\tdecipher.update(ciphertext),\n\t\t\tdecipher.final(),\n\t\t]);\n\t\tconst expected = Buffer.from(CANARY_PLAINTEXT, \"utf8\");\n\t\treturn (\n\t\t\tplaintext.length === expected.length &&\n\t\t\ttimingSafeEqual(plaintext, expected)\n\t\t);\n\t} catch {\n\t\t// A wrong key fails the GCM auth tag, which throws. That is a mismatch,\n\t\t// not an error to propagate.\n\t\treturn false;\n\t}\n}\n\n/**\n * Encrypt the secrets bundle under an operator passphrase.\n * Layout: `salt(16) || iv(12) || authTag(16) || ciphertext`.\n */\nexport function encryptBundle(plaintext: string, passphrase: string): Buffer {\n\tif (!passphrase) throw new Error(\"passphrase is required\");\n\tconst salt = randomBytes(SALT_LEN);\n\tconst key = scryptSync(passphrase, salt, 32, SCRYPT_OPTS);\n\tconst iv = randomBytes(IV_LEN);\n\tconst cipher = createCipheriv(\"aes-256-gcm\", key, iv);\n\tconst ciphertext = Buffer.concat([\n\t\tcipher.update(plaintext, \"utf8\"),\n\t\tcipher.final(),\n\t]);\n\treturn Buffer.concat([salt, iv, cipher.getAuthTag(), ciphertext]);\n}\n\nexport function decryptBundle(envelope: Buffer, passphrase: string): string {\n\tconst salt = envelope.subarray(0, SALT_LEN);\n\tconst iv = envelope.subarray(SALT_LEN, SALT_LEN + IV_LEN);\n\tconst tag = envelope.subarray(SALT_LEN + IV_LEN, SALT_LEN + IV_LEN + TAG_LEN);\n\tconst ciphertext = envelope.subarray(SALT_LEN + IV_LEN + TAG_LEN);\n\tconst key = scryptSync(passphrase, salt, 32, SCRYPT_OPTS);\n\tconst decipher = createDecipheriv(\"aes-256-gcm\", key, iv);\n\tdecipher.setAuthTag(tag);\n\treturn decipher.update(ciphertext).toString(\"utf8\") + decipher.final(\"utf8\");\n}\n\nexport type RestorePrecheck =\n\t| { ok: true }\n\t| { ok: false; reason: string; fatal: boolean };\n\n/**\n * Everything that must hold before a restore writes anything.\n *\n * `fatal` distinguishes \"this bundle can never restore here\" from \"this needs\n * an explicit override\" — the caller surfaces them differently.\n */\nexport function precheckRestore(input: {\n\tmanifest: BackupManifest;\n\ttargetNetwork: string;\n\ttargetIsEmpty: boolean;\n\tforce: boolean;\n\tsecretsKeyHex?: string;\n}): RestorePrecheck {\n\tif (input.manifest.schema_version !== BACKUP_MANIFEST_VERSION) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfatal: true,\n\t\t\treason: `bundle schema_version ${input.manifest.schema_version} is not supported (expected ${BACKUP_MANIFEST_VERSION})`,\n\t\t};\n\t}\n\tif (input.manifest.network !== input.targetNetwork) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfatal: true,\n\t\t\treason: `bundle is ${input.manifest.network}; this instance is ${input.targetNetwork}`,\n\t\t};\n\t}\n\tif (!input.targetIsEmpty && !input.force) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tfatal: false,\n\t\t\treason:\n\t\t\t\t\"target database already holds chain data; restoring would overwrite it\",\n\t\t};\n\t}\n\tconst secrets = input.manifest.secrets;\n\tif (secrets) {\n\t\tif (!input.secretsKeyHex) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfatal: false,\n\t\t\t\treason:\n\t\t\t\t\t\"bundle carries encrypted columns but no secrets key was supplied; restoring now would leave them unreadable\",\n\t\t\t};\n\t\t}\n\t\tif (!keyMatchesCanary(secrets.canary, input.secretsKeyHex)) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tfatal: true,\n\t\t\t\treason:\n\t\t\t\t\t\"the supplied SECONDLAYER_SECRETS_KEY does not match the one this backup was taken with; encrypted columns would be permanently unreadable\",\n\t\t\t};\n\t\t}\n\t}\n\treturn { ok: true };\n}\n",
12
12
  "/**\n * Uninstall with data preservation — tear the stack down without destroying\n * what cannot be rebuilt.\n *\n * The asymmetry that shapes this whole file: the index can be reconstructed\n * from the archive, and the chainstate can be re-synced, but the keys cannot be\n * recovered by any means. `SECONDLAYER_SECRETS_KEY` decrypts columns that are\n * otherwise permanently unreadable, and `STREAMS_SIGNING_PRIVATE_KEY` is the\n * identity anything this instance published was signed under.\n *\n * So the default removes containers and leaves every byte of data in place, and\n * the destructive path refuses unless the operator has said the words AND the\n * keys are demonstrably somewhere else. A teardown that silently takes the keys\n * with it is not an uninstall, it is data loss with a friendly name.\n */\n\nexport const REMOVABLE = [\"containers\", \"networks\", \"handler-cache\"] as const;\nexport type Removable = (typeof REMOVABLE)[number];\n\nexport const PRESERVED = [\"index\", \"chainstate\", \"secrets\", \"backups\"] as const;\nexport type Preserved = (typeof PRESERVED)[number];\n\nexport type UninstallPlan = {\n\t/** What the plan will actually delete. */\n\tremoves: Removable[];\n\t/** What survives, and why it matters. */\n\tpreserves: { what: Preserved; detail: string }[];\n\t/** Volumes destroyed only on the purge path. */\n\tdestroys: string[];\n\tpurge: boolean;\n};\n\nexport type UninstallDecision =\n\t| { ok: true; plan: UninstallPlan; warnings: string[] }\n\t| { ok: false; reason: string };\n\nexport function planUninstall(input: {\n\tpurge: boolean;\n\t/** The operator typed the confirmation. */\n\tconfirmed: boolean;\n\t/** A backup bundle exists that carries the keys. */\n\tkeysBackedUp: boolean;\n\t/** Secrets are currently present (there is something to lose). */\n\tsecretsPresent: boolean;\n\tdataDir: string;\n}): UninstallDecision {\n\tconst preserves: UninstallPlan[\"preserves\"] = [\n\t\t{\n\t\t\twhat: \"index\",\n\t\t\tdetail: \"the Postgres volume — rebuildable from the archive, but slow\",\n\t\t},\n\t\t{\n\t\t\twhat: \"chainstate\",\n\t\t\tdetail: \"bundled node data, if any — re-syncable\",\n\t\t},\n\t\t{\n\t\t\twhat: \"secrets\",\n\t\t\tdetail: `${input.dataDir} and .env.local — NOT recoverable if lost`,\n\t\t},\n\t\t{ what: \"backups\", detail: \"any bundles already written\" },\n\t];\n\n\tif (!input.purge) {\n\t\treturn {\n\t\t\tok: true,\n\t\t\twarnings: [],\n\t\t\tplan: {\n\t\t\t\tremoves: [...REMOVABLE],\n\t\t\t\tpreserves,\n\t\t\t\tdestroys: [],\n\t\t\t\tpurge: false,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Purge is the only path that can lose something irreplaceable, so both\n\t// gates are required and neither is implied by the other.\n\tif (!input.confirmed) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason:\n\t\t\t\t\"purge destroys the index and every volume; re-run with the explicit confirmation flag\",\n\t\t};\n\t}\n\tif (input.secretsPresent && !input.keysBackedUp) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason:\n\t\t\t\t\"refusing to purge: this instance holds keys with no backup bundle. Run `secondlayer backup` first — the index can be rebuilt from the archive, the keys cannot.\",\n\t\t};\n\t}\n\n\treturn {\n\t\tok: true,\n\t\twarnings: [\n\t\t\t\"purge removes the index; a rebuild from the archive takes hours\",\n\t\t],\n\t\tplan: {\n\t\t\tremoves: [...REMOVABLE],\n\t\t\t// Even on purge the secrets on disk are left alone: the operator asked\n\t\t\t// to destroy the stack's data, not to shred their own key material.\n\t\t\tpreserves: preserves.filter((p) => p.what === \"secrets\"),\n\t\t\tdestroys: [\"postgres_data\", \"subgraphs_data\"],\n\t\t\tpurge: true,\n\t\t},\n\t};\n}\n\n/** The compose invocation a plan corresponds to. */\nexport function uninstallCommand(\n\tplan: UninstallPlan,\n\tcomposeFile: string,\n): string[] {\n\tconst base = [\"compose\", \"-f\", composeFile, \"down\", \"--remove-orphans\"];\n\treturn plan.purge ? [...base, \"-v\"] : base;\n}\n",
@@ -16,7 +16,7 @@
16
16
  "/**\n * Boot-time resource preflight — the thing that makes the guardrail floors real.\n *\n * `preflightResources` existed and was correct for a long time, but nothing\n * called it, so the self-host docs claimed \"constrained boxes fail at start\"\n * while no box ever did. This module closes that gap.\n *\n * The refusal is deliberately overridable. Enforcing a floor on a runtime that\n * is already released can stop a running install from coming back up after an\n * upgrade — a box that was undersized yesterday is still undersized today, and\n * discovering that during a restart is the worst possible moment. So an\n * operator can proceed past the refusal with SECONDLAYER_ALLOW_UNDERSIZED,\n * which converts a silent risk into an acknowledged one. That is the honest\n * trade: we refuse by default, and we never take away the operator's ability to\n * run their own box.\n */\nimport { type GuardrailNetwork, preflightResources } from \"./guardrails.ts\";\nimport { type MeasuredResources, measureResources } from \"./resources.ts\";\n\nexport const UNDERSIZED_OVERRIDE = \"SECONDLAYER_ALLOW_UNDERSIZED\";\n\nexport type PreflightDecision = {\n\taction: \"pass\" | \"warn\" | \"refuse\";\n\tmessages: string[];\n};\n\nfunction isOverridden(env: Record<string, string | undefined>): boolean {\n\treturn env[UNDERSIZED_OVERRIDE]?.trim().toLowerCase() === \"true\";\n}\n\nexport function decidePreflight(input: {\n\tmeasured: MeasuredResources;\n\tmode: \"external\" | \"stacks\" | \"full\";\n\tnetwork: GuardrailNetwork;\n\tenv?: Record<string, string | undefined>;\n}): PreflightDecision {\n\tconst env = input.env ?? {};\n\tconst result = preflightResources(\n\t\tinput.measured.snapshot,\n\t\tinput.mode,\n\t\tinput.network,\n\t);\n\n\tconst messages: string[] = [];\n\t// Say what we could not see. An operator debugging a surprising pass\n\t// deserves to know the check was partial.\n\tif (input.measured.unknown.length > 0) {\n\t\tmessages.push(\n\t\t\t`resource preflight could not measure: ${input.measured.unknown.join(\", \")}`,\n\t\t);\n\t}\n\n\tif (result.ok) {\n\t\treturn { action: messages.length > 0 ? \"warn\" : \"pass\", messages };\n\t}\n\n\tmessages.push(...result.errors);\n\tif (isOverridden(env)) {\n\t\tmessages.push(\n\t\t\t`${UNDERSIZED_OVERRIDE}=true — starting anyway. This box is below the documented floor; expect to run out of disk as history accumulates.`,\n\t\t);\n\t\treturn { action: \"warn\", messages };\n\t}\n\n\tmessages.push(\n\t\t`Refusing to start. Resize the box, or set ${UNDERSIZED_OVERRIDE}=true to proceed at your own risk. Sizing guidance: https://www.secondlayer.tools/docs/self-host#guardrails`,\n\t);\n\treturn { action: \"refuse\", messages };\n}\n\n/** Measure this box and decide. Returns the decision; the caller exits. */\nexport async function runPreflight(input: {\n\tdataDir: string;\n\tmode: \"external\" | \"stacks\" | \"full\";\n\tnetwork: GuardrailNetwork;\n\tquery?: (sql: string) => Promise<Array<Record<string, unknown>>>;\n\tenv?: Record<string, string | undefined>;\n}): Promise<PreflightDecision> {\n\tconst measured = await measureResources({\n\t\tdataDir: input.dataDir,\n\t\tquery: input.query,\n\t});\n\treturn decidePreflight({\n\t\tmeasured,\n\t\tmode: input.mode,\n\t\tnetwork: input.network,\n\t\tenv: input.env,\n\t});\n}\n",
17
17
  "/**\n * Child-process commands the one-box supervisor starts.\n * Publisher stays off the default profile.\n */\n\nimport type { ModuleId } from \"./modules.ts\";\n\nexport const MODULE_COMMANDS: Record<ModuleId, readonly string[]> = {\n\tapi: [\"bun\", \"run\", \"packages/api/src/index.ts\"],\n\tingest: [\"bun\", \"run\", \"packages/indexer/src/index.ts\"],\n\tdecoder: [\"bun\", \"run\", \"packages/indexer/src/decode/service.ts\"],\n\tsubgraph: [\"bun\", \"run\", \"packages/subgraphs/src/service.ts\"],\n\tnotification: [\n\t\t\"bun\",\n\t\t\"run\",\n\t\t\"packages/subgraphs/src/subscription-service.ts\",\n\t],\n\tverification: [\"bun\", \"run\", \"packages/shared/src/runtime/verify-loop.ts\"],\n\tpublisher: [\"bun\", \"run\", \"packages/indexer/src/streams-bulk/scheduler.ts\"],\n};\n\nexport function commandFor(id: ModuleId): readonly string[] {\n\treturn MODULE_COMMANDS[id];\n}\n"
18
18
  ],
19
- "mappings": ";;;;;;;;;;;;;;;;;AAKO,IAAM,aAAa;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAGO,IAAM,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAiBO,IAAM,kBAAuC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,oBAAyC,CAAC,WAAW;AAE3D,SAAS,UAAU,CAAC,OAAkC;AAAA,EAC5D,OAAQ,WAAiC,SAAS,KAA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,EAAE,QAAQ,QAAQ,SAAS;AAAA,EACnC;AAAA,EAEA,SAAS,KACR,6CAA6C,gIAC9C;AAAA,EACA,OAAO,EAAE,QAAQ,UAAU,SAAS;AAAA;AAIrC,eAAsB,YAAY,CAAC,OAMJ;AAAA,EAC9B,MAAM,WAAW,MAAM,iBAAiB;AAAA,IACvC,SAAS,MAAM;AAAA,IACf,OAAO,MAAM;AAAA,EACd,CAAC;AAAA,EACD,OAAO,gBAAgB;AAAA,IACtB;AAAA,IACA,MAAM,MAAM;AAAA,IACZ,SAAS,MAAM;AAAA,IACf,KAAK,MAAM;AAAA,EACZ,CAAC;AAAA;;AChFK,IAAM,kBAAuD;AAAA,EACnE,KAAK,CAAC,OAAO,OAAO,2BAA2B;AAAA,EAC/C,QAAQ,CAAC,OAAO,OAAO,+BAA+B;AAAA,EACtD,SAAS,CAAC,OAAO,OAAO,wCAAwC;AAAA,EAChE,UAAU,CAAC,OAAO,OAAO,mCAAmC;AAAA,EAC5D,cAAc;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAAA,EACA,cAAc,CAAC,OAAO,OAAO,4CAA4C;AAAA,EACzE,WAAW,CAAC,OAAO,OAAO,gDAAgD;AAC3E;AAEO,SAAS,UAAU,CAAC,IAAiC;AAAA,EAC3D,OAAO,gBAAgB;AAAA;",
20
+ "debugId": "3BB8F0C6EEDF219364756E2164756E21",
21
21
  "names": []
22
22
  }
@@ -12,18 +12,12 @@ interface DeploySubgraphRequest {
12
12
  sourceCode?: string;
13
13
  /** Validate the definition + print the DDL plan without deploying. */
14
14
  dryRun?: boolean;
15
- /**
16
- * Read visibility. Server-side default: deploys → public (anon reads on
17
- * /v1/subgraphs, name claimed in the global public namespace).
18
- */
19
- visibility?: "public" | "private";
20
15
  }
21
16
  declare const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest>;
22
17
  interface DeploySubgraphResponse {
23
18
  action: "created" | "unchanged" | "handler_updated" | "updated" | "reindexed";
24
19
  subgraphId: string;
25
20
  version: string;
26
- visibility?: "public" | "private";
27
21
  message: string;
28
22
  /** Effective indexing start height. */
29
23
  start_block?: number;
@@ -25,8 +25,7 @@ var DeploySubgraphRequestSchema = z.object({
25
25
  handlerCode: z.string().max(1048576, "handler code exceeds 1MB limit"),
26
26
  startBlock: z.number().int().nonnegative().optional(),
27
27
  sourceCode: z.string().max(1048576, "source code exceeds 1MB limit").optional(),
28
- dryRun: z.boolean().optional(),
29
- visibility: z.enum(["public", "private"]).optional()
28
+ dryRun: z.boolean().optional()
30
29
  });
31
30
 
32
31
  // src/schemas/subscriptions.ts
@@ -419,5 +418,5 @@ export {
419
418
  CHAIN_TRIGGER_FIELDS
420
419
  };
421
420
 
422
- //# debugId=674E6A31C0BEE4F264756E2164756E21
421
+ //# debugId=7B1B5B4BE50333EE64756E2164756E21
423
422
  //# sourceMappingURL=index.js.map
@@ -2,10 +2,10 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/schemas/subgraphs.ts", "../src/schemas/subscriptions.ts"],
4
4
  "sourcesContent": [
5
- "import { z } from \"zod\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** Override the definition's startBlock for this deploy only. */\n\tstartBlock?: number;\n\t/** Original TypeScript source, persisted so chat can read/diff/edit later. */\n\tsourceCode?: string;\n\t/** Validate the definition + print the DDL plan without deploying. */\n\tdryRun?: boolean;\n\t/**\n\t * Read visibility. Server-side default: deploys → public (anon reads on\n\t * /v1/subgraphs, name claimed in the global public namespace).\n\t */\n\tvisibility?: \"public\" | \"private\";\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), z.record(z.string(), z.unknown()))\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\tdryRun: z.boolean().optional(),\n\t\tvisibility: z.enum([\"public\", \"private\"]).optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"handler_updated\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tvisibility?: \"public\" | \"private\";\n\tmessage: string;\n\t/** Effective indexing start height. */\n\tstart_block?: number;\n\toperationId?: string;\n\treindexStarted?: boolean;\n\t/** Bounded candidate-event denominator for the reindex just started, when the\n\t * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate\n\t * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */\n\testimatedEvents?: number;\n\t/** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */\n\twarnings?: string[];\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalRows?: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tprogress: number;\n\tblocksRemaining?: number;\n\tsyncMode?: \"sync\" | \"reindex\";\n\tgapCount: number;\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n\tvisibility?: \"public\" | \"private\";\n\t/** Most recent indexing error reason + when it occurred, if any. */\n\tlastError?: string | null;\n\tlastErrorAt?: string | null;\n\t/** Last row mutation timestamp; powers per-card freshness. */\n\tupdatedAt?: string | null;\n\t/** Number of subscriptions attached to this subgraph. */\n\tsubscriptionCount?: number;\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tmode?: \"sync\" | \"reindex\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\t/**\n\t * Backward-compatible denominator for progress displays. During reindexing,\n\t * this is the reindex target block rather than the live source chain tip.\n\t */\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tblocksRemaining: number;\n\tprocessedBlocks?: number;\n\ttotalBlocks?: number;\n\tprogress: number;\n\t/** Present while the populating operation is queued: approximate claim\n\t * position + honest event denominator + naive start estimate. */\n\tqueue?: {\n\t\tposition: number | null;\n\t\testimatedEvents: number | null;\n\t\testimatedStartSeconds: number | null;\n\t};\n\t/** Event-based progress for sparse syncs (block pct is meaningless when\n\t * most heights are skipped). */\n\testimatedEvents?: number;\n\tprocessedEvents?: number;\n\tetaSeconds?: number | null;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tschemaHash?: string;\n\tstatus: string;\n\tvisibility?: \"public\" | \"private\";\n\tlastProcessedBlock: number;\n\tdescription?: string;\n\tsources?: Record<string, unknown>;\n\tdefinition?: Record<string, unknown>;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<\n\t\t\t\tstring,\n\t\t\t\t{\n\t\t\t\t\ttype: string;\n\t\t\t\t\tnullable?: boolean;\n\t\t\t\t\tindexed?: boolean;\n\t\t\t\t\tsearchable?: boolean;\n\t\t\t\t\tdefault?: string | number | boolean;\n\t\t\t\t}\n\t\t\t>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t\tindexes?: readonly (readonly string[])[];\n\t\t\tuniqueKeys?: readonly (readonly string[])[];\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n\toperationId?: string;\n\tstatus?: \"queued\" | \"running\" | \"cancel_requested\";\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n\n/**\n * Request shape for `GET /api/subgraphs/:subgraphName/:tableName/aggregate`.\n * `filters` reuses the list/count where-surface; the rest name the columns to\n * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).\n */\nexport interface SubgraphAggregateParams {\n\tfilters?: Record<string, string>;\n\tcount?: boolean;\n\tcountDistinct?: string[];\n\tsum?: string[];\n\tmin?: string[];\n\tmax?: string[];\n}\n\n/**\n * Aggregate response. Keys are present only for requested aggregates.\n * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`\n * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `\"0\"`;\n * `min`/`max` are `null` when the filtered set is empty or all-null.\n */\nexport interface SubgraphAggregateResponse {\n\tcount?: number;\n\tcountDistinct?: Record<string, number>;\n\tsum?: Record<string, string>;\n\tmin?: Record<string, string | null>;\n\tmax?: Record<string, string | null>;\n}\n",
5
+ "import { z } from \"zod\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** Override the definition's startBlock for this deploy only. */\n\tstartBlock?: number;\n\t/** Original TypeScript source, persisted so chat can read/diff/edit later. */\n\tsourceCode?: string;\n\t/** Validate the definition + print the DDL plan without deploying. */\n\tdryRun?: boolean;\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), z.record(z.string(), z.unknown()))\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\tdryRun: z.boolean().optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"handler_updated\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tmessage: string;\n\t/** Effective indexing start height. */\n\tstart_block?: number;\n\toperationId?: string;\n\treindexStarted?: boolean;\n\t/** Bounded candidate-event denominator for the reindex just started, when the\n\t * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate\n\t * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */\n\testimatedEvents?: number;\n\t/** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */\n\twarnings?: string[];\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalRows?: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tprogress: number;\n\tblocksRemaining?: number;\n\tsyncMode?: \"sync\" | \"reindex\";\n\tgapCount: number;\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n\tvisibility?: \"public\" | \"private\";\n\t/** Most recent indexing error reason + when it occurred, if any. */\n\tlastError?: string | null;\n\tlastErrorAt?: string | null;\n\t/** Last row mutation timestamp; powers per-card freshness. */\n\tupdatedAt?: string | null;\n\t/** Number of subscriptions attached to this subgraph. */\n\tsubscriptionCount?: number;\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tmode?: \"sync\" | \"reindex\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\t/**\n\t * Backward-compatible denominator for progress displays. During reindexing,\n\t * this is the reindex target block rather than the live source chain tip.\n\t */\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tblocksRemaining: number;\n\tprocessedBlocks?: number;\n\ttotalBlocks?: number;\n\tprogress: number;\n\t/** Present while the populating operation is queued: approximate claim\n\t * position + honest event denominator + naive start estimate. */\n\tqueue?: {\n\t\tposition: number | null;\n\t\testimatedEvents: number | null;\n\t\testimatedStartSeconds: number | null;\n\t};\n\t/** Event-based progress for sparse syncs (block pct is meaningless when\n\t * most heights are skipped). */\n\testimatedEvents?: number;\n\tprocessedEvents?: number;\n\tetaSeconds?: number | null;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tschemaHash?: string;\n\tstatus: string;\n\tvisibility?: \"public\" | \"private\";\n\tlastProcessedBlock: number;\n\tdescription?: string;\n\tsources?: Record<string, unknown>;\n\tdefinition?: Record<string, unknown>;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<\n\t\t\t\tstring,\n\t\t\t\t{\n\t\t\t\t\ttype: string;\n\t\t\t\t\tnullable?: boolean;\n\t\t\t\t\tindexed?: boolean;\n\t\t\t\t\tsearchable?: boolean;\n\t\t\t\t\tdefault?: string | number | boolean;\n\t\t\t\t}\n\t\t\t>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t\tindexes?: readonly (readonly string[])[];\n\t\t\tuniqueKeys?: readonly (readonly string[])[];\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n\toperationId?: string;\n\tstatus?: \"queued\" | \"running\" | \"cancel_requested\";\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n\n/**\n * Request shape for `GET /api/subgraphs/:subgraphName/:tableName/aggregate`.\n * `filters` reuses the list/count where-surface; the rest name the columns to\n * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).\n */\nexport interface SubgraphAggregateParams {\n\tfilters?: Record<string, string>;\n\tcount?: boolean;\n\tcountDistinct?: string[];\n\tsum?: string[];\n\tmin?: string[];\n\tmax?: string[];\n}\n\n/**\n * Aggregate response. Keys are present only for requested aggregates.\n * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`\n * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `\"0\"`;\n * `min`/`max` are `null` when the filtered set is empty or all-null.\n */\nexport interface SubgraphAggregateResponse {\n\tcount?: number;\n\tcountDistinct?: Record<string, number>;\n\tsum?: Record<string, string>;\n\tmin?: Record<string, string | null>;\n\tmax?: Record<string, string | null>;\n}\n",
6
6
  "import { z } from \"zod\";\n\nexport const SUBSCRIPTION_FORMATS = [\n\t\"standard-webhooks\",\n\t\"inngest\",\n\t\"trigger\",\n\t\"cloudflare\",\n\t\"cloudevents\",\n\t\"raw\",\n] as const;\n\nexport const SUBSCRIPTION_RUNTIMES = [\n\t\"inngest\",\n\t\"trigger\",\n\t\"cloudflare\",\n\t\"node\",\n] as const;\n\nexport const SUBSCRIPTION_STATUSES = [\"active\", \"paused\", \"error\"] as const;\n\nexport const SUBSCRIPTION_FILTER_OPERATORS = [\n\t\"eq\",\n\t\"neq\",\n\t\"gt\",\n\t\"gte\",\n\t\"lt\",\n\t\"lte\",\n\t\"in\",\n] as const;\n\nconst webhookUrl = z\n\t.string()\n\t.trim()\n\t.min(1)\n\t.refine(\n\t\t(value) => value.startsWith(\"http://\") || value.startsWith(\"https://\"),\n\t\t\"must be an http(s) URL\",\n\t);\n\nconst name = z.string().trim().min(1).max(128);\nconst resourceName = z.string().trim().min(1).max(128);\n\nexport const SubscriptionStatusSchema: z.ZodType<SubscriptionStatus> = z.enum(\n\tSUBSCRIPTION_STATUSES,\n);\nexport const SubscriptionFormatSchema: z.ZodType<SubscriptionFormat> =\n\tz.enum(SUBSCRIPTION_FORMATS);\nexport const SubscriptionRuntimeSchema: z.ZodType<SubscriptionRuntime> = z.enum(\n\tSUBSCRIPTION_RUNTIMES,\n);\n\nexport const SubscriptionFilterPrimitiveSchema: z.ZodType<SubscriptionFilterPrimitive> =\n\tz.union([z.string(), z.number().finite(), z.boolean()]);\n\nexport const SubscriptionFilterOperatorSchema: z.ZodType<SubscriptionFilterOperator> =\n\tz.union([\n\t\tz.object({ eq: SubscriptionFilterPrimitiveSchema }).strict(),\n\t\tz.object({ neq: SubscriptionFilterPrimitiveSchema }).strict(),\n\t\tz.object({ gt: z.union([z.string(), z.number().finite()]) }).strict(),\n\t\tz.object({ gte: z.union([z.string(), z.number().finite()]) }).strict(),\n\t\tz.object({ lt: z.union([z.string(), z.number().finite()]) }).strict(),\n\t\tz.object({ lte: z.union([z.string(), z.number().finite()]) }).strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\tin: z.array(SubscriptionFilterPrimitiveSchema).min(1),\n\t\t\t})\n\t\t\t.strict(),\n\t]);\n\nexport const SubscriptionFilterClauseSchema: z.ZodType<SubscriptionFilterClause> =\n\tz.union([\n\t\tSubscriptionFilterPrimitiveSchema,\n\t\tSubscriptionFilterOperatorSchema,\n\t]);\n\nexport const SubscriptionFilterSchema: z.ZodType<SubscriptionFilter> = z.record(\n\tz.string().min(1),\n\tSubscriptionFilterClauseSchema,\n);\n\n// --- Chain triggers (direct chain-level subscriptions) -----------------------\n// A chain subscription reacts to raw chain events matched directly off the\n// Index/Streams clock (no subgraph). `triggers` is an array of these filters —\n// the JSON mirror of the subgraph runtime's `SubgraphFilter` union. Defined\n// here (not imported from @secondlayer/subgraphs) to avoid a shared→subgraphs\n// cycle; the evaluator maps these to `SubgraphFilter` at match time. Amounts are\n// non-negative integer strings (uint128 can exceed JS safe-int) or numbers.\n\nexport const CHAIN_TRIGGER_TYPES = [\n\t\"stx_transfer\",\n\t\"stx_mint\",\n\t\"stx_burn\",\n\t\"stx_lock\",\n\t\"ft_transfer\",\n\t\"ft_mint\",\n\t\"ft_burn\",\n\t\"nft_transfer\",\n\t\"nft_mint\",\n\t\"nft_burn\",\n\t\"contract_call\",\n\t\"contract_deploy\",\n\t\"print_event\",\n\t\"sbtc_deposit\",\n\t\"sbtc_withdrawal_create\",\n\t\"sbtc_withdrawal_accept\",\n\t\"sbtc_withdrawal_reject\",\n\t\"sbtc_withdrawal_swept_confirmed\",\n] as const;\n\nconst triggerAmount = z.union([\n\tz.string().trim().regex(/^\\d+$/, \"must be a non-negative integer string\"),\n\tz.number().int().nonnegative(),\n]);\n/** Principal/identifier/name patterns — `*` wildcards allowed (matched by the\n * evaluator). */\nconst triggerPattern = z.string().trim().min(1);\nconst trait = z.string().trim().min(1);\n\nexport const ChainTriggerSchema: z.ZodType<ChainTrigger> = z.discriminatedUnion(\n\t\"type\",\n\t[\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"stx_transfer\"),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\trecipient: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t\tmaxAmount: triggerAmount.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"stx_mint\"),\n\t\t\t\trecipient: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"stx_burn\"),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"stx_lock\"),\n\t\t\t\tlockedAddress: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"ft_transfer\"),\n\t\t\t\tassetIdentifier: triggerPattern.optional(),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\trecipient: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"ft_mint\"),\n\t\t\t\tassetIdentifier: triggerPattern.optional(),\n\t\t\t\trecipient: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"ft_burn\"),\n\t\t\t\tassetIdentifier: triggerPattern.optional(),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"nft_transfer\"),\n\t\t\t\tassetIdentifier: triggerPattern.optional(),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\trecipient: triggerPattern.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"nft_mint\"),\n\t\t\t\tassetIdentifier: triggerPattern.optional(),\n\t\t\t\trecipient: triggerPattern.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"nft_burn\"),\n\t\t\t\tassetIdentifier: triggerPattern.optional(),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"contract_call\"),\n\t\t\t\tcontractId: triggerPattern.optional(),\n\t\t\t\tfunctionName: triggerPattern.optional(),\n\t\t\t\tcaller: triggerPattern.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"contract_deploy\"),\n\t\t\t\tdeployer: triggerPattern.optional(),\n\t\t\t\tcontractName: triggerPattern.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"print_event\"),\n\t\t\t\tcontractId: triggerPattern.optional(),\n\t\t\t\ttopic: triggerPattern.optional(),\n\t\t\t\ttrait: trait.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"sbtc_deposit\"),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t\tmaxAmount: triggerAmount.optional(),\n\t\t\t\tbitcoinTxid: triggerPattern.optional(),\n\t\t\t\trequestId: z.number().int().nonnegative().optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"sbtc_withdrawal_create\"),\n\t\t\t\tsender: triggerPattern.optional(),\n\t\t\t\tminAmount: triggerAmount.optional(),\n\t\t\t\tmaxAmount: triggerAmount.optional(),\n\t\t\t\trequestId: z.number().int().nonnegative().optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"sbtc_withdrawal_accept\"),\n\t\t\t\trequestId: z.number().int().nonnegative().optional(),\n\t\t\t\tsweepTxid: triggerPattern.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"sbtc_withdrawal_reject\"),\n\t\t\t\trequestId: z.number().int().nonnegative().optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t\tz\n\t\t\t.object({\n\t\t\t\ttype: z.literal(\"sbtc_withdrawal_swept_confirmed\"),\n\t\t\t\trequestId: z.number().int().nonnegative().optional(),\n\t\t\t\tsweepTxid: triggerPattern.optional(),\n\t\t\t})\n\t\t\t.strict(),\n\t],\n);\n\nexport const ChainTriggersSchema: z.ZodType<ChainTrigger[]> = z\n\t.array(ChainTriggerSchema)\n\t.min(1)\n\t.max(50);\n\n/**\n * Per-type accepted filter fields for chain triggers, DERIVED from\n * {@link ChainTriggerSchema} so the agent-facing reference can never drift behind\n * the validator. `{ stx_transfer: [\"sender\",\"recipient\",\"minAmount\",\"maxAmount\"], ... }`.\n */\nexport const CHAIN_TRIGGER_FIELDS: Record<string, string[]> =\n\tObject.fromEntries(\n\t\t// biome-ignore lint/suspicious/noExplicitAny: zod-internal introspection of this module's own discriminated union\n\t\t((ChainTriggerSchema as any)._zod.def.options as any[]).map((opt) => {\n\t\t\tconst shape = opt._zod.def.shape as Record<string, unknown>;\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: literal value lives on the zod-internal def\n\t\t\tconst type = (shape.type as any)._zod.def.values[0] as string;\n\t\t\treturn [type, Object.keys(shape).filter((k) => k !== \"type\")];\n\t\t}),\n\t);\n\nexport const CreateSubscriptionRequestSchema: z.ZodType<ParsedCreateSubscriptionRequest> =\n\tz\n\t\t.object({\n\t\t\tname,\n\t\t\t// Subgraph mode (kind=subgraph): subgraphName + tableName + optional filter.\n\t\t\tsubgraphName: resourceName.optional(),\n\t\t\ttableName: resourceName.optional(),\n\t\t\tfilter: SubscriptionFilterSchema.optional(),\n\t\t\t// Chain mode (kind=chain): triggers.\n\t\t\ttriggers: ChainTriggersSchema.optional(),\n\t\t\turl: webhookUrl,\n\t\t\tformat: SubscriptionFormatSchema.default(\"standard-webhooks\"),\n\t\t\truntime: SubscriptionRuntimeSchema.nullable().optional(),\n\t\t\tauthConfig: z.record(z.string(), z.unknown()).optional(),\n\t\t\tmaxRetries: z.number().int().min(0).max(100).optional(),\n\t\t\ttimeoutMs: z.number().int().min(100).max(300_000).optional(),\n\t\t\tconcurrency: z.number().int().min(1).max(100).optional(),\n\t\t})\n\t\t.refine(\n\t\t\t(v) => {\n\t\t\t\tconst subgraphMode =\n\t\t\t\t\tv.subgraphName !== undefined || v.tableName !== undefined;\n\t\t\t\tconst chainMode = v.triggers !== undefined;\n\t\t\t\tif (chainMode && subgraphMode) return false;\n\t\t\t\tif (chainMode) return true;\n\t\t\t\t// Subgraph mode requires BOTH subgraphName and tableName.\n\t\t\t\treturn v.subgraphName !== undefined && v.tableName !== undefined;\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t\"provide either { subgraphName, tableName } for a subgraph subscription OR { triggers } for a chain subscription — not both\",\n\t\t\t},\n\t\t)\n\t\t.refine((v) => v.filter === undefined || v.triggers === undefined, {\n\t\t\tmessage:\n\t\t\t\t\"`filter` applies to subgraph subscriptions; chain subscriptions use `triggers`\",\n\t\t\tpath: [\"filter\"],\n\t\t});\n\nexport const UpdateSubscriptionRequestSchema: z.ZodType<UpdateSubscriptionRequest> =\n\tz\n\t\t.object({\n\t\t\tname: name.optional(),\n\t\t\turl: webhookUrl.optional(),\n\t\t\tfilter: SubscriptionFilterSchema.optional(),\n\t\t\tformat: SubscriptionFormatSchema.optional(),\n\t\t\truntime: SubscriptionRuntimeSchema.nullable().optional(),\n\t\t\tauthConfig: z.record(z.string(), z.unknown()).optional(),\n\t\t\tmaxRetries: z.number().int().min(0).max(100).optional(),\n\t\t\ttimeoutMs: z.number().int().min(100).max(300_000).optional(),\n\t\t\tconcurrency: z.number().int().min(1).max(100).optional(),\n\t\t})\n\t\t.refine((value) => Object.keys(value).length > 0, {\n\t\t\tmessage: \"At least one field must be provided\",\n\t\t});\n\nexport const ReplaySubscriptionRequestSchema: z.ZodType<ReplaySubscriptionRequest> =\n\tz\n\t\t.object({\n\t\t\tfromBlock: z.number().int().nonnegative(),\n\t\t\ttoBlock: z.number().int().nonnegative(),\n\t\t\tforce: z.string().trim().min(1).max(64).optional(),\n\t\t})\n\t\t.refine((value) => value.fromBlock <= value.toBlock, {\n\t\t\tmessage: \"fromBlock must be less than or equal to toBlock\",\n\t\t\tpath: [\"toBlock\"],\n\t\t});\n\nexport type SubscriptionStatus = (typeof SUBSCRIPTION_STATUSES)[number];\n/** Polymorphic subscription mode (mirrors db/types `SubscriptionKind`). */\nexport type SubscriptionKind = \"subgraph\" | \"chain\";\nexport type SubscriptionFormat = (typeof SUBSCRIPTION_FORMATS)[number];\nexport type SubscriptionRuntime = (typeof SUBSCRIPTION_RUNTIMES)[number];\nexport type SubscriptionFilterPrimitive = string | number | boolean;\nexport type SubscriptionFilterOperator =\n\t| { eq: SubscriptionFilterPrimitive }\n\t| { neq: SubscriptionFilterPrimitive }\n\t| { gt: string | number }\n\t| { gte: string | number }\n\t| { lt: string | number }\n\t| { lte: string | number }\n\t| { in: SubscriptionFilterPrimitive[] };\nexport type SubscriptionFilterClause =\n\t| SubscriptionFilterPrimitive\n\t| SubscriptionFilterOperator;\nexport type SubscriptionFilter = Record<string, SubscriptionFilterClause>;\n\nexport type ChainTriggerType = (typeof CHAIN_TRIGGER_TYPES)[number];\n/** Non-negative integer amount over JSON (string for uint128 safety, or number). */\nexport type ChainTriggerAmount = string | number;\n\ninterface TraitScoped {\n\ttrait?: string;\n}\n\n/** JSON mirror of the subgraph runtime's `SubgraphFilter` union. */\nexport type ChainTrigger =\n\t| {\n\t\t\ttype: \"stx_transfer\";\n\t\t\tsender?: string;\n\t\t\trecipient?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t\t\tmaxAmount?: ChainTriggerAmount;\n\t }\n\t| { type: \"stx_mint\"; recipient?: string; minAmount?: ChainTriggerAmount }\n\t| { type: \"stx_burn\"; sender?: string; minAmount?: ChainTriggerAmount }\n\t| {\n\t\t\ttype: \"stx_lock\";\n\t\t\tlockedAddress?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t }\n\t| ({\n\t\t\ttype: \"ft_transfer\";\n\t\t\tassetIdentifier?: string;\n\t\t\tsender?: string;\n\t\t\trecipient?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t } & TraitScoped)\n\t| ({\n\t\t\ttype: \"ft_mint\";\n\t\t\tassetIdentifier?: string;\n\t\t\trecipient?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t } & TraitScoped)\n\t| ({\n\t\t\ttype: \"ft_burn\";\n\t\t\tassetIdentifier?: string;\n\t\t\tsender?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t } & TraitScoped)\n\t| ({\n\t\t\ttype: \"nft_transfer\";\n\t\t\tassetIdentifier?: string;\n\t\t\tsender?: string;\n\t\t\trecipient?: string;\n\t } & TraitScoped)\n\t| ({\n\t\t\ttype: \"nft_mint\";\n\t\t\tassetIdentifier?: string;\n\t\t\trecipient?: string;\n\t } & TraitScoped)\n\t| ({\n\t\t\ttype: \"nft_burn\";\n\t\t\tassetIdentifier?: string;\n\t\t\tsender?: string;\n\t } & TraitScoped)\n\t| ({\n\t\t\ttype: \"contract_call\";\n\t\t\tcontractId?: string;\n\t\t\tfunctionName?: string;\n\t\t\tcaller?: string;\n\t } & TraitScoped)\n\t| { type: \"contract_deploy\"; deployer?: string; contractName?: string }\n\t| ({\n\t\t\ttype: \"print_event\";\n\t\t\tcontractId?: string;\n\t\t\ttopic?: string;\n\t } & TraitScoped)\n\t| {\n\t\t\ttype: \"sbtc_deposit\";\n\t\t\tsender?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t\t\tmaxAmount?: ChainTriggerAmount;\n\t\t\tbitcoinTxid?: string;\n\t\t\trequestId?: number;\n\t }\n\t| {\n\t\t\ttype: \"sbtc_withdrawal_create\";\n\t\t\tsender?: string;\n\t\t\tminAmount?: ChainTriggerAmount;\n\t\t\tmaxAmount?: ChainTriggerAmount;\n\t\t\trequestId?: number;\n\t }\n\t| {\n\t\t\ttype: \"sbtc_withdrawal_accept\";\n\t\t\trequestId?: number;\n\t\t\tsweepTxid?: string;\n\t }\n\t| { type: \"sbtc_withdrawal_reject\"; requestId?: number }\n\t| {\n\t\t\ttype: \"sbtc_withdrawal_swept_confirmed\";\n\t\t\trequestId?: number;\n\t\t\tsweepTxid?: string;\n\t };\n\n/** Args for a chain-trigger builder — every field of a variant except `type`. */\ntype TriggerArgs<T extends ChainTrigger[\"type\"]> = Omit<\n\tExtract<ChainTrigger, { type: T }>,\n\t\"type\"\n>;\n\n/**\n * Ergonomic chain-trigger constructors for `subscriptions.create({ triggers })`.\n * Each returns a bare `ChainTrigger` (the wire shape the API expects):\n *\n * ```ts\n * client.subscriptions.create({\n * url: \"https://my.app/webhook\",\n * triggers: [trigger.contractCall({ contractId: \"SP....amm\", functionName: \"swap-*\" })],\n * });\n * ```\n */\nexport const trigger = {\n\tstxTransfer: (f: TriggerArgs<\"stx_transfer\"> = {}): ChainTrigger => ({\n\t\ttype: \"stx_transfer\",\n\t\t...f,\n\t}),\n\tstxMint: (f: TriggerArgs<\"stx_mint\"> = {}): ChainTrigger => ({\n\t\ttype: \"stx_mint\",\n\t\t...f,\n\t}),\n\tstxBurn: (f: TriggerArgs<\"stx_burn\"> = {}): ChainTrigger => ({\n\t\ttype: \"stx_burn\",\n\t\t...f,\n\t}),\n\tstxLock: (f: TriggerArgs<\"stx_lock\"> = {}): ChainTrigger => ({\n\t\ttype: \"stx_lock\",\n\t\t...f,\n\t}),\n\tftTransfer: (f: TriggerArgs<\"ft_transfer\"> = {}): ChainTrigger => ({\n\t\ttype: \"ft_transfer\",\n\t\t...f,\n\t}),\n\tftMint: (f: TriggerArgs<\"ft_mint\"> = {}): ChainTrigger => ({\n\t\ttype: \"ft_mint\",\n\t\t...f,\n\t}),\n\tftBurn: (f: TriggerArgs<\"ft_burn\"> = {}): ChainTrigger => ({\n\t\ttype: \"ft_burn\",\n\t\t...f,\n\t}),\n\tnftTransfer: (f: TriggerArgs<\"nft_transfer\"> = {}): ChainTrigger => ({\n\t\ttype: \"nft_transfer\",\n\t\t...f,\n\t}),\n\tnftMint: (f: TriggerArgs<\"nft_mint\"> = {}): ChainTrigger => ({\n\t\ttype: \"nft_mint\",\n\t\t...f,\n\t}),\n\tnftBurn: (f: TriggerArgs<\"nft_burn\"> = {}): ChainTrigger => ({\n\t\ttype: \"nft_burn\",\n\t\t...f,\n\t}),\n\tcontractCall: (f: TriggerArgs<\"contract_call\"> = {}): ChainTrigger => ({\n\t\ttype: \"contract_call\",\n\t\t...f,\n\t}),\n\tcontractDeploy: (f: TriggerArgs<\"contract_deploy\"> = {}): ChainTrigger => ({\n\t\ttype: \"contract_deploy\",\n\t\t...f,\n\t}),\n\tprintEvent: (f: TriggerArgs<\"print_event\"> = {}): ChainTrigger => ({\n\t\ttype: \"print_event\",\n\t\t...f,\n\t}),\n\tsbtcDeposit: (f: TriggerArgs<\"sbtc_deposit\"> = {}): ChainTrigger => ({\n\t\ttype: \"sbtc_deposit\",\n\t\t...f,\n\t}),\n\tsbtcWithdrawalCreate: (\n\t\tf: TriggerArgs<\"sbtc_withdrawal_create\"> = {},\n\t): ChainTrigger => ({\n\t\ttype: \"sbtc_withdrawal_create\",\n\t\t...f,\n\t}),\n\tsbtcWithdrawalAccept: (\n\t\tf: TriggerArgs<\"sbtc_withdrawal_accept\"> = {},\n\t): ChainTrigger => ({\n\t\ttype: \"sbtc_withdrawal_accept\",\n\t\t...f,\n\t}),\n\tsbtcWithdrawalReject: (\n\t\tf: TriggerArgs<\"sbtc_withdrawal_reject\"> = {},\n\t): ChainTrigger => ({\n\t\ttype: \"sbtc_withdrawal_reject\",\n\t\t...f,\n\t}),\n\tsbtcWithdrawalSweptConfirmed: (\n\t\tf: TriggerArgs<\"sbtc_withdrawal_swept_confirmed\"> = {},\n\t): ChainTrigger => ({\n\t\ttype: \"sbtc_withdrawal_swept_confirmed\",\n\t\t...f,\n\t}),\n} as const;\n\nexport interface CreateSubscriptionRequest {\n\tname: string;\n\t/** Subgraph mode. */\n\tsubgraphName?: string;\n\ttableName?: string;\n\tfilter?: SubscriptionFilter;\n\t/** Chain mode. */\n\ttriggers?: ChainTrigger[];\n\turl: string;\n\tformat?: SubscriptionFormat;\n\truntime?: SubscriptionRuntime | null;\n\tauthConfig?: Record<string, unknown>;\n\tmaxRetries?: number;\n\ttimeoutMs?: number;\n\tconcurrency?: number;\n}\n\nexport interface ParsedCreateSubscriptionRequest\n\textends Omit<CreateSubscriptionRequest, \"format\"> {\n\tformat: SubscriptionFormat;\n}\n\nexport interface UpdateSubscriptionRequest {\n\tname?: string;\n\turl?: string;\n\tfilter?: SubscriptionFilter;\n\tformat?: SubscriptionFormat;\n\truntime?: SubscriptionRuntime | null;\n\tauthConfig?: Record<string, unknown>;\n\tmaxRetries?: number;\n\ttimeoutMs?: number;\n\tconcurrency?: number;\n}\n\nexport type ParsedUpdateSubscriptionRequest = UpdateSubscriptionRequest;\n\nexport interface ReplaySubscriptionRequest {\n\tfromBlock: number;\n\ttoBlock: number;\n\tforce?: string;\n}\n\nexport type ParsedReplaySubscriptionRequest = ReplaySubscriptionRequest;\n\nexport interface SubscriptionSummary {\n\tid: string;\n\tname: string;\n\tstatus: SubscriptionStatus;\n\tkind: SubscriptionKind;\n\t/** Null for chain subscriptions. */\n\tsubgraphName: string | null;\n\t/** Null for chain subscriptions. */\n\ttableName: string | null;\n\tformat: SubscriptionFormat;\n\truntime: SubscriptionRuntime | null;\n\turl: string;\n\tlastDeliveryAt: string | null;\n\tlastSuccessAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubscriptionDetail extends SubscriptionSummary {\n\tfilter: Record<string, unknown>;\n\t/** Chain-trigger filters (chain subscriptions only). */\n\ttriggers: ChainTrigger[] | null;\n\tauthConfig: Record<string, unknown>;\n\tmaxRetries: number;\n\ttimeoutMs: number;\n\tconcurrency: number;\n\tcircuitFailures: number;\n\tcircuitOpenedAt: string | null;\n\tlastError: string | null;\n}\n\nexport interface CreateSubscriptionResponse {\n\tsubscription: SubscriptionDetail;\n\t/** Plaintext signing secret — surfaced ONCE. Store it server-side. */\n\tsigningSecret: string;\n}\n\nexport interface RotateSecretResponse {\n\tsubscription: SubscriptionDetail;\n\tsigningSecret: string;\n}\n\nexport interface DeliveryRow {\n\tid: string;\n\tattempt: number;\n\tstatusCode: number | null;\n\terrorMessage: string | null;\n\tdurationMs: number | null;\n\tresponseBody: string | null;\n\tdispatchedAt: string;\n}\n\nexport interface ReplayResult {\n\treplayId: string;\n\tenqueuedCount: number;\n\tscannedCount: number;\n}\n\n/** Result of a one-off test delivery (`POST /:id/test`). Logged as a delivery\n * row (with a null outbox_id) so it shows up under the subscription's deliveries. */\nexport interface SubscriptionTestResult {\n\tok: boolean;\n\tstatusCode: number | null;\n\terror: string | null;\n\tdurationMs: number;\n\tdeliveryId: string;\n}\n\nexport interface DeadRow {\n\tid: string;\n\teventType: string;\n\tattempt: number;\n\tblockHeight: number;\n\ttxId: string | null;\n\tpayload: Record<string, unknown>;\n\tfailedAt: string | null;\n\tcreatedAt: string;\n}\n\nexport interface SubscriptionSchemaColumn {\n\ttype?: unknown;\n}\n\nexport interface SubscriptionSchemaTable {\n\tcolumns: Record<string, SubscriptionSchemaColumn>;\n}\n\nexport type SubscriptionSchemaTables = Record<string, SubscriptionSchemaTable>;\n\nconst SCALAR_COLUMN_TYPES = new Set([\n\t\"text\",\n\t\"uint\",\n\t\"int\",\n\t\"principal\",\n\t\"boolean\",\n\t\"timestamp\",\n]);\n\nconst COMPARISON_COLUMN_TYPES = new Set([\"uint\", \"int\", \"timestamp\"]);\n\nfunction formatIssuePath(path: PropertyKey[]): string {\n\treturn path.length > 0 ? `${path.map(String).join(\".\")}: ` : \"\";\n}\n\nexport function formatSubscriptionSchemaErrors(error: z.ZodError): string[] {\n\treturn error.issues.map(\n\t\t(issue) => `${formatIssuePath(issue.path)}${issue.message}`,\n\t);\n}\n\nfunction operatorForClause(clause: SubscriptionFilterClause): string {\n\tif (clause === null || typeof clause !== \"object\" || Array.isArray(clause)) {\n\t\treturn \"eq\";\n\t}\n\treturn Object.keys(clause)[0] ?? \"eq\";\n}\n\nexport function validateSubscriptionFilterForTable(input: {\n\tsubgraphName?: string;\n\ttableName: string;\n\tfilter?: unknown;\n\ttables: SubscriptionSchemaTables;\n}): string[] {\n\tconst errors: string[] = [];\n\tconst table = input.tables[input.tableName];\n\tif (!table) {\n\t\tconst names = Object.keys(input.tables);\n\t\terrors.push(\n\t\t\t`Unknown table \"${input.tableName}\"${\n\t\t\t\tinput.subgraphName ? ` in subgraph \"${input.subgraphName}\"` : \"\"\n\t\t\t}.${names.length > 0 ? ` Available tables: ${names.join(\", \")}.` : \"\"}`,\n\t\t);\n\t\treturn errors;\n\t}\n\n\tif (input.filter === undefined) return errors;\n\n\tconst parsed = SubscriptionFilterSchema.safeParse(input.filter);\n\tif (!parsed.success) {\n\t\treturn formatSubscriptionSchemaErrors(parsed.error);\n\t}\n\n\tfor (const [field, clause] of Object.entries(parsed.data)) {\n\t\tconst column = table.columns[field];\n\t\tif (!column) {\n\t\t\terrors.push(\n\t\t\t\t`Unknown filter field \"${field}\" on table \"${input.tableName}\".`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst columnType =\n\t\t\ttypeof column.type === \"string\" ? column.type.toLowerCase() : \"\";\n\t\tif (!SCALAR_COLUMN_TYPES.has(columnType)) {\n\t\t\terrors.push(\n\t\t\t\t`Filter field \"${field}\" has unsupported type \"${columnType || \"unknown\"}\"; subscription filters require scalar columns.`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst operator = operatorForClause(clause);\n\t\tif (\n\t\t\t(operator === \"gt\" ||\n\t\t\t\toperator === \"gte\" ||\n\t\t\t\toperator === \"lt\" ||\n\t\t\t\toperator === \"lte\") &&\n\t\t\t!COMPARISON_COLUMN_TYPES.has(columnType)\n\t\t) {\n\t\t\terrors.push(\n\t\t\t\t`Operator \"${operator}\" is not supported for ${columnType} field \"${field}\".`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn errors;\n}\n"
7
7
  ],
8
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAwBO,IAAM,8BACZ,EAAE,OAAO;AAAA,EACR,MAAM,EACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,EAAE;AAAA,EACR,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,SAAS,EACP,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,EACpD,OACA,CAAC,MAAM,OAAO,KAAK,CAAC,EAAE,SAAS,GAC/B,+BACD;AAAA,EACD,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,IAAI,SAAW,gCAAgC;AAAA,EACvE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAAA,EACpD,YAAY,EACV,OAAO,EACP,IAAI,SAAW,+BAA+B,EAC9C,SAAS;AAAA,EACX,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,YAA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A,IAC1D,MAAM,SAAS,MAAM,QAAQ;AAAA,IAC7B,IAAI,CAAC,QAAQ;AAAA,MACZ,OAAO,KACN,yBAAyB,oBAAoB,MAAM,aACpD;AAAA,MACA;AAAA,IACD;AAAA,IAEA,MAAM,aACL,OAAO,OAAO,SAAS,WAAW,OAAO,KAAK,YAAY,IAAI;AAAA,IAC/D,IAAI,CAAC,oBAAoB,IAAI,UAAU,GAAG;AAAA,MACzC,OAAO,KACN,iBAAiB,gCAAgC,cAAc,0DAChE;AAAA,MACA;AAAA,IACD;AAAA,IAEA,MAAM,WAAW,kBAAkB,MAAM;AAAA,IACzC,KACE,aAAa,QACb,aAAa,SACb,aAAa,QACb,aAAa,UACd,CAAC,wBAAwB,IAAI,UAAU,GACtC;AAAA,MACD,OAAO,KACN,aAAa,kCAAkC,qBAAqB,SACrE;AAAA,IACD;AAAA,EACD;AAAA,EAEA,OAAO;AAAA;",
9
+ "debugId": "7B1B5B4BE50333EE64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -12,18 +12,12 @@ interface DeploySubgraphRequest {
12
12
  sourceCode?: string;
13
13
  /** Validate the definition + print the DDL plan without deploying. */
14
14
  dryRun?: boolean;
15
- /**
16
- * Read visibility. Server-side default: deploys → public (anon reads on
17
- * /v1/subgraphs, name claimed in the global public namespace).
18
- */
19
- visibility?: "public" | "private";
20
15
  }
21
16
  declare const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest>;
22
17
  interface DeploySubgraphResponse {
23
18
  action: "created" | "unchanged" | "handler_updated" | "updated" | "reindexed";
24
19
  subgraphId: string;
25
20
  version: string;
26
- visibility?: "public" | "private";
27
21
  message: string;
28
22
  /** Effective indexing start height. */
29
23
  start_block?: number;
@@ -25,12 +25,11 @@ var DeploySubgraphRequestSchema = z.object({
25
25
  handlerCode: z.string().max(1048576, "handler code exceeds 1MB limit"),
26
26
  startBlock: z.number().int().nonnegative().optional(),
27
27
  sourceCode: z.string().max(1048576, "source code exceeds 1MB limit").optional(),
28
- dryRun: z.boolean().optional(),
29
- visibility: z.enum(["public", "private"]).optional()
28
+ dryRun: z.boolean().optional()
30
29
  });
31
30
  export {
32
31
  DeploySubgraphRequestSchema
33
32
  };
34
33
 
35
- //# debugId=1268F6D27AF0DE3364756E2164756E21
34
+ //# debugId=467AF6D6771698BE64756E2164756E21
36
35
  //# sourceMappingURL=subgraphs.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/schemas/subgraphs.ts"],
4
4
  "sourcesContent": [
5
- "import { z } from \"zod\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** Override the definition's startBlock for this deploy only. */\n\tstartBlock?: number;\n\t/** Original TypeScript source, persisted so chat can read/diff/edit later. */\n\tsourceCode?: string;\n\t/** Validate the definition + print the DDL plan without deploying. */\n\tdryRun?: boolean;\n\t/**\n\t * Read visibility. Server-side default: deploys → public (anon reads on\n\t * /v1/subgraphs, name claimed in the global public namespace).\n\t */\n\tvisibility?: \"public\" | \"private\";\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), z.record(z.string(), z.unknown()))\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\tdryRun: z.boolean().optional(),\n\t\tvisibility: z.enum([\"public\", \"private\"]).optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"handler_updated\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tvisibility?: \"public\" | \"private\";\n\tmessage: string;\n\t/** Effective indexing start height. */\n\tstart_block?: number;\n\toperationId?: string;\n\treindexStarted?: boolean;\n\t/** Bounded candidate-event denominator for the reindex just started, when the\n\t * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate\n\t * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */\n\testimatedEvents?: number;\n\t/** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */\n\twarnings?: string[];\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalRows?: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tprogress: number;\n\tblocksRemaining?: number;\n\tsyncMode?: \"sync\" | \"reindex\";\n\tgapCount: number;\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n\tvisibility?: \"public\" | \"private\";\n\t/** Most recent indexing error reason + when it occurred, if any. */\n\tlastError?: string | null;\n\tlastErrorAt?: string | null;\n\t/** Last row mutation timestamp; powers per-card freshness. */\n\tupdatedAt?: string | null;\n\t/** Number of subscriptions attached to this subgraph. */\n\tsubscriptionCount?: number;\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tmode?: \"sync\" | \"reindex\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\t/**\n\t * Backward-compatible denominator for progress displays. During reindexing,\n\t * this is the reindex target block rather than the live source chain tip.\n\t */\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tblocksRemaining: number;\n\tprocessedBlocks?: number;\n\ttotalBlocks?: number;\n\tprogress: number;\n\t/** Present while the populating operation is queued: approximate claim\n\t * position + honest event denominator + naive start estimate. */\n\tqueue?: {\n\t\tposition: number | null;\n\t\testimatedEvents: number | null;\n\t\testimatedStartSeconds: number | null;\n\t};\n\t/** Event-based progress for sparse syncs (block pct is meaningless when\n\t * most heights are skipped). */\n\testimatedEvents?: number;\n\tprocessedEvents?: number;\n\tetaSeconds?: number | null;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tschemaHash?: string;\n\tstatus: string;\n\tvisibility?: \"public\" | \"private\";\n\tlastProcessedBlock: number;\n\tdescription?: string;\n\tsources?: Record<string, unknown>;\n\tdefinition?: Record<string, unknown>;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<\n\t\t\t\tstring,\n\t\t\t\t{\n\t\t\t\t\ttype: string;\n\t\t\t\t\tnullable?: boolean;\n\t\t\t\t\tindexed?: boolean;\n\t\t\t\t\tsearchable?: boolean;\n\t\t\t\t\tdefault?: string | number | boolean;\n\t\t\t\t}\n\t\t\t>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t\tindexes?: readonly (readonly string[])[];\n\t\t\tuniqueKeys?: readonly (readonly string[])[];\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n\toperationId?: string;\n\tstatus?: \"queued\" | \"running\" | \"cancel_requested\";\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n\n/**\n * Request shape for `GET /api/subgraphs/:subgraphName/:tableName/aggregate`.\n * `filters` reuses the list/count where-surface; the rest name the columns to\n * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).\n */\nexport interface SubgraphAggregateParams {\n\tfilters?: Record<string, string>;\n\tcount?: boolean;\n\tcountDistinct?: string[];\n\tsum?: string[];\n\tmin?: string[];\n\tmax?: string[];\n}\n\n/**\n * Aggregate response. Keys are present only for requested aggregates.\n * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`\n * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `\"0\"`;\n * `min`/`max` are `null` when the filtered set is empty or all-null.\n */\nexport interface SubgraphAggregateResponse {\n\tcount?: number;\n\tcountDistinct?: Record<string, number>;\n\tsum?: Record<string, string>;\n\tmin?: Record<string, string | null>;\n\tmax?: Record<string, string | null>;\n}\n"
5
+ "import { z } from \"zod\";\n\n// ── Deploy Subgraph Request ─────────────────────────────────────────────────\n\nexport interface DeploySubgraphRequest {\n\tname: string;\n\tversion?: string;\n\tdescription?: string;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\t/** Override the definition's startBlock for this deploy only. */\n\tstartBlock?: number;\n\t/** Original TypeScript source, persisted so chat can read/diff/edit later. */\n\tsourceCode?: string;\n\t/** Validate the definition + print the DDL plan without deploying. */\n\tdryRun?: boolean;\n}\n\nexport const DeploySubgraphRequestSchema: z.ZodType<DeploySubgraphRequest> =\n\tz.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.regex(/^[a-z0-9-]+$/, \"lowercase alphanumeric + hyphens only\")\n\t\t\t.max(63),\n\t\tversion: z.string().optional(),\n\t\tdescription: z.string().optional(),\n\t\tsources: z\n\t\t\t.record(z.string(), z.record(z.string(), z.unknown()))\n\t\t\t.refine(\n\t\t\t\t(s) => Object.keys(s).length > 0,\n\t\t\t\t\"Must have at least one source\",\n\t\t\t),\n\t\tschema: z.record(z.string(), z.unknown()),\n\t\thandlerCode: z.string().max(1_048_576, \"handler code exceeds 1MB limit\"),\n\t\tstartBlock: z.number().int().nonnegative().optional(),\n\t\tsourceCode: z\n\t\t\t.string()\n\t\t\t.max(1_048_576, \"source code exceeds 1MB limit\")\n\t\t\t.optional(),\n\t\tdryRun: z.boolean().optional(),\n\t});\n\nexport interface DeploySubgraphResponse {\n\taction: \"created\" | \"unchanged\" | \"handler_updated\" | \"updated\" | \"reindexed\";\n\tsubgraphId: string;\n\tversion: string;\n\tmessage: string;\n\t/** Effective indexing start height. */\n\tstart_block?: number;\n\toperationId?: string;\n\treindexStarted?: boolean;\n\t/** Bounded candidate-event denominator for the reindex just started, when the\n\t * op was classifiable as sparse/light. Absent for heavy ops (no upfront estimate\n\t * possible) — check `sl subgraphs status` after ~30s for a rate-based ETA instead. */\n\testimatedEvents?: number;\n\t/** Non-blocking deploy lints (e.g. handler reads a print field never observed on-chain). */\n\twarnings?: string[];\n\tdiff?: {\n\t\taddedTables: string[];\n\t\tremovedTables: string[];\n\t\taddedColumns: Record<string, string[]>;\n\t\tbreakingChanges: string[];\n\t};\n}\n\n// Subgraph API response types\n\nexport interface SubgraphSummary {\n\tname: string;\n\tversion: string;\n\tstatus: string;\n\tlastProcessedBlock: number;\n\ttotalProcessed: number;\n\ttotalRows?: number;\n\ttotalErrors: number;\n\ttables: string[];\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tprogress: number;\n\tblocksRemaining?: number;\n\tsyncMode?: \"sync\" | \"reindex\";\n\tgapCount: number;\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n\tvisibility?: \"public\" | \"private\";\n\t/** Most recent indexing error reason + when it occurred, if any. */\n\tlastError?: string | null;\n\tlastErrorAt?: string | null;\n\t/** Last row mutation timestamp; powers per-card freshness. */\n\tupdatedAt?: string | null;\n\t/** Number of subscriptions attached to this subgraph. */\n\tsubscriptionCount?: number;\n\tcreatedAt: string;\n}\n\nexport interface SubgraphGapRange {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n}\n\nexport interface SubgraphSyncInfo {\n\tstatus: \"synced\" | \"catching_up\" | \"reindexing\" | \"error\";\n\tmode?: \"sync\" | \"reindex\";\n\tstartBlock: number;\n\tlastProcessedBlock: number;\n\t/**\n\t * Backward-compatible denominator for progress displays. During reindexing,\n\t * this is the reindex target block rather than the live source chain tip.\n\t */\n\tchainTip: number;\n\tsourceChainTip?: number;\n\ttargetBlock?: number;\n\tblocksRemaining: number;\n\tprocessedBlocks?: number;\n\ttotalBlocks?: number;\n\tprogress: number;\n\t/** Present while the populating operation is queued: approximate claim\n\t * position + honest event denominator + naive start estimate. */\n\tqueue?: {\n\t\tposition: number | null;\n\t\testimatedEvents: number | null;\n\t\testimatedStartSeconds: number | null;\n\t};\n\t/** Event-based progress for sparse syncs (block pct is meaningless when\n\t * most heights are skipped). */\n\testimatedEvents?: number;\n\tprocessedEvents?: number;\n\tetaSeconds?: number | null;\n\tgaps: {\n\t\tcount: number;\n\t\ttotalMissingBlocks: number;\n\t\tranges: SubgraphGapRange[];\n\t};\n\t/** history_filling = expected gaps while a tip-first backfill op runs. */\n\tintegrity: \"complete\" | \"gaps_detected\" | \"history_filling\";\n}\n\nexport interface SubgraphDetail {\n\tname: string;\n\tversion: string;\n\tschemaHash?: string;\n\tstatus: string;\n\tvisibility?: \"public\" | \"private\";\n\tlastProcessedBlock: number;\n\tdescription?: string;\n\tsources?: Record<string, unknown>;\n\tdefinition?: Record<string, unknown>;\n\thealth: {\n\t\ttotalProcessed: number;\n\t\ttotalErrors: number;\n\t\terrorRate: number;\n\t\tlastError: string | null;\n\t\tlastErrorAt: string | null;\n\t};\n\tsync: SubgraphSyncInfo;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcolumns: Record<\n\t\t\t\tstring,\n\t\t\t\t{\n\t\t\t\t\ttype: string;\n\t\t\t\t\tnullable?: boolean;\n\t\t\t\t\tindexed?: boolean;\n\t\t\t\t\tsearchable?: boolean;\n\t\t\t\t\tdefault?: string | number | boolean;\n\t\t\t\t}\n\t\t\t>;\n\t\t\trowCount: number;\n\t\t\texample: string;\n\t\t\tindexes?: readonly (readonly string[])[];\n\t\t\tuniqueKeys?: readonly (readonly string[])[];\n\t\t}\n\t>;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubgraphGapEntry {\n\tstart: number;\n\tend: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: string;\n\tresolvedAt: string | null;\n}\n\nexport interface SubgraphGapsResponse {\n\tdata: SubgraphGapEntry[];\n\tmeta: {\n\t\ttotal: number;\n\t\ttotalMissingBlocks: number;\n\t\tlimit: number;\n\t\toffset: number;\n\t};\n}\n\nexport interface ReindexResponse {\n\tmessage: string;\n\tfromBlock: number;\n\ttoBlock: number | string;\n\toperationId?: string;\n\tstatus?: \"queued\" | \"running\" | \"cancel_requested\";\n}\n\nexport interface SubgraphQueryParams {\n\tsort?: string;\n\torder?: string;\n\tlimit?: number;\n\toffset?: number;\n\tfields?: string;\n\tfilters?: Record<string, string>;\n}\n\n/**\n * Request shape for `GET /api/subgraphs/:subgraphName/:tableName/aggregate`.\n * `filters` reuses the list/count where-surface; the rest name the columns to\n * aggregate. SUM/MIN/MAX columns must be numeric (uint/int, plus `_block_height`).\n */\nexport interface SubgraphAggregateParams {\n\tfilters?: Record<string, string>;\n\tcount?: boolean;\n\tcountDistinct?: string[];\n\tsum?: string[];\n\tmin?: string[];\n\tmax?: string[];\n}\n\n/**\n * Aggregate response. Keys are present only for requested aggregates.\n * `count`/`countDistinct` are JSON numbers (counts << 2^53); `sum`/`min`/`max`\n * are lossless strings (NUMERIC `::text`). `sum` of an empty set is `\"0\"`;\n * `min`/`max` are `null` when the filtered set is empty or all-null.\n */\nexport interface SubgraphAggregateResponse {\n\tcount?: number;\n\tcountDistinct?: Record<string, number>;\n\tsum?: Record<string, string>;\n\tmin?: Record<string, string | null>;\n\tmax?: Record<string, string | null>;\n}\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAwBO,IAAM,8BACZ,EAAE,OAAO;AAAA,EACR,MAAM,EACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,EAAE;AAAA,EACR,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,SAAS,EACP,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,EACpD,OACA,CAAC,MAAM,OAAO,KAAK,CAAC,EAAE,SAAS,GAC/B,+BACD;AAAA,EACD,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,IAAI,SAAW,gCAAgC;AAAA,EACvE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAAA,EACpD,YAAY,EACV,OAAO,EACP,IAAI,SAAW,+BAA+B,EAC9C,SAAS;AAAA,EACX,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,YAAY,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,EAAE,SAAS;AACpD,CAAC;",
8
- "debugId": "1268F6D27AF0DE3364756E2164756E21",
7
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAmBO,IAAM,8BACZ,EAAE,OAAO;AAAA,EACR,MAAM,EACJ,OAAO,EACP,MAAM,gBAAgB,uCAAuC,EAC7D,IAAI,EAAE;AAAA,EACR,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,SAAS,EACP,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,EACpD,OACA,CAAC,MAAM,OAAO,KAAK,CAAC,EAAE,SAAS,GAC/B,+BACD;AAAA,EACD,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,IAAI,SAAW,gCAAgC;AAAA,EACvE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAAA,EACpD,YAAY,EACV,OAAO,EACP,IAAI,SAAW,+BAA+B,EAC9C,SAAS;AAAA,EACX,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAC9B,CAAC;",
8
+ "debugId": "467AF6D6771698BE64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -79,6 +79,15 @@ type SubgraphSpecFormat = "openapi" | "agent" | "markdown";
79
79
  interface SubgraphSpecOptions {
80
80
  serverUrl?: string;
81
81
  generatedAt?: string;
82
+ /**
83
+ * Self-hosted instances ignore the `visibility` column when deciding
84
+ * whether a read needs a key (`/v1/subgraphs` auth is the loopback rule,
85
+ * not the flag) — but this generator still branched on it, so a spec built
86
+ * for a self-hosted deploy pointed readers at the authenticated `/api`
87
+ * path for a read that was actually open. Callers on that mode should set
88
+ * this so the generated URLs match the auth the API actually enforces.
89
+ */
90
+ forcePublicRead?: boolean;
82
91
  }
83
92
  interface SubgraphAgentSchema {
84
93
  name: string;