@intellectif/lk-core 0.12.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 +24 -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-Bz9wUigA.d.cts} +181 -4
- package/dist/{index-CRKtWP5G.d.ts → index-CJbbVE9o.d.ts} +181 -4
- package/dist/index.cjs +128 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +60 -5
- 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.`
|
|
@@ -826,7 +860,7 @@ function checkItems(draft) {
|
|
|
826
860
|
result = validateDraft(item.type, item);
|
|
827
861
|
} catch (e) {
|
|
828
862
|
issues.push(
|
|
829
|
-
|
|
863
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
830
864
|
"ig_item_type_unknown",
|
|
831
865
|
["items", index, "type"],
|
|
832
866
|
`"${item.type}" is not a registered activity type.`
|
|
@@ -840,7 +874,7 @@ function checkItems(draft) {
|
|
|
840
874
|
}
|
|
841
875
|
for (const id of repeated) {
|
|
842
876
|
issues.push(
|
|
843
|
-
|
|
877
|
+
_chunkXONKWL6Dcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
844
878
|
);
|
|
845
879
|
}
|
|
846
880
|
return issues;
|
|
@@ -848,26 +882,30 @@ function checkItems(draft) {
|
|
|
848
882
|
|
|
849
883
|
// src/authoring/index.ts
|
|
850
884
|
function validateDraft(type, draft) {
|
|
851
|
-
|
|
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);
|
|
852
889
|
if (descriptor === void 0) {
|
|
853
|
-
throw new (0,
|
|
890
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(type));
|
|
854
891
|
}
|
|
855
|
-
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) : [];
|
|
856
893
|
const issues = [...reported];
|
|
857
894
|
const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
|
|
858
895
|
if (!parsed.success) {
|
|
896
|
+
const covered = _chunkXONKWL6Dcjs.coveredPathsOf.call(void 0, reported);
|
|
859
897
|
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
860
898
|
for (const schemaIssue of parsed.error.issues) {
|
|
861
899
|
const path = schemaIssue.path.map(String);
|
|
862
|
-
if (
|
|
900
|
+
if (covered.has(_chunkXONKWL6Dcjs.pathKey.call(void 0, path))) {
|
|
863
901
|
continue;
|
|
864
902
|
}
|
|
865
|
-
if (path.length > 0 &&
|
|
903
|
+
if (path.length > 0 && _chunkXONKWL6Dcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
866
904
|
const key = JSON.stringify(path);
|
|
867
905
|
if (!reportedEmpty.has(key)) {
|
|
868
906
|
reportedEmpty.add(key);
|
|
869
907
|
issues.push(
|
|
870
|
-
|
|
908
|
+
_chunkXONKWL6Dcjs.issue.call(void 0,
|
|
871
909
|
"null_not_allowed",
|
|
872
910
|
path,
|
|
873
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."
|
|
@@ -891,9 +929,9 @@ function validateDraft(type, draft) {
|
|
|
891
929
|
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
892
930
|
}
|
|
893
931
|
function createDraft(type, context) {
|
|
894
|
-
const descriptor =
|
|
932
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
895
933
|
if (descriptor === void 0) {
|
|
896
|
-
throw new (0,
|
|
934
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(type));
|
|
897
935
|
}
|
|
898
936
|
const create = _optionalChain([descriptor, 'access', _18 => _18.authoring, 'optionalAccess', _19 => _19.createDraft]);
|
|
899
937
|
if (create === void 0) {
|
|
@@ -918,7 +956,7 @@ function createDraft(type, context) {
|
|
|
918
956
|
return create({ newId });
|
|
919
957
|
}
|
|
920
958
|
function normalise(found) {
|
|
921
|
-
const documented = Object.hasOwn(
|
|
959
|
+
const documented = Object.hasOwn(_chunkXONKWL6Dcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkXONKWL6Dcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
922
960
|
return {
|
|
923
961
|
...found,
|
|
924
962
|
path: found.path.map(String),
|
|
@@ -982,9 +1020,9 @@ function redactValue(value, policy, reveal) {
|
|
|
982
1020
|
}
|
|
983
1021
|
function redact(data, options = {}) {
|
|
984
1022
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
985
|
-
const descriptor =
|
|
1023
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
986
1024
|
if (descriptor === void 0) {
|
|
987
|
-
throw new (0,
|
|
1025
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(String(data.type));
|
|
988
1026
|
}
|
|
989
1027
|
if (descriptor.fieldPolicy === void 0) {
|
|
990
1028
|
throw new Error(
|
|
@@ -997,7 +1035,7 @@ function redact(data, options = {}) {
|
|
|
997
1035
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
998
1036
|
const parsed = descriptor.redactedSchema.safeParse(result);
|
|
999
1037
|
if (!parsed.success) {
|
|
1000
|
-
throw new (0,
|
|
1038
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1001
1039
|
descriptor.type,
|
|
1002
1040
|
parsed.error.issues.map((issue2) => ({
|
|
1003
1041
|
path: issue2.path.map(String),
|
|
@@ -1011,13 +1049,13 @@ function redact(data, options = {}) {
|
|
|
1011
1049
|
}
|
|
1012
1050
|
function assertRedacted(data) {
|
|
1013
1051
|
if (typeof data !== "object" || data === null) {
|
|
1014
|
-
throw new (0,
|
|
1052
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("unknown", [
|
|
1015
1053
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
1016
1054
|
]);
|
|
1017
1055
|
}
|
|
1018
1056
|
const candidate = data;
|
|
1019
1057
|
if (candidate.redacted !== true) {
|
|
1020
|
-
throw new (0,
|
|
1058
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
1021
1059
|
{
|
|
1022
1060
|
path: ["redacted"],
|
|
1023
1061
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -1026,12 +1064,12 @@ function assertRedacted(data) {
|
|
|
1026
1064
|
]);
|
|
1027
1065
|
}
|
|
1028
1066
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
1029
|
-
const descriptor =
|
|
1067
|
+
const descriptor = _chunkXONKWL6Dcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1030
1068
|
if (descriptor === void 0) {
|
|
1031
|
-
throw new (0,
|
|
1069
|
+
throw new (0, _chunkXONKWL6Dcjs.UnknownActivityTypeError)(type);
|
|
1032
1070
|
}
|
|
1033
1071
|
if (descriptor.redactedSchema === void 0) {
|
|
1034
|
-
throw new (0,
|
|
1072
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(descriptor.type, [
|
|
1035
1073
|
{
|
|
1036
1074
|
path: [],
|
|
1037
1075
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -1041,7 +1079,7 @@ function assertRedacted(data) {
|
|
|
1041
1079
|
}
|
|
1042
1080
|
const parsed = descriptor.redactedSchema.safeParse(candidate);
|
|
1043
1081
|
if (!parsed.success) {
|
|
1044
|
-
throw new (0,
|
|
1082
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1045
1083
|
descriptor.type,
|
|
1046
1084
|
parsed.error.issues.map((issue2) => ({
|
|
1047
1085
|
path: issue2.path.map(String),
|
|
@@ -1057,7 +1095,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
1057
1095
|
title: "public",
|
|
1058
1096
|
body: "public",
|
|
1059
1097
|
bodyHtml: "public",
|
|
1060
|
-
media:
|
|
1098
|
+
media: _chunkXONKWL6Dcjs.MEDIA_FIELD_POLICY,
|
|
1061
1099
|
locale: "public",
|
|
1062
1100
|
attribution: "public",
|
|
1063
1101
|
transcript: "author-only"
|
|
@@ -1083,9 +1121,9 @@ function redactItemGroup(group, options = {}) {
|
|
|
1083
1121
|
redacted: true
|
|
1084
1122
|
};
|
|
1085
1123
|
if (reveal === "none") {
|
|
1086
|
-
const parsed =
|
|
1124
|
+
const parsed = _chunkDQKJUMUWcjs.RedactedItemGroupSchema.safeParse(result);
|
|
1087
1125
|
if (!parsed.success) {
|
|
1088
|
-
throw new (0,
|
|
1126
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1089
1127
|
"item-group",
|
|
1090
1128
|
parsed.error.issues.map((issue2) => ({
|
|
1091
1129
|
path: issue2.path.map(String),
|
|
@@ -1099,13 +1137,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
1099
1137
|
}
|
|
1100
1138
|
function assertRedactedItemGroup(data) {
|
|
1101
1139
|
if (typeof data !== "object" || data === null) {
|
|
1102
|
-
throw new (0,
|
|
1140
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("item-group", [
|
|
1103
1141
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
1104
1142
|
]);
|
|
1105
1143
|
}
|
|
1106
1144
|
const candidate = data;
|
|
1107
1145
|
if (candidate.redacted !== true) {
|
|
1108
|
-
throw new (0,
|
|
1146
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)("item-group", [
|
|
1109
1147
|
{
|
|
1110
1148
|
path: ["redacted"],
|
|
1111
1149
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -1113,9 +1151,9 @@ function assertRedactedItemGroup(data) {
|
|
|
1113
1151
|
}
|
|
1114
1152
|
]);
|
|
1115
1153
|
}
|
|
1116
|
-
const parsed =
|
|
1154
|
+
const parsed = _chunkDQKJUMUWcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
1117
1155
|
if (!parsed.success) {
|
|
1118
|
-
throw new (0,
|
|
1156
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1119
1157
|
"item-group",
|
|
1120
1158
|
parsed.error.issues.map((issue2) => ({
|
|
1121
1159
|
path: issue2.path.map(String),
|
|
@@ -1128,8 +1166,8 @@ function assertRedactedItemGroup(data) {
|
|
|
1128
1166
|
try {
|
|
1129
1167
|
assertRedacted(item);
|
|
1130
1168
|
} catch (error) {
|
|
1131
|
-
if (error instanceof
|
|
1132
|
-
throw new (0,
|
|
1169
|
+
if (error instanceof _chunkXONKWL6Dcjs.ActivitySchemaError) {
|
|
1170
|
+
throw new (0, _chunkXONKWL6Dcjs.ActivitySchemaError)(
|
|
1133
1171
|
"item-group",
|
|
1134
1172
|
error.errors.map((issue2) => ({
|
|
1135
1173
|
...issue2,
|
|
@@ -1242,5 +1280,22 @@ function assertRedactedItemGroup(data) {
|
|
|
1242
1280
|
|
|
1243
1281
|
|
|
1244
1282
|
|
|
1245
|
-
|
|
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;
|
|
1246
1301
|
//# sourceMappingURL=index.cjs.map
|