@openexam/compose
v0.1.0
Published
Pool selection + exam composition for OpenExam (spec 0.2). Deterministic via a seeded RNG per ADR-005.
Readme
@openexam/compose
Pool selection + exam composition. Resolves an exam document
(type: exam) into a flat ordered sequence of assignment
documents, expanding pool references along the way.
import { composeExam, loadExamPackage } from '@openexam/compose';
const pkg = await loadExamPackage('/path/to/my-exam-package');
const composed = composeExam({
exam: pkg.exams[0]!,
pools: pkg.pools,
assignments: pkg.assignments,
seed: 42,
});
// composed.items: Document[] in resolved orderSelection is deterministic per ADR-005: a seeded xorshift32 RNG drives pool selection, so two runs with the same seed pick the same items.
tag and difficulty selection criteria both look at the
assignment's tags: array — difficulty: easy is satisfied if
the assignment has easy in its tags. (No separate difficulty
frontmatter field — keeping it as a tag avoids a schema change.)
License
Apache-2.0. See LICENSE and the canonical ../../LICENSE at the repository root.
