@longsightgroup/qti3-core 0.9.8 → 0.9.10
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/asset-url.d.ts.map +1 -1
- package/dist/asset-url.js +5 -6
- package/dist/asset-url.js.map +1 -1
- package/dist/catalog.d.ts +5 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +30 -12
- package/dist/catalog.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/parser-item-metadata.d.ts +1 -1
- package/dist/parser-item-metadata.d.ts.map +1 -1
- package/dist/parser-item-metadata.js +4 -1
- package/dist/parser-item-metadata.js.map +1 -1
- package/dist/parser-processing.d.ts.map +1 -1
- package/dist/parser-processing.js +4 -0
- package/dist/parser-processing.js.map +1 -1
- package/dist/parser.js +7 -2
- package/dist/parser.js.map +1 -1
- package/dist/processing-expression-collection.d.ts +4 -0
- package/dist/processing-expression-collection.d.ts.map +1 -0
- package/dist/processing-expression-collection.js +44 -0
- package/dist/processing-expression-collection.js.map +1 -0
- package/dist/qti-package-assets.d.ts +3 -1
- package/dist/qti-package-assets.d.ts.map +1 -1
- package/dist/qti-package-assets.js +22 -0
- package/dist/qti-package-assets.js.map +1 -1
- package/dist/qti-package-items.d.ts +2 -1
- package/dist/qti-package-items.d.ts.map +1 -1
- package/dist/qti-package-items.js +96 -18
- package/dist/qti-package-items.js.map +1 -1
- package/dist/qti-package-manifest.d.ts.map +1 -1
- package/dist/qti-package-manifest.js +2 -0
- package/dist/qti-package-manifest.js.map +1 -1
- package/dist/qti-package-metadata.d.ts +5 -2
- package/dist/qti-package-metadata.d.ts.map +1 -1
- package/dist/qti-package-metadata.js +116 -8
- package/dist/qti-package-metadata.js.map +1 -1
- package/dist/qti-package-types.d.ts +62 -0
- package/dist/qti-package-types.d.ts.map +1 -1
- package/dist/qti-package-xml.d.ts.map +1 -1
- package/dist/qti-package-xml.js +1 -1
- package/dist/qti-package-xml.js.map +1 -1
- package/dist/qti-package.d.ts +2 -1
- package/dist/qti-package.d.ts.map +1 -1
- package/dist/qti-package.js +2 -0
- package/dist/qti-package.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.js +32 -1
- package/dist/validation.js.map +1 -1
- package/package.json +1 -1
- package/src/asset-url.ts +5 -6
- package/src/catalog.ts +64 -11
- package/src/index.ts +11 -0
- package/src/parser-item-metadata.ts +7 -1
- package/src/parser-processing.ts +4 -0
- package/src/parser.ts +11 -3
- package/src/processing-expression-collection.ts +57 -0
- package/src/qti-package-assets.ts +30 -0
- package/src/qti-package-items.ts +190 -29
- package/src/qti-package-manifest.ts +2 -0
- package/src/qti-package-metadata.ts +174 -7
- package/src/qti-package-types.ts +69 -0
- package/src/qti-package-xml.ts +2 -1
- package/src/qti-package.ts +9 -0
- package/src/types.ts +6 -0
- package/src/validation.ts +35 -1
package/src/qti-package.ts
CHANGED
|
@@ -36,22 +36,30 @@ import {
|
|
|
36
36
|
import type { QtiDiagnostic } from "./types.js";
|
|
37
37
|
|
|
38
38
|
export { decodeUtf8, readQtiPackageZipEntries };
|
|
39
|
+
export { discoverQtiPackageContentAssets } from "./qti-package-assets.js";
|
|
39
40
|
export { normalizePackagePath } from "./qti-package-paths.js";
|
|
40
41
|
export { QTI_ITEM_RESOURCE_TYPE, QTI_PACKAGE_MANIFEST_PATH } from "./qti-package-manifest.js";
|
|
41
42
|
export type { QtiPackageEntry };
|
|
42
43
|
|
|
43
44
|
export type {
|
|
45
|
+
QtiAssessmentSectionPackageModel,
|
|
44
46
|
QtiAssessmentTestItemRef,
|
|
45
47
|
QtiAssessmentTestPackageModel,
|
|
46
48
|
QtiManifestFile,
|
|
47
49
|
QtiManifestResource,
|
|
48
50
|
QtiPackageAsset,
|
|
51
|
+
QtiPackageContentAssetDiscovery,
|
|
49
52
|
QtiPackageAssetSource,
|
|
50
53
|
QtiPackageItem,
|
|
51
54
|
QtiPackageItemSource,
|
|
52
55
|
QtiPackageParseResult,
|
|
53
56
|
QtiPackageShape,
|
|
57
|
+
QtiItemSessionControl,
|
|
54
58
|
QtiStandardAlignment,
|
|
59
|
+
QtiTestPartNavigationMode,
|
|
60
|
+
QtiTestPartPackageModel,
|
|
61
|
+
QtiTestPartSubmissionMode,
|
|
62
|
+
QtiTimeLimits,
|
|
55
63
|
QtiTimingMetadata,
|
|
56
64
|
} from "./qti-package-types.js";
|
|
57
65
|
|
|
@@ -159,6 +167,7 @@ function parseQtiPackageEntries(
|
|
|
159
167
|
return {
|
|
160
168
|
ok: diagnostics.every((diagnostic) => diagnostic.severity !== "error"),
|
|
161
169
|
title,
|
|
170
|
+
entries,
|
|
162
171
|
packageShape,
|
|
163
172
|
items,
|
|
164
173
|
assets,
|
package/src/types.ts
CHANGED
|
@@ -385,6 +385,7 @@ export interface QtiCatalog {
|
|
|
385
385
|
|
|
386
386
|
export interface QtiCatalogCard {
|
|
387
387
|
support: string;
|
|
388
|
+
language?: string | undefined;
|
|
388
389
|
htmlContent?: QtiCatalogHtmlContent | undefined;
|
|
389
390
|
fileHrefs: QtiCatalogFileHref[];
|
|
390
391
|
entries: QtiCatalogCardEntry[];
|
|
@@ -416,7 +417,9 @@ export interface QtiCatalogFileHref {
|
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
export interface QtiCatalogReference {
|
|
420
|
+
referenceId: string;
|
|
419
421
|
idref: string;
|
|
422
|
+
qtiName: string;
|
|
420
423
|
source?: QtiSourceLocation | undefined;
|
|
421
424
|
}
|
|
422
425
|
|
|
@@ -437,6 +440,7 @@ export interface QtiAssessmentItem {
|
|
|
437
440
|
timeDependent?: boolean | undefined;
|
|
438
441
|
attributes: Record<string, string>;
|
|
439
442
|
prompt?: string | undefined;
|
|
443
|
+
itemBodyAttributes?: Record<string, string> | undefined;
|
|
440
444
|
itemBodySource?: QtiSourceLocation | undefined;
|
|
441
445
|
responseDeclarations: QtiResponseDeclaration[];
|
|
442
446
|
outcomeDeclarations: QtiOutcomeDeclaration[];
|
|
@@ -490,6 +494,8 @@ export interface QtiResponseProcessing {
|
|
|
490
494
|
template?: string | undefined;
|
|
491
495
|
rules: QtiResponseRule[];
|
|
492
496
|
conditions: QtiResponseCondition[];
|
|
497
|
+
/** Direct processing expressions retained even when they are not wrapped in a response rule. */
|
|
498
|
+
expressions?: QtiProcessingExpression[] | undefined;
|
|
493
499
|
}
|
|
494
500
|
|
|
495
501
|
export interface QtiResponseCondition {
|
package/src/validation.ts
CHANGED
|
@@ -635,7 +635,10 @@ function validateCatalogCard(
|
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
const entries = "entries" in card ? card.entries : [];
|
|
638
|
-
const
|
|
638
|
+
const hasHtmlContent = Boolean(card.htmlContent);
|
|
639
|
+
const hasFileHrefs = card.fileHrefs.length > 0;
|
|
640
|
+
const hasDirectContent = hasHtmlContent || hasFileHrefs;
|
|
641
|
+
const hasContent = hasDirectContent || entries.length > 0;
|
|
639
642
|
if (!hasContent) {
|
|
640
643
|
diagnostics.push({
|
|
641
644
|
code: "catalog.card.content.required",
|
|
@@ -646,6 +649,37 @@ function validateCatalogCard(
|
|
|
646
649
|
});
|
|
647
650
|
}
|
|
648
651
|
|
|
652
|
+
if (hasHtmlContent && hasFileHrefs) {
|
|
653
|
+
diagnostics.push({
|
|
654
|
+
code: "catalog.card.content.choice",
|
|
655
|
+
severity: "error",
|
|
656
|
+
message: "qti-card or qti-card-entry must use qti-html-content or qti-file-href, not both.",
|
|
657
|
+
path: card.source?.path,
|
|
658
|
+
source: card.source,
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
if (entries.length > 0 && hasDirectContent) {
|
|
663
|
+
diagnostics.push({
|
|
664
|
+
code: "catalog.card.entries.choice",
|
|
665
|
+
severity: "error",
|
|
666
|
+
message: "qti-card must use direct content or qti-card-entry children, not both.",
|
|
667
|
+
path: card.source?.path,
|
|
668
|
+
source: card.source,
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
const defaultEntries = entries.filter((entry) => entry.default);
|
|
673
|
+
if (defaultEntries.length > 1) {
|
|
674
|
+
diagnostics.push({
|
|
675
|
+
code: "catalog.cardEntry.default.multiple",
|
|
676
|
+
severity: "error",
|
|
677
|
+
message: "Only one qti-card-entry in a qti-card may be designated as default.",
|
|
678
|
+
path: defaultEntries[1]?.source?.path ?? card.source?.path,
|
|
679
|
+
source: defaultEntries[1]?.source ?? card.source,
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
|
|
649
683
|
if (card.htmlContent) {
|
|
650
684
|
validateCatalogHtmlContent(card.htmlContent.children, diagnostics);
|
|
651
685
|
}
|