@intellectif/lk-core 0.13.0 → 0.14.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 +35 -0
- package/README.md +1 -1
- package/dist/{activity-DfAmJ1sl.d.cts → activity-BVkg9VDo.d.cts} +153 -4
- package/dist/{activity-DfAmJ1sl.d.ts → activity-BVkg9VDo.d.ts} +153 -4
- package/dist/{chunk-DQKJUMUW.cjs → chunk-2NIALQEH.cjs} +24 -19
- package/dist/chunk-2NIALQEH.cjs.map +1 -0
- package/dist/{chunk-XKKKWKRH.js → chunk-6RND47QE.js} +694 -126
- package/dist/chunk-6RND47QE.js.map +1 -0
- package/dist/{chunk-FT7SAC3X.cjs → chunk-CZRUMHKW.cjs} +4 -4
- package/dist/{chunk-FT7SAC3X.cjs.map → chunk-CZRUMHKW.cjs.map} +1 -1
- package/dist/chunk-J5OIRIOW.cjs +1034 -0
- package/dist/chunk-J5OIRIOW.cjs.map +1 -0
- package/dist/{chunk-Y36S3X3L.js → chunk-NBADQ3JU.js} +7 -2
- package/dist/chunk-NBADQ3JU.js.map +1 -0
- package/dist/{chunk-PYP3HCRQ.js → chunk-R7PV3XIC.js} +2 -2
- package/dist/chunk-RTIR6R2U.js +1034 -0
- package/dist/chunk-RTIR6R2U.js.map +1 -0
- package/dist/{chunk-XONKWL6D.cjs → chunk-VCXIPLEW.cjs} +585 -17
- package/dist/chunk-VCXIPLEW.cjs.map +1 -0
- package/dist/{index-Bz9wUigA.d.cts → index-BE1bM2Wi.d.cts} +225 -3
- package/dist/{index-CJbbVE9o.d.ts → index-v2_-Fyn3.d.ts} +225 -3
- package/dist/index.cjs +113 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -17
- package/dist/index.d.ts +50 -17
- package/dist/index.js +39 -6
- package/dist/index.js.map +1 -1
- package/dist/schemas.cjs +11 -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 +10 -2
- package/dist/scoring.cjs +23 -3
- package/dist/scoring.cjs.map +1 -1
- package/dist/scoring.d.cts +471 -16
- package/dist/scoring.d.ts +471 -16
- package/dist/scoring.js +24 -4
- 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 +63 -3
- package/vectors/replay.d.mts +7 -2
- package/vectors/replay.mjs +83 -1
- package/vectors/scoring.json +10875 -2
- package/dist/chunk-DQKJUMUW.cjs.map +0 -1
- package/dist/chunk-FGN4LLSP.js +0 -387
- package/dist/chunk-FGN4LLSP.js.map +0 -1
- package/dist/chunk-UHQVIC3P.cjs +0 -387
- package/dist/chunk-UHQVIC3P.cjs.map +0 -1
- package/dist/chunk-XKKKWKRH.js.map +0 -1
- package/dist/chunk-XONKWL6D.cjs.map +0 -1
- package/dist/chunk-Y36S3X3L.js.map +0 -1
- /package/dist/{chunk-PYP3HCRQ.js.map → chunk-R7PV3XIC.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var _chunkUHQVIC3Pcjs = require('./chunk-UHQVIC3P.cjs');
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
|
|
19
|
+
var _chunkJ5OIRIOWcjs = require('./chunk-J5OIRIOW.cjs');
|
|
20
20
|
|
|
21
|
-
var _chunkFT7SAC3Xcjs = require('./chunk-FT7SAC3X.cjs');
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
|
|
26
|
+
var _chunkCZRUMHKWcjs = require('./chunk-CZRUMHKW.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
@@ -34,13 +34,13 @@ var _chunkFT7SAC3Xcjs = require('./chunk-FT7SAC3X.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var _chunkDQKJUMUWcjs = require('./chunk-DQKJUMUW.cjs');
|
|
38
37
|
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
|
|
43
|
+
var _chunk2NIALQEHcjs = require('./chunk-2NIALQEH.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -109,7 +109,22 @@ var _chunkDQKJUMUWcjs = require('./chunk-DQKJUMUW.cjs');
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
var _chunkVCXIPLEWcjs = require('./chunk-VCXIPLEW.cjs');
|
|
113
128
|
|
|
114
129
|
// src/content-hash.ts
|
|
115
130
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -638,22 +653,22 @@ function createItemGroupDraft(context) {
|
|
|
638
653
|
};
|
|
639
654
|
}
|
|
640
655
|
function validateItemGroupDraft(draft) {
|
|
641
|
-
return
|
|
656
|
+
return _chunkVCXIPLEWcjs.withValidationScope.call(void 0, () => validateItemGroupDraftInScope(draft));
|
|
642
657
|
}
|
|
643
658
|
function validateItemGroupDraftInScope(draft) {
|
|
644
659
|
const issues = [];
|
|
645
|
-
if (!
|
|
660
|
+
if (!_chunkVCXIPLEWcjs.isRecord.call(void 0, draft)) {
|
|
646
661
|
issues.push(
|
|
647
|
-
|
|
662
|
+
_chunkVCXIPLEWcjs.issue.call(void 0, "ig_not_an_object", [], "A group must be an object with a stimulus and its items.")
|
|
648
663
|
);
|
|
649
664
|
return { status: "invalid", issues };
|
|
650
665
|
}
|
|
651
666
|
issues.push(...checkGroupIdentity(draft));
|
|
652
|
-
if (
|
|
667
|
+
if (_chunkVCXIPLEWcjs.isRecord.call(void 0, draft.stimulus)) {
|
|
653
668
|
issues.push(...checkStimulus(draft.stimulus));
|
|
654
|
-
} else if (
|
|
669
|
+
} else if (_chunkVCXIPLEWcjs.isUnset.call(void 0, draft.stimulus)) {
|
|
655
670
|
issues.push(
|
|
656
|
-
|
|
671
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
657
672
|
"ig_stimulus_required",
|
|
658
673
|
["stimulus"],
|
|
659
674
|
"Add the passage, recording or image the questions are about."
|
|
@@ -661,25 +676,25 @@ function validateItemGroupDraftInScope(draft) {
|
|
|
661
676
|
);
|
|
662
677
|
}
|
|
663
678
|
issues.push(...checkItems(draft));
|
|
664
|
-
if (
|
|
679
|
+
if (_chunkVCXIPLEWcjs.groupCaptionsRevealDictation.call(void 0, draft, (captionsUrl) => !_chunkVCXIPLEWcjs.isUnwritten.call(void 0, captionsUrl))) {
|
|
665
680
|
issues.push(
|
|
666
|
-
|
|
681
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
667
682
|
"dc_captions_not_allowed",
|
|
668
683
|
["stimulus", "media", "captionsUrl"],
|
|
669
|
-
|
|
684
|
+
_chunkVCXIPLEWcjs.GROUP_CAPTIONS_REVEAL_DICTATION
|
|
670
685
|
)
|
|
671
686
|
);
|
|
672
687
|
}
|
|
673
|
-
const parsed =
|
|
688
|
+
const parsed = _chunk2NIALQEHcjs.ItemGroupSchema.safeParse(draft, { reportInput: true });
|
|
674
689
|
if (!parsed.success) {
|
|
675
690
|
for (const schemaIssue of parsed.error.issues) {
|
|
676
691
|
const path = schemaIssue.path.map(String);
|
|
677
|
-
if (issues.some((known) =>
|
|
692
|
+
if (issues.some((known) => _chunkVCXIPLEWcjs.covers.call(void 0, known.path, path))) {
|
|
678
693
|
continue;
|
|
679
694
|
}
|
|
680
|
-
if (path.length > 0 &&
|
|
695
|
+
if (path.length > 0 && _chunkVCXIPLEWcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
681
696
|
issues.push(
|
|
682
|
-
|
|
697
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
683
698
|
"null_not_allowed",
|
|
684
699
|
path,
|
|
685
700
|
"This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
@@ -695,7 +710,7 @@ function validateItemGroupDraftInScope(draft) {
|
|
|
695
710
|
});
|
|
696
711
|
}
|
|
697
712
|
}
|
|
698
|
-
const stored =
|
|
713
|
+
const stored = _chunk2NIALQEHcjs.validateItemGroup.call(void 0, draft);
|
|
699
714
|
if (issues.length === 0 && stored.success) {
|
|
700
715
|
return { status: "complete", data: stored.data, issues };
|
|
701
716
|
}
|
|
@@ -711,7 +726,7 @@ function checkGroupIdentity(draft) {
|
|
|
711
726
|
const issues = [];
|
|
712
727
|
if (draft.schemaVersion !== "1.0") {
|
|
713
728
|
issues.push(
|
|
714
|
-
|
|
729
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
715
730
|
"schema_version_invalid",
|
|
716
731
|
["schemaVersion"],
|
|
717
732
|
'The draft must have schemaVersion "1.0". A draft from createItemGroupDraft has it.'
|
|
@@ -719,14 +734,14 @@ function checkGroupIdentity(draft) {
|
|
|
719
734
|
);
|
|
720
735
|
}
|
|
721
736
|
if (draft.type !== "item-group") {
|
|
722
|
-
issues.push(
|
|
737
|
+
issues.push(_chunkVCXIPLEWcjs.issue.call(void 0, "type_mismatch", ["type"], `The draft's type must be "item-group".`));
|
|
723
738
|
}
|
|
724
|
-
if (
|
|
725
|
-
issues.push(
|
|
739
|
+
if (_chunkVCXIPLEWcjs.isMissingId.call(void 0, draft.id)) {
|
|
740
|
+
issues.push(_chunkVCXIPLEWcjs.issue.call(void 0, "id_required", ["id"], "The group has no id."));
|
|
726
741
|
}
|
|
727
|
-
if (!
|
|
742
|
+
if (!_chunkVCXIPLEWcjs.isUnset.call(void 0, draft.shuffle) && draft.shuffle !== "none" && draft.shuffle !== "within-group") {
|
|
728
743
|
issues.push(
|
|
729
|
-
|
|
744
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
730
745
|
"ig_shuffle_invalid",
|
|
731
746
|
["shuffle"],
|
|
732
747
|
'Shuffling is either "none" or "within-group". Leave it out to keep the authored order.'
|
|
@@ -745,13 +760,13 @@ var MEDIA_FOR_KIND = {
|
|
|
745
760
|
function checkStimulus(stimulus) {
|
|
746
761
|
const issues = [];
|
|
747
762
|
const at = (...rest) => ["stimulus", ...rest];
|
|
748
|
-
if (
|
|
749
|
-
issues.push(
|
|
763
|
+
if (_chunkVCXIPLEWcjs.isMissingId.call(void 0, stimulus.id)) {
|
|
764
|
+
issues.push(_chunkVCXIPLEWcjs.issue.call(void 0, "ig_stimulus_id_required", at("id"), "The stimulus has no id."));
|
|
750
765
|
}
|
|
751
766
|
const kind = stimulus.kind;
|
|
752
|
-
if (
|
|
767
|
+
if (_chunkVCXIPLEWcjs.isUnwritten.call(void 0, kind)) {
|
|
753
768
|
issues.push(
|
|
754
|
-
|
|
769
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
755
770
|
"ig_stimulus_kind_required",
|
|
756
771
|
at("kind"),
|
|
757
772
|
"Choose what the questions are about: a text, a recording, a video, an image, or a mix."
|
|
@@ -760,71 +775,71 @@ function checkStimulus(stimulus) {
|
|
|
760
775
|
} else if (typeof kind !== "string" || !KINDS.has(kind)) {
|
|
761
776
|
if (typeof kind === "string") {
|
|
762
777
|
issues.push(
|
|
763
|
-
|
|
778
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
764
779
|
"ig_stimulus_kind_invalid",
|
|
765
780
|
at("kind"),
|
|
766
781
|
`"${kind}" is not a stimulus kind. Use text, audio, video, image or mixed.`
|
|
767
782
|
)
|
|
768
783
|
);
|
|
769
784
|
}
|
|
770
|
-
if (
|
|
771
|
-
issues.push(...
|
|
785
|
+
if (_chunkVCXIPLEWcjs.isRecord.call(void 0, stimulus.media)) {
|
|
786
|
+
issues.push(..._chunkVCXIPLEWcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
772
787
|
}
|
|
773
788
|
return issues;
|
|
774
789
|
}
|
|
775
790
|
const hasBody = typeof stimulus.body === "string" && stimulus.body.trim() !== "";
|
|
776
|
-
const htmlPresent = !
|
|
791
|
+
const htmlPresent = !_chunkVCXIPLEWcjs.isUnset.call(void 0, stimulus.bodyHtml);
|
|
777
792
|
if (!hasBody && (kind === "text" || kind === "mixed" || htmlPresent)) {
|
|
778
793
|
issues.push(
|
|
779
|
-
|
|
794
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
780
795
|
"ig_stimulus_body_required",
|
|
781
796
|
at("body"),
|
|
782
|
-
|
|
797
|
+
_chunkVCXIPLEWcjs.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
798
|
)
|
|
784
799
|
);
|
|
785
800
|
}
|
|
786
|
-
if (kind !== "text" &&
|
|
801
|
+
if (kind !== "text" && _chunkVCXIPLEWcjs.isUnset.call(void 0, stimulus.media)) {
|
|
787
802
|
issues.push(
|
|
788
|
-
|
|
803
|
+
_chunkVCXIPLEWcjs.issue.call(void 0, "ig_stimulus_media_required", at("media"), "Add the recording, video or image.")
|
|
789
804
|
);
|
|
790
|
-
} else if (
|
|
805
|
+
} else if (_chunkVCXIPLEWcjs.isRecord.call(void 0, stimulus.media)) {
|
|
791
806
|
const allowed = MEDIA_FOR_KIND[kind];
|
|
792
807
|
const mediaType = stimulus.media.type;
|
|
793
808
|
if (allowed !== void 0 && typeof mediaType === "string" && !allowed.includes(mediaType)) {
|
|
794
809
|
issues.push(
|
|
795
|
-
|
|
810
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
796
811
|
"ig_stimulus_media_kind",
|
|
797
812
|
at("media", "type"),
|
|
798
813
|
`A "${kind}" stimulus cannot carry ${mediaType} media. Use ${allowed.join(" or ")}.`
|
|
799
814
|
)
|
|
800
815
|
);
|
|
801
816
|
}
|
|
802
|
-
issues.push(...
|
|
817
|
+
issues.push(..._chunkVCXIPLEWcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
803
818
|
}
|
|
804
819
|
return issues;
|
|
805
820
|
}
|
|
806
821
|
function checkItems(draft) {
|
|
807
822
|
const issues = [];
|
|
808
|
-
const items =
|
|
823
|
+
const items = _chunkVCXIPLEWcjs.isUnset.call(void 0, draft.items) ? [] : draft.items;
|
|
809
824
|
if (!Array.isArray(items)) {
|
|
810
825
|
return issues;
|
|
811
826
|
}
|
|
812
827
|
if (items.length === 0) {
|
|
813
828
|
issues.push(
|
|
814
|
-
|
|
829
|
+
_chunkVCXIPLEWcjs.issue.call(void 0, "ig_items_required", ["items"], "Add at least one question about this material.")
|
|
815
830
|
);
|
|
816
831
|
return issues;
|
|
817
832
|
}
|
|
818
833
|
const seen = /* @__PURE__ */ new Set();
|
|
819
834
|
const repeated = /* @__PURE__ */ new Set();
|
|
820
835
|
for (const [index, item] of items.entries()) {
|
|
821
|
-
if (!
|
|
836
|
+
if (!_chunkVCXIPLEWcjs.isRecord.call(void 0, item)) {
|
|
822
837
|
continue;
|
|
823
838
|
}
|
|
824
839
|
const ordinal = index + 1;
|
|
825
|
-
if (
|
|
840
|
+
if (_chunkVCXIPLEWcjs.isMissingId.call(void 0, item.id)) {
|
|
826
841
|
issues.push(
|
|
827
|
-
|
|
842
|
+
_chunkVCXIPLEWcjs.issue.call(void 0, "ig_item_id_required", ["items", index, "id"], `Question ${ordinal} has no id.`)
|
|
828
843
|
);
|
|
829
844
|
} else if (typeof item.id === "string") {
|
|
830
845
|
if (seen.has(item.id)) {
|
|
@@ -834,7 +849,7 @@ function checkItems(draft) {
|
|
|
834
849
|
}
|
|
835
850
|
if (item.type === "item-group") {
|
|
836
851
|
issues.push(
|
|
837
|
-
|
|
852
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
838
853
|
"ig_item_nested_group",
|
|
839
854
|
["items", index, "type"],
|
|
840
855
|
"Groups do not nest: every item must be an activity."
|
|
@@ -842,9 +857,9 @@ function checkItems(draft) {
|
|
|
842
857
|
);
|
|
843
858
|
continue;
|
|
844
859
|
}
|
|
845
|
-
if (
|
|
860
|
+
if (_chunkVCXIPLEWcjs.isUnwritten.call(void 0, item.type)) {
|
|
846
861
|
issues.push(
|
|
847
|
-
|
|
862
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
848
863
|
"ig_item_type_required",
|
|
849
864
|
["items", index, "type"],
|
|
850
865
|
`Choose what kind of question ${ordinal} is.`
|
|
@@ -858,9 +873,12 @@ function checkItems(draft) {
|
|
|
858
873
|
let result;
|
|
859
874
|
try {
|
|
860
875
|
result = validateDraft(item.type, item);
|
|
861
|
-
} catch (
|
|
876
|
+
} catch (error) {
|
|
877
|
+
if (!(error instanceof _chunkVCXIPLEWcjs.UnknownActivityTypeError) || error.activityType !== item.type) {
|
|
878
|
+
throw error;
|
|
879
|
+
}
|
|
862
880
|
issues.push(
|
|
863
|
-
|
|
881
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
864
882
|
"ig_item_type_unknown",
|
|
865
883
|
["items", index, "type"],
|
|
866
884
|
`"${item.type}" is not a registered activity type.`
|
|
@@ -874,7 +892,7 @@ function checkItems(draft) {
|
|
|
874
892
|
}
|
|
875
893
|
for (const id of repeated) {
|
|
876
894
|
issues.push(
|
|
877
|
-
|
|
895
|
+
_chunkVCXIPLEWcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
878
896
|
);
|
|
879
897
|
}
|
|
880
898
|
return issues;
|
|
@@ -882,30 +900,30 @@ function checkItems(draft) {
|
|
|
882
900
|
|
|
883
901
|
// src/authoring/index.ts
|
|
884
902
|
function validateDraft(type, draft) {
|
|
885
|
-
return
|
|
903
|
+
return _chunkVCXIPLEWcjs.withValidationScope.call(void 0, () => validateDraftInScope(type, draft));
|
|
886
904
|
}
|
|
887
905
|
function validateDraftInScope(type, draft) {
|
|
888
|
-
const descriptor =
|
|
906
|
+
const descriptor = _chunkVCXIPLEWcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
889
907
|
if (descriptor === void 0) {
|
|
890
|
-
throw new (0,
|
|
908
|
+
throw new (0, _chunkVCXIPLEWcjs.UnknownActivityTypeError)(String(type));
|
|
891
909
|
}
|
|
892
|
-
const reported =
|
|
910
|
+
const reported = _chunkVCXIPLEWcjs.isRecord.call(void 0, draft) && _optionalChain([descriptor, 'access', _16 => _16.authoring, 'optionalAccess', _17 => _17.checkDraft]) !== void 0 ? descriptor.authoring.checkDraft(draft).map(normalise) : [];
|
|
893
911
|
const issues = [...reported];
|
|
894
912
|
const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
|
|
895
913
|
if (!parsed.success) {
|
|
896
|
-
const covered =
|
|
914
|
+
const covered = _chunkVCXIPLEWcjs.coveredPathsOf.call(void 0, reported);
|
|
897
915
|
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
898
916
|
for (const schemaIssue of parsed.error.issues) {
|
|
899
917
|
const path = schemaIssue.path.map(String);
|
|
900
|
-
if (covered.has(
|
|
918
|
+
if (covered.has(_chunkVCXIPLEWcjs.pathKey.call(void 0, path))) {
|
|
901
919
|
continue;
|
|
902
920
|
}
|
|
903
|
-
if (path.length > 0 &&
|
|
921
|
+
if (path.length > 0 && _chunkVCXIPLEWcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
904
922
|
const key = JSON.stringify(path);
|
|
905
923
|
if (!reportedEmpty.has(key)) {
|
|
906
924
|
reportedEmpty.add(key);
|
|
907
925
|
issues.push(
|
|
908
|
-
|
|
926
|
+
_chunkVCXIPLEWcjs.issue.call(void 0,
|
|
909
927
|
"null_not_allowed",
|
|
910
928
|
path,
|
|
911
929
|
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."
|
|
@@ -929,9 +947,9 @@ function validateDraftInScope(type, draft) {
|
|
|
929
947
|
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
930
948
|
}
|
|
931
949
|
function createDraft(type, context) {
|
|
932
|
-
const descriptor =
|
|
950
|
+
const descriptor = _chunkVCXIPLEWcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
933
951
|
if (descriptor === void 0) {
|
|
934
|
-
throw new (0,
|
|
952
|
+
throw new (0, _chunkVCXIPLEWcjs.UnknownActivityTypeError)(String(type));
|
|
935
953
|
}
|
|
936
954
|
const create = _optionalChain([descriptor, 'access', _18 => _18.authoring, 'optionalAccess', _19 => _19.createDraft]);
|
|
937
955
|
if (create === void 0) {
|
|
@@ -956,7 +974,7 @@ function createDraft(type, context) {
|
|
|
956
974
|
return create({ newId });
|
|
957
975
|
}
|
|
958
976
|
function normalise(found) {
|
|
959
|
-
const documented = Object.hasOwn(
|
|
977
|
+
const documented = Object.hasOwn(_chunkVCXIPLEWcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkVCXIPLEWcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
960
978
|
return {
|
|
961
979
|
...found,
|
|
962
980
|
path: found.path.map(String),
|
|
@@ -1020,9 +1038,9 @@ function redactValue(value, policy, reveal) {
|
|
|
1020
1038
|
}
|
|
1021
1039
|
function redact(data, options = {}) {
|
|
1022
1040
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
1023
|
-
const descriptor =
|
|
1041
|
+
const descriptor = _chunkVCXIPLEWcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
1024
1042
|
if (descriptor === void 0) {
|
|
1025
|
-
throw new (0,
|
|
1043
|
+
throw new (0, _chunkVCXIPLEWcjs.UnknownActivityTypeError)(String(data.type));
|
|
1026
1044
|
}
|
|
1027
1045
|
if (descriptor.fieldPolicy === void 0) {
|
|
1028
1046
|
throw new Error(
|
|
@@ -1035,7 +1053,7 @@ function redact(data, options = {}) {
|
|
|
1035
1053
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
1036
1054
|
const parsed = descriptor.redactedSchema.safeParse(result);
|
|
1037
1055
|
if (!parsed.success) {
|
|
1038
|
-
throw new (0,
|
|
1056
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(
|
|
1039
1057
|
descriptor.type,
|
|
1040
1058
|
parsed.error.issues.map((issue2) => ({
|
|
1041
1059
|
path: issue2.path.map(String),
|
|
@@ -1049,13 +1067,13 @@ function redact(data, options = {}) {
|
|
|
1049
1067
|
}
|
|
1050
1068
|
function assertRedacted(data) {
|
|
1051
1069
|
if (typeof data !== "object" || data === null) {
|
|
1052
|
-
throw new (0,
|
|
1070
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)("unknown", [
|
|
1053
1071
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
1054
1072
|
]);
|
|
1055
1073
|
}
|
|
1056
1074
|
const candidate = data;
|
|
1057
1075
|
if (candidate.redacted !== true) {
|
|
1058
|
-
throw new (0,
|
|
1076
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
1059
1077
|
{
|
|
1060
1078
|
path: ["redacted"],
|
|
1061
1079
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -1064,12 +1082,12 @@ function assertRedacted(data) {
|
|
|
1064
1082
|
]);
|
|
1065
1083
|
}
|
|
1066
1084
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
1067
|
-
const descriptor =
|
|
1085
|
+
const descriptor = _chunkVCXIPLEWcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1068
1086
|
if (descriptor === void 0) {
|
|
1069
|
-
throw new (0,
|
|
1087
|
+
throw new (0, _chunkVCXIPLEWcjs.UnknownActivityTypeError)(type);
|
|
1070
1088
|
}
|
|
1071
1089
|
if (descriptor.redactedSchema === void 0) {
|
|
1072
|
-
throw new (0,
|
|
1090
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(descriptor.type, [
|
|
1073
1091
|
{
|
|
1074
1092
|
path: [],
|
|
1075
1093
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -1079,7 +1097,7 @@ function assertRedacted(data) {
|
|
|
1079
1097
|
}
|
|
1080
1098
|
const parsed = descriptor.redactedSchema.safeParse(candidate);
|
|
1081
1099
|
if (!parsed.success) {
|
|
1082
|
-
throw new (0,
|
|
1100
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(
|
|
1083
1101
|
descriptor.type,
|
|
1084
1102
|
parsed.error.issues.map((issue2) => ({
|
|
1085
1103
|
path: issue2.path.map(String),
|
|
@@ -1095,7 +1113,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
1095
1113
|
title: "public",
|
|
1096
1114
|
body: "public",
|
|
1097
1115
|
bodyHtml: "public",
|
|
1098
|
-
media:
|
|
1116
|
+
media: _chunkVCXIPLEWcjs.MEDIA_FIELD_POLICY,
|
|
1099
1117
|
locale: "public",
|
|
1100
1118
|
attribution: "public",
|
|
1101
1119
|
transcript: "author-only"
|
|
@@ -1121,9 +1139,9 @@ function redactItemGroup(group, options = {}) {
|
|
|
1121
1139
|
redacted: true
|
|
1122
1140
|
};
|
|
1123
1141
|
if (reveal === "none") {
|
|
1124
|
-
const parsed =
|
|
1142
|
+
const parsed = _chunk2NIALQEHcjs.RedactedItemGroupSchema.safeParse(result);
|
|
1125
1143
|
if (!parsed.success) {
|
|
1126
|
-
throw new (0,
|
|
1144
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(
|
|
1127
1145
|
"item-group",
|
|
1128
1146
|
parsed.error.issues.map((issue2) => ({
|
|
1129
1147
|
path: issue2.path.map(String),
|
|
@@ -1137,13 +1155,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
1137
1155
|
}
|
|
1138
1156
|
function assertRedactedItemGroup(data) {
|
|
1139
1157
|
if (typeof data !== "object" || data === null) {
|
|
1140
|
-
throw new (0,
|
|
1158
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)("item-group", [
|
|
1141
1159
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
1142
1160
|
]);
|
|
1143
1161
|
}
|
|
1144
1162
|
const candidate = data;
|
|
1145
1163
|
if (candidate.redacted !== true) {
|
|
1146
|
-
throw new (0,
|
|
1164
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)("item-group", [
|
|
1147
1165
|
{
|
|
1148
1166
|
path: ["redacted"],
|
|
1149
1167
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -1151,9 +1169,9 @@ function assertRedactedItemGroup(data) {
|
|
|
1151
1169
|
}
|
|
1152
1170
|
]);
|
|
1153
1171
|
}
|
|
1154
|
-
const parsed =
|
|
1172
|
+
const parsed = _chunk2NIALQEHcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
1155
1173
|
if (!parsed.success) {
|
|
1156
|
-
throw new (0,
|
|
1174
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(
|
|
1157
1175
|
"item-group",
|
|
1158
1176
|
parsed.error.issues.map((issue2) => ({
|
|
1159
1177
|
path: issue2.path.map(String),
|
|
@@ -1166,8 +1184,8 @@ function assertRedactedItemGroup(data) {
|
|
|
1166
1184
|
try {
|
|
1167
1185
|
assertRedacted(item);
|
|
1168
1186
|
} catch (error) {
|
|
1169
|
-
if (error instanceof
|
|
1170
|
-
throw new (0,
|
|
1187
|
+
if (error instanceof _chunkVCXIPLEWcjs.ActivitySchemaError) {
|
|
1188
|
+
throw new (0, _chunkVCXIPLEWcjs.ActivitySchemaError)(
|
|
1171
1189
|
"item-group",
|
|
1172
1190
|
error.errors.map((issue2) => ({
|
|
1173
1191
|
...issue2,
|
|
@@ -1297,5 +1315,20 @@ function assertRedactedItemGroup(data) {
|
|
|
1297
1315
|
|
|
1298
1316
|
|
|
1299
1317
|
|
|
1300
|
-
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
exports.ActivitySchemaError = _chunkVCXIPLEWcjs.ActivitySchemaError; exports.BlankConfigSchema = _chunkVCXIPLEWcjs.BlankConfigSchema; exports.DEFAULT_PASS_THRESHOLD = _chunkJ5OIRIOWcjs.DEFAULT_PASS_THRESHOLD; exports.DICTATION_MAX_ACCEPTED_TRANSCRIPTS = _chunkVCXIPLEWcjs.DICTATION_MAX_ACCEPTED_TRANSCRIPTS; exports.DICTATION_MAX_EQUIVALENCES = _chunkVCXIPLEWcjs.DICTATION_MAX_EQUIVALENCES; exports.DICTATION_MAX_EQUIVALENCE_LENGTH = _chunkVCXIPLEWcjs.DICTATION_MAX_EQUIVALENCE_LENGTH; exports.DICTATION_MAX_TEXT_LENGTH = _chunkVCXIPLEWcjs.DICTATION_MAX_TEXT_LENGTH; exports.DICTATION_MAX_TRANSCRIPT_LENGTH = _chunkVCXIPLEWcjs.DICTATION_MAX_TRANSCRIPT_LENGTH; exports.DeferredScoringError = _chunkVCXIPLEWcjs.DeferredScoringError; exports.DictationDataSchema = _chunkVCXIPLEWcjs.DictationDataSchema; exports.DictationEquivalenceSchema = _chunkVCXIPLEWcjs.DictationEquivalenceSchema; exports.DictationSlowMediaSchema = _chunkVCXIPLEWcjs.DictationSlowMediaSchema; exports.DictationToleranceSchema = _chunkVCXIPLEWcjs.DictationToleranceSchema; exports.FeedbackSchema = _chunkVCXIPLEWcjs.FeedbackSchema; exports.FillInTheBlanksDataSchema = _chunkVCXIPLEWcjs.FillInTheBlanksDataSchema; exports.GapSelectBankSchema = _chunkVCXIPLEWcjs.GapSelectBankSchema; exports.GapSelectChoiceSchema = _chunkVCXIPLEWcjs.GapSelectChoiceSchema; exports.GapSelectDataSchema = _chunkVCXIPLEWcjs.GapSelectDataSchema; exports.GapSelectGapSchema = _chunkVCXIPLEWcjs.GapSelectGapSchema; exports.ItemGroupSchema = _chunk2NIALQEHcjs.ItemGroupSchema; exports.MediaPlaybackSchema = _chunkVCXIPLEWcjs.MediaPlaybackSchema; exports.MediaSchema = _chunkVCXIPLEWcjs.MediaSchema; exports.MediaUrlSchema = _chunkVCXIPLEWcjs.MediaUrlSchema; exports.MultipleChoiceDataSchema = _chunkVCXIPLEWcjs.MultipleChoiceDataSchema; exports.MultipleChoiceOptionMediaSchema = _chunkVCXIPLEWcjs.MultipleChoiceOptionMediaSchema; exports.MultipleChoiceOptionSchema = _chunkVCXIPLEWcjs.MultipleChoiceOptionSchema; exports.NativeControlHintSchema = _chunkVCXIPLEWcjs.NativeControlHintSchema; exports.READ_ALOUD_MAX_DIMENSION_WEIGHT = _chunkVCXIPLEWcjs.READ_ALOUD_MAX_DIMENSION_WEIGHT; exports.READ_ALOUD_MAX_REFERENCE_LENGTH = _chunkVCXIPLEWcjs.READ_ALOUD_MAX_REFERENCE_LENGTH; exports.READ_ALOUD_MAX_SECONDS = _chunkVCXIPLEWcjs.READ_ALOUD_MAX_SECONDS; exports.READ_ALOUD_MAX_TAKES = _chunkVCXIPLEWcjs.READ_ALOUD_MAX_TAKES; exports.ReadAloudDataSchema = _chunkVCXIPLEWcjs.ReadAloudDataSchema; exports.ReadAloudSlowMediaSchema = _chunkVCXIPLEWcjs.ReadAloudSlowMediaSchema; exports.RedactedBlankConfigSchema = _chunkVCXIPLEWcjs.RedactedBlankConfigSchema; exports.RedactedDictationDataSchema = _chunkVCXIPLEWcjs.RedactedDictationDataSchema; exports.RedactedDictationSlowMediaSchema = _chunkVCXIPLEWcjs.RedactedDictationSlowMediaSchema; exports.RedactedFillInTheBlanksDataSchema = _chunkVCXIPLEWcjs.RedactedFillInTheBlanksDataSchema; exports.RedactedGapSelectBankSchema = _chunkVCXIPLEWcjs.RedactedGapSelectBankSchema; exports.RedactedGapSelectChoiceSchema = _chunkVCXIPLEWcjs.RedactedGapSelectChoiceSchema; exports.RedactedGapSelectDataSchema = _chunkVCXIPLEWcjs.RedactedGapSelectDataSchema; exports.RedactedGapSelectGapSchema = _chunkVCXIPLEWcjs.RedactedGapSelectGapSchema; exports.RedactedItemGroupSchema = _chunk2NIALQEHcjs.RedactedItemGroupSchema; exports.RedactedMediaSchema = _chunkVCXIPLEWcjs.RedactedMediaSchema; exports.RedactedMultipleChoiceDataSchema = _chunkVCXIPLEWcjs.RedactedMultipleChoiceDataSchema; exports.RedactedMultipleChoiceOptionMediaSchema = _chunkVCXIPLEWcjs.RedactedMultipleChoiceOptionMediaSchema; exports.RedactedMultipleChoiceOptionSchema = _chunkVCXIPLEWcjs.RedactedMultipleChoiceOptionSchema; exports.RedactedReadAloudDataSchema = _chunkVCXIPLEWcjs.RedactedReadAloudDataSchema; exports.RedactedScoringError = _chunkVCXIPLEWcjs.RedactedScoringError; exports.RedactedStimulusSchema = _chunk2NIALQEHcjs.RedactedStimulusSchema; exports.RedactedWrittenResponseDataSchema = _chunkVCXIPLEWcjs.RedactedWrittenResponseDataSchema; exports.SPEECH_ASSESSMENT_MAX_WORDS = _chunkVCXIPLEWcjs.SPEECH_ASSESSMENT_MAX_WORDS; exports.StimulusSchema = _chunk2NIALQEHcjs.StimulusSchema; exports.TextMatchPolicySchema = _chunkVCXIPLEWcjs.TextMatchPolicySchema; exports.UnknownActivityTypeError = _chunkVCXIPLEWcjs.UnknownActivityTypeError; exports.WrittenResponseDataSchema = _chunkVCXIPLEWcjs.WrittenResponseDataSchema; exports.WrittenResponseRubricCriterionSchema = _chunkVCXIPLEWcjs.WrittenResponseRubricCriterionSchema; exports.WrittenResponseRubricSchema = _chunkVCXIPLEWcjs.WrittenResponseRubricSchema; exports.XAPIVerb = _chunkCZRUMHKWcjs.XAPIVerb; exports.XAPI_VERB_DISPLAY = _chunkCZRUMHKWcjs.XAPI_VERB_DISPLAY; exports.alignDictation = _chunkVCXIPLEWcjs.alignDictation; exports.alignReadAloud = _chunkJ5OIRIOWcjs.alignReadAloud; exports.assertRedacted = assertRedacted; exports.assertRedactedItemGroup = assertRedactedItemGroup; exports.canonicalJson = canonicalJson; exports.classifyBand = _chunkJ5OIRIOWcjs.classifyBand; exports.composeAssessmentScore = _chunkJ5OIRIOWcjs.composeAssessmentScore; exports.computePassThreshold = _chunkJ5OIRIOWcjs.computePassThreshold; exports.contentHash = contentHash; exports.countWords = _chunkVCXIPLEWcjs.countWords; exports.createDraft = createDraft; exports.createItemGroupDraft = createItemGroupDraft; exports.defineActivityType = _chunkVCXIPLEWcjs.defineActivityType; exports.dictationJsonSchema = _chunk2NIALQEHcjs.dictationJsonSchema; exports.dictationReferenceWords = _chunkVCXIPLEWcjs.dictationReferenceWords; exports.dictationType = _chunkVCXIPLEWcjs.dictationType; exports.diffDictationChars = _chunkJ5OIRIOWcjs.diffDictationChars; exports.diffResponses = diffResponses; exports.entryKeyOf = entryKeyOf; exports.evaluate = _chunkJ5OIRIOWcjs.evaluate; exports.fillInTheBlanksJsonSchema = _chunk2NIALQEHcjs.fillInTheBlanksJsonSchema; exports.fillInTheBlanksType = _chunkVCXIPLEWcjs.fillInTheBlanksType; exports.fingerprint = fingerprint; exports.flattenSequence = flattenSequence; exports.gapSelectJsonSchema = _chunk2NIALQEHcjs.gapSelectJsonSchema; exports.gapSelectType = _chunkVCXIPLEWcjs.gapSelectType; exports.getActivityTypeDescriptor = _chunkVCXIPLEWcjs.getActivityTypeDescriptor; exports.gradeFromRubric = _chunkJ5OIRIOWcjs.gradeFromRubric; exports.gradeReadAloud = _chunkJ5OIRIOWcjs.gradeReadAloud; exports.gte = _chunkJ5OIRIOWcjs.gte; exports.hasGrade = _chunkJ5OIRIOWcjs.hasGrade; exports.hashSeed = hashSeed; exports.inspectWav = _chunkJ5OIRIOWcjs.inspectWav; exports.isItemGroup = isItemGroup; exports.itemGroupJsonSchema = _chunk2NIALQEHcjs.itemGroupJsonSchema; exports.jsonSchemaFor = _chunk2NIALQEHcjs.jsonSchemaFor; exports.levenshteinDistance = _chunkVCXIPLEWcjs.levenshteinDistance; exports.matchText = _chunkVCXIPLEWcjs.matchText; exports.multipleChoiceJsonSchema = _chunk2NIALQEHcjs.multipleChoiceJsonSchema; exports.multipleChoiceType = _chunkVCXIPLEWcjs.multipleChoiceType; exports.outcomeFromGrade = _chunkJ5OIRIOWcjs.outcomeFromGrade; exports.outcomeFromUnscorable = _chunkJ5OIRIOWcjs.outcomeFromUnscorable; exports.planAttempt = planAttempt; exports.planMediaBudgets = planMediaBudgets; exports.readAloudJsonSchema = _chunk2NIALQEHcjs.readAloudJsonSchema; exports.readAloudType = _chunkVCXIPLEWcjs.readAloudType; exports.redact = redact; exports.redactItemGroup = redactItemGroup; exports.registerActivityType = _chunkVCXIPLEWcjs.registerActivityType; exports.registeredActivityTypes = _chunkVCXIPLEWcjs.registeredActivityTypes; exports.resolvePlaybackPolicy = resolvePlaybackPolicy; exports.restoreAttemptState = restoreAttemptState; exports.restoreMediaPlayLedger = restoreMediaPlayLedger; exports.roundGrade = _chunkJ5OIRIOWcjs.roundGrade; exports.score = _chunkJ5OIRIOWcjs.score; exports.scoredItemsFromPlan = scoredItemsFromPlan; exports.seededShuffle = seededShuffle; exports.serializeAttemptState = serializeAttemptState; exports.serializeMediaPlayLedger = serializeMediaPlayLedger; exports.slotMediaKey = slotMediaKey; exports.stimulusJsonSchema = _chunk2NIALQEHcjs.stimulusJsonSchema; exports.stimulusMediaKey = stimulusMediaKey; exports.validateActivity = _chunk2NIALQEHcjs.validateActivity; exports.validateDraft = validateDraft; exports.validateItemGroup = _chunk2NIALQEHcjs.validateItemGroup; exports.validateItemGroupDraft = validateItemGroupDraft; exports.validateSpeechAssessment = _chunkJ5OIRIOWcjs.validateSpeechAssessment; exports.validateXAPIStatement = _chunkCZRUMHKWcjs.validateXAPIStatement; exports.verifyAttemptPlan = verifyAttemptPlan; exports.writtenResponseJsonSchema = _chunk2NIALQEHcjs.writtenResponseJsonSchema; exports.writtenResponseType = _chunkVCXIPLEWcjs.writtenResponseType; exports.xAPIBuilder = _chunkCZRUMHKWcjs.xAPIBuilder; exports.xapiDefinitionFor = _chunkCZRUMHKWcjs.xapiDefinitionFor;
|
|
1301
1334
|
//# sourceMappingURL=index.cjs.map
|