@intellectif/lk-core 0.15.0 → 0.16.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/{activity-C7cR8U9n.d.cts → activity-DcxtpX7Z.d.cts} +5 -1
  3. package/dist/{activity-C7cR8U9n.d.ts → activity-DcxtpX7Z.d.ts} +5 -1
  4. package/dist/{chunk-5KWF34LJ.cjs → chunk-6P6XK2LI.cjs} +31 -31
  5. package/dist/{chunk-5KWF34LJ.cjs.map → chunk-6P6XK2LI.cjs.map} +1 -1
  6. package/dist/{chunk-QFWEF5ST.cjs → chunk-F7UOLKWV.cjs} +34 -23
  7. package/dist/chunk-F7UOLKWV.cjs.map +1 -0
  8. package/dist/{chunk-W7AQP6AV.cjs → chunk-FJJ2GVBA.cjs} +24 -22
  9. package/dist/chunk-FJJ2GVBA.cjs.map +1 -0
  10. package/dist/{chunk-EEMVWBPP.js → chunk-GOZGBVJP.js} +10 -8
  11. package/dist/chunk-GOZGBVJP.js.map +1 -0
  12. package/dist/{chunk-DPHX4E7X.js → chunk-IRUD73IQ.js} +34 -23
  13. package/dist/chunk-IRUD73IQ.js.map +1 -0
  14. package/dist/{chunk-54XYQ3CS.js → chunk-OXF7VT7S.js} +2 -2
  15. package/dist/{chunk-L6YBQXSB.js → chunk-S63IOKFP.js} +2 -2
  16. package/dist/{chunk-7ETU6EXQ.cjs → chunk-VFTVZJO5.cjs} +4 -4
  17. package/dist/{chunk-7ETU6EXQ.cjs.map → chunk-VFTVZJO5.cjs.map} +1 -1
  18. package/dist/{index-D10NaztZ.d.ts → index-BWpwZRQw.d.cts} +1 -1
  19. package/dist/{index-BWyMDlUS.d.cts → index-DRJqwO2y.d.ts} +1 -1
  20. package/dist/index.cjs +112 -111
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +17 -4
  23. package/dist/index.d.ts +17 -4
  24. package/dist/index.js +8 -7
  25. package/dist/index.js.map +1 -1
  26. package/dist/schemas.cjs +3 -3
  27. package/dist/schemas.d.cts +2 -2
  28. package/dist/schemas.d.ts +2 -2
  29. package/dist/schemas.js +2 -2
  30. package/dist/scoring.cjs +3 -3
  31. package/dist/scoring.d.cts +2 -2
  32. package/dist/scoring.d.ts +2 -2
  33. package/dist/scoring.js +2 -2
  34. package/dist/xapi.cjs +3 -3
  35. package/dist/xapi.d.cts +1 -1
  36. package/dist/xapi.d.ts +1 -1
  37. package/dist/xapi.js +2 -2
  38. package/package.json +1 -1
  39. package/dist/chunk-DPHX4E7X.js.map +0 -1
  40. package/dist/chunk-EEMVWBPP.js.map +0 -1
  41. package/dist/chunk-QFWEF5ST.cjs.map +0 -1
  42. package/dist/chunk-W7AQP6AV.cjs.map +0 -1
  43. /package/dist/{chunk-54XYQ3CS.js.map → chunk-OXF7VT7S.js.map} +0 -0
  44. /package/dist/{chunk-L6YBQXSB.js.map → chunk-S63IOKFP.js.map} +0 -0
@@ -1208,10 +1208,10 @@ var DictationDataSchema = DictationDataShape.check(
1208
1208
  }
1209
1209
  for (const field of ["media", "slowMedia"]) {
1210
1210
  const recording = data[field];
1211
- if (_optionalChain([recording, 'optionalAccess', _48 => _48.captionsUrl]) !== void 0) {
1211
+ for (const captions of captionFieldsOf(recording)) {
1212
1212
  report(
1213
- [field, "captionsUrl"],
1214
- recording.captionsUrl,
1213
+ [field, captions],
1214
+ _optionalChain([recording, 'optionalAccess', _48 => _48[captions]]),
1215
1215
  "A dictation recording cannot carry captions: the captions are the answer. Offer an accessible alternative as a different item."
1216
1216
  );
1217
1217
  }
@@ -1247,17 +1247,32 @@ var DictationDataSchema = DictationDataShape.check(
1247
1247
  }
1248
1248
  })
