@intellectif/lk-core 0.11.0 → 0.12.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 +14 -0
- package/dist/{chunk-VBM5H6P5.cjs → chunk-4OHWLCI6.cjs} +8 -8
- package/dist/{chunk-VBM5H6P5.cjs.map → chunk-4OHWLCI6.cjs.map} +1 -1
- package/dist/{chunk-XGCTAQSS.js → chunk-7JMMPE7O.js} +2 -2
- package/dist/{chunk-FIS5KBCE.js → chunk-FVN37GIH.js} +28 -1
- package/dist/chunk-FVN37GIH.js.map +1 -0
- package/dist/{chunk-7ODQRNR4.cjs → chunk-J6POE4HL.cjs} +29 -2
- package/dist/chunk-J6POE4HL.cjs.map +1 -0
- package/dist/{chunk-VTTRXGDD.cjs → chunk-O2IVKTHV.cjs} +4 -4
- package/dist/{chunk-VTTRXGDD.cjs.map → chunk-O2IVKTHV.cjs.map} +1 -1
- package/dist/{chunk-ZTY4UIUD.js → chunk-RK2NVTHZ.js} +2 -2
- package/dist/{chunk-IXXMYJI7.js → chunk-UQPNJP2O.js} +2 -2
- package/dist/{chunk-3FEAEO3D.cjs → chunk-VYE6BYON.cjs} +13 -13
- package/dist/{chunk-3FEAEO3D.cjs.map → chunk-VYE6BYON.cjs.map} +1 -1
- package/dist/index.cjs +294 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +266 -10
- package/dist/index.js.map +1 -1
- package/dist/schemas.cjs +3 -3
- package/dist/schemas.js +2 -2
- package/dist/scoring.cjs +3 -3
- package/dist/scoring.js +2 -2
- package/dist/xapi.cjs +3 -3
- package/dist/xapi.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7ODQRNR4.cjs.map +0 -1
- package/dist/chunk-FIS5KBCE.js.map +0 -1
- /package/dist/{chunk-XGCTAQSS.js.map → chunk-7JMMPE7O.js.map} +0 -0
- /package/dist/{chunk-ZTY4UIUD.js.map → chunk-RK2NVTHZ.js.map} +0 -0
- /package/dist/{chunk-IXXMYJI7.js.map → chunk-UQPNJP2O.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk4OHWLCI6cjs = require('./chunk-4OHWLCI6.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkO2IVKTHVcjs = require('./chunk-O2IVKTHV.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -32,7 +32,7 @@ var _chunkVTTRXGDDcjs = require('./chunk-VTTRXGDD.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkVYE6BYONcjs = require('./chunk-VYE6BYON.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -82,7 +82,12 @@ var _chunk3FEAEO3Dcjs = require('./chunk-3FEAEO3D.cjs');
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
var _chunkJ6POE4HLcjs = require('./chunk-J6POE4HL.cjs');
|
|
86
91
|
|
|
87
92
|
// src/content-hash.ts
|
|
88
93
|
function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -586,28 +591,283 @@ function diffResponses(before, after) {
|
|
|
586
591
|
return entries;
|
|
587
592
|
}
|
|
588
593
|
|
|
594
|
+
// src/authoring/item-group.ts
|
|
595
|
+
function createItemGroupDraft(context) {
|
|
596
|
+
const issued = /* @__PURE__ */ new Set();
|
|
597
|
+
const newId = () => {
|
|
598
|
+
const id = context.newId();
|
|
599
|
+
if (typeof id !== "string" || id === "") {
|
|
600
|
+
throw new Error("createItemGroupDraft: newId() must return a non-empty string.");
|
|
601
|
+
}
|
|
602
|
+
if (issued.has(id)) {
|
|
603
|
+
throw new Error(
|
|
604
|
+
`createItemGroupDraft: newId() returned "${id}" twice. Ids within one draft must differ.`
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
issued.add(id);
|
|
608
|
+
return id;
|
|
609
|
+
};
|
|
610
|
+
return {
|
|
611
|
+
schemaVersion: "1.0",
|
|
612
|
+
type: "item-group",
|
|
613
|
+
id: newId(),
|
|
614
|
+
stimulus: { id: newId(), kind: "text", body: "" },
|
|
615
|
+
items: []
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
function validateItemGroupDraft(draft) {
|
|
619
|
+
const issues = [];
|
|
620
|
+
if (!_chunkJ6POE4HLcjs.isRecord.call(void 0, draft)) {
|
|
621
|
+
issues.push(
|
|
622
|
+
_chunkJ6POE4HLcjs.issue.call(void 0, "ig_not_an_object", [], "A group must be an object with a stimulus and its items.")
|
|
623
|
+
);
|
|
624
|
+
return { status: "invalid", issues };
|
|
625
|
+
}
|
|
626
|
+
issues.push(...checkGroupIdentity(draft));
|
|
627
|
+
if (_chunkJ6POE4HLcjs.isRecord.call(void 0, draft.stimulus)) {
|
|
628
|
+
issues.push(...checkStimulus(draft.stimulus));
|
|
629
|
+
} else if (_chunkJ6POE4HLcjs.isUnset.call(void 0, draft.stimulus)) {
|
|
630
|
+
issues.push(
|
|
631
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
632
|
+
"ig_stimulus_required",
|
|
633
|
+
["stimulus"],
|
|
634
|
+
"Add the passage, recording or image the questions are about."
|
|
635
|
+
)
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
issues.push(...checkItems(draft));
|
|
639
|
+
const parsed = _chunkVYE6BYONcjs.ItemGroupSchema.safeParse(draft, { reportInput: true });
|
|
640
|
+
if (!parsed.success) {
|
|
641
|
+
for (const schemaIssue of parsed.error.issues) {
|
|
642
|
+
const path = schemaIssue.path.map(String);
|
|
643
|
+
if (issues.some((known) => _chunkJ6POE4HLcjs.covers.call(void 0, known.path, path))) {
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if (path.length > 0 && _chunkJ6POE4HLcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
647
|
+
issues.push(
|
|
648
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
649
|
+
"null_not_allowed",
|
|
650
|
+
path,
|
|
651
|
+
"This field cannot be null. Leave it out if it is optional, or give it a value."
|
|
652
|
+
)
|
|
653
|
+
);
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
issues.push({
|
|
657
|
+
path,
|
|
658
|
+
message: schemaIssue.message,
|
|
659
|
+
code: schemaIssue.code,
|
|
660
|
+
severity: "invalid"
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
const stored = _chunkVYE6BYONcjs.validateItemGroup.call(void 0, draft);
|
|
665
|
+
if (issues.length === 0 && stored.success) {
|
|
666
|
+
return { status: "complete", data: stored.data, issues };
|
|
667
|
+
}
|
|
668
|
+
if (issues.length === 0) {
|
|
669
|
+
for (const error of stored.success ? [] : stored.errors) {
|
|
670
|
+
issues.push({ ...error, severity: "invalid" });
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
const invalid = issues.some((found) => found.severity !== "incomplete");
|
|
674
|
+
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
675
|
+
}
|
|
676
|
+
function checkGroupIdentity(draft) {
|
|
677
|
+
const issues = [];
|
|
678
|
+
if (draft.schemaVersion !== "1.0") {
|
|
679
|
+
issues.push(
|
|
680
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
681
|
+
"schema_version_invalid",
|
|
682
|
+
["schemaVersion"],
|
|
683
|
+
'The draft must have schemaVersion "1.0". A draft from createItemGroupDraft has it.'
|
|
684
|
+
)
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
if (draft.type !== "item-group") {
|
|
688
|
+
issues.push(_chunkJ6POE4HLcjs.issue.call(void 0, "type_mismatch", ["type"], `The draft's type must be "item-group".`));
|
|
689
|
+
}
|
|
690
|
+
if (_chunkJ6POE4HLcjs.isMissingId.call(void 0, draft.id)) {
|
|
691
|
+
issues.push(_chunkJ6POE4HLcjs.issue.call(void 0, "id_required", ["id"], "The group has no id."));
|
|
692
|
+
}
|
|
693
|
+
if (!_chunkJ6POE4HLcjs.isUnset.call(void 0, draft.shuffle) && draft.shuffle !== "none" && draft.shuffle !== "within-group") {
|
|
694
|
+
issues.push(
|
|
695
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
696
|
+
"ig_shuffle_invalid",
|
|
697
|
+
["shuffle"],
|
|
698
|
+
'Shuffling is either "none" or "within-group". Leave it out to keep the authored order.'
|
|
699
|
+
)
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
return issues;
|
|
703
|
+
}
|
|
704
|
+
var KINDS = /* @__PURE__ */ new Set(["text", "audio", "video", "image", "mixed"]);
|
|
705
|
+
var MEDIA_FOR_KIND = {
|
|
706
|
+
audio: ["audio"],
|
|
707
|
+
video: ["video", "embed"],
|
|
708
|
+
image: ["image"],
|
|
709
|
+
mixed: ["audio", "video", "image", "embed"]
|
|
710
|
+
};
|
|
711
|
+
function checkStimulus(stimulus) {
|
|
712
|
+
const issues = [];
|
|
713
|
+
const at = (...rest) => ["stimulus", ...rest];
|
|
714
|
+
if (_chunkJ6POE4HLcjs.isMissingId.call(void 0, stimulus.id)) {
|
|
715
|
+
issues.push(_chunkJ6POE4HLcjs.issue.call(void 0, "ig_stimulus_id_required", at("id"), "The stimulus has no id."));
|
|
716
|
+
}
|
|
717
|
+
const kind = stimulus.kind;
|
|
718
|
+
if (_chunkJ6POE4HLcjs.isUnwritten.call(void 0, kind)) {
|
|
719
|
+
issues.push(
|
|
720
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
721
|
+
"ig_stimulus_kind_required",
|
|
722
|
+
at("kind"),
|
|
723
|
+
"Choose what the questions are about: a text, a recording, a video, an image, or a mix."
|
|
724
|
+
)
|
|
725
|
+
);
|
|
726
|
+
} else if (typeof kind !== "string" || !KINDS.has(kind)) {
|
|
727
|
+
if (typeof kind === "string") {
|
|
728
|
+
issues.push(
|
|
729
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
730
|
+
"ig_stimulus_kind_invalid",
|
|
731
|
+
at("kind"),
|
|
732
|
+
`"${kind}" is not a stimulus kind. Use text, audio, video, image or mixed.`
|
|
733
|
+
)
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
if (_chunkJ6POE4HLcjs.isRecord.call(void 0, stimulus.media)) {
|
|
737
|
+
issues.push(..._chunkJ6POE4HLcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
738
|
+
}
|
|
739
|
+
return issues;
|
|
740
|
+
}
|
|
741
|
+
const hasBody = typeof stimulus.body === "string" && stimulus.body.trim() !== "";
|
|
742
|
+
const htmlPresent = !_chunkJ6POE4HLcjs.isUnset.call(void 0, stimulus.bodyHtml);
|
|
743
|
+
if (!hasBody && (kind === "text" || kind === "mixed" || htmlPresent)) {
|
|
744
|
+
issues.push(
|
|
745
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
746
|
+
"ig_stimulus_body_required",
|
|
747
|
+
at("body"),
|
|
748
|
+
_chunkJ6POE4HLcjs.isUnwritten.call(void 0, stimulus.bodyHtml) ? "Write the passage." : "Write the passage as plain text too. The rich-text version is shown only where a sanitiser is supplied."
|
|
749
|
+
)
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
if (kind !== "text" && _chunkJ6POE4HLcjs.isUnset.call(void 0, stimulus.media)) {
|
|
753
|
+
issues.push(
|
|
754
|
+
_chunkJ6POE4HLcjs.issue.call(void 0, "ig_stimulus_media_required", at("media"), "Add the recording, video or image.")
|
|
755
|
+
);
|
|
756
|
+
} else if (_chunkJ6POE4HLcjs.isRecord.call(void 0, stimulus.media)) {
|
|
757
|
+
const allowed = MEDIA_FOR_KIND[kind];
|
|
758
|
+
const mediaType = stimulus.media.type;
|
|
759
|
+
if (allowed !== void 0 && typeof mediaType === "string" && !allowed.includes(mediaType)) {
|
|
760
|
+
issues.push(
|
|
761
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
762
|
+
"ig_stimulus_media_kind",
|
|
763
|
+
at("media", "type"),
|
|
764
|
+
`A "${kind}" stimulus cannot carry ${mediaType} media. Use ${allowed.join(" or ")}.`
|
|
765
|
+
)
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
issues.push(..._chunkJ6POE4HLcjs.checkMedia.call(void 0, stimulus.media, at("media")));
|
|
769
|
+
}
|
|
770
|
+
return issues;
|
|
771
|
+
}
|
|
772
|
+
function checkItems(draft) {
|
|
773
|
+
const issues = [];
|
|
774
|
+
const items = _chunkJ6POE4HLcjs.isUnset.call(void 0, draft.items) ? [] : draft.items;
|
|
775
|
+
if (!Array.isArray(items)) {
|
|
776
|
+
return issues;
|
|
777
|
+
}
|
|
778
|
+
if (items.length === 0) {
|
|
779
|
+
issues.push(
|
|
780
|
+
_chunkJ6POE4HLcjs.issue.call(void 0, "ig_items_required", ["items"], "Add at least one question about this material.")
|
|
781
|
+
);
|
|
782
|
+
return issues;
|
|
783
|
+
}
|
|
784
|
+
const seen = /* @__PURE__ */ new Set();
|
|
785
|
+
const repeated = /* @__PURE__ */ new Set();
|
|
786
|
+
for (const [index, item] of items.entries()) {
|
|
787
|
+
if (!_chunkJ6POE4HLcjs.isRecord.call(void 0, item)) {
|
|
788
|
+
continue;
|
|
789
|
+
}
|
|
790
|
+
const ordinal = index + 1;
|
|
791
|
+
if (_chunkJ6POE4HLcjs.isMissingId.call(void 0, item.id)) {
|
|
792
|
+
issues.push(
|
|
793
|
+
_chunkJ6POE4HLcjs.issue.call(void 0, "ig_item_id_required", ["items", index, "id"], `Question ${ordinal} has no id.`)
|
|
794
|
+
);
|
|
795
|
+
} else if (typeof item.id === "string") {
|
|
796
|
+
if (seen.has(item.id)) {
|
|
797
|
+
repeated.add(item.id);
|
|
798
|
+
}
|
|
799
|
+
seen.add(item.id);
|
|
800
|
+
}
|
|
801
|
+
if (item.type === "item-group") {
|
|
802
|
+
issues.push(
|
|
803
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
804
|
+
"ig_item_nested_group",
|
|
805
|
+
["items", index, "type"],
|
|
806
|
+
"Groups do not nest: every item must be an activity."
|
|
807
|
+
)
|
|
808
|
+
);
|
|
809
|
+
continue;
|
|
810
|
+
}
|
|
811
|
+
if (_chunkJ6POE4HLcjs.isUnwritten.call(void 0, item.type)) {
|
|
812
|
+
issues.push(
|
|
813
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
814
|
+
"ig_item_type_required",
|
|
815
|
+
["items", index, "type"],
|
|
816
|
+
`Choose what kind of question ${ordinal} is.`
|
|
817
|
+
)
|
|
818
|
+
);
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
if (typeof item.type !== "string") {
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
let result;
|
|
825
|
+
try {
|
|
826
|
+
result = validateDraft(item.type, item);
|
|
827
|
+
} catch (e) {
|
|
828
|
+
issues.push(
|
|
829
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
830
|
+
"ig_item_type_unknown",
|
|
831
|
+
["items", index, "type"],
|
|
832
|
+
`"${item.type}" is not a registered activity type.`
|
|
833
|
+
)
|
|
834
|
+
);
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
for (const found of result.issues) {
|
|
838
|
+
issues.push({ ...found, path: ["items", String(index), ...found.path] });
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
for (const id of repeated) {
|
|
842
|
+
issues.push(
|
|
843
|
+
_chunkJ6POE4HLcjs.issue.call(void 0, "ig_item_id_duplicate", ["items"], `More than one question has the id "${id}".`)
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
return issues;
|
|
847
|
+
}
|
|
848
|
+
|
|
589
849
|
// src/authoring/index.ts
|
|
590
850
|
function validateDraft(type, draft) {
|
|
591
|
-
const descriptor =
|
|
851
|
+
const descriptor = _chunkJ6POE4HLcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
592
852
|
if (descriptor === void 0) {
|
|
593
|
-
throw new (0,
|
|
853
|
+
throw new (0, _chunkJ6POE4HLcjs.UnknownActivityTypeError)(String(type));
|
|
594
854
|
}
|
|
595
|
-
const reported =
|
|
855
|
+
const reported = _chunkJ6POE4HLcjs.isRecord.call(void 0, draft) && _optionalChain([descriptor, 'access', _16 => _16.authoring, 'optionalAccess', _17 => _17.checkDraft]) !== void 0 ? descriptor.authoring.checkDraft(draft).map(normalise) : [];
|
|
596
856
|
const issues = [...reported];
|
|
597
857
|
const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
|
|
598
858
|
if (!parsed.success) {
|
|
599
859
|
const reportedEmpty = /* @__PURE__ */ new Set();
|
|
600
860
|
for (const schemaIssue of parsed.error.issues) {
|
|
601
861
|
const path = schemaIssue.path.map(String);
|
|
602
|
-
if (reported.some((known) => covers(known.path, path))) {
|
|
862
|
+
if (reported.some((known) => _chunkJ6POE4HLcjs.covers.call(void 0, known.path, path))) {
|
|
603
863
|
continue;
|
|
604
864
|
}
|
|
605
|
-
if (path.length > 0 &&
|
|
865
|
+
if (path.length > 0 && _chunkJ6POE4HLcjs.refusesEmpty.call(void 0, draft, schemaIssue)) {
|
|
606
866
|
const key = JSON.stringify(path);
|
|
607
867
|
if (!reportedEmpty.has(key)) {
|
|
608
868
|
reportedEmpty.add(key);
|
|
609
869
|
issues.push(
|
|
610
|
-
|
|
870
|
+
_chunkJ6POE4HLcjs.issue.call(void 0,
|
|
611
871
|
"null_not_allowed",
|
|
612
872
|
path,
|
|
613
873
|
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."
|
|
@@ -631,9 +891,9 @@ function validateDraft(type, draft) {
|
|
|
631
891
|
return { status: invalid ? "invalid" : "incomplete", issues };
|
|
632
892
|
}
|
|
633
893
|
function createDraft(type, context) {
|
|
634
|
-
const descriptor =
|
|
894
|
+
const descriptor = _chunkJ6POE4HLcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
635
895
|
if (descriptor === void 0) {
|
|
636
|
-
throw new (0,
|
|
896
|
+
throw new (0, _chunkJ6POE4HLcjs.UnknownActivityTypeError)(String(type));
|
|
637
897
|
}
|
|
638
898
|
const create = _optionalChain([descriptor, 'access', _18 => _18.authoring, 'optionalAccess', _19 => _19.createDraft]);
|
|
639
899
|
if (create === void 0) {
|
|
@@ -658,19 +918,13 @@ function createDraft(type, context) {
|
|
|
658
918
|
return create({ newId });
|
|
659
919
|
}
|
|
660
920
|
function normalise(found) {
|
|
661
|
-
const documented = Object.hasOwn(
|
|
921
|
+
const documented = Object.hasOwn(_chunkJ6POE4HLcjs.DRAFT_ISSUE_SEVERITY, found.code) ? _chunkJ6POE4HLcjs.DRAFT_ISSUE_SEVERITY[found.code] : void 0;
|
|
662
922
|
return {
|
|
663
923
|
...found,
|
|
664
924
|
path: found.path.map(String),
|
|
665
925
|
severity: _nullishCoalesce(documented, () => ( (found.severity === "incomplete" ? "incomplete" : "invalid")))
|
|
666
926
|
};
|
|
667
927
|
}
|
|
668
|
-
function covers(reported, failed) {
|
|
669
|
-
if (failed.length === 0) {
|
|
670
|
-
return reported.length === 0;
|
|
671
|
-
}
|
|
672
|
-
return failed.every((segment, index) => reported[index] === segment);
|
|
673
|
-
}
|
|
674
928
|
|
|
675
929
|
// src/redact.ts
|
|
676
930
|
function mergePolicy(base, overrides) {
|
|
@@ -728,9 +982,9 @@ function redactValue(value, policy, reveal) {
|
|
|
728
982
|
}
|
|
729
983
|
function redact(data, options = {}) {
|
|
730
984
|
const reveal = _nullishCoalesce(options.reveal, () => ( "none"));
|
|
731
|
-
const descriptor =
|
|
985
|
+
const descriptor = _chunkJ6POE4HLcjs.getActivityTypeDescriptor.call(void 0, data.type);
|
|
732
986
|
if (descriptor === void 0) {
|
|
733
|
-
throw new (0,
|
|
987
|
+
throw new (0, _chunkJ6POE4HLcjs.UnknownActivityTypeError)(String(data.type));
|
|
734
988
|
}
|
|
735
989
|
if (descriptor.fieldPolicy === void 0) {
|
|
736
990
|
throw new Error(
|
|
@@ -743,7 +997,7 @@ function redact(data, options = {}) {
|
|
|
743
997
|
if (reveal === "none" && descriptor.redactedSchema !== void 0) {
|
|
744
998
|
const parsed = descriptor.redactedSchema.safeParse(result);
|
|
745
999
|
if (!parsed.success) {
|
|
746
|
-
throw new (0,
|
|
1000
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(
|
|
747
1001
|
descriptor.type,
|
|
748
1002
|
parsed.error.issues.map((issue2) => ({
|
|
749
1003
|
path: issue2.path.map(String),
|
|
@@ -757,13 +1011,13 @@ function redact(data, options = {}) {
|
|
|
757
1011
|
}
|
|
758
1012
|
function assertRedacted(data) {
|
|
759
1013
|
if (typeof data !== "object" || data === null) {
|
|
760
|
-
throw new (0,
|
|
1014
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)("unknown", [
|
|
761
1015
|
{ path: [], message: "Redacted activity data must be an object.", code: "invalid_type" }
|
|
762
1016
|
]);
|
|
763
1017
|
}
|
|
764
1018
|
const candidate = data;
|
|
765
1019
|
if (candidate.redacted !== true) {
|
|
766
|
-
throw new (0,
|
|
1020
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(String(_nullishCoalesce(candidate.type, () => ( "unknown"))), [
|
|
767
1021
|
{
|
|
768
1022
|
path: ["redacted"],
|
|
769
1023
|
message: "Missing redacted marker \u2014 this payload is not a redact() projection.",
|
|
@@ -772,12 +1026,12 @@ function assertRedacted(data) {
|
|
|
772
1026
|
]);
|
|
773
1027
|
}
|
|
774
1028
|
const type = typeof candidate.type === "string" ? candidate.type : "";
|
|
775
|
-
const descriptor =
|
|
1029
|
+
const descriptor = _chunkJ6POE4HLcjs.getActivityTypeDescriptor.call(void 0, type);
|
|
776
1030
|
if (descriptor === void 0) {
|
|
777
|
-
throw new (0,
|
|
1031
|
+
throw new (0, _chunkJ6POE4HLcjs.UnknownActivityTypeError)(type);
|
|
778
1032
|
}
|
|
779
1033
|
if (descriptor.redactedSchema === void 0) {
|
|
780
|
-
throw new (0,
|
|
1034
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(descriptor.type, [
|
|
781
1035
|
{
|
|
782
1036
|
path: [],
|
|
783
1037
|
message: `Activity type "${descriptor.type}" registers no redactedSchema; assertRedacted cannot prove this payload is learner-safe.`,
|
|
@@ -787,7 +1041,7 @@ function assertRedacted(data) {
|
|
|
787
1041
|
}
|
|
788
1042
|
const parsed = descriptor.redactedSchema.safeParse(candidate);
|
|
789
1043
|
if (!parsed.success) {
|
|
790
|
-
throw new (0,
|
|
1044
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(
|
|
791
1045
|
descriptor.type,
|
|
792
1046
|
parsed.error.issues.map((issue2) => ({
|
|
793
1047
|
path: issue2.path.map(String),
|
|
@@ -803,7 +1057,7 @@ var STIMULUS_FIELD_POLICY = {
|
|
|
803
1057
|
title: "public",
|
|
804
1058
|
body: "public",
|
|
805
1059
|
bodyHtml: "public",
|
|
806
|
-
media:
|
|
1060
|
+
media: _chunkJ6POE4HLcjs.MEDIA_FIELD_POLICY,
|
|
807
1061
|
locale: "public",
|
|
808
1062
|
attribution: "public",
|
|
809
1063
|
transcript: "author-only"
|
|
@@ -829,9 +1083,9 @@ function redactItemGroup(group, options = {}) {
|
|
|
829
1083
|
redacted: true
|
|
830
1084
|
};
|
|
831
1085
|
if (reveal === "none") {
|
|
832
|
-
const parsed =
|
|
1086
|
+
const parsed = _chunkVYE6BYONcjs.RedactedItemGroupSchema.safeParse(result);
|
|
833
1087
|
if (!parsed.success) {
|
|
834
|
-
throw new (0,
|
|
1088
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(
|
|
835
1089
|
"item-group",
|
|
836
1090
|
parsed.error.issues.map((issue2) => ({
|
|
837
1091
|
path: issue2.path.map(String),
|
|
@@ -845,13 +1099,13 @@ function redactItemGroup(group, options = {}) {
|
|
|
845
1099
|
}
|
|
846
1100
|
function assertRedactedItemGroup(data) {
|
|
847
1101
|
if (typeof data !== "object" || data === null) {
|
|
848
|
-
throw new (0,
|
|
1102
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)("item-group", [
|
|
849
1103
|
{ path: [], message: "Redacted item group must be an object.", code: "invalid_type" }
|
|
850
1104
|
]);
|
|
851
1105
|
}
|
|
852
1106
|
const candidate = data;
|
|
853
1107
|
if (candidate.redacted !== true) {
|
|
854
|
-
throw new (0,
|
|
1108
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)("item-group", [
|
|
855
1109
|
{
|
|
856
1110
|
path: ["redacted"],
|
|
857
1111
|
message: "Missing redacted marker \u2014 this payload is not a redactItemGroup() projection.",
|
|
@@ -859,9 +1113,9 @@ function assertRedactedItemGroup(data) {
|
|
|
859
1113
|
}
|
|
860
1114
|
]);
|
|
861
1115
|
}
|
|
862
|
-
const parsed =
|
|
1116
|
+
const parsed = _chunkVYE6BYONcjs.RedactedItemGroupSchema.safeParse(candidate);
|
|
863
1117
|
if (!parsed.success) {
|
|
864
|
-
throw new (0,
|
|
1118
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(
|
|
865
1119
|
"item-group",
|
|
866
1120
|
parsed.error.issues.map((issue2) => ({
|
|
867
1121
|
path: issue2.path.map(String),
|
|
@@ -874,8 +1128,8 @@ function assertRedactedItemGroup(data) {
|
|
|
874
1128
|
try {
|
|
875
1129
|
assertRedacted(item);
|
|
876
1130
|
} catch (error) {
|
|
877
|
-
if (error instanceof
|
|
878
|
-
throw new (0,
|
|
1131
|
+
if (error instanceof _chunkJ6POE4HLcjs.ActivitySchemaError) {
|
|
1132
|
+
throw new (0, _chunkJ6POE4HLcjs.ActivitySchemaError)(
|
|
879
1133
|
"item-group",
|
|
880
1134
|
error.errors.map((issue2) => ({
|
|
881
1135
|
...issue2,
|
|
@@ -986,5 +1240,7 @@ function assertRedactedItemGroup(data) {
|
|
|
986
1240
|
|
|
987
1241
|
|
|
988
1242
|
|
|
989
|
-
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
exports.ActivitySchemaError = _chunkJ6POE4HLcjs.ActivitySchemaError; exports.BlankConfigSchema = _chunkJ6POE4HLcjs.BlankConfigSchema; exports.DEFAULT_PASS_THRESHOLD = _chunk4OHWLCI6cjs.DEFAULT_PASS_THRESHOLD; exports.DeferredScoringError = _chunkJ6POE4HLcjs.DeferredScoringError; exports.FeedbackSchema = _chunkJ6POE4HLcjs.FeedbackSchema; exports.FillInTheBlanksDataSchema = _chunkJ6POE4HLcjs.FillInTheBlanksDataSchema; exports.GapSelectBankSchema = _chunkJ6POE4HLcjs.GapSelectBankSchema; exports.GapSelectChoiceSchema = _chunkJ6POE4HLcjs.GapSelectChoiceSchema; exports.GapSelectDataSchema = _chunkJ6POE4HLcjs.GapSelectDataSchema; exports.GapSelectGapSchema = _chunkJ6POE4HLcjs.GapSelectGapSchema; exports.ItemGroupSchema = _chunkVYE6BYONcjs.ItemGroupSchema; exports.MediaPlaybackSchema = _chunkJ6POE4HLcjs.MediaPlaybackSchema; exports.MediaSchema = _chunkJ6POE4HLcjs.MediaSchema; exports.MediaUrlSchema = _chunkJ6POE4HLcjs.MediaUrlSchema; exports.MultipleChoiceDataSchema = _chunkJ6POE4HLcjs.MultipleChoiceDataSchema; exports.MultipleChoiceOptionMediaSchema = _chunkJ6POE4HLcjs.MultipleChoiceOptionMediaSchema; exports.MultipleChoiceOptionSchema = _chunkJ6POE4HLcjs.MultipleChoiceOptionSchema; exports.NativeControlHintSchema = _chunkJ6POE4HLcjs.NativeControlHintSchema; exports.RedactedBlankConfigSchema = _chunkJ6POE4HLcjs.RedactedBlankConfigSchema; exports.RedactedFillInTheBlanksDataSchema = _chunkJ6POE4HLcjs.RedactedFillInTheBlanksDataSchema; exports.RedactedGapSelectBankSchema = _chunkJ6POE4HLcjs.RedactedGapSelectBankSchema; exports.RedactedGapSelectChoiceSchema = _chunkJ6POE4HLcjs.RedactedGapSelectChoiceSchema; exports.RedactedGapSelectDataSchema = _chunkJ6POE4HLcjs.RedactedGapSelectDataSchema; exports.RedactedGapSelectGapSchema = _chunkJ6POE4HLcjs.RedactedGapSelectGapSchema; exports.RedactedItemGroupSchema = _chunkVYE6BYONcjs.RedactedItemGroupSchema; exports.RedactedMediaSchema = _chunkJ6POE4HLcjs.RedactedMediaSchema; exports.RedactedMultipleChoiceDataSchema = _chunkJ6POE4HLcjs.RedactedMultipleChoiceDataSchema; exports.RedactedMultipleChoiceOptionMediaSchema = _chunkJ6POE4HLcjs.RedactedMultipleChoiceOptionMediaSchema; exports.RedactedMultipleChoiceOptionSchema = _chunkJ6POE4HLcjs.RedactedMultipleChoiceOptionSchema; exports.RedactedScoringError = _chunkJ6POE4HLcjs.RedactedScoringError; exports.RedactedStimulusSchema = _chunkVYE6BYONcjs.RedactedStimulusSchema; exports.RedactedWrittenResponseDataSchema = _chunkJ6POE4HLcjs.RedactedWrittenResponseDataSchema; exports.StimulusSchema = _chunkVYE6BYONcjs.StimulusSchema; exports.TextMatchPolicySchema = _chunkJ6POE4HLcjs.TextMatchPolicySchema; exports.UnknownActivityTypeError = _chunkJ6POE4HLcjs.UnknownActivityTypeError; exports.WrittenResponseDataSchema = _chunkJ6POE4HLcjs.WrittenResponseDataSchema; exports.WrittenResponseRubricCriterionSchema = _chunkJ6POE4HLcjs.WrittenResponseRubricCriterionSchema; exports.WrittenResponseRubricSchema = _chunkJ6POE4HLcjs.WrittenResponseRubricSchema; exports.XAPIVerb = _chunkO2IVKTHVcjs.XAPIVerb; exports.XAPI_VERB_DISPLAY = _chunkO2IVKTHVcjs.XAPI_VERB_DISPLAY; exports.assertRedacted = assertRedacted; exports.assertRedactedItemGroup = assertRedactedItemGroup; exports.canonicalJson = canonicalJson; exports.classifyBand = _chunk4OHWLCI6cjs.classifyBand; exports.composeAssessmentScore = _chunk4OHWLCI6cjs.composeAssessmentScore; exports.computePassThreshold = _chunk4OHWLCI6cjs.computePassThreshold; exports.contentHash = contentHash; exports.countWords = _chunkJ6POE4HLcjs.countWords; exports.createDraft = createDraft; exports.createItemGroupDraft = createItemGroupDraft; exports.defineActivityType = _chunkJ6POE4HLcjs.defineActivityType; exports.diffResponses = diffResponses; exports.entryKeyOf = entryKeyOf; exports.evaluate = _chunk4OHWLCI6cjs.evaluate; exports.fillInTheBlanksJsonSchema = _chunkVYE6BYONcjs.fillInTheBlanksJsonSchema; exports.fillInTheBlanksType = _chunkJ6POE4HLcjs.fillInTheBlanksType; exports.fingerprint = fingerprint; exports.flattenSequence = flattenSequence; exports.gapSelectJsonSchema = _chunkVYE6BYONcjs.gapSelectJsonSchema; exports.getActivityTypeDescriptor = _chunkJ6POE4HLcjs.getActivityTypeDescriptor; exports.gradeFromRubric = _chunk4OHWLCI6cjs.gradeFromRubric; exports.gte = _chunk4OHWLCI6cjs.gte; exports.hasGrade = _chunk4OHWLCI6cjs.hasGrade; exports.hashSeed = hashSeed; exports.isItemGroup = isItemGroup; exports.itemGroupJsonSchema = _chunkVYE6BYONcjs.itemGroupJsonSchema; exports.jsonSchemaFor = _chunkVYE6BYONcjs.jsonSchemaFor; exports.levenshteinDistance = _chunkJ6POE4HLcjs.levenshteinDistance; exports.matchText = _chunkJ6POE4HLcjs.matchText; exports.multipleChoiceJsonSchema = _chunkVYE6BYONcjs.multipleChoiceJsonSchema; exports.multipleChoiceType = _chunkJ6POE4HLcjs.multipleChoiceType; exports.outcomeFromGrade = _chunk4OHWLCI6cjs.outcomeFromGrade; exports.planAttempt = planAttempt; exports.planMediaBudgets = planMediaBudgets; exports.redact = redact; exports.redactItemGroup = redactItemGroup; exports.registerActivityType = _chunkJ6POE4HLcjs.registerActivityType; exports.registeredActivityTypes = _chunkJ6POE4HLcjs.registeredActivityTypes; exports.resolvePlaybackPolicy = resolvePlaybackPolicy; exports.restoreAttemptState = restoreAttemptState; exports.restoreMediaPlayLedger = restoreMediaPlayLedger; exports.roundGrade = _chunk4OHWLCI6cjs.roundGrade; exports.score = _chunk4OHWLCI6cjs.score; exports.scoredItemsFromPlan = scoredItemsFromPlan; exports.seededShuffle = seededShuffle; exports.serializeAttemptState = serializeAttemptState; exports.serializeMediaPlayLedger = serializeMediaPlayLedger; exports.slotMediaKey = slotMediaKey; exports.stimulusJsonSchema = _chunkVYE6BYONcjs.stimulusJsonSchema; exports.stimulusMediaKey = stimulusMediaKey; exports.validateActivity = _chunkVYE6BYONcjs.validateActivity; exports.validateDraft = validateDraft; exports.validateItemGroup = _chunkVYE6BYONcjs.validateItemGroup; exports.validateItemGroupDraft = validateItemGroupDraft; exports.validateXAPIStatement = _chunkO2IVKTHVcjs.validateXAPIStatement; exports.verifyAttemptPlan = verifyAttemptPlan; exports.writtenResponseJsonSchema = _chunkVYE6BYONcjs.writtenResponseJsonSchema; exports.writtenResponseType = _chunkJ6POE4HLcjs.writtenResponseType; exports.xAPIBuilder = _chunkO2IVKTHVcjs.xAPIBuilder; exports.xapiDefinitionFor = _chunkO2IVKTHVcjs.xapiDefinitionFor;
|
|
990
1246
|
//# sourceMappingURL=index.cjs.map
|