Skip to content

Export TypeScript types for btcmap.org via ts-rs - #103

Merged
bubelov merged 6 commits into
masterfrom
feat/frontend-types
Aug 13, 2026
Merged

Export TypeScript types for btcmap.org via ts-rs#103
bubelov merged 6 commits into
masterfrom
feat/frontend-types

Conversation

@escapedcat

@escapedcat escapedcat commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Implements #102 — TypeScript type generation for btcmap.org as a parallel dev tool.

What this does

  • Adds ts-rs and derives TS on the 39 v4 response/request structs btcmap.org consumes (opt-in per struct; the unconsumed events module is deliberately skipped)
  • Adds a type-export-only all-optional Place struct describing the dynamic fields-driven responses of GET /v4/places, kept in sync with service::element::TAGS by a unit test
  • Commits bindings/ (the generated output) so consumers fetch it straight from GitHub — no Rust toolchain or checkout of this repo needed. cargo test regenerates the directory, and a new CI step fails if a commit leaves it stale
  • Adds a devtools export-ts-types [target-dir] subcommand for exporting the bindings to an arbitrary directory locally
  • Structs whose names repeat across modules get #[ts(rename = ...)] so every binding has a unique file/type name; 64-bit integers are exported as number (JSON transport), RFC 3339 timestamps as string

What this deliberately does not do

  • No changes under docs/rest/ — the MD docs workflow is untouched
  • No route, main.rs, or handler changes; nothing new is served or published
  • No runtime code — the derive is compile-time only

Test plan

  • cargo test — full suite green, including the 39 export_bindings_* tests and place_type_covers_all_generate_tags_fields
  • devtools export-ts-types <dir> verified against a scratch dir (39 files) and a real btcmap.org checkout, where pnpm typecheck and pnpm lint pass over the generated files
  • Docs: README section on the bindings workflow, AGENTS.md rules for agents touching exported structs

Companion frontend PR: teambtcmap/btcmap.org#1243 (should land after this one).

🤖 Generated with Claude Code

escapedcat and others added 4 commits August 12, 2026 14:16
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
escapedcat and others added 2 commits August 12, 2026 15:37
The frontend fetches bindings/ from GitHub instead of needing a local
checkout with a Rust toolchain. cargo test regenerates the directory, so
a CI diff check keeps the committed copy honest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cargo.toml: kept both dependency groups (master's SPKI-pinning TLS stack
and this branch's ts-rs). The new MeResponse.geofence field from master
gained the ts-rs number override, and bindings/ was regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@escapedcat
escapedcat requested a balanced review from Copilot August 12, 2026 13:50

This comment was marked as off-topic.

@escapedcat
escapedcat marked this pull request as ready for review August 12, 2026 13:54
@escapedcat
escapedcat requested a review from bubelov August 12, 2026 13:58
@bubelov
bubelov merged commit 08b8c18 into master Aug 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants