@intellectif/lk-core 1.1.0 → 1.2.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 +15 -0
- package/README.md +2 -1
- package/dist/{activity-MBOYLBjR.d.cts → activity-D705CXng.d.cts} +324 -2
- package/dist/{activity-MBOYLBjR.d.ts → activity-D705CXng.d.ts} +324 -2
- package/dist/ai-check.cjs +174 -12
- package/dist/ai-check.cjs.map +1 -1
- package/dist/ai-check.d.cts +15 -3
- package/dist/ai-check.d.ts +15 -3
- package/dist/ai-check.js +166 -4
- package/dist/ai-check.js.map +1 -1
- package/dist/{chunk-TJJFKKH2.cjs → chunk-46BXIGLG.cjs} +4 -4
- package/dist/{chunk-TJJFKKH2.cjs.map → chunk-46BXIGLG.cjs.map} +1 -1
- package/dist/{chunk-VSH7ECQL.cjs → chunk-4YANYTFN.cjs} +43 -43
- package/dist/{chunk-VSH7ECQL.cjs.map → chunk-4YANYTFN.cjs.map} +1 -1
- package/dist/chunk-7KOWU4RO.js +2207 -0
- package/dist/chunk-7KOWU4RO.js.map +1 -0
- package/dist/{chunk-DSDXL3JO.cjs → chunk-7THXD7AN.cjs} +657 -197
- package/dist/chunk-7THXD7AN.cjs.map +1 -0
- package/dist/chunk-CYCTIXUN.cjs +118 -0
- package/dist/chunk-CYCTIXUN.cjs.map +1 -0
- package/dist/chunk-CYPA5BW5.js +118 -0
- package/dist/chunk-CYPA5BW5.js.map +1 -0
- package/dist/{chunk-SJVRUPJT.js → chunk-JTNDIBZO.js} +2 -2
- package/dist/{chunk-XS6U2ARZ.js → chunk-MV2N2WNS.js} +6 -112
- package/dist/chunk-MV2N2WNS.js.map +1 -0
- package/dist/chunk-MXI26H62.cjs +2207 -0
- package/dist/chunk-MXI26H62.cjs.map +1 -0
- package/dist/{chunk-FBKTION6.js → chunk-QS7B42ZR.js} +640 -180
- package/dist/chunk-QS7B42ZR.js.map +1 -0
- package/dist/{chunk-IARLJ5MW.js → chunk-QX2ERL72.js} +2 -2
- package/dist/{chunk-2JT2WUQ2.cjs → chunk-ZWXQSKCX.cjs} +14 -120
- package/dist/chunk-ZWXQSKCX.cjs.map +1 -0
- package/dist/{index-DlcqkM_L.d.ts → index-BChYtrEe.d.ts} +1 -1
- package/dist/{index-DlCW0XaQ.d.cts → index-VXt_v3YI.d.cts} +1 -1
- package/dist/index.cjs +68 -593
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +245 -60
- package/dist/index.d.ts +245 -60
- package/dist/index.js +68 -593
- package/dist/index.js.map +1 -1
- package/dist/schemas.cjs +5 -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 +5 -3
- package/dist/scoring.cjs +3 -3
- package/dist/scoring.d.cts +2 -2
- package/dist/scoring.d.ts +2 -2
- package/dist/scoring.js +2 -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/dist/chunk-2JT2WUQ2.cjs.map +0 -1
- package/dist/chunk-DSDXL3JO.cjs.map +0 -1
- package/dist/chunk-FBKTION6.js.map +0 -1
- package/dist/chunk-LDFQUZII.cjs +0 -950
- package/dist/chunk-LDFQUZII.cjs.map +0 -1
- package/dist/chunk-NQHETFDA.js +0 -950
- package/dist/chunk-NQHETFDA.js.map +0 -1
- package/dist/chunk-XS6U2ARZ.js.map +0 -1
- /package/dist/{chunk-SJVRUPJT.js.map → chunk-JTNDIBZO.js.map} +0 -0
- /package/dist/{chunk-IARLJ5MW.js.map → chunk-QX2ERL72.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk46BXIGLGcjs = require('./chunk-46BXIGLG.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -18,6 +18,7 @@ var _chunkTJJFKKH2cjs = require('./chunk-TJJFKKH2.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
var _chunkCYCTIXUNcjs = require('./chunk-CYCTIXUN.cjs');
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
|
|
@@ -27,7 +28,6 @@ var _chunkTJJFKKH2cjs = require('./chunk-TJJFKKH2.cjs');
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
var _chunk2JT2WUQ2cjs = require('./chunk-2JT2WUQ2.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
@@ -50,7 +50,6 @@ var _chunk2JT2WUQ2cjs = require('./chunk-2JT2WUQ2.cjs');
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var _chunkLDFQUZIIcjs = require('./chunk-LDFQUZII.cjs');
|
|
54
53
|
|
|
55
54
|
|
|
56
55
|
|
|
@@ -61,6 +60,7 @@ var _chunkLDFQUZIIcjs = require('./chunk-LDFQUZII.cjs');
|
|
|
61
60
|
|
|
62
61
|
|
|
63
62
|
|
|
63
|
+
var _chunkMXI26H62cjs = require('./chunk-MXI26H62.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -75,7 +75,6 @@ var _chunkLDFQUZIIcjs = require('./chunk-LDFQUZII.cjs');
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
var _chunkVSH7ECQLcjs = require('./chunk-VSH7ECQL.cjs');
|
|
79
78
|
|
|
80
79
|
|
|
81
80
|
|
|
@@ -86,6 +85,7 @@ var _chunkVSH7ECQLcjs = require('./chunk-VSH7ECQL.cjs');
|
|
|
86
85
|
|
|
87
86
|
|
|
88
87
|
|
|
88
|
+
var _chunk4YANYTFNcjs = require('./chunk-4YANYTFN.cjs');
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
@@ -95,6 +95,7 @@ var _chunkVSH7ECQLcjs = require('./chunk-VSH7ECQL.cjs');
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
|
|
98
|
+
var _chunkZWXQSKCXcjs = require('./chunk-ZWXQSKCX.cjs');
|
|
98
99
|
|
|
99
100
|
|
|
100
101
|
|
|
@@ -122,7 +123,12 @@ var _chunkVSH7ECQLcjs = require('./chunk-VSH7ECQL.cjs');
|
|
|
122
123
|
|
|
123
124
|
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
var _chunk7THXD7ANcjs = require('./chunk-7THXD7AN.cjs');
|
|
126
132
|
|
|
127
133
|
// src/content-hash.ts
|
|
128
134
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -685,14 +691,14 @@ function frozenScoring(policy) {
|
|
|
685
691
|
if (policy === void 0 || policy === null) {
|
|
686
692
|
return void 0;
|
|
687
693
|
}
|
|
688
|
-
const checked =
|
|
694
|
+
const checked = _chunk4YANYTFNcjs.validateItemScoringPolicy.call(void 0, policy);
|
|
689
695
|
if (!checked.success) {
|
|
690
696
|
const first = checked.issues[0];
|
|
691
697
|
throw new Error(
|
|
692
698
|
`planAttempt: the scoring policy is not one to record \u2014 ${_nullishCoalesce(_optionalChain([first, 'optionalAccess', _24 => _24.message]), () => ( "invalid"))}` + (checked.issues.length > 1 ? ` (and ${checked.issues.length - 1} more)` : "")
|
|
693
699
|
);
|
|
694
700
|
}
|
|
695
|
-
return
|
|
701
|
+
return _chunk4YANYTFNcjs.resolveItemScoringPolicy.call(void 0, checked.data);
|
|
696
702
|
}
|
|
697
703
|
function missingOutcome(slot, policy) {
|
|
698
704
|
if (typeof policy === "function") {
|
|
@@ -813,551 +819,6 @@ function diffResponses(before, after) {
|
|
|
813
819
|
return entries;
|
|
814
820
|
}
|
|
815
821
|
|
|
816
|
-
// src/authoring/item-group.ts
|
|
817
|
-
function createItemGroupDraft(context) {
|
|
818
|
-
const issued = /* @__PURE__ */ new Set();
|
|
819
|
-
const newId = () => {
|
|
820
|
-
const id = context.newId();
|
|
821
|
-
if (typeof id !== "string" || id === "") {
|
|
822
|
-
throw new Error("createItemGroupDraft: newId() must return a non-empty string.");
|
|
823
|
-
}
|
|
824
|
-
if (issued.has(id)) {
|
|
825
|
-
throw new Error(
|
|
826
|
-
`createItemGroupDraft: newId() returned "${id}" twice. Ids within one draft must differ.`
|
|
827
|
-
);
|
|
828
|
-
}
|
|
829
|
-
issued.add(id);
|
|
830
|
-
return id;
|
|
831
|
-
};
|
|
832
|
-
return {
|
|
833
|
-
schemaVersion: "1.0",
|
|
834
|
-
type: "item-group",
|
|
835
|
-
id: newId(),
|
|
836
|
-
stimulus: { id: newId(), kind: "text", body: "" },
|
|
837
|
-
items: []
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
function createInteractiveVideoDraft(context) {
|
|
841
|
-
const draft = createItemGroupDraft(context);
|
|
842
|
-
return {
|
|
843
|
-
...draft,
|
|
844
|
-
stimulus: { id: draft.stimulus.id, kind: "video", media: { type: "video", url: "" } },
|
|
845
|
-
timeline: { cues: [] }
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
function validateItemGroupDraft(draft) {
|
|
849
|
-
return _chunkDSDXL3JOcjs.withValidationScope.call(void 0, () => validateItemGroupDraftInScope(draft));
|
|
850
|
-
}
|
|
851
|
-
function validateItemGroupDraftInScope(draft) {
|
|
852
|
-
const issues = [];
|
|
853
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, draft)) {
|
|
854
|
-
issues.push(
|
|
855
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_not_an_object", [], "A group must be an object with a stimulus and its items.")
|
|
856
|
-
);
|
|
857
|
-
return { status: "invalid", issues };
|
|
858
|
-
}
|
|
859
|
-
issues.push(...checkGroupIdentity(draft));
|
|
860
|
-
if (_chunkDSDXL3JOcjs.isRecord.call(void 0, draft.stimulus)) {
|
|
861
|
-
issues.push(...checkStimulus(draft.stimulus));
|
|
862
|
-
} else if (_chunkDSDXL3JOcjs.isUnset.call(void 0, draft.stimulus)) {
|
|
863
|
-
issues.push(
|
|
864
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
865
|
-
"ig_stimulus_required",
|
|
866
|
-
["stimulus"],
|
|
867
|
-
"Add the passage, recording or image the questions are about."
|
|
868
|
-
)
|
|
869
|
-
);
|
|
870
|
-
}
|
|
871
|
-
issues.push(...checkItems(draft));
|
|
872
|
-
if (draft.timeline !== void 0 && draft.timeline !== null) {
|
|
873
|
-
issues.push(...checkTimeline(draft));
|
|
874
|
-
}
|
|
875
|
-
const captions = _chunkDSDXL3JOcjs.groupCaptionsField.call(void 0, draft, (captionsUrl) => !_chunkDSDXL3JOcjs.isUnwritten.call(void 0, captionsUrl));
|
|
876
|
-
if (captions !== void 0) {
|
|
877
|
-
issues.push(
|
|
878
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
879
|
-
"dc_captions_not_allowed",
|
|
880
|
-
["stimulus", "media", captions],
|
|
881
|
-
_chunkDSDXL3JOcjs.GROUP_CAPTIONS_REVEAL_DICTATION
|
|
882
|
-
)
|
|
883
|
-
);
|
|
884
|
-
}
|
|
885
|
-
const parsed = _chunk2JT2WUQ2cjs.ItemGroupSchema.safeParse(draft, { reportInput: true });
|
|
886
|
-
if (!parsed.success) {
|
|
887
|
-
for (const schemaIssue of parsed.error.issues) {
|
|
888
|
-
const path = schemaIssue.path.map(String);
|
|
889
|
-
if (issues.some((known) => _chunkDSDXL3JOcjs.covers.call(void 0, known.path, path))) {
|
|
890
|
-
continue;
|
|
891
|
-
}
|
|
892
|
-
if (path.length > 0 && _chunkDSDXL3JOcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
893
|
-
issues.push(
|
|
894
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
895
|
-
"null_not_allowed",
|
|
896
|
-
path,
|
|
897
|
-
"This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
898
|
-
)
|
|
899
|
-
);
|
|
900
|
-
continue;
|
|
901
|
-
}
|
|
902
|
-
issues.push({
|
|
903
|
-
path,
|
|
904
|
-
message: schemaIssue.message,
|
|
905
|
-
code: schemaIssue.code,
|
|
906
|
-
severity: "invalid"
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
const stored = _chunk2JT2WUQ2cjs.validateItemGroup.call(void 0, draft);
|
|
911
|
-
if (issues.length === 0 && stored.success) {
|
|
912
|
-
return { status: "complete", data: stored.data, issues };
|
|
913
|
-
}
|
|
914
|
-
if (issues.length === 0) {
|
|
915
|
-
for (const error of stored.success ? [] : stored.errors) {
|
|
916
|
-
issues.push({ ...error, severity: "invalid" });
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
const invalid = issues.some((found) => found.severity !== "incomplete");
|
|
920
|
-
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
921
|
-
}
|
|
922
|
-
function checkTimeline(draft) {
|
|
923
|
-
const issues = [];
|
|
924
|
-
const timeline = draft.timeline;
|
|
925
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, timeline)) {
|
|
926
|
-
return issues;
|
|
927
|
-
}
|
|
928
|
-
const stimulus = _chunkDSDXL3JOcjs.isRecord.call(void 0, draft.stimulus) ? draft.stimulus : void 0;
|
|
929
|
-
if (stimulus !== void 0 && !_chunkDSDXL3JOcjs.isUnwritten.call(void 0, stimulus.kind) && stimulus.kind !== "video") {
|
|
930
|
-
issues.push(
|
|
931
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
932
|
-
"ig_timeline_stimulus_kind",
|
|
933
|
-
["stimulus", "kind"],
|
|
934
|
-
"An interactive video needs a video: quizzes open at moments of it."
|
|
935
|
-
)
|
|
936
|
-
);
|
|
937
|
-
} else if (stimulus !== void 0 && _chunkDSDXL3JOcjs.isRecord.call(void 0, stimulus.media) && !_chunkDSDXL3JOcjs.isUnwritten.call(void 0, stimulus.media.type) && stimulus.media.type !== "video") {
|
|
938
|
-
issues.push(
|
|
939
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
940
|
-
"ig_timeline_stimulus_kind",
|
|
941
|
-
["stimulus", "media", "type"],
|
|
942
|
-
"Upload a video file. An embedded player from another site cannot be paused when a quiz opens."
|
|
943
|
-
)
|
|
944
|
-
);
|
|
945
|
-
}
|
|
946
|
-
if (draft.shuffle === "within-group") {
|
|
947
|
-
issues.push(
|
|
948
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
949
|
-
"ig_timeline_shuffle",
|
|
950
|
-
["shuffle"],
|
|
951
|
-
"The questions of an interactive video appear in the order their quizzes open, so they cannot be shuffled."
|
|
952
|
-
)
|
|
953
|
-
);
|
|
954
|
-
}
|
|
955
|
-
const items = Array.isArray(draft.items) ? draft.items : [];
|
|
956
|
-
const itemIndexById = /* @__PURE__ */ new Map();
|
|
957
|
-
items.forEach((item, index) => {
|
|
958
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, item)) {
|
|
959
|
-
return;
|
|
960
|
-
}
|
|
961
|
-
if (typeof item.id === "string" && item.id !== "") {
|
|
962
|
-
itemIndexById.set(item.id, index);
|
|
963
|
-
}
|
|
964
|
-
const type = item.type;
|
|
965
|
-
if (typeof type === "string" && type !== "" && type !== "item-group" && !_chunk2JT2WUQ2cjs.isInteractiveVideoItemType.call(void 0, type) && _chunkDSDXL3JOcjs.getActivityTypeDescriptor.call(void 0, type) !== void 0) {
|
|
966
|
-
issues.push(
|
|
967
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
968
|
-
"ig_timeline_item_type",
|
|
969
|
-
["items", index, "type"],
|
|
970
|
-
`An interactive video can hold ${_chunk2JT2WUQ2cjs.INTERACTIVE_VIDEO_ITEM_TYPES.join(", ")} questions only.`
|
|
971
|
-
)
|
|
972
|
-
);
|
|
973
|
-
}
|
|
974
|
-
if (type === "dictation" && _chunkDSDXL3JOcjs.isUnset.call(void 0, item.media)) {
|
|
975
|
-
issues.push(
|
|
976
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
977
|
-
"ig_timeline_dictation_media",
|
|
978
|
-
["items", index, "media"],
|
|
979
|
-
"Add the recording this dictation plays: inside a video it cannot play the video."
|
|
980
|
-
)
|
|
981
|
-
);
|
|
982
|
-
}
|
|
983
|
-
});
|
|
984
|
-
const cues = Array.isArray(timeline.cues) ? timeline.cues : [];
|
|
985
|
-
const quizIds = /* @__PURE__ */ new Set();
|
|
986
|
-
const placed = /* @__PURE__ */ new Set();
|
|
987
|
-
cues.forEach((cue, cueIndex) => {
|
|
988
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, cue)) {
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
const at = (field, ...rest) => [
|
|
992
|
-
"timeline",
|
|
993
|
-
"cues",
|
|
994
|
-
cueIndex,
|
|
995
|
-
field,
|
|
996
|
-
...rest
|
|
997
|
-
];
|
|
998
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, cue.id)) {
|
|
999
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "ig_timeline_quiz_id_required", at("id"), "This quiz has no id."));
|
|
1000
|
-
} else if (typeof cue.id === "string") {
|
|
1001
|
-
if (quizIds.has(cue.id)) {
|
|
1002
|
-
issues.push(
|
|
1003
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_timeline_quiz_id_duplicate", at("id"), `Two quizzes share the id "${cue.id}".`)
|
|
1004
|
-
);
|
|
1005
|
-
}
|
|
1006
|
-
quizIds.add(cue.id);
|
|
1007
|
-
}
|
|
1008
|
-
if (_chunkDSDXL3JOcjs.isUnset.call(void 0, cue.at)) {
|
|
1009
|
-
issues.push(
|
|
1010
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1011
|
-
"ig_timeline_quiz_time_required",
|
|
1012
|
-
at("at"),
|
|
1013
|
-
"Choose when in the video this quiz opens."
|
|
1014
|
-
)
|
|
1015
|
-
);
|
|
1016
|
-
} else if (typeof cue.at !== "number" || !Number.isFinite(cue.at) || cue.at < 0) {
|
|
1017
|
-
issues.push(
|
|
1018
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1019
|
-
"ig_timeline_quiz_time_invalid",
|
|
1020
|
-
at("at"),
|
|
1021
|
-
"A quiz opens at a number of seconds, 0 or more."
|
|
1022
|
-
)
|
|
1023
|
-
);
|
|
1024
|
-
}
|
|
1025
|
-
if (_chunkDSDXL3JOcjs.isUnset.call(void 0, cue.itemIds) || Array.isArray(cue.itemIds) && cue.itemIds.length === 0) {
|
|
1026
|
-
issues.push(
|
|
1027
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_timeline_quiz_empty", at("itemIds"), "Add at least one question to this quiz.")
|
|
1028
|
-
);
|
|
1029
|
-
return;
|
|
1030
|
-
}
|
|
1031
|
-
if (!Array.isArray(cue.itemIds)) {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
cue.itemIds.forEach((itemId, position) => {
|
|
1035
|
-
if (typeof itemId !== "string") {
|
|
1036
|
-
return;
|
|
1037
|
-
}
|
|
1038
|
-
if (!itemIndexById.has(itemId)) {
|
|
1039
|
-
issues.push(
|
|
1040
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1041
|
-
"ig_timeline_quiz_unknown_item",
|
|
1042
|
-
at("itemIds", position),
|
|
1043
|
-
`This quiz names a question that is not in the video ("${itemId}").`
|
|
1044
|
-
)
|
|
1045
|
-
);
|
|
1046
|
-
} else if (placed.has(itemId)) {
|
|
1047
|
-
issues.push(
|
|
1048
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1049
|
-
"ig_timeline_item_duplicate",
|
|
1050
|
-
at("itemIds", position),
|
|
1051
|
-
"This question is already in a quiz: each question belongs to one quiz."
|
|
1052
|
-
)
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
|
-
placed.add(itemId);
|
|
1056
|
-
});
|
|
1057
|
-
});
|
|
1058
|
-
for (const [itemId, index] of itemIndexById) {
|
|
1059
|
-
if (!placed.has(itemId)) {
|
|
1060
|
-
issues.push(
|
|
1061
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1062
|
-
"ig_timeline_item_unplaced",
|
|
1063
|
-
["items", index],
|
|
1064
|
-
"Add this question to a quiz, or the video never shows it."
|
|
1065
|
-
)
|
|
1066
|
-
);
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
const chapters = Array.isArray(timeline.chapters) ? timeline.chapters : [];
|
|
1070
|
-
let previousAt;
|
|
1071
|
-
chapters.forEach((chapter, index) => {
|
|
1072
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, chapter)) {
|
|
1073
|
-
return;
|
|
1074
|
-
}
|
|
1075
|
-
if (_chunkDSDXL3JOcjs.isUnwritten.call(void 0, chapter.title)) {
|
|
1076
|
-
issues.push(
|
|
1077
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1078
|
-
"ig_timeline_chapter_title",
|
|
1079
|
-
["timeline", "chapters", index, "title"],
|
|
1080
|
-
"Give this chapter a title."
|
|
1081
|
-
)
|
|
1082
|
-
);
|
|
1083
|
-
}
|
|
1084
|
-
if (typeof chapter.at === "number" && Number.isFinite(chapter.at)) {
|
|
1085
|
-
if (previousAt !== void 0 && chapter.at <= previousAt) {
|
|
1086
|
-
issues.push(
|
|
1087
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1088
|
-
"ig_timeline_chapter_order",
|
|
1089
|
-
["timeline", "chapters", index, "at"],
|
|
1090
|
-
"Chapters must start in order, each after the one before it."
|
|
1091
|
-
)
|
|
1092
|
-
);
|
|
1093
|
-
}
|
|
1094
|
-
previousAt = chapter.at;
|
|
1095
|
-
}
|
|
1096
|
-
});
|
|
1097
|
-
return issues;
|
|
1098
|
-
}
|
|
1099
|
-
function checkGroupIdentity(draft) {
|
|
1100
|
-
const issues = [];
|
|
1101
|
-
if (draft.schemaVersion !== "1.0") {
|
|
1102
|
-
issues.push(
|
|
1103
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1104
|
-
"schema_version_invalid",
|
|
1105
|
-
["schemaVersion"],
|
|
1106
|
-
'The draft must have schemaVersion "1.0". A draft from createItemGroupDraft has it.'
|
|
1107
|
-
)
|
|
1108
|
-
);
|
|
1109
|
-
}
|
|
1110
|
-
if (draft.type !== "item-group") {
|
|
1111
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "type_mismatch", ["type"], `The draft's type must be "item-group".`));
|
|
1112
|
-
}
|
|
1113
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, draft.id)) {
|
|
1114
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "id_required", ["id"], "The group has no id."));
|
|
1115
|
-
}
|
|
1116
|
-
if (!_chunkDSDXL3JOcjs.isUnset.call(void 0, draft.shuffle) && draft.shuffle !== "none" && draft.shuffle !== "within-group") {
|
|
1117
|
-
issues.push(
|
|
1118
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1119
|
-
"ig_shuffle_invalid",
|
|
1120
|
-
["shuffle"],
|
|
1121
|
-
'Shuffling is either "none" or "within-group". Leave it out to keep the authored order.'
|
|
1122
|
-
)
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
|
-
return issues;
|
|
1126
|
-
}
|
|
1127
|
-
var KINDS = /* @__PURE__ */ new Set(["text", "audio", "video", "image", "mixed"]);
|
|
1128
|
-
var MEDIA_FOR_KIND = {
|
|
1129
|
-
audio: ["audio"],
|
|
1130
|
-
video: ["video", "embed"],
|
|
1131
|
-
image: ["image"],
|
|
1132
|
-
mixed: ["audio", "video", "image", "embed"]
|
|
1133
|
-
};
|
|
1134
|
-
function checkStimulus(stimulus) {
|
|
1135
|
-
const issues = [];
|
|
1136
|
-
const at = (...rest) => ["stimulus", ...rest];
|
|
1137
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, stimulus.id)) {
|
|
1138
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "ig_stimulus_id_required", at("id"), "The stimulus has no id."));
|
|
1139
|
-
}
|
|
1140
|
-
const kind = stimulus.kind;
|
|
1141
|
-
if (_chunkDSDXL3JOcjs.isUnwritten.call(void 0, kind)) {
|
|
1142
|
-
issues.push(
|
|
1143
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1144
|
-
"ig_stimulus_kind_required",
|
|
1145
|
-
at("kind"),
|
|
1146
|
-
"Choose what the questions are about: a text, a recording, a video, an image, or a mix."
|
|
1147
|
-
)
|
|
1148
|
-
);
|
|
1149
|
-
} else if (typeof kind !== "string" || !KINDS.has(kind)) {
|
|
1150
|
-
if (typeof kind === "string") {
|
|
1151
|
-
issues.push(
|
|
1152
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1153
|
-
"ig_stimulus_kind_invalid",
|
|
1154
|
-
at("kind"),
|
|
1155
|
-
`"${kind}" is not a stimulus kind. Use text, audio, video, image or mixed.`
|
|
1156
|
-
)
|
|
1157
|
-
);
|
|
1158
|
-
}
|
|
1159
|
-
if (_chunkDSDXL3JOcjs.isRecord.call(void 0, stimulus.media)) {
|
|
1160
|
-
issues.push(..._chunkDSDXL3JOcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
1161
|
-
}
|
|
1162
|
-
return issues;
|
|
1163
|
-
}
|
|
1164
|
-
const hasBody = typeof stimulus.body === "string" && stimulus.body.trim() !== "";
|
|
1165
|
-
const htmlPresent = !_chunkDSDXL3JOcjs.isUnset.call(void 0, stimulus.bodyHtml);
|
|
1166
|
-
if (!hasBody && (kind === "text" || kind === "mixed" || htmlPresent)) {
|
|
1167
|
-
issues.push(
|
|
1168
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1169
|
-
"ig_stimulus_body_required",
|
|
1170
|
-
at("body"),
|
|
1171
|
-
_chunkDSDXL3JOcjs.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."
|
|
1172
|
-
)
|
|
1173
|
-
);
|
|
1174
|
-
}
|
|
1175
|
-
if (kind !== "text" && _chunkDSDXL3JOcjs.isUnset.call(void 0, stimulus.media)) {
|
|
1176
|
-
issues.push(
|
|
1177
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_stimulus_media_required", at("media"), "Add the recording, video or image.")
|
|
1178
|
-
);
|
|
1179
|
-
} else if (_chunkDSDXL3JOcjs.isRecord.call(void 0, stimulus.media)) {
|
|
1180
|
-
const allowed = MEDIA_FOR_KIND[kind];
|
|
1181
|
-
const mediaType = stimulus.media.type;
|
|
1182
|
-
if (allowed !== void 0 && typeof mediaType === "string" && !allowed.includes(mediaType)) {
|
|
1183
|
-
issues.push(
|
|
1184
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1185
|
-
"ig_stimulus_media_kind",
|
|
1186
|
-
at("media", "type"),
|
|
1187
|
-
`A "${kind}" stimulus cannot carry ${mediaType} media. Use ${allowed.join(" or ")}.`
|
|
1188
|
-
)
|
|
1189
|
-
);
|
|
1190
|
-
}
|
|
1191
|
-
issues.push(..._chunkDSDXL3JOcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
1192
|
-
}
|
|
1193
|
-
return issues;
|
|
1194
|
-
}
|
|
1195
|
-
function checkItems(draft) {
|
|
1196
|
-
const issues = [];
|
|
1197
|
-
const items = _chunkDSDXL3JOcjs.isUnset.call(void 0, draft.items) ? [] : draft.items;
|
|
1198
|
-
if (!Array.isArray(items)) {
|
|
1199
|
-
return issues;
|
|
1200
|
-
}
|
|
1201
|
-
if (items.length === 0) {
|
|
1202
|
-
issues.push(
|
|
1203
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_items_required", ["items"], "Add at least one question about this material.")
|
|
1204
|
-
);
|
|
1205
|
-
return issues;
|
|
1206
|
-
}
|
|
1207
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1208
|
-
const repeated = /* @__PURE__ */ new Set();
|
|
1209
|
-
for (const [index, item] of items.entries()) {
|
|
1210
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, item)) {
|
|
1211
|
-
continue;
|
|
1212
|
-
}
|
|
1213
|
-
const ordinal = index + 1;
|
|
1214
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, item.id)) {
|
|
1215
|
-
issues.push(
|
|
1216
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_item_id_required", ["items", index, "id"], `Question ${ordinal} has no id.`)
|
|
1217
|
-
);
|
|
1218
|
-
} else if (typeof item.id === "string") {
|
|
1219
|
-
if (seen.has(item.id)) {
|
|
1220
|
-
repeated.add(item.id);
|
|
1221
|
-
}
|
|
1222
|
-
seen.add(item.id);
|
|
1223
|
-
}
|
|
1224
|
-
if (item.type === "item-group") {
|
|
1225
|
-
issues.push(
|
|
1226
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1227
|
-
"ig_item_nested_group",
|
|
1228
|
-
["items", index, "type"],
|
|
1229
|
-
"Groups do not nest: every item must be an activity."
|
|
1230
|
-
)
|
|
1231
|
-
);
|
|
1232
|
-
continue;
|
|
1233
|
-
}
|
|
1234
|
-
if (_chunkDSDXL3JOcjs.isUnwritten.call(void 0, item.type)) {
|
|
1235
|
-
issues.push(
|
|
1236
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1237
|
-
"ig_item_type_required",
|
|
1238
|
-
["items", index, "type"],
|
|
1239
|
-
`Choose what kind of question ${ordinal} is.`
|
|
1240
|
-
)
|
|
1241
|
-
);
|
|
1242
|
-
continue;
|
|
1243
|
-
}
|
|
1244
|
-
if (typeof item.type !== "string") {
|
|
1245
|
-
continue;
|
|
1246
|
-
}
|
|
1247
|
-
let result;
|
|
1248
|
-
try {
|
|
1249
|
-
result = validateDraft(item.type, item);
|
|
1250
|
-
} catch (error) {
|
|
1251
|
-
if (!(error instanceof _chunkDSDXL3JOcjs.UnknownActivityTypeError) || error.activityType !== item.type) {
|
|
1252
|
-
throw error;
|
|
1253
|
-
}
|
|
1254
|
-
issues.push(
|
|
1255
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1256
|
-
"ig_item_type_unknown",
|
|
1257
|
-
["items", index, "type"],
|
|
1258
|
-
`"${item.type}" is not a registered activity type.`
|
|
1259
|
-
)
|
|
1260
|
-
);
|
|
1261
|
-
continue;
|
|
1262
|
-
}
|
|
1263
|
-
for (const found of result.issues) {
|
|
1264
|
-
issues.push({ ...found, path: ["items", String(index), ...found.path] });
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
for (const id of repeated) {
|
|
1268
|
-
issues.push(
|
|
1269
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
1270
|
-
);
|
|
1271
|
-
}
|
|
1272
|
-
return issues;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
// src/authoring/index.ts
|
|
1276
|
-
function validateDraft(type, draft) {
|
|
1277
|
-
return _chunkDSDXL3JOcjs.withValidationScope.call(void 0, () => validateDraftInScope(type, draft));
|
|
1278
|
-
}
|
|
1279
|
-
function validateDraftInScope(type, draft) {
|
|
1280
|
-
const descriptor = _chunkDSDXL3JOcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1281
|
-
if (descriptor === void 0) {
|
|
1282
|
-
throw new (0, _chunkDSDXL3JOcjs.UnknownActivityTypeError)(String(type));
|
|
1283
|
-
}
|
|
1284
|
-
const reported = _chunkDSDXL3JOcjs.isRecord.call(void 0, draft) && _optionalChain([descriptor, 'access', _25 => _25.authoring, 'optionalAccess', _26 => _26.checkDraft]) !== void 0 ? descriptor.authoring.checkDraft(draft).map(normalise) : [];
|
|
1285
|
-
const issues = [...reported];
|
|
1286
|
-
const parsed = _chunkDSDXL3JOcjs.readSchema.call(void 0, descriptor.schema, draft, `Activity type "${descriptor.type}"`, {
|
|
1287
|
-
reportInput: true
|
|
1288
|
-
});
|
|
1289
|
-
if (!parsed.success) {
|
|
1290
|
-
const covered = _chunkDSDXL3JOcjs.coveredPathsOf.call(void 0, reported);
|
|
1291
|
-
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
1292
|
-
for (const schemaIssue of parsed.issues) {
|
|
1293
|
-
const path = schemaIssue.path.map(String);
|
|
1294
|
-
if (covered.has(_chunkDSDXL3JOcjs.pathKey.call(void 0, path))) {
|
|
1295
|
-
continue;
|
|
1296
|
-
}
|
|
1297
|
-
if (path.length > 0 && _chunkDSDXL3JOcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
1298
|
-
const key = JSON.stringify(path);
|
|
1299
|
-
if (!reportedEmpty.has(key)) {
|
|
1300
|
-
reportedEmpty.add(key);
|
|
1301
|
-
issues.push(
|
|
1302
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1303
|
-
"null_not_allowed",
|
|
1304
|
-
path,
|
|
1305
|
-
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."
|
|
1306
|
-
)
|
|
1307
|
-
);
|
|
1308
|
-
}
|
|
1309
|
-
continue;
|
|
1310
|
-
}
|
|
1311
|
-
issues.push({
|
|
1312
|
-
path,
|
|
1313
|
-
message: schemaIssue.message,
|
|
1314
|
-
code: schemaIssue.code,
|
|
1315
|
-
severity: "invalid"
|
|
1316
|
-
});
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
if (parsed.success && issues.length === 0) {
|
|
1320
|
-
return { status: "complete", data: parsed.data, issues };
|
|
1321
|
-
}
|
|
1322
|
-
const invalid = issues.some((found) => found.severity !== "incomplete");
|
|
1323
|
-
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
1324
|
-
}
|
|
1325
|
-
function createDraft(type, context) {
|
|
1326
|
-
const descriptor = _chunkDSDXL3JOcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1327
|
-
if (descriptor === void 0) {
|
|
1328
|
-
throw new (0, _chunkDSDXL3JOcjs.UnknownActivityTypeError)(String(type));
|
|
1329
|
-
}
|
|
1330
|
-
const create = _optionalChain([descriptor, 'access', _27 => _27.authoring, 'optionalAccess', _28 => _28.createDraft]);
|
|
1331
|
-
if (create === void 0) {
|
|
1332
|
-
throw new Error(
|
|
1333
|
-
`Activity type "${String(type)}" declares no authoring.createDraft, so there is no empty draft to create. Build the draft yourself; validateDraft works for every registered type.`
|
|
1334
|
-
);
|
|
1335
|
-
}
|
|
1336
|
-
const issued = /* @__PURE__ */ new Set();
|
|
1337
|
-
const newId = () => {
|
|
1338
|
-
const id = context.newId();
|
|
1339
|
-
if (typeof id !== "string" || id === "") {
|
|
1340
|
-
throw new Error("createDraft: newId() must return a non-empty string.");
|
|
1341
|
-
}
|
|
1342
|
-
if (issued.has(id)) {
|
|
1343
|
-
throw new Error(
|
|
1344
|
-
`createDraft: newId() returned "${id}" twice. Ids within one draft must differ \u2014 two options sharing an id cannot be scored apart.`
|
|
1345
|
-
);
|
|
1346
|
-
}
|
|
1347
|
-
issued.add(id);
|
|
1348
|
-
return id;
|
|
1349
|
-
};
|
|
1350
|
-
return create({ newId });
|
|
1351
|
-
}
|
|
1352
|
-
function normalise(found) {
|
|
1353
|
-
const documented = Object.hasOwn(_chunkDSDXL3JOcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkDSDXL3JOcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
1354
|
-
return {
|
|
1355
|
-
...found,
|
|
1356
|
-
path: found.path.map(String),
|
|
1357
|
-
severity: _nullishCoalesce(documented, () => ( (found.severity === "incomplete" ? "incomplete" : "invalid")))
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
822
|
// src/redact.ts
|
|
1362
823
|
function mergePolicy(base, overrides) {
|
|
1363
824
|
if (overrides === void 0) {
|
|
@@ -1414,9 +875,9 @@ function redactValue(value, policy, reveal) {
|
|
|
1414
875
|
}
|
|
1415
876
|
function redact(data, options = {}) {
|
|
1416
877
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
1417
|
-
const descriptor =
|
|
878
|
+
const descriptor = _chunk7THXD7ANcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
1418
879
|
if (descriptor === void 0) {
|
|
1419
|
-
throw new (0,
|
|
880
|
+
throw new (0, _chunk7THXD7ANcjs.UnknownActivityTypeError)(String(data.type));
|
|
1420
881
|
}
|
|
1421
882
|
if (descriptor.fieldPolicy === void 0) {
|
|
1422
883
|
throw new Error(
|
|
@@ -1427,18 +888,18 @@ function redact(data, options = {}) {
|
|
|
1427
888
|
const projected = redactValue(data, effectivePolicy, reveal);
|
|
1428
889
|
const result = { ...projected, redacted: true };
|
|
1429
890
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
1430
|
-
const parsed =
|
|
891
|
+
const parsed = _chunk7THXD7ANcjs.readSchema.call(void 0,
|
|
1431
892
|
descriptor.redactedSchema,
|
|
1432
893
|
result,
|
|
1433
894
|
`Activity type "${descriptor.type}"`
|
|
1434
895
|
);
|
|
1435
896
|
if (!parsed.success) {
|
|
1436
|
-
throw new (0,
|
|
897
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1437
898
|
descriptor.type,
|
|
1438
|
-
parsed.issues.map((
|
|
1439
|
-
path:
|
|
1440
|
-
message:
|
|
1441
|
-
code:
|
|
899
|
+
parsed.issues.map((issue) => ({
|
|
900
|
+
path: issue.path.map(String),
|
|
901
|
+
message: issue.message,
|
|
902
|
+
code: issue.code
|
|
1442
903
|
}))
|
|
1443
904
|
);
|
|
1444
905
|
}
|
|
@@ -1447,13 +908,13 @@ function redact(data, options = {}) {
|
|
|
1447
908
|
}
|
|
1448
909
|
function assertRedacted(data) {
|
|
1449
910
|
if (typeof data !== "object" || data === null) {
|
|
1450
|
-
throw new (0,
|
|
911
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)("unknown", [
|
|
1451
912
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
1452
913
|
]);
|
|
1453
914
|
}
|
|
1454
915
|
const candidate = data;
|
|
1455
916
|
if (candidate.redacted !== true) {
|
|
1456
|
-
throw new (0,
|
|
917
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
1457
918
|
{
|
|
1458
919
|
path: ["redacted"],
|
|
1459
920
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -1462,12 +923,12 @@ function assertRedacted(data) {
|
|
|
1462
923
|
]);
|
|
1463
924
|
}
|
|
1464
925
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
1465
|
-
const descriptor =
|
|
926
|
+
const descriptor = _chunk7THXD7ANcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1466
927
|
if (descriptor === void 0) {
|
|
1467
|
-
throw new (0,
|
|
928
|
+
throw new (0, _chunk7THXD7ANcjs.UnknownActivityTypeError)(type);
|
|
1468
929
|
}
|
|
1469
930
|
if (descriptor.redactedSchema === void 0) {
|
|
1470
|
-
throw new (0,
|
|
931
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(descriptor.type, [
|
|
1471
932
|
{
|
|
1472
933
|
path: [],
|
|
1473
934
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -1475,18 +936,18 @@ function assertRedacted(data) {
|
|
|
1475
936
|
}
|
|
1476
937
|
]);
|
|
1477
938
|
}
|
|
1478
|
-
const parsed =
|
|
939
|
+
const parsed = _chunk7THXD7ANcjs.readSchema.call(void 0,
|
|
1479
940
|
descriptor.redactedSchema,
|
|
1480
941
|
candidate,
|
|
1481
942
|
`Activity type "${descriptor.type}"`
|
|
1482
943
|
);
|
|
1483
944
|
if (!parsed.success) {
|
|
1484
|
-
throw new (0,
|
|
945
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1485
946
|
descriptor.type,
|
|
1486
|
-
parsed.issues.map((
|
|
1487
|
-
path:
|
|
1488
|
-
message:
|
|
1489
|
-
code:
|
|
947
|
+
parsed.issues.map((issue) => ({
|
|
948
|
+
path: issue.path.map(String),
|
|
949
|
+
message: issue.message,
|
|
950
|
+
code: issue.code
|
|
1490
951
|
}))
|
|
1491
952
|
);
|
|
1492
953
|
}
|
|
@@ -1497,7 +958,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
1497
958
|
title: "public",
|
|
1498
959
|
body: "public",
|
|
1499
960
|
bodyHtml: "public",
|
|
1500
|
-
media:
|
|
961
|
+
media: _chunk7THXD7ANcjs.MEDIA_FIELD_POLICY,
|
|
1501
962
|
locale: "public",
|
|
1502
963
|
attribution: "public",
|
|
1503
964
|
transcript: "author-only"
|
|
@@ -1541,14 +1002,14 @@ function redactItemGroup(group, options = {}) {
|
|
|
1541
1002
|
redacted: true
|
|
1542
1003
|
};
|
|
1543
1004
|
if (reveal === "none") {
|
|
1544
|
-
const parsed =
|
|
1005
|
+
const parsed = _chunkZWXQSKCXcjs.RedactedItemGroupSchema.safeParse(result);
|
|
1545
1006
|
if (!parsed.success) {
|
|
1546
|
-
throw new (0,
|
|
1007
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1547
1008
|
"item-group",
|
|
1548
|
-
parsed.error.issues.map((
|
|
1549
|
-
path:
|
|
1550
|
-
message:
|
|
1551
|
-
code:
|
|
1009
|
+
parsed.error.issues.map((issue) => ({
|
|
1010
|
+
path: issue.path.map(String),
|
|
1011
|
+
message: issue.message,
|
|
1012
|
+
code: issue.code
|
|
1552
1013
|
}))
|
|
1553
1014
|
);
|
|
1554
1015
|
}
|
|
@@ -1557,13 +1018,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
1557
1018
|
}
|
|
1558
1019
|
function assertRedactedItemGroup(data) {
|
|
1559
1020
|
if (typeof data !== "object" || data === null) {
|
|
1560
|
-
throw new (0,
|
|
1021
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)("item-group", [
|
|
1561
1022
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
1562
1023
|
]);
|
|
1563
1024
|
}
|
|
1564
1025
|
const candidate = data;
|
|
1565
1026
|
if (candidate.redacted !== true) {
|
|
1566
|
-
throw new (0,
|
|
1027
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)("item-group", [
|
|
1567
1028
|
{
|
|
1568
1029
|
path: ["redacted"],
|
|
1569
1030
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -1571,14 +1032,14 @@ function assertRedactedItemGroup(data) {
|
|
|
1571
1032
|
}
|
|
1572
1033
|
]);
|
|
1573
1034
|
}
|
|
1574
|
-
const parsed =
|
|
1035
|
+
const parsed = _chunkZWXQSKCXcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
1575
1036
|
if (!parsed.success) {
|
|
1576
|
-
throw new (0,
|
|
1037
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1577
1038
|
"item-group",
|
|
1578
|
-
parsed.error.issues.map((
|
|
1579
|
-
path:
|
|
1580
|
-
message:
|
|
1581
|
-
code:
|
|
1039
|
+
parsed.error.issues.map((issue) => ({
|
|
1040
|
+
path: issue.path.map(String),
|
|
1041
|
+
message: issue.message,
|
|
1042
|
+
code: issue.code
|
|
1582
1043
|
}))
|
|
1583
1044
|
);
|
|
1584
1045
|
}
|
|
@@ -1586,12 +1047,12 @@ function assertRedactedItemGroup(data) {
|
|
|
1586
1047
|
try {
|
|
1587
1048
|
assertRedacted(item);
|
|
1588
1049
|
} catch (error) {
|
|
1589
|
-
if (error instanceof
|
|
1590
|
-
throw new (0,
|
|
1050
|
+
if (error instanceof _chunk7THXD7ANcjs.ActivitySchemaError) {
|
|
1051
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1591
1052
|
"item-group",
|
|
1592
|
-
error.errors.map((
|
|
1593
|
-
...
|
|
1594
|
-
path: ["items", String(index), ...
|
|
1053
|
+
error.errors.map((issue) => ({
|
|
1054
|
+
...issue,
|
|
1055
|
+
path: ["items", String(index), ...issue.path]
|
|
1595
1056
|
}))
|
|
1596
1057
|
);
|
|
1597
1058
|
}
|
|
@@ -1632,7 +1093,7 @@ function composeTimelineScore(entryKey, items, policy) {
|
|
|
1632
1093
|
`composeTimelineScore: no scored item belongs to entry "${entryKey}". Pass the video's slotKey (or its position in the sequence), and the items of the attempt that holds it.`
|
|
1633
1094
|
);
|
|
1634
1095
|
}
|
|
1635
|
-
return
|
|
1096
|
+
return _chunk4YANYTFNcjs.composeAssessmentScore.call(void 0, [{ id: entryKey, weight: 1, items: own }], policy);
|
|
1636
1097
|
}
|
|
1637
1098
|
|
|
1638
1099
|
|
|
@@ -1767,5 +1228,19 @@ function composeTimelineScore(entryKey, items, policy) {
|
|
|
1767
1228
|
|
|
1768
1229
|
|
|
1769
1230
|
|
|
1770
|
-
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
exports.AI_COACHING_MAX_TIP_LENGTH = _chunkMXI26H62cjs.AI_COACHING_MAX_TIP_LENGTH; exports.AI_COACHING_MAX_WORDS = _chunkMXI26H62cjs.AI_COACHING_MAX_WORDS; exports.AI_CRITIQUE_MAX_FIELD_LENGTH = _chunkMXI26H62cjs.AI_CRITIQUE_MAX_FIELD_LENGTH; exports.AI_CRITIQUE_MAX_FINDINGS = _chunkMXI26H62cjs.AI_CRITIQUE_MAX_FINDINGS; exports.AI_DRAFTS_MAX_COUNT = _chunkMXI26H62cjs.AI_DRAFTS_MAX_COUNT; exports.AI_DRAFTS_MAX_REPAIRS = _chunkMXI26H62cjs.AI_DRAFTS_MAX_REPAIRS; exports.AI_EXPLANATION_TYPES = _chunkMXI26H62cjs.AI_EXPLANATION_TYPES; exports.AI_HINT_TYPES = _chunkMXI26H62cjs.AI_HINT_TYPES; exports.AI_TEXT_MAX_LENGTH = _chunkMXI26H62cjs.AI_TEXT_MAX_LENGTH; exports.AI_WRITING_MAX_CORRECTIONS = _chunkMXI26H62cjs.AI_WRITING_MAX_CORRECTIONS; exports.AI_WRITING_MAX_FIELD_LENGTH = _chunkMXI26H62cjs.AI_WRITING_MAX_FIELD_LENGTH; exports.ActivitySchemaError = _chunk7THXD7ANcjs.ActivitySchemaError; exports.DEFAULT_ITEM_SCORING_POLICY = _chunk4YANYTFNcjs.DEFAULT_ITEM_SCORING_POLICY; exports.DEFAULT_PASS_THRESHOLD = _chunk4YANYTFNcjs.DEFAULT_PASS_THRESHOLD; exports.DICTATION_MAX_ACCEPTED_TRANSCRIPTS = _chunk7THXD7ANcjs.DICTATION_MAX_ACCEPTED_TRANSCRIPTS; exports.DICTATION_MAX_EQUIVALENCES = _chunk7THXD7ANcjs.DICTATION_MAX_EQUIVALENCES; exports.DICTATION_MAX_EQUIVALENCE_LENGTH = _chunk7THXD7ANcjs.DICTATION_MAX_EQUIVALENCE_LENGTH; exports.DICTATION_MAX_TEXT_LENGTH = _chunk7THXD7ANcjs.DICTATION_MAX_TEXT_LENGTH; exports.DICTATION_MAX_TRANSCRIPT_LENGTH = _chunk7THXD7ANcjs.DICTATION_MAX_TRANSCRIPT_LENGTH; exports.DeferredScoringError = _chunk7THXD7ANcjs.DeferredScoringError; exports.INTERACTIVE_VIDEO_ITEM_TYPES = _chunkZWXQSKCXcjs.INTERACTIVE_VIDEO_ITEM_TYPES; exports.ITEM_SCORING_MAX_RETRIES = _chunk4YANYTFNcjs.ITEM_SCORING_MAX_RETRIES; exports.OPEN_DELIVERY_POLICY = OPEN_DELIVERY_POLICY; exports.READ_ALOUD_MAX_DIMENSION_WEIGHT = _chunk7THXD7ANcjs.READ_ALOUD_MAX_DIMENSION_WEIGHT; exports.READ_ALOUD_MAX_REFERENCE_LENGTH = _chunk7THXD7ANcjs.READ_ALOUD_MAX_REFERENCE_LENGTH; exports.READ_ALOUD_MAX_SECONDS = _chunk7THXD7ANcjs.READ_ALOUD_MAX_SECONDS; exports.READ_ALOUD_MAX_TAKES = _chunk7THXD7ANcjs.READ_ALOUD_MAX_TAKES; exports.RedactedScoringError = _chunk7THXD7ANcjs.RedactedScoringError; exports.SPEECH_ASSESSMENT_MAX_WORDS = _chunk7THXD7ANcjs.SPEECH_ASSESSMENT_MAX_WORDS; exports.TIMELINE_MAX_CHAPTERS = _chunkZWXQSKCXcjs.TIMELINE_MAX_CHAPTERS; exports.TIMELINE_MAX_ITEMS = _chunkZWXQSKCXcjs.TIMELINE_MAX_ITEMS; exports.TIMELINE_MAX_QUIZZES = _chunkZWXQSKCXcjs.TIMELINE_MAX_QUIZZES; exports.TIMELINE_MAX_TITLE_LENGTH = _chunkZWXQSKCXcjs.TIMELINE_MAX_TITLE_LENGTH; exports.UnknownActivityTypeError = _chunk7THXD7ANcjs.UnknownActivityTypeError; exports.XAPIVerb = _chunk46BXIGLGcjs.XAPIVerb; exports.XAPI_VERB_DISPLAY = _chunk46BXIGLGcjs.XAPI_VERB_DISPLAY; exports.aiAllowedByContent = _chunkMXI26H62cjs.aiAllowedByContent; exports.aiCoachingRequest = _chunkMXI26H62cjs.aiCoachingRequest; exports.aiCritiqueRequest = _chunkMXI26H62cjs.aiCritiqueRequest; exports.aiDraftsRepairRequest = _chunkMXI26H62cjs.aiDraftsRepairRequest; exports.aiDraftsRequest = _chunkMXI26H62cjs.aiDraftsRequest; exports.aiExplanationRequest = _chunkMXI26H62cjs.aiExplanationRequest; exports.aiGradeOf = _chunkMXI26H62cjs.aiGradeOf; exports.aiHintRequest = _chunkMXI26H62cjs.aiHintRequest; exports.aiSupports = _chunkMXI26H62cjs.aiSupports; exports.aiWritingFeedbackRequest = _chunkMXI26H62cjs.aiWritingFeedbackRequest; exports.alignDictation = _chunk7THXD7ANcjs.alignDictation; exports.alignReadAloud = _chunk4YANYTFNcjs.alignReadAloud; exports.assertRedacted = assertRedacted; exports.assertRedactedItemGroup = assertRedactedItemGroup; exports.buildAiFacts = _chunkMXI26H62cjs.buildAiFacts; exports.canonicalJson = canonicalJson; exports.checkAiCoaching = _chunkMXI26H62cjs.checkAiCoaching; exports.checkAiCritique = _chunkMXI26H62cjs.checkAiCritique; exports.checkAiDrafts = _chunkMXI26H62cjs.checkAiDrafts; exports.checkAiExplanation = _chunkMXI26H62cjs.checkAiExplanation; exports.checkAiHint = _chunkMXI26H62cjs.checkAiHint; exports.checkAiWritingFeedback = _chunkMXI26H62cjs.checkAiWritingFeedback; exports.classifyBand = _chunk4YANYTFNcjs.classifyBand; exports.combineDeliveryPolicies = combineDeliveryPolicies; exports.composeAssessmentScore = _chunk4YANYTFNcjs.composeAssessmentScore; exports.composeTimelineScore = composeTimelineScore; exports.computePassThreshold = _chunk4YANYTFNcjs.computePassThreshold; exports.contentHash = contentHash; exports.countWords = _chunk7THXD7ANcjs.countWords; exports.createDraft = _chunkMXI26H62cjs.createDraft; exports.createInteractiveVideoDraft = _chunkMXI26H62cjs.createInteractiveVideoDraft; exports.createItemGroupDraft = _chunkMXI26H62cjs.createItemGroupDraft; exports.critiqueDraft = _chunkMXI26H62cjs.critiqueDraft; exports.critiqueDrafts = _chunkMXI26H62cjs.critiqueDrafts; exports.critiqueItemGroupDraft = _chunkMXI26H62cjs.critiqueItemGroupDraft; exports.defineActivityType = _chunk7THXD7ANcjs.defineActivityType; exports.dictationJsonSchema = _chunkCYCTIXUNcjs.dictationJsonSchema; exports.dictationReferenceWords = _chunk7THXD7ANcjs.dictationReferenceWords; exports.dictationType = _chunk7THXD7ANcjs.dictationType; exports.diffDictationChars = _chunk4YANYTFNcjs.diffDictationChars; exports.diffResponses = diffResponses; exports.entryKeyOf = entryKeyOf; exports.evaluate = _chunk4YANYTFNcjs.evaluate; exports.evaluateTries = _chunk4YANYTFNcjs.evaluateTries; exports.fillInTheBlanksJsonSchema = _chunkCYCTIXUNcjs.fillInTheBlanksJsonSchema; exports.fillInTheBlanksType = _chunk7THXD7ANcjs.fillInTheBlanksType; exports.fingerprint = fingerprint; exports.flattenSequence = flattenSequence; exports.gapSelectJsonSchema = _chunkCYCTIXUNcjs.gapSelectJsonSchema; exports.gapSelectType = _chunk7THXD7ANcjs.gapSelectType; exports.generateDrafts = _chunkMXI26H62cjs.generateDrafts; exports.getActivityTypeDescriptor = _chunk7THXD7ANcjs.getActivityTypeDescriptor; exports.gradeFromRubric = _chunk4YANYTFNcjs.gradeFromRubric; exports.gradeReadAloud = _chunk4YANYTFNcjs.gradeReadAloud; exports.gte = _chunk4YANYTFNcjs.gte; exports.hasGrade = _chunk4YANYTFNcjs.hasGrade; exports.hashSeed = hashSeed; exports.hintRevealsAnswer = _chunkMXI26H62cjs.hintRevealsAnswer; exports.inspectWav = _chunk4YANYTFNcjs.inspectWav; exports.interactiveVideoFromDrafts = _chunkMXI26H62cjs.interactiveVideoFromDrafts; exports.isInteractiveVideoItemType = _chunkZWXQSKCXcjs.isInteractiveVideoItemType; exports.isItemGroup = isItemGroup; exports.itemGroupJsonSchema = _chunkCYCTIXUNcjs.itemGroupJsonSchema; exports.jsonSchemaFor = _chunkCYCTIXUNcjs.jsonSchemaFor; exports.levenshteinDistance = _chunk7THXD7ANcjs.levenshteinDistance; exports.matchText = _chunk7THXD7ANcjs.matchText; exports.multipleChoiceJsonSchema = _chunkCYCTIXUNcjs.multipleChoiceJsonSchema; exports.multipleChoiceType = _chunk7THXD7ANcjs.multipleChoiceType; exports.outcomeFromGrade = _chunk4YANYTFNcjs.outcomeFromGrade; exports.outcomeFromUnscorable = _chunk4YANYTFNcjs.outcomeFromUnscorable; exports.planAttempt = planAttempt; exports.planMediaBudgets = planMediaBudgets; exports.readAiTextResult = _chunkMXI26H62cjs.readAiTextResult; exports.readAloudJsonSchema = _chunkCYCTIXUNcjs.readAloudJsonSchema; exports.readAloudType = _chunk7THXD7ANcjs.readAloudType; exports.readMediaProgress = readMediaProgress; exports.redact = redact; exports.redactItemGroup = redactItemGroup; exports.registerActivityType = _chunk7THXD7ANcjs.registerActivityType; exports.registeredActivityTypes = _chunk7THXD7ANcjs.registeredActivityTypes; exports.resolveDeliveryPolicy = resolveDeliveryPolicy; exports.resolveItemScoringPolicy = _chunk4YANYTFNcjs.resolveItemScoringPolicy; exports.resolvePlaybackPolicy = resolvePlaybackPolicy; exports.restoreAttemptState = restoreAttemptState; exports.restoreMediaPlayLedger = restoreMediaPlayLedger; exports.roundGrade = _chunk4YANYTFNcjs.roundGrade; exports.score = _chunk4YANYTFNcjs.score; exports.scoreTries = _chunk4YANYTFNcjs.scoreTries; exports.scoredItemsFromPlan = scoredItemsFromPlan; exports.seededShuffle = seededShuffle; exports.serializeAttemptState = serializeAttemptState; exports.serializeMediaPlayLedger = serializeMediaPlayLedger; exports.slotMediaKey = slotMediaKey; exports.stimulusJsonSchema = _chunkCYCTIXUNcjs.stimulusJsonSchema; exports.stimulusMediaKey = stimulusMediaKey; exports.validateActivity = _chunkCYCTIXUNcjs.validateActivity; exports.validateDeliveryPolicy = validateDeliveryPolicy; exports.validateDraft = _chunkMXI26H62cjs.validateDraft; exports.validateItemGroup = _chunkZWXQSKCXcjs.validateItemGroup; exports.validateItemGroupDraft = _chunkMXI26H62cjs.validateItemGroupDraft; exports.validateItemScoringPolicy = _chunk4YANYTFNcjs.validateItemScoringPolicy; exports.validateMedia = _chunkCYCTIXUNcjs.validateMedia; exports.validateOptionMedia = _chunkCYCTIXUNcjs.validateOptionMedia; exports.validateSpeechAssessment = _chunk4YANYTFNcjs.validateSpeechAssessment; exports.validateXAPIStatement = _chunk46BXIGLGcjs.validateXAPIStatement; exports.verifyAttemptPlan = verifyAttemptPlan; exports.writtenResponseJsonSchema = _chunkCYCTIXUNcjs.writtenResponseJsonSchema; exports.writtenResponseType = _chunk7THXD7ANcjs.writtenResponseType; exports.xAPIBuilder = _chunk46BXIGLGcjs.xAPIBuilder; exports.xapiDefinitionFor = _chunk46BXIGLGcjs.xapiDefinitionFor;
|
|
1771
1246
|
//# sourceMappingURL=index.cjs.map
|