course-pack
v1.0.0-alpha.15
Published
Course Pack is a serialized collection of courses, instructors, programs and providers.
Downloads
13
Readme
Course Pack
Course Pack is a serialized collection of courses, instructors, programs, and providers.
Course Pack is the official supported data source format of UniCourse.
Format
You can find the format specification here (JSON Schema).
Subtypes
Course Pack has two subtypes: Frozen Course Pack and Extendable Course Pack.
A Course Pack is Frozen if all of the id-like fields are CUIDs, which makes the data immutable and interchangeable with UniCourse database.
If a Course Pack is not Frozen, we call it Extendable, which takes the advantage of the flexibility of custom id formats and can be easily merged with other Course Packs in the same convention.
Verify Course Pack
You can use verify
function to type-safe verify a Course Pack.
import fs from "node:fs";
import type { CoursePack } from "course-pack";
import { verify } from "course-pack";
const pack: unknown = JSON.parse(fs.readFileSync("course-pack.json", "utf-8"));
try {
const verified: CoursePack = verify(pack);
console.log(verified);
} catch (error) {
console.error(error);
}