evaluators icon indicating copy to clipboard operation
evaluators copied to clipboard

feat(ts-sdk): Knowledge Graph client layer

Open adnanrhussain opened this issue 5 months ago • 1 comments

Summary

Adds a typed HTTP client for the Learning Commons Knowledge Graph API. Infrastructure used by the Math Standards Alignment Evaluator (PR #91), kept as a separate PR so it can be reviewed independently.

  • KnowledgeGraphClient — single class that handles all KG HTTP calls with concurrency limiting (p-limit), promise caching (evict-on-reject so transient 429/503 errors are retryable), 30s timeout, and cursor-based pagination for learning components
  • KnowledgeGraphError — typed error for KG HTTP failures, exported from SDK root
  • platformApiKey added to BaseEvaluatorConfig for any evaluator that needs KG access
  • kg-api.d.ts generated from the official spec at docs.learningcommons.org/api-reference/knowledge-graph-api/openapi.yaml via npm run generate:kg-types

PR #91 depends on this

ahussain/math-standards-alignment (PR #91) must be merged after this one.

Test plan

  • [x] npm test -- --run tests/unit/knowledge-graph — 19 tests pass
  • [x] npx tsc --noEmit — 0 errors
  • [x] npm run lint — 0 errors

adnanrhussain avatar Jun 10 '26 03:06 adnanrhussain

Codecov Report

:x: Patch coverage is 97.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdks/typescript/src/knowledge-graph/client.ts 97.22% 2 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar Jun 10 '26 03:06 codecov[bot]