@intellectif/lk-core 0.12.0 → 0.13.1
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 +36 -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-VYE6BYON.cjs → chunk-DQKJUMUW.cjs} +38 -15
- package/dist/chunk-DQKJUMUW.cjs.map +1 -0
- package/dist/{chunk-RK2NVTHZ.js → chunk-FGN4LLSP.js} +50 -6
- package/dist/chunk-FGN4LLSP.js.map +1 -0
- package/dist/{chunk-O2IVKTHV.cjs → chunk-FT7SAC3X.cjs} +4 -4
- package/dist/{chunk-O2IVKTHV.cjs.map → chunk-FT7SAC3X.cjs.map} +1 -1
- package/dist/{chunk-UQPNJP2O.js → chunk-PYP3HCRQ.js} +2 -2
- package/dist/{chunk-4OHWLCI6.cjs → chunk-UHQVIC3P.cjs} +58 -14
- package/dist/chunk-UHQVIC3P.cjs.map +1 -0
- package/dist/{chunk-FVN37GIH.js → chunk-XKKKWKRH.js} +1944 -177
- package/dist/chunk-XKKKWKRH.js.map +1 -0
- package/dist/{chunk-J6POE4HL.cjs → chunk-XONKWL6D.cjs} +1785 -18
- package/dist/chunk-XONKWL6D.cjs.map +1 -0
- package/dist/{chunk-7JMMPE7O.js → chunk-Y36S3X3L.js} +26 -3
- package/dist/chunk-Y36S3X3L.js.map +1 -0
- package/dist/{index-B_scInLM.d.cts → index-BefQ8FAS.d.cts} +192 -15
- package/dist/{index-CRKtWP5G.d.ts → index-BiIvdASA.d.ts} +192 -15
- package/dist/index.cjs +132 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +64 -6
- 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-4OHWLCI6.cjs.map +0 -1
- package/dist/chunk-7JMMPE7O.js.map +0 -1
- package/dist/chunk-FVN37GIH.js.map +0 -1
- package/dist/chunk-J6POE4HL.cjs.map +0 -1
- package/dist/chunk-RK2NVTHZ.js.map +0 -1
- package/dist/chunk-VYE6BYON.cjs.map +0 -1
- /package/dist/{chunk-UQPNJP2O.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 _chunk4OHWLCI6cjs = require('./chunk-4OHWLCI6.cjs');
|
|
14
13
|
|
|
14
|
+
var _chunkUHQVIC3Pcjs = require('./chunk-UHQVIC3P.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var _chunkO2IVKTHVcjs = require('./chunk-O2IVKTHV.cjs');
|
|
21
20
|
|
|
21
|
+
var _chunkFT7SAC3Xcjs = require('./chunk-FT7SAC3X.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -32,9 +32,9 @@ var _chunkO2IVKTHVcjs = require('./chunk-O2IVKTHV.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var _chunkVYE6BYONcjs = require('./chunk-VYE6BYON.cjs');
|
|
36
35
|
|
|
37
36
|
|
|
37
|
+
var _chunkDQKJUMUWcjs = require('./chunk-DQKJUMUW.cjs');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -87,7 +87,29 @@ var _chunkVYE6BYONcjs = require('./chunk-VYE6BYON.cjs');
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
|
|
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');
|
|
91
113
|
|
|
92
114
|
// src/content-hash.ts
|
|
93
115
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -616,19 +638,22 @@ function createItemGroupDraft(context) {
|
|
|
616
638
|
};
|
|
617
639
|
}
|
|
618
640
|
function validateItemGroupDraft(draft) {
|
|
641
|
+
return _chunkXONKWL6Dcjs.withValidationScope.call(void 0, () => validateItemGroupDraftInScope(draft));
|
|
642
|
+
}
|
|
643
|
+
function validateItemGroupDraftInScope(draft) {
|
|
619
644
|
const issues = [];
|
|
620
|
-
if (!
|
|
645
|
+
if (!_chunkXONKWL6Dcjs.isRecord.call(void 0, draft)) {
|
|
621
646
|
issues.push(
|
|
622
|
-
|
|
647
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_not_an_object", [], "A group must be an object with a stimulus and its items.")
|
|
623
648
|
);
|
|
624
649
|
return { status: "invalid", issues };
|
|
625
650
|
}
|
|
626
651
|
issues.push(...checkGroupIdentity(draft));
|
|
627
|
-
if (
|
|
652
|
+
if (_chunkXONKWL6Dcjs.isRecord.call(void 0, draft.stimulus)) {
|
|
628
653
|
issues.push(...checkStimulus(draft.stimulus));
|
|
629
|
-
} else if (
|
|
654
|
+
} else if (_chunkXONKWL6Dcjs.isUnset.call(void 0, draft.stimulus)) {
|
|
630
655
|
issues.push(
|
|
631
|
-
|
|
656
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
632
657
|
"ig_stimulus_required",
|
|
633
658
|
["stimulus"],
|
|
634
659
|
"Add the passage, recording or image the questions are about."
|
|
@@ -636,16 +661,25 @@ function validateItemGroupDraft(draft) {
|
|
|
636
661
|
);
|
|
637
662
|
}
|
|
638
663
|
issues.push(...checkItems(draft));
|
|
639
|
-
|
|
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 });
|
|
640
674
|
if (!parsed.success) {
|
|
641
675
|
for (const schemaIssue of parsed.error.issues) {
|
|
642
676
|
const path = schemaIssue.path.map(String);
|
|
643
|
-
if (issues.some((known) =>
|
|
677
|
+
if (issues.some((known) => _chunkXONKWL6Dcjs.covers.call(void 0, known.path, path))) {
|
|
644
678
|
continue;
|
|
645
679
|
}
|
|
646
|
-
if (path.length > 0 &&
|
|
680
|
+
if (path.length > 0 && _chunkXONKWL6Dcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
647
681
|
issues.push(
|
|
648
|
-
|
|
682
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
649
683
|
"null_not_allowed",
|
|
650
684
|
path,
|
|
651
685
|
"This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
@@ -661,7 +695,7 @@ function validateItemGroupDraft(draft) {
|
|
|
661
695
|
});
|
|
662
696
|
}
|
|
663
697
|
}
|
|
664
|
-
const stored =
|
|
698
|
+
const stored = _chunkDQKJUMUWcjs.validateItemGroup.call(void 0, draft);
|
|
665
699
|
if (issues.length === 0 && stored.success) {
|
|
666
700
|
return { status: "complete", data: stored.data, issues };
|
|
667
701
|
}
|
|
@@ -677,7 +711,7 @@ function checkGroupIdentity(draft) {
|
|
|
677
711
|
const issues = [];
|
|
678
712
|
if (draft.schemaVersion !== "1.0") {
|
|
679
713
|
issues.push(
|
|
680
|
-
|
|
714
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
681
715
|
"schema_version_invalid",
|
|
682
716
|
["schemaVersion"],
|
|
683
717
|
'The draft must have schemaVersion "1.0". A draft from createItemGroupDraft has it.'
|
|
@@ -685,14 +719,14 @@ function checkGroupIdentity(draft) {
|
|
|
685
719
|
);
|
|
686
720
|
}
|
|
687
721
|
if (draft.type !== "item-group") {
|
|
688
|
-
issues.push(
|
|
722
|
+
issues.push(_chunkXONKWL6Dcjs.issue.call(void 0, "type_mismatch", ["type"], `The draft's type must be "item-group".`));
|
|
689
723
|
}
|
|
690
|
-
if (
|
|
691
|
-
issues.push(
|
|
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."));
|
|
692
726
|
}
|
|
693
|
-
if (!
|
|
727
|
+
if (!_chunkXONKWL6Dcjs.isUnset.call(void 0, draft.shuffle) && draft.shuffle !== "none" && draft.shuffle !== "within-group") {
|
|
694
728
|
issues.push(
|
|
695
|
-
|
|
729
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
696
730
|
"ig_shuffle_invalid",
|
|
697
731
|
["shuffle"],
|
|
698
732
|
'Shuffling is either "none" or "within-group". Leave it out to keep the authored order.'
|
|
@@ -711,13 +745,13 @@ var MEDIA_FOR_KIND = {
|
|
|
711
745
|
function checkStimulus(stimulus) {
|
|
712
746
|
const issues = [];
|
|
713
747
|
const at = (...rest) => ["stimulus", ...rest];
|
|
714
|
-
if (
|
|
715
|
-
issues.push(
|
|
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."));
|
|
716
750
|
}
|
|
717
751
|
const kind = stimulus.kind;
|
|
718
|
-
if (
|
|
752
|
+
if (_chunkXONKWL6Dcjs.isUnwritten.call(void 0, kind)) {
|
|
719
753
|
issues.push(
|
|
720
|
-
|
|
754
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
721
755
|
"ig_stimulus_kind_required",
|
|
722
756
|
at("kind"),
|
|
723
757
|
"Choose what the questions are about: a text, a recording, a video, an image, or a mix."
|
|
@@ -726,71 +760,71 @@ function checkStimulus(stimulus) {
|
|
|
726
760
|
} else if (typeof kind !== "string" || !KINDS.has(kind)) {
|
|
727
761
|
if (typeof kind === "string") {
|
|
728
762
|
issues.push(
|
|
729
|
-
|
|
763
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
730
764
|
"ig_stimulus_kind_invalid",
|
|
731
765
|
at("kind"),
|
|
732
766
|
`"${kind}" is not a stimulus kind. Use text, audio, video, image or mixed.`
|
|
733
767
|
)
|
|
734
768
|
);
|
|
735
769
|
}
|
|
736
|
-
if (
|
|
737
|
-
issues.push(...
|
|
770
|
+
if (_chunkXONKWL6Dcjs.isRecord.call(void 0, stimulus.media)) {
|
|
771
|
+
issues.push(..._chunkXONKWL6Dcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
738
772
|
}
|
|
739
773
|
return issues;
|
|
740
774
|
}
|
|
741
775
|
const hasBody = typeof stimulus.body === "string" && stimulus.body.trim() !== "";
|
|
742
|
-
const htmlPresent = !
|
|
776
|
+
const htmlPresent = !_chunkXONKWL6Dcjs.isUnset.call(void 0, stimulus.bodyHtml);
|
|
743
777
|
if (!hasBody && (kind === "text" || kind === "mixed" || htmlPresent)) {
|
|
744
778
|
issues.push(
|
|
745
|
-
|
|
779
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
746
780
|
"ig_stimulus_body_required",
|
|
747
781
|
at("body"),
|
|
748
|
-
|
|
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."
|
|
749
783
|
)
|
|
750
784
|
);
|
|
751
785
|
}
|
|
752
|
-
if (kind !== "text" &&
|
|
786
|
+
if (kind !== "text" && _chunkXONKWL6Dcjs.isUnset.call(void 0, stimulus.media)) {
|
|
753
787
|
issues.push(
|
|
754
|
-
|
|
788
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_stimulus_media_required", at("media"), "Add the recording, video or image.")
|
|
755
789
|
);
|
|
756
|
-
} else if (
|
|
790
|
+
} else if (_chunkXONKWL6Dcjs.isRecord.call(void 0, stimulus.media)) {
|
|
757
791
|
const allowed = MEDIA_FOR_KIND[kind];
|
|
758
792
|
const mediaType = stimulus.media.type;
|
|
759
793
|
if (allowed !== void 0 && typeof mediaType === "string" && !allowed.includes(mediaType)) {
|
|
760
794
|
issues.push(
|
|
761
|
-
|
|
795
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
762
796
|
"ig_stimulus_media_kind",
|
|
763
797
|
at("media", "type"),
|
|
764
798
|
`A "${kind}" stimulus cannot carry ${mediaType} media. Use ${allowed.join(" or ")}.`
|
|
765
799
|
)
|
|
766
800
|
);
|
|
767
801
|
}
|
|
768
|
-
issues.push(...
|
|
802
|
+
issues.push(..._chunkXONKWL6Dcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
769
803
|
}
|
|
770
804
|
return issues;
|
|
771
805
|
}
|
|
772
806
|
function checkItems(draft) {
|
|
773
807
|
const issues = [];
|
|
774
|
-
const items =
|
|
808
|
+
const items = _chunkXONKWL6Dcjs.isUnset.call(void 0, draft.items) ? [] : draft.items;
|
|
775
809
|
if (!Array.isArray(items)) {
|
|
776
810
|
return issues;
|
|
777
811
|
}
|
|
778
812
|
if (items.length === 0) {
|
|
779
813
|
issues.push(
|
|
780
|
-
|
|
814
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_items_required", ["items"], "Add at least one question about this material.")
|
|
781
815
|
);
|
|
782
816
|
return issues;
|
|
783
817
|
}
|
|
784
818
|
const seen = /* @__PURE__ */ new Set();
|
|
785
819
|
const repeated = /* @__PURE__ */ new Set();
|
|
786
820
|
for (const [index, item] of items.entries()) {
|
|
787
|
-
if (!
|
|
821
|
+
if (!_chunkXONKWL6Dcjs.isRecord.call(void 0, item)) {
|
|
788
822
|
continue;
|
|
789
823
|
}
|
|
790
824
|
const ordinal = index + 1;
|
|
791
|
-
if (
|
|
825
|
+
if (_chunkXONKWL6Dcjs.isMissingId.call(void 0, item.id)) {
|
|
792
826
|
issues.push(
|
|
793
|
-
|
|
827
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_item_id_required", ["items", index, "id"], `Question ${ordinal} has no id.`)
|
|
794
828
|
);
|
|
795
829
|
} else if (typeof item.id === "string") {
|
|
796
830
|
if (seen.has(item.id)) {
|
|
@@ -800,7 +834,7 @@ function checkItems(draft) {
|
|
|
800
834
|
}
|
|
801
835
|
if (item.type === "item-group") {
|
|
802
836
|
issues.push(
|
|
803
|
-
|
|
837
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
804
838
|
"ig_item_nested_group",
|
|
805
839
|
["items", index, "type"],
|
|
806
840
|
"Groups do not nest: every item must be an activity."
|
|
@@ -808,9 +842,9 @@ function checkItems(draft) {
|
|
|
808
842
|
);
|
|
809
843
|
continue;
|
|
810
844
|
}
|
|
811
|
-
if (
|
|
845
|
+
if (_chunkXONKWL6Dcjs.isUnwritten.call(void 0, item.type)) {
|
|
812
846
|
issues.push(
|
|
813
|
-
|
|
847
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
814
848
|
"ig_item_type_required",
|
|
815
849
|
["items", index, "type"],
|
|
816
850
|
`Choose what kind of question ${ordinal} is.`
|
|
@@ -824,9 +858,12 @@ function checkItems(draft) {
|
|
|
824
858
|
let result;
|
|
825
859
|
try {
|
|
826
860
|
result = validateDraft(item.type, item);
|
|
827
|
-
} catch (
|
|
861
|
+
} catch (error) {
|
|
862
|
+
if (!(error instanceof _chunkXONKWL6Dcjs.UnknownActivityTypeError) || error.activityType !== item.type) {
|
|
863
|
+
throw error;
|
|
864
|
+
}
|
|
828
865
|
issues.push(
|
|
829
|
-
|
|
866
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
830
867
|
"ig_item_type_unknown",
|
|
831
868
|
["items", index, "type"],
|
|
832
869
|
`"${item.type}" is not a registered activity type.`
|
|
@@ -840,7 +877,7 @@ function checkItems(draft) {
|
|
|
840
877
|
}
|
|
841
878
|
for (const id of repeated) {
|
|
842
879
|
issues.push(
|
|
843
|
-
|
|
880
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
844
881
|
);
|
|
845
882
|
}
|
|
846
883
|
return issues;
|
|
@@ -848,26 +885,30 @@ function checkItems(draft) {
|
|
|
848
885
|
|
|
849
886
|
// src/authoring/index.ts
|
|
850
887
|
function validateDraft(type, draft) {
|
|
851
|
-
|
|
888
|
+
return _chunkXONKWL6Dcjs.withValidationScope.call(void 0, () => validateDraftInScope(type, draft));
|
|
889
|
+
}
|
|
890
|
+
function validateDraftInScope(type, draft) {
|
|
891
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
852
892
|
if (descriptor === void 0) {
|
|
853
|
-
throw new (0,
|
|
893
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(type));
|
|
854
894
|
}
|
|
855
|
-
const reported =
|
|
895
|
+
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) : [];
|
|
856
896
|
const issues = [...reported];
|
|
857
897
|
const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
|
|
858
898
|
if (!parsed.success) {
|
|
899
|
+
const covered = _chunkXONKWL6Dcjs.coveredPathsOf.call(void 0, reported);
|
|
859
900
|
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
860
901
|
for (const schemaIssue of parsed.error.issues) {
|
|
861
902
|
const path = schemaIssue.path.map(String);
|
|
862
|
-
if (
|
|
903
|
+
if (covered.has(_chunkXONKWL6Dcjs.pathKey.call(void 0, path))) {
|
|
863
904
|
continue;
|
|
864
905
|
}
|
|
865
|
-
if (path.length > 0 &&
|
|
906
|
+
if (path.length > 0 && _chunkXONKWL6Dcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
866
907
|
const key = JSON.stringify(path);
|
|
867
908
|
if (!reportedEmpty.has(key)) {
|
|
868
909
|
reportedEmpty.add(key);
|
|
869
910
|
issues.push(
|
|
870
|
-
|
|
911
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
871
912
|
"null_not_allowed",
|
|
872
913
|
path,
|
|
873
914
|
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."
|
|
@@ -891,9 +932,9 @@ function validateDraft(type, draft) {
|
|
|
891
932
|
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
892
933
|
}
|
|
893
934
|
function createDraft(type, context) {
|
|
894
|
-
const descriptor =
|
|
935
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
895
936
|
if (descriptor === void 0) {
|
|
896
|
-
throw new (0,
|
|
937
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(type));
|
|
897
938
|
}
|
|
898
939
|
const create = _optionalChain([descriptor, 'access', _18 => _18.authoring, 'optionalAccess', _19 => _19.createDraft]);
|
|
899
940
|
if (create === void 0) {
|
|
@@ -918,7 +959,7 @@ function createDraft(type, context) {
|
|
|
918
959
|
return create({ newId });
|
|
919
960
|
}
|
|
920
961
|
function normalise(found) {
|
|
921
|
-
const documented = Object.hasOwn(
|
|
962
|
+
const documented = Object.hasOwn(_chunkXONKWL6Dcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkXONKWL6Dcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
922
963
|
return {
|
|
923
964
|
...found,
|
|
924
965
|
path: found.path.map(String),
|
|
@@ -982,9 +1023,9 @@ function redactValue(value, policy, reveal) {
|
|
|
982
1023
|
}
|
|
983
1024
|
function redact(data, options = {}) {
|
|
984
1025
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
985
|
-
const descriptor =
|
|
1026
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
986
1027
|
if (descriptor === void 0) {
|
|
987
|
-
throw new (0,
|
|
1028
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(data.type));
|
|
988
1029
|
}
|
|
989
1030
|
if (descriptor.fieldPolicy === void 0) {
|
|
990
1031
|
throw new Error(
|
|
@@ -997,7 +1038,7 @@ function redact(data, options = {}) {
|
|
|
997
1038
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
998
1039
|
const parsed = descriptor.redactedSchema.safeParse(result);
|
|
999
1040
|
if (!parsed.success) {
|
|
1000
|
-
throw new (0,
|
|
1041
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1001
1042
|
descriptor.type,
|
|
1002
1043
|
parsed.error.issues.map((issue2) => ({
|
|
1003
1044
|
path: issue2.path.map(String),
|
|
@@ -1011,13 +1052,13 @@ function redact(data, options = {}) {
|
|
|
1011
1052
|
}
|
|
1012
1053
|
function assertRedacted(data) {
|
|
1013
1054
|
if (typeof data !== "object" || data === null) {
|
|
1014
|
-
throw new (0,
|
|
1055
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("unknown", [
|
|
1015
1056
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
1016
1057
|
]);
|
|
1017
1058
|
}
|
|
1018
1059
|
const candidate = data;
|
|
1019
1060
|
if (candidate.redacted !== true) {
|
|
1020
|
-
throw new (0,
|
|
1061
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
1021
1062
|
{
|
|
1022
1063
|
path: ["redacted"],
|
|
1023
1064
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -1026,12 +1067,12 @@ function assertRedacted(data) {
|
|
|
1026
1067
|
]);
|
|
1027
1068
|
}
|
|
1028
1069
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
1029
|
-
const descriptor =
|
|
1070
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1030
1071
|
if (descriptor === void 0) {
|
|
1031
|
-
throw new (0,
|
|
1072
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(type);
|
|
1032
1073
|
}
|
|
1033
1074
|
if (descriptor.redactedSchema === void 0) {
|
|
1034
|
-
throw new (0,
|
|
1075
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(descriptor.type, [
|
|
1035
1076
|
{
|
|
1036
1077
|
path: [],
|
|
1037
1078
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -1041,7 +1082,7 @@ function assertRedacted(data) {
|
|
|
1041
1082
|
}
|
|
1042
1083
|
const parsed = descriptor.redactedSchema.safeParse(candidate);
|
|
1043
1084
|
if (!parsed.success) {
|
|
1044
|
-
throw new (0,
|
|
1085
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1045
1086
|
descriptor.type,
|
|
1046
1087
|
parsed.error.issues.map((issue2) => ({
|
|
1047
1088
|
path: issue2.path.map(String),
|
|
@@ -1057,7 +1098,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
1057
1098
|
title: "public",
|
|
1058
1099
|
body: "public",
|
|
1059
1100
|
bodyHtml: "public",
|
|
1060
|
-
media:
|
|
1101
|
+
media: _chunkXONKWL6Dcjs.MEDIA_FIELD_POLICY,
|
|
1061
1102
|
locale: "public",
|
|
1062
1103
|
attribution: "public",
|
|
1063
1104
|
transcript: "author-only"
|
|
@@ -1083,9 +1124,9 @@ function redactItemGroup(group, options = {}) {
|
|
|
1083
1124
|
redacted: true
|
|
1084
1125
|
};
|
|
1085
1126
|
if (reveal === "none") {
|
|
1086
|
-
const parsed =
|
|
1127
|
+
const parsed = _chunkDQKJUMUWcjs.RedactedItemGroupSchema.safeParse(result);
|
|
1087
1128
|
if (!parsed.success) {
|
|
1088
|
-
throw new (0,
|
|
1129
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1089
1130
|
"item-group",
|
|
1090
1131
|
parsed.error.issues.map((issue2) => ({
|
|
1091
1132
|
path: issue2.path.map(String),
|
|
@@ -1099,13 +1140,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
1099
1140
|
}
|
|
1100
1141
|
function assertRedactedItemGroup(data) {
|
|
1101
1142
|
if (typeof data !== "object" || data === null) {
|
|
1102
|
-
throw new (0,
|
|
1143
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("item-group", [
|
|
1103
1144
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
1104
1145
|
]);
|
|
1105
1146
|
}
|
|
1106
1147
|
const candidate = data;
|
|
1107
1148
|
if (candidate.redacted !== true) {
|
|
1108
|
-
throw new (0,
|
|
1149
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("item-group", [
|
|
1109
1150
|
{
|
|
1110
1151
|
path: ["redacted"],
|
|
1111
1152
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -1113,9 +1154,9 @@ function assertRedactedItemGroup(data) {
|
|
|
1113
1154
|
}
|
|
1114
1155
|
]);
|
|
1115
1156
|
}
|
|
1116
|
-
const parsed =
|
|
1157
|
+
const parsed = _chunkDQKJUMUWcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
1117
1158
|
if (!parsed.success) {
|
|
1118
|
-
throw new (0,
|
|
1159
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1119
1160
|
"item-group",
|
|
1120
1161
|
parsed.error.issues.map((issue2) => ({
|
|
1121
1162
|
path: issue2.path.map(String),
|
|
@@ -1128,8 +1169,8 @@ function assertRedactedItemGroup(data) {
|
|
|
1128
1169
|
try {
|
|
1129
1170
|
assertRedacted(item);
|
|
1130
1171
|
} catch (error) {
|
|
1131
|
-
if (error instanceof
|
|
1132
|
-
throw new (0,
|
|
1172
|
+
if (error instanceof _chunkXONKWL6Dcjs.ActivitySchemaError) {
|
|
1173
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1133
1174
|
"item-group",
|
|
1134
1175
|
error.errors.map((issue2) => ({
|
|
1135
1176
|
...issue2,
|
|
@@ -1242,5 +1283,22 @@ function assertRedactedItemGroup(data) {
|
|
|
1242
1283
|
|
|
1243
1284
|
|
|
1244
1285
|
|
|
1245
|
-
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
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;
|
|
1246
1304
|
//# sourceMappingURL=index.cjs.map
|