@conform-ed/qti-xml 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cc-qti/convert-to-v3.d.ts +46 -0
- package/dist/cc-qti/index.d.ts +2 -0
- package/dist/cc-qti/normalize-questestinterop.d.ts +28 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +805 -0
- package/package.json +2 -2
- package/src/cc-qti/convert-to-v3.ts +460 -0
- package/src/cc-qti/index.ts +2 -0
- package/src/cc-qti/normalize-questestinterop.ts +544 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge Common Cartridge QTI ASI 1.2.1 (`questestinterop`) into QTI 3.0.1 ASI XML, so a CC
|
|
3
|
+
* cartridge's assessments/question-banks can be ingested + delivered + scored by the same
|
|
4
|
+
* QTI 3 engine as everything else (ADR-0022). The conversion targets the *normalized* QTI 3
|
|
5
|
+
* document the serializers consume, so the emitted XML is guaranteed to re-validate via
|
|
6
|
+
* `validateQtiXmlContent`.
|
|
7
|
+
*
|
|
8
|
+
* A `questestinterop` is either an `<objectbank>` (→ N standalone items) or an `<assessment>`
|
|
9
|
+
* (→ N items + one `assessmentTest` that references them).
|
|
10
|
+
*/
|
|
11
|
+
export type CcQtiInteractionKind = "choice" | "textEntry" | "extendedText";
|
|
12
|
+
export type CcQtiConvertedItem = {
|
|
13
|
+
identifier: string;
|
|
14
|
+
title: string;
|
|
15
|
+
ccProfile: string | undefined;
|
|
16
|
+
interactionKind: CcQtiInteractionKind;
|
|
17
|
+
xml: string;
|
|
18
|
+
};
|
|
19
|
+
export type CcQtiConvertedTest = {
|
|
20
|
+
identifier: string;
|
|
21
|
+
title: string;
|
|
22
|
+
itemIdentifiers: string[];
|
|
23
|
+
xml: string;
|
|
24
|
+
};
|
|
25
|
+
export type CcQtiConversionResult = {
|
|
26
|
+
status: "converted";
|
|
27
|
+
source: "assessment" | "objectbank";
|
|
28
|
+
items: CcQtiConvertedItem[];
|
|
29
|
+
test?: CcQtiConvertedTest;
|
|
30
|
+
} | {
|
|
31
|
+
status: "invalid";
|
|
32
|
+
issues: string[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Convert a CC `questestinterop` XML string into QTI 3.0.1 artifacts. Returns the converted
|
|
36
|
+
* item XMLs (+ a test XML when the source is an `<assessment>`), or a structured `invalid`
|
|
37
|
+
* result when the input is not even structurally valid CC QTI.
|
|
38
|
+
*
|
|
39
|
+
* Validation defaults to **structural** (the raw CC schema). The stricter CC *profile* rules
|
|
40
|
+
* (item-type coherence, no duplicate idents, feedback linkage) are opt-in via `{ profile: true }`
|
|
41
|
+
* — they are a conformance gate for clean cartridges, not a bar a best-effort import of a
|
|
42
|
+
* real-world export should trip over (those routinely violate the profile).
|
|
43
|
+
*/
|
|
44
|
+
export declare function convertCcQtiV1ToV3(xml: string, options?: {
|
|
45
|
+
profile?: boolean;
|
|
46
|
+
}): CcQtiConversionResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a Common Cartridge QTI ASI 1.2.1 (`questestinterop`) document — the QTI dialect
|
|
3
|
+
* CC 1.3/1.4 carries — from raw XML into the `kind`-tagged structure described by
|
|
4
|
+
* `@conform-ed/contracts/common-cartridge/v1_4`. This mirrors the QTI 3 `normalize.ts`
|
|
5
|
+
* pattern (XML node tree → typed contract shape) and is the input stage of the CC→QTI-3
|
|
6
|
+
* bridge (`convert-to-v3.ts`). The output is validated against the official CC profile, so
|
|
7
|
+
* non-conformant questestinterop is rejected here rather than silently mis-converted.
|
|
8
|
+
*/
|
|
9
|
+
import { type QtiQuestestinteropRaw } from "@conform-ed/contracts/common-cartridge/v1_4";
|
|
10
|
+
/** CC 1.x carries QTI ASI 1.2.1 under this namespace. */
|
|
11
|
+
export declare const ccQtiNamespace = "http://www.imsglobal.org/xsd/ims_qtiasiv1p2";
|
|
12
|
+
export type NormalizeQuestestinteropResult = {
|
|
13
|
+
status: "valid";
|
|
14
|
+
document: {
|
|
15
|
+
questestinterop: QtiQuestestinteropRaw;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
status: "invalid";
|
|
19
|
+
issues: string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Parse + normalize a `questestinterop` XML string into the CC 1.4 contract shape and validate
|
|
23
|
+
* it. When `profile` is true (default), the stricter CC profile rules are applied (item-type
|
|
24
|
+
* coherence, feedback linkage); when false, only the structural raw schema is checked.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeQuestestinterop(xml: string, options?: {
|
|
27
|
+
profile?: boolean;
|
|
28
|
+
}): NormalizeQuestestinteropResult;
|
package/dist/index.d.ts
CHANGED