1249
1249
  );
1250
- function groupCaptionsRevealDictation(group, hasCaptions = (captionsUrl) => captionsUrl !== void 0) {
1251
- const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1252
- if (!isObject(group) || !isObject(group.stimulus) || !isObject(group.stimulus.media)) {
1253
- return false;
1250
+ var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1251
+ function captionFieldsOf(media, written = (captionsUrl) => captionsUrl !== void 0) {
1252
+ if (!isObject(media)) {
1253
+ return [];
1254
1254
  }
1255
- if (!hasCaptions(group.stimulus.media.captionsUrl) || !Array.isArray(group.items)) {
1256
- return false;
1255
+ const fields = [];
1256
+ if (written(media.captionsUrl)) {
1257
+ fields.push("captionsUrl");
1258
+ }
1259
+ if (Array.isArray(media.tracks) && media.tracks.length > 0) {
1260
+ fields.push("tracks");
1261
+ }
1262
+ return fields;
1263
+ }
1264
+ function groupCaptionsField(group, written) {
1265
+ if (!isObject(group) || !isObject(group.stimulus) || !Array.isArray(group.items)) {
1266
+ return void 0;
1257
1267
  }
1258
- return group.items.some(
1268
+ const [field] = captionFieldsOf(group.stimulus.media, written);
1269
+ if (field === void 0) {
1270
+ return void 0;
1271
+ }
1272
+ const played = group.items.some(
1259
1273
  (item) => isObject(item) && item.type === "dictation" && item.media === void 0
1260
1274
  );
1275
+ return played ? field : void 0;
1261
1276
  }
1262
1277
  var GROUP_CAPTIONS_REVEAL_DICTATION = "The stimulus recording carries captions, and a dictation in this group plays that recording: the captions are the answer. Remove the captions, or give the dictation its own recording.";
1263
1278
 
@@ -1791,12 +1806,12 @@ var RedactedDictationDataSchema = _v4.z.strictObject({
1791
1806
  hints: _v4.z.strictObject({ mode: _v4.z.literal("progressive-words") }).optional()
1792
1807
  }).check((ctx) => {
1793
1808
  const data = ctx.value;
1794
- if (_optionalChain([data, 'access', _65 => _65.media, 'optionalAccess', _66 => _66.captionsUrl]) !== void 0) {
1809
+ for (const captions of captionFieldsOf(data.media)) {
1795
1810
  ctx.issues.push({
1796
1811
  code: "custom",
1797
- input: data.media.captionsUrl,
1812
+ input: _optionalChain([data, 'access', _65 => _65.media, 'optionalAccess', _66 => _66[captions]]),
1798
1813
  message: "A dictation recording cannot carry captions: the captions are the answer, so this payload is not learner-safe.",
1799
- path: ["media", "captionsUrl"]
1814
+ path: ["media", captions]
1800
1815
  });
1801
1816
  }
1802
1817
  if (data.slowMedia !== void 0 && _optionalChain([data, 'access', _67 => _67.media, 'optionalAccess', _68 => _68.playback, 'optionalAccess', _69 => _69.maxPlays]) !== void 0) {
@@ -2656,10 +2671,8 @@ function checkRecording(media) {
2656
2671
  )
2657
2672
  );
2658
2673
  }
2659
- if (!isUnset(media.captionsUrl)) {
2660
- issues.push(
2661
- issue("dc_captions_not_allowed", ["media", "captionsUrl"], CAPTIONS_ARE_THE_ANSWER)
2662
- );
2674
+ for (const captions of captionFieldsOf(media, (captionsUrl) => !isUnset(captionsUrl))) {
2675
+ issues.push(issue("dc_captions_not_allowed", ["media", captions], CAPTIONS_ARE_THE_ANSWER));
2663
2676
  }
2664
2677
  return issues;
2665
2678
  }
@@ -2684,10 +2697,8 @@ function checkSlowRecording(draft) {
2684
2697
  DictationSlowMediaSchema
2685
2698
  )
2686
2699
  );
2687
- if (!isUnset(slow.captionsUrl)) {
2688
- issues.push(
2689
- issue("dc_captions_not_allowed", ["slowMedia", "captionsUrl"], CAPTIONS_ARE_THE_ANSWER)
2690
- );
2700
+ for (const captions of captionFieldsOf(slow, (captionsUrl) => !isUnset(captionsUrl))) {
2701
+ issues.push(issue("dc_captions_not_allowed", ["slowMedia", captions], CAPTIONS_ARE_THE_ANSWER));
2691
2702
  }
2692
2703
  if (slow.playback !== void 0) {
2693
2704
  issues.push(
@@ -4426,5 +4437,5 @@ registerActivityType(readAloudType);
4426
4437
 
4427
4438
 
4428
4439
 
4429
- exports.ActivitySchemaError = ActivitySchemaError; exports.UnknownActivityTypeError = UnknownActivityTypeError; exports.RedactedScoringError = RedactedScoringError; exports.DeferredScoringError = DeferredScoringError; exports.withValidationScope = withValidationScope; exports.DICTATION_MAX_TRANSCRIPT_LENGTH = DICTATION_MAX_TRANSCRIPT_LENGTH; exports.DICTATION_MAX_TEXT_LENGTH = DICTATION_MAX_TEXT_LENGTH; exports.DICTATION_MAX_EQUIVALENCE_LENGTH = DICTATION_MAX_EQUIVALENCE_LENGTH; exports.DICTATION_MAX_EQUIVALENCES = DICTATION_MAX_EQUIVALENCES; exports.DICTATION_MAX_ACCEPTED_TRANSCRIPTS = DICTATION_MAX_ACCEPTED_TRANSCRIPTS; exports.codePointLength = codePointLength; exports.normalizeDictationText = normalizeDictationText; exports.FeedbackSchema = FeedbackSchema; exports.MediaUrlSchema = MediaUrlSchema; exports.NativeControlHintSchema = NativeControlHintSchema; exports.MediaPlaybackSchema = MediaPlaybackSchema; exports.MediaTrackSchema = MediaTrackSchema; exports.MediaSchema = MediaSchema; exports.RedactedMediaSchema = RedactedMediaSchema; exports.DictationSlowMediaSchema = DictationSlowMediaSchema; exports.DictationEquivalenceSchema = DictationEquivalenceSchema; exports.DictationToleranceSchema = DictationToleranceSchema; exports.DictationDataSchema = DictationDataSchema; exports.groupCaptionsRevealDictation = groupCaptionsRevealDictation; exports.GROUP_CAPTIONS_REVEAL_DICTATION = GROUP_CAPTIONS_REVEAL_DICTATION; exports.DRAFT_ISSUE_SEVERITY = DRAFT_ISSUE_SEVERITY; exports.issue = issue; exports.isRecord = isRecord; exports.refusesEmpty = refusesEmpty; exports.isUnset = isUnset; exports.isUnwritten = isUnwritten; exports.isMissingId = isMissingId; exports.checkMedia = checkMedia; exports.covers = covers; exports.pathKey = pathKey; exports.coveredPathsOf = coveredPathsOf; exports.TextMatchPolicySchema = TextMatchPolicySchema; exports.BlankConfigSchema = BlankConfigSchema; exports.FillInTheBlanksDataSchema = FillInTheBlanksDataSchema; exports.MultipleChoiceOptionMediaSchema = MultipleChoiceOptionMediaSchema; exports.MultipleChoiceOptionSchema = MultipleChoiceOptionSchema; exports.MultipleChoiceDataSchema = MultipleChoiceDataSchema; exports.READ_ALOUD_MAX_REFERENCE_LENGTH = READ_ALOUD_MAX_REFERENCE_LENGTH; exports.READ_ALOUD_MAX_SECONDS = READ_ALOUD_MAX_SECONDS; exports.READ_ALOUD_MAX_TAKES = READ_ALOUD_MAX_TAKES; exports.READ_ALOUD_MAX_DIMENSION_WEIGHT = READ_ALOUD_MAX_DIMENSION_WEIGHT; exports.SPEECH_ASSESSMENT_MAX_WORDS = SPEECH_ASSESSMENT_MAX_WORDS; exports.SPEECH_ASSESSMENT_MAX_TEXT_LENGTH = SPEECH_ASSESSMENT_MAX_TEXT_LENGTH; exports.CANONICAL_LOCALE_RE = CANONICAL_LOCALE_RE; exports.ReadAloudSlowMediaSchema = ReadAloudSlowMediaSchema; exports.ReadAloudDataSchema = ReadAloudDataSchema; exports.countWords = countWords; exports.GapSelectChoiceSchema = GapSelectChoiceSchema; exports.GapSelectBankSchema = GapSelectBankSchema; exports.GapSelectGapSchema = GapSelectGapSchema; exports.GapSelectDataSchema = GapSelectDataSchema; exports.WrittenResponseRubricCriterionSchema = WrittenResponseRubricCriterionSchema; exports.WrittenResponseRubricSchema = WrittenResponseRubricSchema; exports.WrittenResponseDataSchema = WrittenResponseDataSchema; exports.RedactedMultipleChoiceOptionMediaSchema = RedactedMultipleChoiceOptionMediaSchema; exports.RedactedMultipleChoiceOptionSchema = RedactedMultipleChoiceOptionSchema; exports.RedactedMultipleChoiceDataSchema = RedactedMultipleChoiceDataSchema; exports.RedactedBlankConfigSchema = RedactedBlankConfigSchema; exports.RedactedFillInTheBlanksDataSchema = RedactedFillInTheBlanksDataSchema; exports.RedactedGapSelectChoiceSchema = RedactedGapSelectChoiceSchema; exports.RedactedGapSelectBankSchema = RedactedGapSelectBankSchema; exports.RedactedGapSelectGapSchema = RedactedGapSelectGapSchema; exports.RedactedGapSelectDataSchema = RedactedGapSelectDataSchema; exports.RedactedWrittenResponseDataSchema = RedactedWrittenResponseDataSchema; exports.RedactedDictationSlowMediaSchema = RedactedDictationSlowMediaSchema; exports.RedactedDictationDataSchema = RedactedDictationDataSchema; exports.RedactedReadAloudDataSchema = RedactedReadAloudDataSchema; exports.dictationReferenceWords = dictationReferenceWords; exports.alignDictation = alignDictation; exports.STEP = STEP; exports.alignSequences = alignSequences; exports.levenshteinDistance = levenshteinDistance; exports.matchText = matchText; exports.defineActivityType = defineActivityType; exports.registerActivityType = registerActivityType; exports.getActivityTypeDescriptor = getActivityTypeDescriptor; exports.registeredActivityTypes = registeredActivityTypes; exports.MEDIA_FIELD_POLICY = MEDIA_FIELD_POLICY; exports.multipleChoiceType = multipleChoiceType; exports.fillInTheBlanksType = fillInTheBlanksType; exports.writtenResponseType = writtenResponseType; exports.gapSelectType = gapSelectType; exports.dictationType = dictationType; exports.readAloudType = readAloudType;
4430
- //# sourceMappingURL=chunk-QFWEF5ST.cjs.map
4440
+ exports.ActivitySchemaError = ActivitySchemaError; exports.UnknownActivityTypeError = UnknownActivityTypeError; exports.RedactedScoringError = RedactedScoringError; exports.DeferredScoringError = DeferredScoringError; exports.withValidationScope = withValidationScope; exports.DICTATION_MAX_TRANSCRIPT_LENGTH = DICTATION_MAX_TRANSCRIPT_LENGTH; exports.DICTATION_MAX_TEXT_LENGTH = DICTATION_MAX_TEXT_LENGTH; exports.DICTATION_MAX_EQUIVALENCE_LENGTH = DICTATION_MAX_EQUIVALENCE_LENGTH; exports.DICTATION_MAX_EQUIVALENCES = DICTATION_MAX_EQUIVALENCES; exports.DICTATION_MAX_ACCEPTED_TRANSCRIPTS = DICTATION_MAX_ACCEPTED_TRANSCRIPTS; exports.codePointLength = codePointLength; exports.normalizeDictationText = normalizeDictationText; exports.FeedbackSchema = FeedbackSchema; exports.MediaUrlSchema = MediaUrlSchema; exports.NativeControlHintSchema = NativeControlHintSchema; exports.MediaPlaybackSchema = MediaPlaybackSchema; exports.MediaTrackSchema = MediaTrackSchema; exports.MediaSchema = MediaSchema; exports.RedactedMediaSchema = RedactedMediaSchema; exports.DictationSlowMediaSchema = DictationSlowMediaSchema; exports.DictationEquivalenceSchema = DictationEquivalenceSchema; exports.DictationToleranceSchema = DictationToleranceSchema; exports.DictationDataSchema = DictationDataSchema; exports.groupCaptionsField = groupCaptionsField; exports.GROUP_CAPTIONS_REVEAL_DICTATION = GROUP_CAPTIONS_REVEAL_DICTATION; exports.DRAFT_ISSUE_SEVERITY = DRAFT_ISSUE_SEVERITY; exports.issue = issue; exports.isRecord = isRecord; exports.refusesEmpty = refusesEmpty; exports.isUnset = isUnset; exports.isUnwritten = isUnwritten; exports.isMissingId = isMissingId; exports.checkMedia = checkMedia; exports.covers = covers; exports.pathKey = pathKey; exports.coveredPathsOf = coveredPathsOf; exports.TextMatchPolicySchema = TextMatchPolicySchema; exports.BlankConfigSchema = BlankConfigSchema; exports.FillInTheBlanksDataSchema = FillInTheBlanksDataSchema; exports.MultipleChoiceOptionMediaSchema = MultipleChoiceOptionMediaSchema; exports.MultipleChoiceOptionSchema = MultipleChoiceOptionSchema; exports.MultipleChoiceDataSchema = MultipleChoiceDataSchema; exports.READ_ALOUD_MAX_REFERENCE_LENGTH = READ_ALOUD_MAX_REFERENCE_LENGTH; exports.READ_ALOUD_MAX_SECONDS = READ_ALOUD_MAX_SECONDS; exports.READ_ALOUD_MAX_TAKES = READ_ALOUD_MAX_TAKES; exports.READ_ALOUD_MAX_DIMENSION_WEIGHT = READ_ALOUD_MAX_DIMENSION_WEIGHT; exports.SPEECH_ASSESSMENT_MAX_WORDS = SPEECH_ASSESSMENT_MAX_WORDS; exports.SPEECH_ASSESSMENT_MAX_TEXT_LENGTH = SPEECH_ASSESSMENT_MAX_TEXT_LENGTH; exports.CANONICAL_LOCALE_RE = CANONICAL_LOCALE_RE; exports.ReadAloudSlowMediaSchema = ReadAloudSlowMediaSchema; exports.ReadAloudDataSchema = ReadAloudDataSchema; exports.countWords = countWords; exports.GapSelectChoiceSchema = GapSelectChoiceSchema; exports.GapSelectBankSchema = GapSelectBankSchema; exports.GapSelectGapSchema = GapSelectGapSchema; exports.GapSelectDataSchema = GapSelectDataSchema; exports.WrittenResponseRubricCriterionSchema = WrittenResponseRubricCriterionSchema; exports.WrittenResponseRubricSchema = WrittenResponseRubricSchema; exports.WrittenResponseDataSchema = WrittenResponseDataSchema; exports.RedactedMultipleChoiceOptionMediaSchema = RedactedMultipleChoiceOptionMediaSchema; exports.RedactedMultipleChoiceOptionSchema = RedactedMultipleChoiceOptionSchema; exports.RedactedMultipleChoiceDataSchema = RedactedMultipleChoiceDataSchema; exports.RedactedBlankConfigSchema = RedactedBlankConfigSchema; exports.RedactedFillInTheBlanksDataSchema = RedactedFillInTheBlanksDataSchema; exports.RedactedGapSelectChoiceSchema = RedactedGapSelectChoiceSchema; exports.RedactedGapSelectBankSchema = RedactedGapSelectBankSchema; exports.RedactedGapSelectGapSchema = RedactedGapSelectGapSchema; exports.RedactedGapSelectDataSchema = RedactedGapSelectDataSchema; exports.RedactedWrittenResponseDataSchema = RedactedWrittenResponseDataSchema; exports.RedactedDictationSlowMediaSchema = RedactedDictationSlowMediaSchema; exports.RedactedDictationDataSchema = RedactedDictationDataSchema; exports.RedactedReadAloudDataSchema = RedactedReadAloudDataSchema; exports.dictationReferenceWords = dictationReferenceWords; exports.alignDictation = alignDictation; exports.STEP = STEP; exports.alignSequences = alignSequences; exports.levenshteinDistance = levenshteinDistance; exports.matchText = matchText; exports.defineActivityType = defineActivityType; exports.registerActivityType = registerActivityType; exports.getActivityTypeDescriptor = getActivityTypeDescriptor; exports.registeredActivityTypes = registeredActivityTypes; exports.MEDIA_FIELD_POLICY = MEDIA_FIELD_POLICY; exports.multipleChoiceType = multipleChoiceType; exports.fillInTheBlanksType = fillInTheBlanksType; exports.writtenResponseType = writtenResponseType; exports.gapSelectType = gapSelectType; exports.dictationType = dictationType; exports.readAloudType = readAloudType;
4441
+ //# sourceMappingURL=chunk-F7UOLKWV.cjs.map