@intellectif/lk-core 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +2 -1
  3. package/dist/{activity-B2QxK15j.d.cts → activity-DfAmJ1sl.d.cts} +134 -7
  4. package/dist/{activity-B2QxK15j.d.ts → activity-DfAmJ1sl.d.ts} +134 -7
  5. package/dist/{chunk-VYE6BYON.cjs → chunk-DQKJUMUW.cjs} +38 -15
  6. package/dist/chunk-DQKJUMUW.cjs.map +1 -0
  7. package/dist/{chunk-RK2NVTHZ.js → chunk-FGN4LLSP.js} +50 -6
  8. package/dist/chunk-FGN4LLSP.js.map +1 -0
  9. package/dist/{chunk-O2IVKTHV.cjs → chunk-FT7SAC3X.cjs} +4 -4
  10. package/dist/{chunk-O2IVKTHV.cjs.map → chunk-FT7SAC3X.cjs.map} +1 -1
  11. package/dist/{chunk-UQPNJP2O.js → chunk-PYP3HCRQ.js} +2 -2
  12. package/dist/{chunk-4OHWLCI6.cjs → chunk-UHQVIC3P.cjs} +58 -14
  13. package/dist/chunk-UHQVIC3P.cjs.map +1 -0
  14. package/dist/{chunk-FVN37GIH.js → chunk-XKKKWKRH.js} +1944 -177
  15. package/dist/chunk-XKKKWKRH.js.map +1 -0
  16. package/dist/{chunk-J6POE4HL.cjs → chunk-XONKWL6D.cjs} +1785 -18
  17. package/dist/chunk-XONKWL6D.cjs.map +1 -0
  18. package/dist/{chunk-7JMMPE7O.js → chunk-Y36S3X3L.js} +26 -3
  19. package/dist/chunk-Y36S3X3L.js.map +1 -0
  20. package/dist/{index-B_scInLM.d.cts → index-Bz9wUigA.d.cts} +181 -4
  21. package/dist/{index-CRKtWP5G.d.ts → index-CJbbVE9o.d.ts} +181 -4
  22. package/dist/index.cjs +128 -73
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +14 -6
  25. package/dist/index.d.ts +14 -6
  26. package/dist/index.js +60 -5
  27. package/dist/index.js.map +1 -1
  28. package/dist/schemas.cjs +17 -3
  29. package/dist/schemas.cjs.map +1 -1
  30. package/dist/schemas.d.cts +2 -2
  31. package/dist/schemas.d.ts +2 -2
  32. package/dist/schemas.js +16 -2
  33. package/dist/scoring.cjs +19 -3
  34. package/dist/scoring.cjs.map +1 -1
  35. package/dist/scoring.d.cts +150 -5
  36. package/dist/scoring.d.ts +150 -5
  37. package/dist/scoring.js +18 -2
  38. package/dist/xapi.cjs +3 -3
  39. package/dist/xapi.d.cts +1 -1
  40. package/dist/xapi.d.ts +1 -1
  41. package/dist/xapi.js +2 -2
  42. package/package.json +1 -1
  43. package/vectors/README.md +9 -1
  44. package/vectors/scoring.json +12023 -1
  45. package/dist/chunk-4OHWLCI6.cjs.map +0 -1
  46. package/dist/chunk-7JMMPE7O.js.map +0 -1
  47. package/dist/chunk-FVN37GIH.js.map +0 -1
  48. package/dist/chunk-J6POE4HL.cjs.map +0 -1
  49. package/dist/chunk-RK2NVTHZ.js.map +0 -1
  50. package/dist/chunk-VYE6BYON.cjs.map +0 -1
  51. /package/dist/{chunk-UQPNJP2O.js.map → chunk-PYP3HCRQ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  classifyBand,
4
4
  composeAssessmentScore,
5
5
  computePassThreshold,
6
+ diffDictationChars,
6
7
  evaluate,
7
8
  gradeFromRubric,
8
9
  gte,
@@ -10,19 +11,20 @@ import {
10
11
  outcomeFromGrade,
11
12
  roundGrade,
12
13
  score
13
- } from "./chunk-RK2NVTHZ.js";
14
+ } from "./chunk-FGN4LLSP.js";
14
15
  import {
15
16
  XAPIVerb,
16
17
  XAPI_VERB_DISPLAY,
17
18
  validateXAPIStatement,
18
19
  xAPIBuilder,
19
20
  xapiDefinitionFor
20
- } from "./chunk-UQPNJP2O.js";
21
+ } from "./chunk-PYP3HCRQ.js";
21
22
  import {
22
23
  ItemGroupSchema,
23
24
  RedactedItemGroupSchema,
24
25
  RedactedStimulusSchema,
25
26
  StimulusSchema,
27
+ dictationJsonSchema,
26
28
  fillInTheBlanksJsonSchema,
27
29
  gapSelectJsonSchema,
28
30
  itemGroupJsonSchema,
@@ -32,14 +34,24 @@ import {
32
34
  validateActivity,
33
35
  validateItemGroup,
34
36
  writtenResponseJsonSchema
35
- } from "./chunk-7JMMPE7O.js";
37
+ } from "./chunk-Y36S3X3L.js";
36
38
  import {
37
39
  ActivitySchemaError,
38
40
  BlankConfigSchema,
41
+ DICTATION_MAX_ACCEPTED_TRANSCRIPTS,
42
+ DICTATION_MAX_EQUIVALENCES,
43
+ DICTATION_MAX_EQUIVALENCE_LENGTH,
44
+ DICTATION_MAX_TEXT_LENGTH,
45
+ DICTATION_MAX_TRANSCRIPT_LENGTH,
39
46
  DRAFT_ISSUE_SEVERITY,
40
47
  DeferredScoringError,
48
+ DictationDataSchema,
49
+ DictationEquivalenceSchema,
50
+ DictationSlowMediaSchema,
51
+ DictationToleranceSchema,
41
52
  FeedbackSchema,
42
53
  FillInTheBlanksDataSchema,
54
+ GROUP_CAPTIONS_REVEAL_DICTATION,
43
55
  GapSelectBankSchema,
44
56
  GapSelectChoiceSchema,
45
57
  GapSelectDataSchema,
@@ -53,6 +65,8 @@ import {
53
65
  MultipleChoiceOptionSchema,
54
66
  NativeControlHintSchema,
55
67
  RedactedBlankConfigSchema,
68
+ RedactedDictationDataSchema,
69
+ RedactedDictationSlowMediaSchema,
56
70
  RedactedFillInTheBlanksDataSchema,
57
71
  RedactedGapSelectBankSchema,
58
72
  RedactedGapSelectChoiceSchema,
@@ -69,12 +83,18 @@ import {
69
83
  WrittenResponseDataSchema,
70
84
  WrittenResponseRubricCriterionSchema,
71
85
  WrittenResponseRubricSchema,
86
+ alignDictation,
72
87
  checkMedia,
73
88
  countWords,
89
+ coveredPathsOf,
74
90
  covers,
75
91
  defineActivityType,
92
+ dictationReferenceWords,
93
+ dictationType,
76
94
  fillInTheBlanksType,
95
+ gapSelectType,
77
96
  getActivityTypeDescriptor,
97
+ groupCaptionsRevealDictation,
78
98
  isMissingId,
79
99
  isRecord,
80
100
  isUnset,
@@ -83,11 +103,13 @@ import {
83
103
  levenshteinDistance,
84
104
  matchText,
85
105
  multipleChoiceType,
106
+ pathKey,
86
107
  refusesEmpty,
87
108
  registerActivityType,
88
109
  registeredActivityTypes,
110
+ withValidationScope,
89
111
  writtenResponseType
90
- } from "./chunk-FVN37GIH.js";
112
+ } from "./chunk-XKKKWKRH.js";
91
113
 
92
114
  // src/content-hash.ts
93
115
  function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
@@ -616,6 +638,9 @@ function createItemGroupDraft(context) {
616
638
  };
617
639
  }
618
640
  function validateItemGroupDraft(draft) {
641
+ return withValidationScope(() => validateItemGroupDraftInScope(draft));
642
+ }
643
+ function validateItemGroupDraftInScope(draft) {
619
644
  const issues = [];
620
645
  if (!isRecord(draft)) {
621
646
  issues.push(
@@ -636,6 +661,15 @@ function validateItemGroupDraft(draft) {
636
661
  );
637
662
  }
638
663
  issues.push(...checkItems(draft));
664
+ if (groupCaptionsRevealDictation(draft, (captionsUrl) => !isUnwritten(captionsUrl))) {
665
+ issues.push(
666
+ issue(
667
+ "dc_captions_not_allowed",
668
+ ["stimulus", "media", "captionsUrl"],
669
+ GROUP_CAPTIONS_REVEAL_DICTATION
670
+ )
671
+ );
672
+ }
639
673
  const parsed = ItemGroupSchema.safeParse(draft, { reportInput: true });
640
674
  if (!parsed.success) {
641
675
  for (const schemaIssue of parsed.error.issues) {
@@ -848,6 +882,9 @@ function checkItems(draft) {
848
882
 
849
883
  // src/authoring/index.ts
850
884
  function validateDraft(type, draft) {
885
+ return withValidationScope(() => validateDraftInScope(type, draft));
886
+ }
887
+ function validateDraftInScope(type, draft) {
851
888
  const descriptor = getActivityTypeDescriptor(type);
852
889
  if (descriptor === void 0) {
853
890
  throw new UnknownActivityTypeError(String(type));
@@ -856,10 +893,11 @@ function validateDraft(type, draft) {
856
893
  const issues = [...reported];
857
894
  const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
858
895
  if (!parsed.success) {
896
+ const covered = coveredPathsOf(reported);
859
897
  const reportedEmpty = /* @__PURE__ */ new Set();
860
898
  for (const schemaIssue of parsed.error.issues) {
861
899
  const path = schemaIssue.path.map(String);
862
- if (reported.some((known) => covers(known.path, path))) {
900
+ if (covered.has(pathKey(path))) {
863
901
  continue;
864
902
  }
865
903
  if (path.length > 0 && refusesEmpty(draft, schemaIssue)) {
@@ -1145,7 +1183,16 @@ export {
1145
1183
  ActivitySchemaError,
1146
1184
  BlankConfigSchema,
1147
1185
  DEFAULT_PASS_THRESHOLD,
1186
+ DICTATION_MAX_ACCEPTED_TRANSCRIPTS,
1187
+ DICTATION_MAX_EQUIVALENCES,
1188
+ DICTATION_MAX_EQUIVALENCE_LENGTH,
1189
+ DICTATION_MAX_TEXT_LENGTH,
1190
+ DICTATION_MAX_TRANSCRIPT_LENGTH,
1148
1191
  DeferredScoringError,
1192
+ DictationDataSchema,
1193
+ DictationEquivalenceSchema,
1194
+ DictationSlowMediaSchema,
1195
+ DictationToleranceSchema,
1149
1196
  FeedbackSchema,
1150
1197
  FillInTheBlanksDataSchema,
1151
1198
  GapSelectBankSchema,
@@ -1161,6 +1208,8 @@ export {
1161
1208
  MultipleChoiceOptionSchema,
1162
1209
  NativeControlHintSchema,
1163
1210
  RedactedBlankConfigSchema,
1211
+ RedactedDictationDataSchema,
1212
+ RedactedDictationSlowMediaSchema,
1164
1213
  RedactedFillInTheBlanksDataSchema,
1165
1214
  RedactedGapSelectBankSchema,
1166
1215
  RedactedGapSelectChoiceSchema,
@@ -1182,6 +1231,7 @@ export {
1182
1231
  WrittenResponseRubricSchema,
1183
1232
  XAPIVerb,
1184
1233
  XAPI_VERB_DISPLAY,
1234
+ alignDictation,
1185
1235
  assertRedacted,
1186
1236
  assertRedactedItemGroup,
1187
1237
  canonicalJson,
@@ -1193,6 +1243,10 @@ export {
1193
1243
  createDraft,
1194
1244
  createItemGroupDraft,
1195
1245
  defineActivityType,
1246
+ dictationJsonSchema,
1247
+ dictationReferenceWords,
1248
+ dictationType,
1249
+ diffDictationChars,
1196
1250
  diffResponses,
1197
1251
  entryKeyOf,
1198
1252
  evaluate,
@@ -1201,6 +1255,7 @@ export {
1201
1255
  fingerprint,
1202
1256
  flattenSequence,
1203
1257
  gapSelectJsonSchema,
1258
+ gapSelectType,
1204
1259
  getActivityTypeDescriptor,
1205
1260
  gradeFromRubric,
1206
1261
  gte,