@intellectif/lk-core 1.0.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 +30 -0
- package/README.md +2 -1
- package/dist/{activity-DgpBJeBc.d.cts → activity-D705CXng.d.cts} +439 -7
- package/dist/{activity-DgpBJeBc.d.ts → activity-D705CXng.d.ts} +439 -7
- package/dist/ai-check.cjs +300 -9
- package/dist/ai-check.cjs.map +1 -1
- package/dist/ai-check.d.cts +18 -3
- package/dist/ai-check.d.ts +18 -3
- package/dist/ai-check.js +295 -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-BVNeSCWC.d.ts → index-BChYtrEe.d.ts} +1 -1
- package/dist/{index-BlOLlwOi.d.cts → index-VXt_v3YI.d.cts} +1 -1
- package/dist/index.cjs +76 -593
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +308 -66
- package/dist/index.d.ts +308 -66
- package/dist/index.js +76 -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 +242 -242
- package/dist/scoring.d.ts +242 -242
- 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-RCZCP5OE.js +0 -729
- package/dist/chunk-RCZCP5OE.js.map +0 -1
- package/dist/chunk-W5KB3DNT.cjs +0 -729
- package/dist/chunk-W5KB3DNT.cjs.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
|
|
|
@@ -46,7 +46,6 @@ var _chunk2JT2WUQ2cjs = require('./chunk-2JT2WUQ2.cjs');
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
var _chunkW5KB3DNTcjs = require('./chunk-W5KB3DNT.cjs');
|
|
50
49
|
|
|
51
50
|
|
|
52
51
|
|
|
@@ -61,6 +60,7 @@ var _chunkW5KB3DNTcjs = require('./chunk-W5KB3DNT.cjs');
|
|
|
61
60
|
|
|
62
61
|
|
|
63
62
|
|
|
63
|
+
var _chunkMXI26H62cjs = require('./chunk-MXI26H62.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
@@ -71,7 +71,6 @@ var _chunkW5KB3DNTcjs = require('./chunk-W5KB3DNT.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var _chunkVSH7ECQLcjs = require('./chunk-VSH7ECQL.cjs');
|
|
75
74
|
|
|
76
75
|
|
|
77
76
|
|
|
@@ -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
|
|
|
@@ -118,7 +119,16 @@ var _chunkVSH7ECQLcjs = require('./chunk-VSH7ECQL.cjs');
|
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
var _chunk7THXD7ANcjs = require('./chunk-7THXD7AN.cjs');
|
|
122
132
|
|
|
123
133
|
// src/content-hash.ts
|
|
124
134
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -681,14 +691,14 @@ function frozenScoring(policy) {
|
|
|
681
691
|
if (policy === void 0 || policy === null) {
|
|
682
692
|
return void 0;
|
|
683
693
|
}
|
|
684
|
-
const checked =
|
|
694
|
+
const checked = _chunk4YANYTFNcjs.validateItemScoringPolicy.call(void 0, policy);
|
|
685
695
|
if (!checked.success) {
|
|
686
696
|
const first = checked.issues[0];
|
|
687
697
|
throw new Error(
|
|
688
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)` : "")
|
|
689
699
|
);
|
|
690
700
|
}
|
|
691
|
-
return
|
|
701
|
+
return _chunk4YANYTFNcjs.resolveItemScoringPolicy.call(void 0, checked.data);
|
|
692
702
|
}
|
|
693
703
|
function missingOutcome(slot, policy) {
|
|
694
704
|
if (typeof policy === "function") {
|
|
@@ -809,551 +819,6 @@ function diffResponses(before, after) {
|
|
|
809
819
|
return entries;
|
|
810
820
|
}
|
|
811
821
|
|
|
812
|
-
// src/authoring/item-group.ts
|
|
813
|
-
function createItemGroupDraft(context) {
|
|
814
|
-
const issued = /* @__PURE__ */ new Set();
|
|
815
|
-
const newId = () => {
|
|
816
|
-
const id = context.newId();
|
|
817
|
-
if (typeof id !== "string" || id === "") {
|
|
818
|
-
throw new Error("createItemGroupDraft: newId() must return a non-empty string.");
|
|
819
|
-
}
|
|
820
|
-
if (issued.has(id)) {
|
|
821
|
-
throw new Error(
|
|
822
|
-
`createItemGroupDraft: newId() returned "${id}" twice. Ids within one draft must differ.`
|
|
823
|
-
);
|
|
824
|
-
}
|
|
825
|
-
issued.add(id);
|
|
826
|
-
return id;
|
|
827
|
-
};
|
|
828
|
-
return {
|
|
829
|
-
schemaVersion: "1.0",
|
|
830
|
-
type: "item-group",
|
|
831
|
-
id: newId(),
|
|
832
|
-
stimulus: { id: newId(), kind: "text", body: "" },
|
|
833
|
-
items: []
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
function createInteractiveVideoDraft(context) {
|
|
837
|
-
const draft = createItemGroupDraft(context);
|
|
838
|
-
return {
|
|
839
|
-
...draft,
|
|
840
|
-
stimulus: { id: draft.stimulus.id, kind: "video", media: { type: "video", url: "" } },
|
|
841
|
-
timeline: { cues: [] }
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
function validateItemGroupDraft(draft) {
|
|
845
|
-
return _chunkDSDXL3JOcjs.withValidationScope.call(void 0, () => validateItemGroupDraftInScope(draft));
|
|
846
|
-
}
|
|
847
|
-
function validateItemGroupDraftInScope(draft) {
|
|
848
|
-
const issues = [];
|
|
849
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, draft)) {
|
|
850
|
-
issues.push(
|
|
851
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_not_an_object", [], "A group must be an object with a stimulus and its items.")
|
|
852
|
-
);
|
|
853
|
-
return { status: "invalid", issues };
|
|
854
|
-
}
|
|
855
|
-
issues.push(...checkGroupIdentity(draft));
|
|
856
|
-
if (_chunkDSDXL3JOcjs.isRecord.call(void 0, draft.stimulus)) {
|
|
857
|
-
issues.push(...checkStimulus(draft.stimulus));
|
|
858
|
-
} else if (_chunkDSDXL3JOcjs.isUnset.call(void 0, draft.stimulus)) {
|
|
859
|
-
issues.push(
|
|
860
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
861
|
-
"ig_stimulus_required",
|
|
862
|
-
["stimulus"],
|
|
863
|
-
"Add the passage, recording or image the questions are about."
|
|
864
|
-
)
|
|
865
|
-
);
|
|
866
|
-
}
|
|
867
|
-
issues.push(...checkItems(draft));
|
|
868
|
-
if (draft.timeline !== void 0 && draft.timeline !== null) {
|
|
869
|
-
issues.push(...checkTimeline(draft));
|
|
870
|
-
}
|
|
871
|
-
const captions = _chunkDSDXL3JOcjs.groupCaptionsField.call(void 0, draft, (captionsUrl) => !_chunkDSDXL3JOcjs.isUnwritten.call(void 0, captionsUrl));
|
|
872
|
-
if (captions !== void 0) {
|
|
873
|
-
issues.push(
|
|
874
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
875
|
-
"dc_captions_not_allowed",
|
|
876
|
-
["stimulus", "media", captions],
|
|
877
|
-
_chunkDSDXL3JOcjs.GROUP_CAPTIONS_REVEAL_DICTATION
|
|
878
|
-
)
|
|
879
|
-
);
|
|
880
|
-
}
|
|
881
|
-
const parsed = _chunk2JT2WUQ2cjs.ItemGroupSchema.safeParse(draft, { reportInput: true });
|
|
882
|
-
if (!parsed.success) {
|
|
883
|
-
for (const schemaIssue of parsed.error.issues) {
|
|
884
|
-
const path = schemaIssue.path.map(String);
|
|
885
|
-
if (issues.some((known) => _chunkDSDXL3JOcjs.covers.call(void 0, known.path, path))) {
|
|
886
|
-
continue;
|
|
887
|
-
}
|
|
888
|
-
if (path.length > 0 && _chunkDSDXL3JOcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
889
|
-
issues.push(
|
|
890
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
891
|
-
"null_not_allowed",
|
|
892
|
-
path,
|
|
893
|
-
"This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
894
|
-
)
|
|
895
|
-
);
|
|
896
|
-
continue;
|
|
897
|
-
}
|
|
898
|
-
issues.push({
|
|
899
|
-
path,
|
|
900
|
-
message: schemaIssue.message,
|
|
901
|
-
code: schemaIssue.code,
|
|
902
|
-
severity: "invalid"
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
const stored = _chunk2JT2WUQ2cjs.validateItemGroup.call(void 0, draft);
|
|
907
|
-
if (issues.length === 0 && stored.success) {
|
|
908
|
-
return { status: "complete", data: stored.data, issues };
|
|
909
|
-
}
|
|
910
|
-
if (issues.length === 0) {
|
|
911
|
-
for (const error of stored.success ? [] : stored.errors) {
|
|
912
|
-
issues.push({ ...error, severity: "invalid" });
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
const invalid = issues.some((found) => found.severity !== "incomplete");
|
|
916
|
-
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
917
|
-
}
|
|
918
|
-
function checkTimeline(draft) {
|
|
919
|
-
const issues = [];
|
|
920
|
-
const timeline = draft.timeline;
|
|
921
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, timeline)) {
|
|
922
|
-
return issues;
|
|
923
|
-
}
|
|
924
|
-
const stimulus = _chunkDSDXL3JOcjs.isRecord.call(void 0, draft.stimulus) ? draft.stimulus : void 0;
|
|
925
|
-
if (stimulus !== void 0 && !_chunkDSDXL3JOcjs.isUnwritten.call(void 0, stimulus.kind) && stimulus.kind !== "video") {
|
|
926
|
-
issues.push(
|
|
927
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
928
|
-
"ig_timeline_stimulus_kind",
|
|
929
|
-
["stimulus", "kind"],
|
|
930
|
-
"An interactive video needs a video: quizzes open at moments of it."
|
|
931
|
-
)
|
|
932
|
-
);
|
|
933
|
-
} else if (stimulus !== void 0 && _chunkDSDXL3JOcjs.isRecord.call(void 0, stimulus.media) && !_chunkDSDXL3JOcjs.isUnwritten.call(void 0, stimulus.media.type) && stimulus.media.type !== "video") {
|
|
934
|
-
issues.push(
|
|
935
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
936
|
-
"ig_timeline_stimulus_kind",
|
|
937
|
-
["stimulus", "media", "type"],
|
|
938
|
-
"Upload a video file. An embedded player from another site cannot be paused when a quiz opens."
|
|
939
|
-
)
|
|
940
|
-
);
|
|
941
|
-
}
|
|
942
|
-
if (draft.shuffle === "within-group") {
|
|
943
|
-
issues.push(
|
|
944
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
945
|
-
"ig_timeline_shuffle",
|
|
946
|
-
["shuffle"],
|
|
947
|
-
"The questions of an interactive video appear in the order their quizzes open, so they cannot be shuffled."
|
|
948
|
-
)
|
|
949
|
-
);
|
|
950
|
-
}
|
|
951
|
-
const items = Array.isArray(draft.items) ? draft.items : [];
|
|
952
|
-
const itemIndexById = /* @__PURE__ */ new Map();
|
|
953
|
-
items.forEach((item, index) => {
|
|
954
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, item)) {
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
if (typeof item.id === "string" && item.id !== "") {
|
|
958
|
-
itemIndexById.set(item.id, index);
|
|
959
|
-
}
|
|
960
|
-
const type = item.type;
|
|
961
|
-
if (typeof type === "string" && type !== "" && type !== "item-group" && !_chunk2JT2WUQ2cjs.isInteractiveVideoItemType.call(void 0, type) && _chunkDSDXL3JOcjs.getActivityTypeDescriptor.call(void 0, type) !== void 0) {
|
|
962
|
-
issues.push(
|
|
963
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
964
|
-
"ig_timeline_item_type",
|
|
965
|
-
["items", index, "type"],
|
|
966
|
-
`An interactive video can hold ${_chunk2JT2WUQ2cjs.INTERACTIVE_VIDEO_ITEM_TYPES.join(", ")} questions only.`
|
|
967
|
-
)
|
|
968
|
-
);
|
|
969
|
-
}
|
|
970
|
-
if (type === "dictation" && _chunkDSDXL3JOcjs.isUnset.call(void 0, item.media)) {
|
|
971
|
-
issues.push(
|
|
972
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
973
|
-
"ig_timeline_dictation_media",
|
|
974
|
-
["items", index, "media"],
|
|
975
|
-
"Add the recording this dictation plays: inside a video it cannot play the video."
|
|
976
|
-
)
|
|
977
|
-
);
|
|
978
|
-
}
|
|
979
|
-
});
|
|
980
|
-
const cues = Array.isArray(timeline.cues) ? timeline.cues : [];
|
|
981
|
-
const quizIds = /* @__PURE__ */ new Set();
|
|
982
|
-
const placed = /* @__PURE__ */ new Set();
|
|
983
|
-
cues.forEach((cue, cueIndex) => {
|
|
984
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, cue)) {
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
const at = (field, ...rest) => [
|
|
988
|
-
"timeline",
|
|
989
|
-
"cues",
|
|
990
|
-
cueIndex,
|
|
991
|
-
field,
|
|
992
|
-
...rest
|
|
993
|
-
];
|
|
994
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, cue.id)) {
|
|
995
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "ig_timeline_quiz_id_required", at("id"), "This quiz has no id."));
|
|
996
|
-
} else if (typeof cue.id === "string") {
|
|
997
|
-
if (quizIds.has(cue.id)) {
|
|
998
|
-
issues.push(
|
|
999
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_timeline_quiz_id_duplicate", at("id"), `Two quizzes share the id "${cue.id}".`)
|
|
1000
|
-
);
|
|
1001
|
-
}
|
|
1002
|
-
quizIds.add(cue.id);
|
|
1003
|
-
}
|
|
1004
|
-
if (_chunkDSDXL3JOcjs.isUnset.call(void 0, cue.at)) {
|
|
1005
|
-
issues.push(
|
|
1006
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1007
|
-
"ig_timeline_quiz_time_required",
|
|
1008
|
-
at("at"),
|
|
1009
|
-
"Choose when in the video this quiz opens."
|
|
1010
|
-
)
|
|
1011
|
-
);
|
|
1012
|
-
} else if (typeof cue.at !== "number" || !Number.isFinite(cue.at) || cue.at < 0) {
|
|
1013
|
-
issues.push(
|
|
1014
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1015
|
-
"ig_timeline_quiz_time_invalid",
|
|
1016
|
-
at("at"),
|
|
1017
|
-
"A quiz opens at a number of seconds, 0 or more."
|
|
1018
|
-
)
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
if (_chunkDSDXL3JOcjs.isUnset.call(void 0, cue.itemIds) || Array.isArray(cue.itemIds) && cue.itemIds.length === 0) {
|
|
1022
|
-
issues.push(
|
|
1023
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_timeline_quiz_empty", at("itemIds"), "Add at least one question to this quiz.")
|
|
1024
|
-
);
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
if (!Array.isArray(cue.itemIds)) {
|
|
1028
|
-
return;
|
|
1029
|
-
}
|
|
1030
|
-
cue.itemIds.forEach((itemId, position) => {
|
|
1031
|
-
if (typeof itemId !== "string") {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
if (!itemIndexById.has(itemId)) {
|
|
1035
|
-
issues.push(
|
|
1036
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1037
|
-
"ig_timeline_quiz_unknown_item",
|
|
1038
|
-
at("itemIds", position),
|
|
1039
|
-
`This quiz names a question that is not in the video ("${itemId}").`
|
|
1040
|
-
)
|
|
1041
|
-
);
|
|
1042
|
-
} else if (placed.has(itemId)) {
|
|
1043
|
-
issues.push(
|
|
1044
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1045
|
-
"ig_timeline_item_duplicate",
|
|
1046
|
-
at("itemIds", position),
|
|
1047
|
-
"This question is already in a quiz: each question belongs to one quiz."
|
|
1048
|
-
)
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
placed.add(itemId);
|
|
1052
|
-
});
|
|
1053
|
-
});
|
|
1054
|
-
for (const [itemId, index] of itemIndexById) {
|
|
1055
|
-
if (!placed.has(itemId)) {
|
|
1056
|
-
issues.push(
|
|
1057
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1058
|
-
"ig_timeline_item_unplaced",
|
|
1059
|
-
["items", index],
|
|
1060
|
-
"Add this question to a quiz, or the video never shows it."
|
|
1061
|
-
)
|
|
1062
|
-
);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
const chapters = Array.isArray(timeline.chapters) ? timeline.chapters : [];
|
|
1066
|
-
let previousAt;
|
|
1067
|
-
chapters.forEach((chapter, index) => {
|
|
1068
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, chapter)) {
|
|
1069
|
-
return;
|
|
1070
|
-
}
|
|
1071
|
-
if (_chunkDSDXL3JOcjs.isUnwritten.call(void 0, chapter.title)) {
|
|
1072
|
-
issues.push(
|
|
1073
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1074
|
-
"ig_timeline_chapter_title",
|
|
1075
|
-
["timeline", "chapters", index, "title"],
|
|
1076
|
-
"Give this chapter a title."
|
|
1077
|
-
)
|
|
1078
|
-
);
|
|
1079
|
-
}
|
|
1080
|
-
if (typeof chapter.at === "number" && Number.isFinite(chapter.at)) {
|
|
1081
|
-
if (previousAt !== void 0 && chapter.at <= previousAt) {
|
|
1082
|
-
issues.push(
|
|
1083
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1084
|
-
"ig_timeline_chapter_order",
|
|
1085
|
-
["timeline", "chapters", index, "at"],
|
|
1086
|
-
"Chapters must start in order, each after the one before it."
|
|
1087
|
-
)
|
|
1088
|
-
);
|
|
1089
|
-
}
|
|
1090
|
-
previousAt = chapter.at;
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
return issues;
|
|
1094
|
-
}
|
|
1095
|
-
function checkGroupIdentity(draft) {
|
|
1096
|
-
const issues = [];
|
|
1097
|
-
if (draft.schemaVersion !== "1.0") {
|
|
1098
|
-
issues.push(
|
|
1099
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1100
|
-
"schema_version_invalid",
|
|
1101
|
-
["schemaVersion"],
|
|
1102
|
-
'The draft must have schemaVersion "1.0". A draft from createItemGroupDraft has it.'
|
|
1103
|
-
)
|
|
1104
|
-
);
|
|
1105
|
-
}
|
|
1106
|
-
if (draft.type !== "item-group") {
|
|
1107
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "type_mismatch", ["type"], `The draft's type must be "item-group".`));
|
|
1108
|
-
}
|
|
1109
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, draft.id)) {
|
|
1110
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "id_required", ["id"], "The group has no id."));
|
|
1111
|
-
}
|
|
1112
|
-
if (!_chunkDSDXL3JOcjs.isUnset.call(void 0, draft.shuffle) && draft.shuffle !== "none" && draft.shuffle !== "within-group") {
|
|
1113
|
-
issues.push(
|
|
1114
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1115
|
-
"ig_shuffle_invalid",
|
|
1116
|
-
["shuffle"],
|
|
1117
|
-
'Shuffling is either "none" or "within-group". Leave it out to keep the authored order.'
|
|
1118
|
-
)
|
|
1119
|
-
);
|
|
1120
|
-
}
|
|
1121
|
-
return issues;
|
|
1122
|
-
}
|
|
1123
|
-
var KINDS = /* @__PURE__ */ new Set(["text", "audio", "video", "image", "mixed"]);
|
|
1124
|
-
var MEDIA_FOR_KIND = {
|
|
1125
|
-
audio: ["audio"],
|
|
1126
|
-
video: ["video", "embed"],
|
|
1127
|
-
image: ["image"],
|
|
1128
|
-
mixed: ["audio", "video", "image", "embed"]
|
|
1129
|
-
};
|
|
1130
|
-
function checkStimulus(stimulus) {
|
|
1131
|
-
const issues = [];
|
|
1132
|
-
const at = (...rest) => ["stimulus", ...rest];
|
|
1133
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, stimulus.id)) {
|
|
1134
|
-
issues.push(_chunkDSDXL3JOcjs.issue.call(void 0, "ig_stimulus_id_required", at("id"), "The stimulus has no id."));
|
|
1135
|
-
}
|
|
1136
|
-
const kind = stimulus.kind;
|
|
1137
|
-
if (_chunkDSDXL3JOcjs.isUnwritten.call(void 0, kind)) {
|
|
1138
|
-
issues.push(
|
|
1139
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1140
|
-
"ig_stimulus_kind_required",
|
|
1141
|
-
at("kind"),
|
|
1142
|
-
"Choose what the questions are about: a text, a recording, a video, an image, or a mix."
|
|
1143
|
-
)
|
|
1144
|
-
);
|
|
1145
|
-
} else if (typeof kind !== "string" || !KINDS.has(kind)) {
|
|
1146
|
-
if (typeof kind === "string") {
|
|
1147
|
-
issues.push(
|
|
1148
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1149
|
-
"ig_stimulus_kind_invalid",
|
|
1150
|
-
at("kind"),
|
|
1151
|
-
`"${kind}" is not a stimulus kind. Use text, audio, video, image or mixed.`
|
|
1152
|
-
)
|
|
1153
|
-
);
|
|
1154
|
-
}
|
|
1155
|
-
if (_chunkDSDXL3JOcjs.isRecord.call(void 0, stimulus.media)) {
|
|
1156
|
-
issues.push(..._chunkDSDXL3JOcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
1157
|
-
}
|
|
1158
|
-
return issues;
|
|
1159
|
-
}
|
|
1160
|
-
const hasBody = typeof stimulus.body === "string" && stimulus.body.trim() !== "";
|
|
1161
|
-
const htmlPresent = !_chunkDSDXL3JOcjs.isUnset.call(void 0, stimulus.bodyHtml);
|
|
1162
|
-
if (!hasBody && (kind === "text" || kind === "mixed" || htmlPresent)) {
|
|
1163
|
-
issues.push(
|
|
1164
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1165
|
-
"ig_stimulus_body_required",
|
|
1166
|
-
at("body"),
|
|
1167
|
-
_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."
|
|
1168
|
-
)
|
|
1169
|
-
);
|
|
1170
|
-
}
|
|
1171
|
-
if (kind !== "text" && _chunkDSDXL3JOcjs.isUnset.call(void 0, stimulus.media)) {
|
|
1172
|
-
issues.push(
|
|
1173
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_stimulus_media_required", at("media"), "Add the recording, video or image.")
|
|
1174
|
-
);
|
|
1175
|
-
} else if (_chunkDSDXL3JOcjs.isRecord.call(void 0, stimulus.media)) {
|
|
1176
|
-
const allowed = MEDIA_FOR_KIND[kind];
|
|
1177
|
-
const mediaType = stimulus.media.type;
|
|
1178
|
-
if (allowed !== void 0 && typeof mediaType === "string" && !allowed.includes(mediaType)) {
|
|
1179
|
-
issues.push(
|
|
1180
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1181
|
-
"ig_stimulus_media_kind",
|
|
1182
|
-
at("media", "type"),
|
|
1183
|
-
`A "${kind}" stimulus cannot carry ${mediaType} media. Use ${allowed.join(" or ")}.`
|
|
1184
|
-
)
|
|
1185
|
-
);
|
|
1186
|
-
}
|
|
1187
|
-
issues.push(..._chunkDSDXL3JOcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
1188
|
-
}
|
|
1189
|
-
return issues;
|
|
1190
|
-
}
|
|
1191
|
-
function checkItems(draft) {
|
|
1192
|
-
const issues = [];
|
|
1193
|
-
const items = _chunkDSDXL3JOcjs.isUnset.call(void 0, draft.items) ? [] : draft.items;
|
|
1194
|
-
if (!Array.isArray(items)) {
|
|
1195
|
-
return issues;
|
|
1196
|
-
}
|
|
1197
|
-
if (items.length === 0) {
|
|
1198
|
-
issues.push(
|
|
1199
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_items_required", ["items"], "Add at least one question about this material.")
|
|
1200
|
-
);
|
|
1201
|
-
return issues;
|
|
1202
|
-
}
|
|
1203
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1204
|
-
const repeated = /* @__PURE__ */ new Set();
|
|
1205
|
-
for (const [index, item] of items.entries()) {
|
|
1206
|
-
if (!_chunkDSDXL3JOcjs.isRecord.call(void 0, item)) {
|
|
1207
|
-
continue;
|
|
1208
|
-
}
|
|
1209
|
-
const ordinal = index + 1;
|
|
1210
|
-
if (_chunkDSDXL3JOcjs.isMissingId.call(void 0, item.id)) {
|
|
1211
|
-
issues.push(
|
|
1212
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_item_id_required", ["items", index, "id"], `Question ${ordinal} has no id.`)
|
|
1213
|
-
);
|
|
1214
|
-
} else if (typeof item.id === "string") {
|
|
1215
|
-
if (seen.has(item.id)) {
|
|
1216
|
-
repeated.add(item.id);
|
|
1217
|
-
}
|
|
1218
|
-
seen.add(item.id);
|
|
1219
|
-
}
|
|
1220
|
-
if (item.type === "item-group") {
|
|
1221
|
-
issues.push(
|
|
1222
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1223
|
-
"ig_item_nested_group",
|
|
1224
|
-
["items", index, "type"],
|
|
1225
|
-
"Groups do not nest: every item must be an activity."
|
|
1226
|
-
)
|
|
1227
|
-
);
|
|
1228
|
-
continue;
|
|
1229
|
-
}
|
|
1230
|
-
if (_chunkDSDXL3JOcjs.isUnwritten.call(void 0, item.type)) {
|
|
1231
|
-
issues.push(
|
|
1232
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1233
|
-
"ig_item_type_required",
|
|
1234
|
-
["items", index, "type"],
|
|
1235
|
-
`Choose what kind of question ${ordinal} is.`
|
|
1236
|
-
)
|
|
1237
|
-
);
|
|
1238
|
-
continue;
|
|
1239
|
-
}
|
|
1240
|
-
if (typeof item.type !== "string") {
|
|
1241
|
-
continue;
|
|
1242
|
-
}
|
|
1243
|
-
let result;
|
|
1244
|
-
try {
|
|
1245
|
-
result = validateDraft(item.type, item);
|
|
1246
|
-
} catch (error) {
|
|
1247
|
-
if (!(error instanceof _chunkDSDXL3JOcjs.UnknownActivityTypeError) || error.activityType !== item.type) {
|
|
1248
|
-
throw error;
|
|
1249
|
-
}
|
|
1250
|
-
issues.push(
|
|
1251
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1252
|
-
"ig_item_type_unknown",
|
|
1253
|
-
["items", index, "type"],
|
|
1254
|
-
`"${item.type}" is not a registered activity type.`
|
|
1255
|
-
)
|
|
1256
|
-
);
|
|
1257
|
-
continue;
|
|
1258
|
-
}
|
|
1259
|
-
for (const found of result.issues) {
|
|
1260
|
-
issues.push({ ...found, path: ["items", String(index), ...found.path] });
|
|
1261
|
-
}
|
|
1262
|
-
}
|
|
1263
|
-
for (const id of repeated) {
|
|
1264
|
-
issues.push(
|
|
1265
|
-
_chunkDSDXL3JOcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
1266
|
-
);
|
|
1267
|
-
}
|
|
1268
|
-
return issues;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
// src/authoring/index.ts
|
|
1272
|
-
function validateDraft(type, draft) {
|
|
1273
|
-
return _chunkDSDXL3JOcjs.withValidationScope.call(void 0, () => validateDraftInScope(type, draft));
|
|
1274
|
-
}
|
|
1275
|
-
function validateDraftInScope(type, draft) {
|
|
1276
|
-
const descriptor = _chunkDSDXL3JOcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1277
|
-
if (descriptor === void 0) {
|
|
1278
|
-
throw new (0, _chunkDSDXL3JOcjs.UnknownActivityTypeError)(String(type));
|
|
1279
|
-
}
|
|
1280
|
-
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) : [];
|
|
1281
|
-
const issues = [...reported];
|
|
1282
|
-
const parsed = _chunkDSDXL3JOcjs.readSchema.call(void 0, descriptor.schema, draft, `Activity type "${descriptor.type}"`, {
|
|
1283
|
-
reportInput: true
|
|
1284
|
-
});
|
|
1285
|
-
if (!parsed.success) {
|
|
1286
|
-
const covered = _chunkDSDXL3JOcjs.coveredPathsOf.call(void 0, reported);
|
|
1287
|
-
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
1288
|
-
for (const schemaIssue of parsed.issues) {
|
|
1289
|
-
const path = schemaIssue.path.map(String);
|
|
1290
|
-
if (covered.has(_chunkDSDXL3JOcjs.pathKey.call(void 0, path))) {
|
|
1291
|
-
continue;
|
|
1292
|
-
}
|
|
1293
|
-
if (path.length > 0 && _chunkDSDXL3JOcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
1294
|
-
const key = JSON.stringify(path);
|
|
1295
|
-
if (!reportedEmpty.has(key)) {
|
|
1296
|
-
reportedEmpty.add(key);
|
|
1297
|
-
issues.push(
|
|
1298
|
-
_chunkDSDXL3JOcjs.issue.call(void 0,
|
|
1299
|
-
"null_not_allowed",
|
|
1300
|
-
path,
|
|
1301
|
-
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."
|
|
1302
|
-
)
|
|
1303
|
-
);
|
|
1304
|
-
}
|
|
1305
|
-
continue;
|
|
1306
|
-
}
|
|
1307
|
-
issues.push({
|
|
1308
|
-
path,
|
|
1309
|
-
message: schemaIssue.message,
|
|
1310
|
-
code: schemaIssue.code,
|
|
1311
|
-
severity: "invalid"
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
if (parsed.success && issues.length === 0) {
|
|
1316
|
-
return { status: "complete", data: parsed.data, issues };
|
|
1317
|
-
}
|
|
1318
|
-
const invalid = issues.some((found) => found.severity !== "incomplete");
|
|
1319
|
-
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
1320
|
-
}
|
|
1321
|
-
function createDraft(type, context) {
|
|
1322
|
-
const descriptor = _chunkDSDXL3JOcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1323
|
-
if (descriptor === void 0) {
|
|
1324
|
-
throw new (0, _chunkDSDXL3JOcjs.UnknownActivityTypeError)(String(type));
|
|
1325
|
-
}
|
|
1326
|
-
const create = _optionalChain([descriptor, 'access', _27 => _27.authoring, 'optionalAccess', _28 => _28.createDraft]);
|
|
1327
|
-
if (create === void 0) {
|
|
1328
|
-
throw new Error(
|
|
1329
|
-
`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.`
|
|
1330
|
-
);
|
|
1331
|
-
}
|
|
1332
|
-
const issued = /* @__PURE__ */ new Set();
|
|
1333
|
-
const newId = () => {
|
|
1334
|
-
const id = context.newId();
|
|
1335
|
-
if (typeof id !== "string" || id === "") {
|
|
1336
|
-
throw new Error("createDraft: newId() must return a non-empty string.");
|
|
1337
|
-
}
|
|
1338
|
-
if (issued.has(id)) {
|
|
1339
|
-
throw new Error(
|
|
1340
|
-
`createDraft: newId() returned "${id}" twice. Ids within one draft must differ \u2014 two options sharing an id cannot be scored apart.`
|
|
1341
|
-
);
|
|
1342
|
-
}
|
|
1343
|
-
issued.add(id);
|
|
1344
|
-
return id;
|
|
1345
|
-
};
|
|
1346
|
-
return create({ newId });
|
|
1347
|
-
}
|
|
1348
|
-
function normalise(found) {
|
|
1349
|
-
const documented = Object.hasOwn(_chunkDSDXL3JOcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkDSDXL3JOcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
1350
|
-
return {
|
|
1351
|
-
...found,
|
|
1352
|
-
path: found.path.map(String),
|
|
1353
|
-
severity: _nullishCoalesce(documented, () => ( (found.severity === "incomplete" ? "incomplete" : "invalid")))
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
822
|
// src/redact.ts
|
|
1358
823
|
function mergePolicy(base, overrides) {
|
|
1359
824
|
if (overrides === void 0) {
|
|
@@ -1410,9 +875,9 @@ function redactValue(value, policy, reveal) {
|
|
|
1410
875
|
}
|
|
1411
876
|
function redact(data, options = {}) {
|
|
1412
877
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
1413
|
-
const descriptor =
|
|
878
|
+
const descriptor = _chunk7THXD7ANcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
1414
879
|
if (descriptor === void 0) {
|
|
1415
|
-
throw new (0,
|
|
880
|
+
throw new (0, _chunk7THXD7ANcjs.UnknownActivityTypeError)(String(data.type));
|
|
1416
881
|
}
|
|
1417
882
|
if (descriptor.fieldPolicy === void 0) {
|
|
1418
883
|
throw new Error(
|
|
@@ -1423,18 +888,18 @@ function redact(data, options = {}) {
|
|
|
1423
888
|
const projected = redactValue(data, effectivePolicy, reveal);
|
|
1424
889
|
const result = { ...projected, redacted: true };
|
|
1425
890
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
1426
|
-
const parsed =
|
|
891
|
+
const parsed = _chunk7THXD7ANcjs.readSchema.call(void 0,
|
|
1427
892
|
descriptor.redactedSchema,
|
|
1428
893
|
result,
|
|
1429
894
|
`Activity type "${descriptor.type}"`
|
|
1430
895
|
);
|
|
1431
896
|
if (!parsed.success) {
|
|
1432
|
-
throw new (0,
|
|
897
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1433
898
|
descriptor.type,
|
|
1434
|
-
parsed.issues.map((
|
|
1435
|
-
path:
|
|
1436
|
-
message:
|
|
1437
|
-
code:
|
|
899
|
+
parsed.issues.map((issue) => ({
|
|
900
|
+
path: issue.path.map(String),
|
|
901
|
+
message: issue.message,
|
|
902
|
+
code: issue.code
|
|
1438
903
|
}))
|
|
1439
904
|
);
|
|
1440
905
|
}
|
|
@@ -1443,13 +908,13 @@ function redact(data, options = {}) {
|
|
|
1443
908
|
}
|
|
1444
909
|
function assertRedacted(data) {
|
|
1445
910
|
if (typeof data !== "object" || data === null) {
|
|
1446
|
-
throw new (0,
|
|
911
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)("unknown", [
|
|
1447
912
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
1448
913
|
]);
|
|
1449
914
|
}
|
|
1450
915
|
const candidate = data;
|
|
1451
916
|
if (candidate.redacted !== true) {
|
|
1452
|
-
throw new (0,
|
|
917
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
1453
918
|
{
|
|
1454
919
|
path: ["redacted"],
|
|
1455
920
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -1458,12 +923,12 @@ function assertRedacted(data) {
|
|
|
1458
923
|
]);
|
|
1459
924
|
}
|
|
1460
925
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
1461
|
-
const descriptor =
|
|
926
|
+
const descriptor = _chunk7THXD7ANcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
1462
927
|
if (descriptor === void 0) {
|
|
1463
|
-
throw new (0,
|
|
928
|
+
throw new (0, _chunk7THXD7ANcjs.UnknownActivityTypeError)(type);
|
|
1464
929
|
}
|
|
1465
930
|
if (descriptor.redactedSchema === void 0) {
|
|
1466
|
-
throw new (0,
|
|
931
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(descriptor.type, [
|
|
1467
932
|
{
|
|
1468
933
|
path: [],
|
|
1469
934
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -1471,18 +936,18 @@ function assertRedacted(data) {
|
|
|
1471
936
|
}
|
|
1472
937
|
]);
|
|
1473
938
|
}
|
|
1474
|
-
const parsed =
|
|
939
|
+
const parsed = _chunk7THXD7ANcjs.readSchema.call(void 0,
|
|
1475
940
|
descriptor.redactedSchema,
|
|
1476
941
|
candidate,
|
|
1477
942
|
`Activity type "${descriptor.type}"`
|
|
1478
943
|
);
|
|
1479
944
|
if (!parsed.success) {
|
|
1480
|
-
throw new (0,
|
|
945
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1481
946
|
descriptor.type,
|
|
1482
|
-
parsed.issues.map((
|
|
1483
|
-
path:
|
|
1484
|
-
message:
|
|
1485
|
-
code:
|
|
947
|
+
parsed.issues.map((issue) => ({
|
|
948
|
+
path: issue.path.map(String),
|
|
949
|
+
message: issue.message,
|
|
950
|
+
code: issue.code
|
|
1486
951
|
}))
|
|
1487
952
|
);
|
|
1488
953
|
}
|
|
@@ -1493,7 +958,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
1493
958
|
title: "public",
|
|
1494
959
|
body: "public",
|
|
1495
960
|
bodyHtml: "public",
|
|
1496
|
-
media:
|
|
961
|
+
media: _chunk7THXD7ANcjs.MEDIA_FIELD_POLICY,
|
|
1497
962
|
locale: "public",
|
|
1498
963
|
attribution: "public",
|
|
1499
964
|
transcript: "author-only"
|
|
@@ -1537,14 +1002,14 @@ function redactItemGroup(group, options = {}) {
|
|
|
1537
1002
|
redacted: true
|
|
1538
1003
|
};
|
|
1539
1004
|
if (reveal === "none") {
|
|
1540
|
-
const parsed =
|
|
1005
|
+
const parsed = _chunkZWXQSKCXcjs.RedactedItemGroupSchema.safeParse(result);
|
|
1541
1006
|
if (!parsed.success) {
|
|
1542
|
-
throw new (0,
|
|
1007
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1543
1008
|
"item-group",
|
|
1544
|
-
parsed.error.issues.map((
|
|
1545
|
-
path:
|
|
1546
|
-
message:
|
|
1547
|
-
code:
|
|
1009
|
+
parsed.error.issues.map((issue) => ({
|
|
1010
|
+
path: issue.path.map(String),
|
|
1011
|
+
message: issue.message,
|
|
1012
|
+
code: issue.code
|
|
1548
1013
|
}))
|
|
1549
1014
|
);
|
|
1550
1015
|
}
|
|
@@ -1553,13 +1018,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
1553
1018
|
}
|
|
1554
1019
|
function assertRedactedItemGroup(data) {
|
|
1555
1020
|
if (typeof data !== "object" || data === null) {
|
|
1556
|
-
throw new (0,
|
|
1021
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)("item-group", [
|
|
1557
1022
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
1558
1023
|
]);
|
|
1559
1024
|
}
|
|
1560
1025
|
const candidate = data;
|
|
1561
1026
|
if (candidate.redacted !== true) {
|
|
1562
|
-
throw new (0,
|
|
1027
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)("item-group", [
|
|
1563
1028
|
{
|
|
1564
1029
|
path: ["redacted"],
|
|
1565
1030
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -1567,14 +1032,14 @@ function assertRedactedItemGroup(data) {
|
|
|
1567
1032
|
}
|
|
1568
1033
|
]);
|
|
1569
1034
|
}
|
|
1570
|
-
const parsed =
|
|
1035
|
+
const parsed = _chunkZWXQSKCXcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
1571
1036
|
if (!parsed.success) {
|
|
1572
|
-
throw new (0,
|
|
1037
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1573
1038
|
"item-group",
|
|
1574
|
-
parsed.error.issues.map((
|
|
1575
|
-
path:
|
|
1576
|
-
message:
|
|
1577
|
-
code:
|
|
1039
|
+
parsed.error.issues.map((issue) => ({
|
|
1040
|
+
path: issue.path.map(String),
|
|
1041
|
+
message: issue.message,
|
|
1042
|
+
code: issue.code
|
|
1578
1043
|
}))
|
|
1579
1044
|
);
|
|
1580
1045
|
}
|
|
@@ -1582,12 +1047,12 @@ function assertRedactedItemGroup(data) {
|
|
|
1582
1047
|
try {
|
|
1583
1048
|
assertRedacted(item);
|
|
1584
1049
|
} catch (error) {
|
|
1585
|
-
if (error instanceof
|
|
1586
|
-
throw new (0,
|
|
1050
|
+
if (error instanceof _chunk7THXD7ANcjs.ActivitySchemaError) {
|
|
1051
|
+
throw new (0, _chunk7THXD7ANcjs.ActivitySchemaError)(
|
|
1587
1052
|
"item-group",
|
|
1588
|
-
error.errors.map((
|
|
1589
|
-
...
|
|
1590
|
-
path: ["items", String(index), ...
|
|
1053
|
+
error.errors.map((issue) => ({
|
|
1054
|
+
...issue,
|
|
1055
|
+
path: ["items", String(index), ...issue.path]
|
|
1591
1056
|
}))
|
|
1592
1057
|
);
|
|
1593
1058
|
}
|
|
@@ -1628,7 +1093,7 @@ function composeTimelineScore(entryKey, items, policy) {
|
|
|
1628
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.`
|
|
1629
1094
|
);
|
|
1630
1095
|
}
|
|
1631
|
-
return
|
|
1096
|
+
return _chunk4YANYTFNcjs.composeAssessmentScore.call(void 0, [{ id: entryKey, weight: 1, items: own }], policy);
|
|
1632
1097
|
}
|
|
1633
1098
|
|
|
1634
1099
|
|
|
@@ -1759,5 +1224,23 @@ function composeTimelineScore(entryKey, items, policy) {
|
|
|
1759
1224
|
|
|
1760
1225
|
|
|
1761
1226
|
|
|
1762
|
-
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
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;
|
|
1763
1246
|
//# sourceMappingURL=index.cjs.map
|