Repository navigation
feat(sdk): add typed data client and versioned OpenAPI contract - #288
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Description
Adds the SDK's read layer: a runtime-agnostic
DataClientfor the app/indexer read models, plus a versioned OpenAPI 3.1 contract and an Ajv-backed contract test.Closes #278
What's included
sdk/src/data/client.tsnew DataClient({ baseUrl, fetch?, headers?, timeoutMs?, signal?, requestId?, onRequestId? }).listPools,getPool,getPoolHistory,getProtocolSummary,getReputation,getReputationLeaderboard,getGovernanceProposals,getPortfolioSummary.{ items, nextCursor, hasMore, total? }; bare-array and legacy page shapes are normalized.AbortControllertimeouts (default 15s) + external abort support.DataClientErrorwithstatus, machine-readablecode,requestId, parsedbody, andcause.crypto.randomUUID()when available; never contains wallet identity.getPoolfalls back toGET /api/pools?id=on 404;getPoolHistoryfalls back to the activity feed when the server returns sparkline history.sdk/src/data/models.tsPage<T>,PoolSummary,PoolDetail,PoolEvent,ProtocolSummary,ReputationProfile,GovernanceProposalSummary,PortfolioSummary, and related rows.bigint).docs/api/openapi.json— OpenAPI 3.1 schemas for every consumed route, pagination, error envelope, andx-experimentalmarkers.docs/api/README.md— versioning, pagination, errors, request ids, route fallbacks, and contract-update workflow.data.test.tscovers normalization, fallbacks, errors, aborts, timeouts, transport failures, and request ids;httpContract.test.tsvalidates fixtures against the OpenAPI schemas with Ajv 2020.Type of Change
How Has This Been Tested?
Run from
sdk/:pnpm typecheck— passespnpm build— emits declarationspnpm test— 187/187 tests pass (15 files)pnpm check:api—✔ Public API OK (177 symbols exported from the root)All HTTP tests use mocked
fetch; no network access required.Checklist