evaluators
evaluators copied to clipboard
feat(ts-sdk): Knowledge Graph client layer
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 componentsKnowledgeGraphError— typed error for KG HTTP failures, exported from SDK rootplatformApiKeyadded toBaseEvaluatorConfigfor any evaluator that needs KG accesskg-api.d.tsgenerated from the official spec atdocs.learningcommons.org/api-reference/knowledge-graph-api/openapi.yamlvianpm 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
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!