Repository navigation
client: add @hypercerts-org/api with record types from @hypercerts-org/lexicon/records - #45
Merged
kristoferlund merged 10 commits intoNov 2, 2026
Conversation
Generates @atproto/lex query definitions and types for every query Lexicon in api/manifest.json, plus the record Lexicons they reference from the pinned @hypercerts-org/lexicon. Generated sources are committed and checked for freshness in pnpm check. Not versioned or published yet. TECH-799
🦋 Changeset detectedLatest commit: 5768b20 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
The package now generates only the API's own Lexicons and imports the record schemas and types its views embed from @hypercerts-org/lexicon/records, which becomes a peer dependency, instead of shipping a copy. Until that subpath is released (hypercerts-lexicon#270) the build uses a vendored tarball of it. Also addresses the review of this PR: a clean build before pnpm pack, type tests against the built package, a fixed allowlist for view names defined by more than one Lexicon so a root export cannot vanish silently, code-unit sorting, a freshness check limited to generated files, matching the validation error in tests, and corrected docs. TECH-799, TECH-817
This was referenced Oct 30, 2026
@hypercerts-org/api now exports app, com, org and pub as generated by lex build --index-file, matching @hypercerts-org/lexicon/records and the @atproto/lex docs: api.call(org.hypercerts.claim.getActivity, ...). Records and other definitions in the tree re-export the lexicon package's modules, so an app can import everything from this package and org.hypercerts.claim.activity is the same module in both. This replaces the flat short names, the PascalCase namespaces and the allowlist for ambiguous view names. Adds check:package (pack, install in a clean project, Node and TypeScript checks) and runs it in CI. TECH-799, TECH-817
- generate.js puts lex's exports and imports in a fixed order (lex reads Lexicon files in file system order, which differs between machines), with the same rules as the lexicon repository, and replaces lex's banner with its own, since it rewrites the files. check:generated covers all of src/. - The sharing test compares every export of each record module, not only main, so definition-only modules are checked too. - check:package follows the SDK's shape: pnpm consumer outside the workspace, Node, TypeScript and a Vite browser build that must tree-shake unused queries. It checks the packed license files. CI runs it on Node 24 and 26. - The package is licensed MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE, Hypercerts Foundation) instead of shipping the repository's HappyView license, and has a repository field. - CI: concurrency group; pnpm version read from packageManager. - @types/node 24.19.2; vendored lexicon tarball rebuilt from #270. - README: which records the tree contains.
- Remove tests of @atproto/lex's own behaviour (request shape, response rejection); keep the tree, sharing, type and embedded-record tests. - check:package keeps the SDK's three checks, without the tree-shaking and packed-license assertions, and runs once in the main CI job. - Remove tsconfig.scripts.json: the build scripts are not type-checked.
The repository held @hypercerts-org/api in client/ and a package named @hypercerts-org/hypercerts-api in api/. Folders now match what they hold: - api/ -> happyview-modules/, package @hypercerts-org/happyview-modules (the HappyView modules, installer and tests; unchanged otherwise). - client/ -> packages/api/ (@hypercerts-org/api), as in the SDK's packages/. Paths in CI, the release workflow, docs, the explorer sources and the pending changesets follow. Release tags from the next release on are @hypercerts-org/happyview-modules@X.Y.Z (changeset added). The name is a proposal for review.
kristoferlund
marked this pull request as ready for review
October 30, 2026 22:31
|
❌ The last analysis has failed. |
Kzoeps
approved these changes
Nov 1, 2026
kristoferlund
deleted the
kristofer/tech-799-hypercerts-api-typescript-types-for-the-xrpc-queries-as-a
branch
November 2, 2026 06:47
Open
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
@hypercerts-org/apias a workspace package inpackages/api/:@atproto/lexquery definitions and TypeScript types for the API, so apps and the SDK can call it typed instead of generating their own bindings. Implements TECH-799 and TECH-817 of the implementation plan.Depends on hypercerts-lexicon#270 (
@hypercerts-org/lexicon/records, TECH-750). Review the two together. Until #270 is released, this PR builds against a vendored tarball of it; see "Before merging".What's in it
app,com,organdpub, as generated bylex build --index-file, the layout the@atproto/lexdocs use and the same as@hypercerts-org/lexicon/records. Every name is an NSID: queries atorg.hypercerts.claim.getActivity(with.$Params,.ActivityView), shared views atorg.hypercerts.api.defs.org.hypercerts.claim.activityis the same module in both packages. Records no query returns (such asorg.hyperboards.board) are not in this tree; apps import them from@hypercerts-org/lexicon/records. Generation fails if a module it needs is missing from/records.packages/api/scripts/generate.jsrunslex buildoverhappyview-modules/manifest.jsonvalidationLexicons, keeps the modules of the API's own 65 Lexicons (63 queries, 2 defs) and the namespace modules on the path to them, points everything else at@hypercerts-org/lexicon/records/<nsid path>, puts lex's exports and imports in a fixed order (lex otherwise follows the file system's listing order, and the output is committed and compared), replaces lex's banner with its own, and applies the bluesky-social/atproto#5738 import fix.LEXICON_VERSION(alsohypercerts.lexiconVersioninpackage.json).@atproto/lex^0.4.2 and@hypercerts-org/lexicon^1.7.0.packages/api/src/is committed (it is what reviewers see change when an API Lexicon changes);pnpm checkruns freshness, Biome, typecheck, build, a type test against the built package and runtime tests (every export of the tree's records is the lexicon package's, and embedded records are validated with its schemas).pnpm check:packagefollows the SDK's check: it installs the packed tarball in a pnpm project outside the workspace, imports it in Node, typechecks a consumer and bundles one query with Vite. CI runs it.pnpm client:generateat the root regenerates; README, CONTRIBUTING and AGENTS.md say when..nvmrc; all CI and release jobs read it withnode-version-file.Before merging
@hypercerts-org/lexicon1.7.0), then replace the vendoredpackages/api/vendor/hypercerts-org-lexicon-1.7.0.tgzwith"@hypercerts-org/lexicon": "1.7.0", deletepackages/api/vendor/, regenerate and update the lockfile.@hypercerts-org/lexicon1.5.0 inhappyview-modules/package.json, so the indexer validates against 1.5.0 while the client types come from 1.7.0. Aligning them is TECH-822.Decisions to review
Folder and package rename (Karma, please confirm or suggest another name). The package named "api" lived in
client/, and the folderapi/held a package named@hypercerts-org/hypercerts-api. Now:api/ishappyview-modules/, package@hypercerts-org/happyview-modules. The modules, installer and tests are unchanged; only paths move. The installer runs fromhappyview-modules/.client/ispackages/api/, like the SDK'spackages/sdk/.@hypercerts-org/happyview-modules@X.Y.Z; earlier releases keep their@hypercerts-org/hypercerts-api@X.Y.Ztags (changeset added, README updated). CI, the release workflow, the explorer sources and the pending changesets follow the new paths.@hypercerts-org/apiis the npm package.Tooling follows the SDK scaffold (TECH-748): Biome 2.6.3 with the same rules, TypeScript 7, the SDK's compiler options, ESM only, Node 24. The rest of this repository keeps ESLint and pnpm 10 for now (TECH-821).
exactOptionalPropertyTypesis off for this package: code generated by@atproto/lex0.4.2 does not compile with it.Not versioned or released yet. The package is in the Changesets
ignorelist, because the release workflow only tags the server bundle (TECH-818). The server bundle's only changeset is the rename below.Release coupling. The release workflow runs
pnpm checkandpnpm build, which now include the client package, so a brokenpackages/api/blocks releasing the server bundle. Main CI gates the same commands, so this should not bite in practice.Consuming it before npm: from the workspace or a
pnpm packtarball (prepackbuilds). A git dependency does not work, becausedist/is not committed.Verification
pnpm --filter @hypercerts-org/api checkpasses;check:generatedfails after a manual edit and ignores stray dotfiles.pnpm packtarball installed with the lexicon tarball in an isolated project: runtime import works, and a TypeScript consumer typechecksapi.call(getActivity, …)withActivityView["record"]assignable to the lexicon package'sActivity.Note
The package is licensed MIT OR Apache-2.0 (
packages/api/LICENSE-MIT,packages/api/LICENSE-APACHE, Hypercerts Foundation), following the suggestion for this repository in the licensing proposal (TECH-736); before, the tarball shipped the repository'sLICENSE.md, whose copyright line reads "Trezy Studios, LLC". If the team settles on another license, only these two files and thelicensefield change.

Confidence Score: 5/5
The reviewed updates appear safe to merge, with the previous installation-example issue fixed.Summary
Adds
@hypercerts-org/apiwith generated query definitions and shared record types.happyview-modulesname.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A["happyview-modules/manifest.json"] --> G["scripts/generate.js"] L["@hypercerts-org/lexicon"] --> G G --> Q["Generated query definitions"] Q --> P["@hypercerts-org/api"] L --> R["Shared record modules"] R --> P P --> C["Typed Client.call"]Reviews (2) · Last reviewed commit: "docs: cd happyview-modules in install ex..." · Reviewed by Greptile