@intellectif/lk-core 0.11.0 → 0.13.0
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/CHANGELOG.md +38 -0
- package/README.md +2 -1
- package/dist/{activity-B2QxK15j.d.cts → activity-DfAmJ1sl.d.cts} +134 -7
- package/dist/{activity-B2QxK15j.d.ts → activity-DfAmJ1sl.d.ts} +134 -7
- package/dist/{chunk-3FEAEO3D.cjs → chunk-DQKJUMUW.cjs} +38 -15
- package/dist/chunk-DQKJUMUW.cjs.map +1 -0
- package/dist/{chunk-ZTY4UIUD.js → chunk-FGN4LLSP.js} +50 -6
- package/dist/chunk-FGN4LLSP.js.map +1 -0
- package/dist/{chunk-VTTRXGDD.cjs → chunk-FT7SAC3X.cjs} +4 -4
- package/dist/{chunk-VTTRXGDD.cjs.map → chunk-FT7SAC3X.cjs.map} +1 -1
- package/dist/{chunk-IXXMYJI7.js → chunk-PYP3HCRQ.js} +2 -2
- package/dist/{chunk-VBM5H6P5.cjs → chunk-UHQVIC3P.cjs} +58 -14
- package/dist/chunk-UHQVIC3P.cjs.map +1 -0
- package/dist/{chunk-FIS5KBCE.js → chunk-XKKKWKRH.js} +1973 -179
- package/dist/chunk-XKKKWKRH.js.map +1 -0
- package/dist/{chunk-7ODQRNR4.cjs → chunk-XONKWL6D.cjs} +1812 -18
- package/dist/chunk-XONKWL6D.cjs.map +1 -0
- package/dist/{chunk-XGCTAQSS.js → chunk-Y36S3X3L.js} +26 -3
- package/dist/chunk-Y36S3X3L.js.map +1 -0
- package/dist/{index-CRKtWP5G.d.ts → index-Bz9wUigA.d.cts} +181 -4
- package/dist/{index-B_scInLM.d.cts → index-CJbbVE9o.d.ts} +181 -4
- package/dist/index.cjs +349 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -6
- package/dist/index.d.ts +48 -6
- package/dist/index.js +322 -11
- package/dist/index.js.map +1 -1
- package/dist/schemas.cjs +17 -3
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.d.cts +2 -2
- package/dist/schemas.d.ts +2 -2
- package/dist/schemas.js +16 -2
- package/dist/scoring.cjs +19 -3
- package/dist/scoring.cjs.map +1 -1
- package/dist/scoring.d.cts +150 -5
- package/dist/scoring.d.ts +150 -5
- package/dist/scoring.js +18 -2
- package/dist/xapi.cjs +3 -3
- package/dist/xapi.d.cts +1 -1
- package/dist/xapi.d.ts +1 -1
- package/dist/xapi.js +2 -2
- package/package.json +1 -1
- package/vectors/README.md +9 -1
- package/vectors/scoring.json +12023 -1
- package/dist/chunk-3FEAEO3D.cjs.map +0 -1
- package/dist/chunk-7ODQRNR4.cjs.map +0 -1
- package/dist/chunk-FIS5KBCE.js.map +0 -1
- package/dist/chunk-VBM5H6P5.cjs.map +0 -1
- package/dist/chunk-XGCTAQSS.js.map +0 -1
- package/dist/chunk-ZTY4UIUD.js.map +0 -1
- /package/dist/{chunk-IXXMYJI7.js.map → chunk-PYP3HCRQ.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var _chunkVBM5H6P5cjs = require('./chunk-VBM5H6P5.cjs');
|
|
14
13
|
|
|
14
|
+
var _chunkUHQVIC3Pcjs = require('./chunk-UHQVIC3P.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var _chunkVTTRXGDDcjs = require('./chunk-VTTRXGDD.cjs');
|
|
21
20
|
|
|
21
|
+
var _chunkFT7SAC3Xcjs = require('./chunk-FT7SAC3X.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -32,9 +32,9 @@ var _chunkVTTRXGDDcjs = require('./chunk-VTTRXGDD.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var _chunk3FEAEO3Dcjs = require('./chunk-3FEAEO3D.cjs');
|
|
36
35
|
|
|
37
36
|
|
|
37
|
+
var _chunkDQKJUMUWcjs = require('./chunk-DQKJUMUW.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -82,7 +82,34 @@ var _chunk3FEAEO3Dcjs = require('./chunk-3FEAEO3D.cjs');
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var _chunkXONKWL6Dcjs = require('./chunk-XONKWL6D.cjs');
|
|
86
113
|
|
|
87
114
|
// src/content-hash.ts
|
|
88
115
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -586,28 +613,299 @@ function diffResponses(before, after) {
|
|
|
586
613
|
return entries;
|
|
587
614
|
}
|
|
588
615
|
|
|
616
|
+
// src/authoring/item-group.ts
|
|
617
|
+
function createItemGroupDraft(context) {
|
|
618
|
+
const issued = /* @__PURE__ */ new Set();
|
|
619
|
+
const newId = () => {
|
|
620
|
+
const id = context.newId();
|
|
621
|
+
if (typeof id !== "string" || id === "") {
|
|
622
|
+
throw new Error("createItemGroupDraft: newId() must return a non-empty string.");
|
|
623
|
+
}
|
|
624
|
+
if (issued.has(id)) {
|
|
625
|
+
throw new Error(
|
|
626
|
+
`createItemGroupDraft: newId() returned "${id}" twice. Ids within one draft must differ.`
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
issued.add(id);
|
|
630
|
+
return id;
|
|
631
|
+
};
|
|
632
|
+
return {
|
|
633
|
+
schemaVersion: "1.0",
|
|
634
|
+
type: "item-group",
|
|
635
|
+
id: newId(),
|
|
636
|
+
stimulus: { id: newId(), kind: "text", body: "" },
|
|
637
|
+
items: []
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function validateItemGroupDraft(draft) {
|
|
641
|
+
return _chunkXONKWL6Dcjs.withValidationScope.call(void 0, () => validateItemGroupDraftInScope(draft));
|
|
642
|
+
}
|
|
643
|
+
function validateItemGroupDraftInScope(draft) {
|
|
644
|
+
const issues = [];
|
|
645
|
+
if (!_chunkXONKWL6Dcjs.isRecord.call(void 0, draft)) {
|
|
646
|
+
issues.push(
|
|
647
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_not_an_object", [], "A group must be an object with a stimulus and its items.")
|
|
648
|
+
);
|
|
649
|
+
return { status: "invalid", issues };
|
|
650
|
+
}
|
|
651
|
+
issues.push(...checkGroupIdentity(draft));
|
|
652
|
+
if (_chunkXONKWL6Dcjs.isRecord.call(void 0, draft.stimulus)) {
|
|
653
|
+
issues.push(...checkStimulus(draft.stimulus));
|
|
654
|
+
} else if (_chunkXONKWL6Dcjs.isUnset.call(void 0, draft.stimulus)) {
|
|
655
|
+
issues.push(
|
|
656
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
657
|
+
"ig_stimulus_required",
|
|
658
|
+
["stimulus"],
|
|
659
|
+
"Add the passage, recording or image the questions are about."
|
|
660
|
+
)
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
issues.push(...checkItems(draft));
|
|
664
|
+
if (_chunkXONKWL6Dcjs.groupCaptionsRevealDictation.call(void 0, draft, (captionsUrl) => !_chunkXONKWL6Dcjs.isUnwritten.call(void 0, captionsUrl))) {
|
|
665
|
+
issues.push(
|
|
666
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
667
|
+
"dc_captions_not_allowed",
|
|
668
|
+
["stimulus", "media", "captionsUrl"],
|
|
669
|
+
_chunkXONKWL6Dcjs.GROUP_CAPTIONS_REVEAL_DICTATION
|
|
670
|
+
)
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
const parsed = _chunkDQKJUMUWcjs.ItemGroupSchema.safeParse(draft, { reportInput: true });
|
|
674
|
+
if (!parsed.success) {
|
|
675
|
+
for (const schemaIssue of parsed.error.issues) {
|
|
676
|
+
const path = schemaIssue.path.map(String);
|
|
677
|
+
if (issues.some((known) => _chunkXONKWL6Dcjs.covers.call(void 0, known.path, path))) {
|
|
678
|
+
continue;
|
|
679
|
+
}
|
|
680
|
+
if (path.length > 0 && _chunkXONKWL6Dcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
681
|
+
issues.push(
|
|
682
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
683
|
+
"null_not_allowed",
|
|
684
|
+
path,
|
|
685
|
+
"This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
686
|
+
)
|
|
687
|
+
);
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
issues.push({
|
|
691
|
+
path,
|
|
692
|
+
message: schemaIssue.message,
|
|
693
|
+
code: schemaIssue.code,
|
|
694
|
+
severity: "invalid"
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const stored = _chunkDQKJUMUWcjs.validateItemGroup.call(void 0, draft);
|
|
699
|
+
if (issues.length === 0 && stored.success) {
|
|
700
|
+
return { status: "complete", data: stored.data, issues };
|
|
701
|
+
}
|
|
702
|
+
if (issues.length === 0) {
|
|
703
|
+
for (const error of stored.success ? [] : stored.errors) {
|
|
704
|
+
issues.push({ ...error, severity: "invalid" });
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
const invalid = issues.some((found) => found.severity !== "incomplete");
|
|
708
|
+
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
709
|
+
}
|
|
710
|
+
function checkGroupIdentity(draft) {
|
|
711
|
+
const issues = [];
|
|
712
|
+
if (draft.schemaVersion !== "1.0") {
|
|
713
|
+
issues.push(
|
|
714
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
715
|
+
"schema_version_invalid",
|
|
716
|
+
["schemaVersion"],
|
|
717
|
+
'The draft must have schemaVersion "1.0". A draft from createItemGroupDraft has it.'
|
|
718
|
+
)
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
if (draft.type !== "item-group") {
|
|
722
|
+
issues.push(_chunkXONKWL6Dcjs.issue.call(void 0, "type_mismatch", ["type"], `The draft's type must be "item-group".`));
|
|
723
|
+
}
|
|
724
|
+
if (_chunkXONKWL6Dcjs.isMissingId.call(void 0, draft.id)) {
|
|
725
|
+
issues.push(_chunkXONKWL6Dcjs.issue.call(void 0, "id_required", ["id"], "The group has no id."));
|
|
726
|
+
}
|
|
727
|
+
if (!_chunkXONKWL6Dcjs.isUnset.call(void 0, draft.shuffle) && draft.shuffle !== "none" && draft.shuffle !== "within-group") {
|
|
728
|
+
issues.push(
|
|
729
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
730
|
+
"ig_shuffle_invalid",
|
|
731
|
+
["shuffle"],
|
|
732
|
+
'Shuffling is either "none" or "within-group". Leave it out to keep the authored order.'
|
|
733
|
+
)
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
return issues;
|
|
737
|
+
}
|
|
738
|
+
var KINDS = /* @__PURE__ */ new Set(["text", "audio", "video", "image", "mixed"]);
|
|
739
|
+
var MEDIA_FOR_KIND = {
|
|
740
|
+
audio: ["audio"],
|
|
741
|
+
video: ["video", "embed"],
|
|
742
|
+
image: ["image"],
|
|
743
|
+
mixed: ["audio", "video", "image", "embed"]
|
|
744
|
+
};
|
|
745
|
+
function checkStimulus(stimulus) {
|
|
746
|
+
const issues = [];
|
|
747
|
+
const at = (...rest) => ["stimulus", ...rest];
|
|
748
|
+
if (_chunkXONKWL6Dcjs.isMissingId.call(void 0, stimulus.id)) {
|
|
749
|
+
issues.push(_chunkXONKWL6Dcjs.issue.call(void 0, "ig_stimulus_id_required", at("id"), "The stimulus has no id."));
|
|
750
|
+
}
|
|
751
|
+
const kind = stimulus.kind;
|
|
752
|
+
if (_chunkXONKWL6Dcjs.isUnwritten.call(void 0, kind)) {
|
|
753
|
+
issues.push(
|
|
754
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
755
|
+
"ig_stimulus_kind_required",
|
|
756
|
+
at("kind"),
|
|
757
|
+
"Choose what the questions are about: a text, a recording, a video, an image, or a mix."
|
|
758
|
+
)
|
|
759
|
+
);
|
|
760
|
+
} else if (typeof kind !== "string" || !KINDS.has(kind)) {
|
|
761
|
+
if (typeof kind === "string") {
|
|
762
|
+
issues.push(
|
|
763
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
764
|
+
"ig_stimulus_kind_invalid",
|
|
765
|
+
at("kind"),
|
|
766
|
+
`"${kind}" is not a stimulus kind. Use text, audio, video, image or mixed.`
|
|
767
|
+
)
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
if (_chunkXONKWL6Dcjs.isRecord.call(void 0, stimulus.media)) {
|
|
771
|
+
issues.push(..._chunkXONKWL6Dcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
772
|
+
}
|
|
773
|
+
return issues;
|
|
774
|
+
}
|
|
775
|
+
const hasBody = typeof stimulus.body === "string" && stimulus.body.trim() !== "";
|
|
776
|
+
const htmlPresent = !_chunkXONKWL6Dcjs.isUnset.call(void 0, stimulus.bodyHtml);
|
|
777
|
+
if (!hasBody && (kind === "text" || kind === "mixed" || htmlPresent)) {
|
|
778
|
+
issues.push(
|
|
779
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
780
|
+
"ig_stimulus_body_required",
|
|
781
|
+
at("body"),
|
|
782
|
+
_chunkXONKWL6Dcjs.isUnwritten.call(void 0, stimulus.bodyHtml) ? "Write the passage." : "Write the passage as plain text too. The rich-text version is shown only where a sanitiser is supplied."
|
|
783
|
+
)
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
if (kind !== "text" && _chunkXONKWL6Dcjs.isUnset.call(void 0, stimulus.media)) {
|
|
787
|
+
issues.push(
|
|
788
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_stimulus_media_required", at("media"), "Add the recording, video or image.")
|
|
789
|
+
);
|
|
790
|
+
} else if (_chunkXONKWL6Dcjs.isRecord.call(void 0, stimulus.media)) {
|
|
791
|
+
const allowed = MEDIA_FOR_KIND[kind];
|
|
792
|
+
const mediaType = stimulus.media.type;
|
|
793
|
+
if (allowed !== void 0 && typeof mediaType === "string" && !allowed.includes(mediaType)) {
|
|
794
|
+
issues.push(
|
|
795
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
796
|
+
"ig_stimulus_media_kind",
|
|
797
|
+
at("media", "type"),
|
|
798
|
+
`A "${kind}" stimulus cannot carry ${mediaType} media. Use ${allowed.join(" or ")}.`
|
|
799
|
+
)
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
issues.push(..._chunkXONKWL6Dcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
803
|
+
}
|
|
804
|
+
return issues;
|
|
805
|
+
}
|
|
806
|
+
function checkItems(draft) {
|
|
807
|
+
const issues = [];
|
|
808
|
+
const items = _chunkXONKWL6Dcjs.isUnset.call(void 0, draft.items) ? [] : draft.items;
|
|
809
|
+
if (!Array.isArray(items)) {
|
|
810
|
+
return issues;
|
|
811
|
+
}
|
|
812
|
+
if (items.length === 0) {
|
|
813
|
+
issues.push(
|
|
814
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_items_required", ["items"], "Add at least one question about this material.")
|
|
815
|
+
);
|
|
816
|
+
return issues;
|
|
817
|
+
}
|
|
818
|
+
const seen = /* @__PURE__ */ new Set();
|
|
819
|
+
const repeated = /* @__PURE__ */ new Set();
|
|
820
|
+
for (const [index, item] of items.entries()) {
|
|
821
|
+
if (!_chunkXONKWL6Dcjs.isRecord.call(void 0, item)) {
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
const ordinal = index + 1;
|
|
825
|
+
if (_chunkXONKWL6Dcjs.isMissingId.call(void 0, item.id)) {
|
|
826
|
+
issues.push(
|
|
827
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_item_id_required", ["items", index, "id"], `Question ${ordinal} has no id.`)
|
|
828
|
+
);
|
|
829
|
+
} else if (typeof item.id === "string") {
|
|
830
|
+
if (seen.has(item.id)) {
|
|
831
|
+
repeated.add(item.id);
|
|
832
|
+
}
|
|
833
|
+
seen.add(item.id);
|
|
834
|
+
}
|
|
835
|
+
if (item.type === "item-group") {
|
|
836
|
+
issues.push(
|
|
837
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
838
|
+
"ig_item_nested_group",
|
|
839
|
+
["items", index, "type"],
|
|
840
|
+
"Groups do not nest: every item must be an activity."
|
|
841
|
+
)
|
|
842
|
+
);
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
if (_chunkXONKWL6Dcjs.isUnwritten.call(void 0, item.type)) {
|
|
846
|
+
issues.push(
|
|
847
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
848
|
+
"ig_item_type_required",
|
|
849
|
+
["items", index, "type"],
|
|
850
|
+
`Choose what kind of question ${ordinal} is.`
|
|
851
|
+
)
|
|
852
|
+
);
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
if (typeof item.type !== "string") {
|
|
856
|
+
continue;
|
|
857
|
+
}
|
|
858
|
+
let result;
|
|
859
|
+
try {
|
|
860
|
+
result = validateDraft(item.type, item);
|
|
861
|
+
} catch (e) {
|
|
862
|
+
issues.push(
|
|
863
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
864
|
+
"ig_item_type_unknown",
|
|
865
|
+
["items", index, "type"],
|
|
866
|
+
`"${item.type}" is not a registered activity type.`
|
|
867
|
+
)
|
|
868
|
+
);
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
for (const found of result.issues) {
|
|
872
|
+
issues.push({ ...found, path: ["items", String(index), ...found.path] });
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
for (const id of repeated) {
|
|
876
|
+
issues.push(
|
|
877
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
return issues;
|
|
881
|
+
}
|
|
882
|
+
|
|
589
883
|
// src/authoring/index.ts
|
|
590
884
|
function validateDraft(type, draft) {
|
|
591
|
-
|
|
885
|
+
return _chunkXONKWL6Dcjs.withValidationScope.call(void 0, () => validateDraftInScope(type, draft));
|
|
886
|
+
}
|
|
887
|
+
function validateDraftInScope(type, draft) {
|
|
888
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
592
889
|
if (descriptor === void 0) {
|
|
593
|
-
throw new (0,
|
|
890
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(type));
|
|
594
891
|
}
|
|
595
|
-
const reported =
|
|
892
|
+
const reported = _chunkXONKWL6Dcjs.isRecord.call(void 0, draft) && _optionalChain([descriptor, 'access', _16 => _16.authoring, 'optionalAccess', _17 => _17.checkDraft]) !== void 0 ? descriptor.authoring.checkDraft(draft).map(normalise) : [];
|
|
596
893
|
const issues = [...reported];
|
|
597
894
|
const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
|
|
598
895
|
if (!parsed.success) {
|
|
896
|
+
const covered = _chunkXONKWL6Dcjs.coveredPathsOf.call(void 0, reported);
|
|
599
897
|
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
600
898
|
for (const schemaIssue of parsed.error.issues) {
|
|
601
899
|
const path = schemaIssue.path.map(String);
|
|
602
|
-
if (
|
|
900
|
+
if (covered.has(_chunkXONKWL6Dcjs.pathKey.call(void 0, path))) {
|
|
603
901
|
continue;
|
|
604
902
|
}
|
|
605
|
-
if (path.length > 0 &&
|
|
903
|
+
if (path.length > 0 && _chunkXONKWL6Dcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
606
904
|
const key = JSON.stringify(path);
|
|
607
905
|
if (!reportedEmpty.has(key)) {
|
|
608
906
|
reportedEmpty.add(key);
|
|
609
907
|
issues.push(
|
|
610
|
-
|
|
908
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
611
909
|
"null_not_allowed",
|
|
612
910
|
path,
|
|
613
911
|
typeof schemaIssue.path.at(-1) === "number" ? "This entry has no value. Remove it, or fill it in." : "This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
@@ -631,9 +929,9 @@ function validateDraft(type, draft) {
|
|
|
631
929
|
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
632
930
|
}
|
|
633
931
|
function createDraft(type, context) {
|
|
634
|
-
const descriptor =
|
|
932
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
635
933
|
if (descriptor === void 0) {
|
|
636
|
-
throw new (0,
|
|
934
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(type));
|
|
637
935
|
}
|
|
638
936
|
const create = _optionalChain([descriptor, 'access', _18 => _18.authoring, 'optionalAccess', _19 => _19.createDraft]);
|
|
639
937
|
if (create === void 0) {
|
|
@@ -658,19 +956,13 @@ function createDraft(type, context) {
|
|
|
658
956
|
return create({ newId });
|
|
659
957
|
}
|
|
660
958
|
function normalise(found) {
|
|
661
|
-
const documented = Object.hasOwn(
|
|
959
|
+
const documented = Object.hasOwn(_chunkXONKWL6Dcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkXONKWL6Dcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
662
960
|
return {
|
|
663
961
|
...found,
|
|
664
962
|
path: found.path.map(String),
|
|
665
963
|
severity: _nullishCoalesce(documented, () => ( (found.severity === "incomplete" ? "incomplete" : "invalid")))
|
|
666
964
|
};
|
|
667
965
|
}
|
|
668
|
-
function covers(reported, failed) {
|
|
669
|
-
if (failed.length === 0) {
|
|
670
|
-
return reported.length === 0;
|
|
671
|
-
}
|
|
672
|
-
return failed.every((segment, index) => reported[index] === segment);
|
|
673
|
-
}
|
|
674
966
|
|
|
675
967
|
// src/redact.ts
|
|
676
968
|
function mergePolicy(base, overrides) {
|
|
@@ -728,9 +1020,9 @@ function redactValue(value, policy, reveal) {
|
|
|
728
1020
|
}
|
|
729
1021
|
function redact(data, options = {}) {
|
|
730
1022
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
731
|
-
const descriptor =
|
|
1023
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
732
1024
|
if (descriptor === void 0) {
|
|
733
|
-
throw new (0,
|
|
1025
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(data.type));
|
|
734
1026
|
}
|
|
735
1027
|
if (descriptor.fieldPolicy === void 0) {
|
|
736
1028
|
throw new Error(
|
|
@@ -743,7 +1035,7 @@ function redact(data, options = {}) {
|
|
|
743
1035
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
744
1036
|
const parsed = descriptor.redactedSchema.safeParse(result);
|
|
745
1037
|
if (!parsed.success) {
|
|
746
|
-
throw new (0,
|
|
1038
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
747
1039
|
descriptor.type,
|
|
748
1040
|
parsed.error.issues.map((issue2) => ({
|
|
749
1041
|
path: issue2.path.map(String),
|
|
@@ -757,13 +1049,13 @@ function redact(data, options = {}) {
|
|
|
757
1049
|
}
|
|
758
1050
|
function assertRedacted(data) {
|
|
759
1051
|
if (typeof data !== "object" || data === null) {
|
|
760
|
-
throw new (0,
|
|
1052
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("unknown", [
|
|
761
1053
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
762
1054
|
]);
|
|
763
1055
|
}
|
|
764
1056
|
const candidate = data;
|
|
765
1057
|
if (candidate.redacted !== true) {
|
|
766
|
-
throw new (0,
|
|
1058
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
767
1059
|
{
|
|
768
1060
|
path: ["redacted"],
|
|
769
1061
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -772,12 +1064,12 @@ function assertRedacted(data) {
|
|
|
772
1064
|
]);
|
|
773
1065
|
}
|
|
774
1066
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
775
|
-
const descriptor =
|
|
1067
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
776
1068
|
if (descriptor === void 0) {
|
|
777
|
-
throw new (0,
|
|
1069
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(type);
|
|
778
1070
|
}
|
|
779
1071
|
if (descriptor.redactedSchema === void 0) {
|
|
780
|
-
throw new (0,
|
|
1072
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(descriptor.type, [
|
|
781
1073
|
{
|
|
782
1074
|
path: [],
|
|
783
1075
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -787,7 +1079,7 @@ function assertRedacted(data) {
|
|
|
787
1079
|
}
|
|
788
1080
|
const parsed = descriptor.redactedSchema.safeParse(candidate);
|
|
789
1081
|
if (!parsed.success) {
|
|
790
|
-
throw new (0,
|
|
1082
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
791
1083
|
descriptor.type,
|
|
792
1084
|
parsed.error.issues.map((issue2) => ({
|
|
793
1085
|
path: issue2.path.map(String),
|
|
@@ -803,7 +1095,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
803
1095
|
title: "public",
|
|
804
1096
|
body: "public",
|
|
805
1097
|
bodyHtml: "public",
|
|
806
|
-
media:
|
|
1098
|
+
media: _chunkXONKWL6Dcjs.MEDIA_FIELD_POLICY,
|
|
807
1099
|
locale: "public",
|
|
808
1100
|
attribution: "public",
|
|
809
1101
|
transcript: "author-only"
|
|
@@ -829,9 +1121,9 @@ function redactItemGroup(group, options = {}) {
|
|
|
829
1121
|
redacted: true
|
|
830
1122
|
};
|
|
831
1123
|
if (reveal === "none") {
|
|
832
|
-
const parsed =
|
|
1124
|
+
const parsed = _chunkDQKJUMUWcjs.RedactedItemGroupSchema.safeParse(result);
|
|
833
1125
|
if (!parsed.success) {
|
|
834
|
-
throw new (0,
|
|
1126
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
835
1127
|
"item-group",
|
|
836
1128
|
parsed.error.issues.map((issue2) => ({
|
|
837
1129
|
path: issue2.path.map(String),
|
|
@@ -845,13 +1137,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
845
1137
|
}
|
|
846
1138
|
function assertRedactedItemGroup(data) {
|
|
847
1139
|
if (typeof data !== "object" || data === null) {
|
|
848
|
-
throw new (0,
|
|
1140
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("item-group", [
|
|
849
1141
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
850
1142
|
]);
|
|
851
1143
|
}
|
|
852
1144
|
const candidate = data;
|
|
853
1145
|
if (candidate.redacted !== true) {
|
|
854
|
-
throw new (0,
|
|
1146
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("item-group", [
|
|
855
1147
|
{
|
|
856
1148
|
path: ["redacted"],
|
|
857
1149
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -859,9 +1151,9 @@ function assertRedactedItemGroup(data) {
|
|
|
859
1151
|
}
|
|
860
1152
|
]);
|
|
861
1153
|
}
|
|
862
|
-
const parsed =
|
|
1154
|
+
const parsed = _chunkDQKJUMUWcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
863
1155
|
if (!parsed.success) {
|
|
864
|
-
throw new (0,
|
|
1156
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
865
1157
|
"item-group",
|
|
866
1158
|
parsed.error.issues.map((issue2) => ({
|
|
867
1159
|
path: issue2.path.map(String),
|
|
@@ -874,8 +1166,8 @@ function assertRedactedItemGroup(data) {
|
|
|
874
1166
|
try {
|
|
875
1167
|
assertRedacted(item);
|
|
876
1168
|
} catch (error) {
|
|
877
|
-
if (error instanceof
|
|
878
|
-
throw new (0,
|
|
1169
|
+
if (error instanceof _chunkXONKWL6Dcjs.ActivitySchemaError) {
|
|
1170
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
879
1171
|
"item-group",
|
|
880
1172
|
error.errors.map((issue2) => ({
|
|
881
1173
|
...issue2,
|
|
@@ -986,5 +1278,24 @@ function assertRedactedItemGroup(data) {
|
|
|
986
1278
|
|
|
987
1279
|
|
|
988
1280
|
|
|
989
|
-
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
exports.ActivitySchemaError = _chunkXONKWL6Dcjs.ActivitySchemaError; exports.BlankConfigSchema = _chunkXONKWL6Dcjs.BlankConfigSchema; exports.DEFAULT_PASS_THRESHOLD = _chunkUHQVIC3Pcjs.DEFAULT_PASS_THRESHOLD; exports.DICTATION_MAX_ACCEPTED_TRANSCRIPTS = _chunkXONKWL6Dcjs.DICTATION_MAX_ACCEPTED_TRANSCRIPTS; exports.DICTATION_MAX_EQUIVALENCES = _chunkXONKWL6Dcjs.DICTATION_MAX_EQUIVALENCES; exports.DICTATION_MAX_EQUIVALENCE_LENGTH = _chunkXONKWL6Dcjs.DICTATION_MAX_EQUIVALENCE_LENGTH; exports.DICTATION_MAX_TEXT_LENGTH = _chunkXONKWL6Dcjs.DICTATION_MAX_TEXT_LENGTH; exports.DICTATION_MAX_TRANSCRIPT_LENGTH = _chunkXONKWL6Dcjs.DICTATION_MAX_TRANSCRIPT_LENGTH; exports.DeferredScoringError = _chunkXONKWL6Dcjs.DeferredScoringError; exports.DictationDataSchema = _chunkXONKWL6Dcjs.DictationDataSchema; exports.DictationEquivalenceSchema = _chunkXONKWL6Dcjs.DictationEquivalenceSchema; exports.DictationSlowMediaSchema = _chunkXONKWL6Dcjs.DictationSlowMediaSchema; exports.DictationToleranceSchema = _chunkXONKWL6Dcjs.DictationToleranceSchema; exports.FeedbackSchema = _chunkXONKWL6Dcjs.FeedbackSchema; exports.FillInTheBlanksDataSchema = _chunkXONKWL6Dcjs.FillInTheBlanksDataSchema; exports.GapSelectBankSchema = _chunkXONKWL6Dcjs.GapSelectBankSchema; exports.GapSelectChoiceSchema = _chunkXONKWL6Dcjs.GapSelectChoiceSchema; exports.GapSelectDataSchema = _chunkXONKWL6Dcjs.GapSelectDataSchema; exports.GapSelectGapSchema = _chunkXONKWL6Dcjs.GapSelectGapSchema; exports.ItemGroupSchema = _chunkDQKJUMUWcjs.ItemGroupSchema; exports.MediaPlaybackSchema = _chunkXONKWL6Dcjs.MediaPlaybackSchema; exports.MediaSchema = _chunkXONKWL6Dcjs.MediaSchema; exports.MediaUrlSchema = _chunkXONKWL6Dcjs.MediaUrlSchema; exports.MultipleChoiceDataSchema = _chunkXONKWL6Dcjs.MultipleChoiceDataSchema; exports.MultipleChoiceOptionMediaSchema = _chunkXONKWL6Dcjs.MultipleChoiceOptionMediaSchema; exports.MultipleChoiceOptionSchema = _chunkXONKWL6Dcjs.MultipleChoiceOptionSchema; exports.NativeControlHintSchema = _chunkXONKWL6Dcjs.NativeControlHintSchema; exports.RedactedBlankConfigSchema = _chunkXONKWL6Dcjs.RedactedBlankConfigSchema; exports.RedactedDictationDataSchema = _chunkXONKWL6Dcjs.RedactedDictationDataSchema; exports.RedactedDictationSlowMediaSchema = _chunkXONKWL6Dcjs.RedactedDictationSlowMediaSchema; exports.RedactedFillInTheBlanksDataSchema = _chunkXONKWL6Dcjs.RedactedFillInTheBlanksDataSchema; exports.RedactedGapSelectBankSchema = _chunkXONKWL6Dcjs.RedactedGapSelectBankSchema; exports.RedactedGapSelectChoiceSchema = _chunkXONKWL6Dcjs.RedactedGapSelectChoiceSchema; exports.RedactedGapSelectDataSchema = _chunkXONKWL6Dcjs.RedactedGapSelectDataSchema; exports.RedactedGapSelectGapSchema = _chunkXONKWL6Dcjs.RedactedGapSelectGapSchema; exports.RedactedItemGroupSchema = _chunkDQKJUMUWcjs.RedactedItemGroupSchema; exports.RedactedMediaSchema = _chunkXONKWL6Dcjs.RedactedMediaSchema; exports.RedactedMultipleChoiceDataSchema = _chunkXONKWL6Dcjs.RedactedMultipleChoiceDataSchema; exports.RedactedMultipleChoiceOptionMediaSchema = _chunkXONKWL6Dcjs.RedactedMultipleChoiceOptionMediaSchema; exports.RedactedMultipleChoiceOptionSchema = _chunkXONKWL6Dcjs.RedactedMultipleChoiceOptionSchema; exports.RedactedScoringError = _chunkXONKWL6Dcjs.RedactedScoringError; exports.RedactedStimulusSchema = _chunkDQKJUMUWcjs.RedactedStimulusSchema; exports.RedactedWrittenResponseDataSchema = _chunkXONKWL6Dcjs.RedactedWrittenResponseDataSchema; exports.StimulusSchema = _chunkDQKJUMUWcjs.StimulusSchema; exports.TextMatchPolicySchema = _chunkXONKWL6Dcjs.TextMatchPolicySchema; exports.UnknownActivityTypeError = _chunkXONKWL6Dcjs.UnknownActivityTypeError; exports.WrittenResponseDataSchema = _chunkXONKWL6Dcjs.WrittenResponseDataSchema; exports.WrittenResponseRubricCriterionSchema = _chunkXONKWL6Dcjs.WrittenResponseRubricCriterionSchema; exports.WrittenResponseRubricSchema = _chunkXONKWL6Dcjs.WrittenResponseRubricSchema; exports.XAPIVerb = _chunkFT7SAC3Xcjs.XAPIVerb; exports.XAPI_VERB_DISPLAY = _chunkFT7SAC3Xcjs.XAPI_VERB_DISPLAY; exports.alignDictation = _chunkXONKWL6Dcjs.alignDictation; exports.assertRedacted = assertRedacted; exports.assertRedactedItemGroup = assertRedactedItemGroup; exports.canonicalJson = canonicalJson; exports.classifyBand = _chunkUHQVIC3Pcjs.classifyBand; exports.composeAssessmentScore = _chunkUHQVIC3Pcjs.composeAssessmentScore; exports.computePassThreshold = _chunkUHQVIC3Pcjs.computePassThreshold; exports.contentHash = contentHash; exports.countWords = _chunkXONKWL6Dcjs.countWords; exports.createDraft = createDraft; exports.createItemGroupDraft = createItemGroupDraft; exports.defineActivityType = _chunkXONKWL6Dcjs.defineActivityType; exports.dictationJsonSchema = _chunkDQKJUMUWcjs.dictationJsonSchema; exports.dictationReferenceWords = _chunkXONKWL6Dcjs.dictationReferenceWords; exports.dictationType = _chunkXONKWL6Dcjs.dictationType; exports.diffDictationChars = _chunkUHQVIC3Pcjs.diffDictationChars; exports.diffResponses = diffResponses; exports.entryKeyOf = entryKeyOf; exports.evaluate = _chunkUHQVIC3Pcjs.evaluate; exports.fillInTheBlanksJsonSchema = _chunkDQKJUMUWcjs.fillInTheBlanksJsonSchema; exports.fillInTheBlanksType = _chunkXONKWL6Dcjs.fillInTheBlanksType; exports.fingerprint = fingerprint; exports.flattenSequence = flattenSequence; exports.gapSelectJsonSchema = _chunkDQKJUMUWcjs.gapSelectJsonSchema; exports.gapSelectType = _chunkXONKWL6Dcjs.gapSelectType; exports.getActivityTypeDescriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor; exports.gradeFromRubric = _chunkUHQVIC3Pcjs.gradeFromRubric; exports.gte = _chunkUHQVIC3Pcjs.gte; exports.hasGrade = _chunkUHQVIC3Pcjs.hasGrade; exports.hashSeed = hashSeed; exports.isItemGroup = isItemGroup; exports.itemGroupJsonSchema = _chunkDQKJUMUWcjs.itemGroupJsonSchema; exports.jsonSchemaFor = _chunkDQKJUMUWcjs.jsonSchemaFor; exports.levenshteinDistance = _chunkXONKWL6Dcjs.levenshteinDistance; exports.matchText = _chunkXONKWL6Dcjs.matchText; exports.multipleChoiceJsonSchema = _chunkDQKJUMUWcjs.multipleChoiceJsonSchema; exports.multipleChoiceType = _chunkXONKWL6Dcjs.multipleChoiceType; exports.outcomeFromGrade = _chunkUHQVIC3Pcjs.outcomeFromGrade; exports.planAttempt = planAttempt; exports.planMediaBudgets = planMediaBudgets; exports.redact = redact; exports.redactItemGroup = redactItemGroup; exports.registerActivityType = _chunkXONKWL6Dcjs.registerActivityType; exports.registeredActivityTypes = _chunkXONKWL6Dcjs.registeredActivityTypes; exports.resolvePlaybackPolicy = resolvePlaybackPolicy; exports.restoreAttemptState = restoreAttemptState; exports.restoreMediaPlayLedger = restoreMediaPlayLedger; exports.roundGrade = _chunkUHQVIC3Pcjs.roundGrade; exports.score = _chunkUHQVIC3Pcjs.score; exports.scoredItemsFromPlan = scoredItemsFromPlan; exports.seededShuffle = seededShuffle; exports.serializeAttemptState = serializeAttemptState; exports.serializeMediaPlayLedger = serializeMediaPlayLedger; exports.slotMediaKey = slotMediaKey; exports.stimulusJsonSchema = _chunkDQKJUMUWcjs.stimulusJsonSchema; exports.stimulusMediaKey = stimulusMediaKey; exports.validateActivity = _chunkDQKJUMUWcjs.validateActivity; exports.validateDraft = validateDraft; exports.validateItemGroup = _chunkDQKJUMUWcjs.validateItemGroup; exports.validateItemGroupDraft = validateItemGroupDraft; exports.validateXAPIStatement = _chunkFT7SAC3Xcjs.validateXAPIStatement; exports.verifyAttemptPlan = verifyAttemptPlan; exports.writtenResponseJsonSchema = _chunkDQKJUMUWcjs.writtenResponseJsonSchema; exports.writtenResponseType = _chunkXONKWL6Dcjs.writtenResponseType; exports.xAPIBuilder = _chunkFT7SAC3Xcjs.xAPIBuilder; exports.xapiDefinitionFor = _chunkFT7SAC3Xcjs.xapiDefinitionFor;
|
|
990
1301
|
//# sourceMappingURL=index.cjs.map
|