@intellectif/lk-core 0.22.0 → 1.0.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 (64) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +5 -5
  3. package/dist/{activity-CYc7SD3d.d.cts → activity-DgpBJeBc.d.cts} +11 -15
  4. package/dist/{activity-CYc7SD3d.d.ts → activity-DgpBJeBc.d.ts} +11 -15
  5. package/dist/ai-check.cjs +8 -8
  6. package/dist/ai-check.d.cts +1 -1
  7. package/dist/ai-check.d.ts +1 -1
  8. package/dist/ai-check.js +3 -3
  9. package/dist/{chunk-2CV6NU32.cjs → chunk-2JT2WUQ2.cjs} +77 -39
  10. package/dist/chunk-2JT2WUQ2.cjs.map +1 -0
  11. package/dist/{chunk-D4TOPSHV.cjs → chunk-DSDXL3JO.cjs} +1216 -1105
  12. package/dist/chunk-DSDXL3JO.cjs.map +1 -0
  13. package/dist/{chunk-D3GP5MET.js → chunk-FBKTION6.js} +1093 -982
  14. package/dist/chunk-FBKTION6.js.map +1 -0
  15. package/dist/{chunk-Q7MV3IXJ.js → chunk-IARLJ5MW.js} +15 -16
  16. package/dist/chunk-IARLJ5MW.js.map +1 -0
  17. package/dist/{chunk-5UCR4UNR.js → chunk-RCZCP5OE.js} +12 -7
  18. package/dist/chunk-RCZCP5OE.js.map +1 -0
  19. package/dist/{chunk-X5DAXBJI.js → chunk-SJVRUPJT.js} +2 -2
  20. package/dist/{chunk-EOFWSGLU.cjs → chunk-TJJFKKH2.cjs} +4 -4
  21. package/dist/{chunk-EOFWSGLU.cjs.map → chunk-TJJFKKH2.cjs.map} +1 -1
  22. package/dist/{chunk-WQVZPIN7.cjs → chunk-VSH7ECQL.cjs} +44 -45
  23. package/dist/chunk-VSH7ECQL.cjs.map +1 -0
  24. package/dist/{chunk-OPMY2MNS.cjs → chunk-W5KB3DNT.cjs} +19 -14
  25. package/dist/chunk-W5KB3DNT.cjs.map +1 -0
  26. package/dist/{chunk-Z7QQZ53L.js → chunk-XS6U2ARZ.js} +70 -32
  27. package/dist/chunk-XS6U2ARZ.js.map +1 -0
  28. package/dist/index-BVNeSCWC.d.ts +548 -0
  29. package/dist/index-BlOLlwOi.d.cts +548 -0
  30. package/dist/index.cjs +129 -206
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +115 -15
  33. package/dist/index.d.ts +115 -15
  34. package/dist/index.js +26 -103
  35. package/dist/index.js.map +1 -1
  36. package/dist/schemas.cjs +3 -94
  37. package/dist/schemas.cjs.map +1 -1
  38. package/dist/schemas.d.cts +2 -3
  39. package/dist/schemas.d.ts +2 -3
  40. package/dist/schemas.js +6 -97
  41. package/dist/scoring.cjs +3 -3
  42. package/dist/scoring.d.cts +2 -2
  43. package/dist/scoring.d.ts +2 -2
  44. package/dist/scoring.js +2 -2
  45. package/dist/xapi.cjs +3 -3
  46. package/dist/xapi.d.cts +1 -1
  47. package/dist/xapi.d.ts +1 -1
  48. package/dist/xapi.js +2 -2
  49. package/package.json +4 -4
  50. package/vectors/README.md +32 -2
  51. package/vectors/scoring.json +1 -498
  52. package/vectors/validation.json +6742 -0
  53. package/vectors/validation.mjs +195 -0
  54. package/dist/chunk-2CV6NU32.cjs.map +0 -1
  55. package/dist/chunk-5UCR4UNR.js.map +0 -1
  56. package/dist/chunk-D3GP5MET.js.map +0 -1
  57. package/dist/chunk-D4TOPSHV.cjs.map +0 -1
  58. package/dist/chunk-OPMY2MNS.cjs.map +0 -1
  59. package/dist/chunk-Q7MV3IXJ.js.map +0 -1
  60. package/dist/chunk-WQVZPIN7.cjs.map +0 -1
  61. package/dist/chunk-Z7QQZ53L.js.map +0 -1
  62. package/dist/index-0Z3-nnAP.d.ts +0 -2303
  63. package/dist/index-CxxiNSSH.d.cts +0 -2303
  64. /package/dist/{chunk-X5DAXBJI.js.map → chunk-SJVRUPJT.js.map} +0 -0
package/dist/index.js CHANGED
@@ -4,20 +4,15 @@ import {
4
4
  validateXAPIStatement,
5
5
  xAPIBuilder,
6
6
  xapiDefinitionFor
7
- } from "./chunk-X5DAXBJI.js";
7
+ } from "./chunk-SJVRUPJT.js";
8
8
  import {
9
9
  INTERACTIVE_VIDEO_ITEM_TYPES,
10
10
  ItemGroupSchema,
11
- MediaTimelineSchema,
12
11
  RedactedItemGroupSchema,
13
- RedactedStimulusSchema,
14
- StimulusSchema,
15
12
  TIMELINE_MAX_CHAPTERS,
16
13
  TIMELINE_MAX_ITEMS,
17
14
  TIMELINE_MAX_QUIZZES,
18
15
  TIMELINE_MAX_TITLE_LENGTH,
19
- TimelineChapterSchema,
20
- TimelineCueSchema,
21
16
  dictationJsonSchema,
22
17
  fillInTheBlanksJsonSchema,
23
18
  gapSelectJsonSchema,
@@ -29,8 +24,10 @@ import {
29
24
  stimulusJsonSchema,
30
25
  validateActivity,
31
26
  validateItemGroup,
27
+ validateMedia,
28
+ validateOptionMedia,
32
29
  writtenResponseJsonSchema
33
- } from "./chunk-Z7QQZ53L.js";
30
+ } from "./chunk-XS6U2ARZ.js";
34
31
  import {
35
32
  AI_EXPLANATION_TYPES,
36
33
  AI_HINT_TYPES,
@@ -49,7 +46,7 @@ import {
49
46
  checkAiWritingFeedback,
50
47
  hintRevealsAnswer,
51
48
  readAiTextResult
52
- } from "./chunk-5UCR4UNR.js";
49
+ } from "./chunk-RCZCP5OE.js";
53
50
  import {
54
51
  DEFAULT_ITEM_SCORING_POLICY,
55
52
  DEFAULT_PASS_THRESHOLD,
@@ -74,11 +71,9 @@ import {
74
71
  scoreTries,
75
72
  validateItemScoringPolicy,
76
73
  validateSpeechAssessment
77
- } from "./chunk-Q7MV3IXJ.js";
74
+ } from "./chunk-IARLJ5MW.js";
78
75
  import {
79
76
  ActivitySchemaError,
80
- AiPermissionsSchema,
81
- BlankConfigSchema,
82
77
  DICTATION_MAX_ACCEPTED_TRANSCRIPTS,
83
78
  DICTATION_MAX_EQUIVALENCES,
84
79
  DICTATION_MAX_EQUIVALENCE_LENGTH,
@@ -86,53 +81,15 @@ import {
86
81
  DICTATION_MAX_TRANSCRIPT_LENGTH,
87
82
  DRAFT_ISSUE_SEVERITY,
88
83
  DeferredScoringError,
89
- DictationDataSchema,
90
- DictationEquivalenceSchema,
91
- DictationSlowMediaSchema,
92
- DictationToleranceSchema,
93
- FeedbackSchema,
94
- FillInTheBlanksDataSchema,
95
84
  GROUP_CAPTIONS_REVEAL_DICTATION,
96
- GapSelectBankSchema,
97
- GapSelectChoiceSchema,
98
- GapSelectDataSchema,
99
- GapSelectGapSchema,
100
85
  MEDIA_FIELD_POLICY,
101
- MediaPlaybackSchema,
102
- MediaSchema,
103
- MediaTrackSchema,
104
- MediaUrlSchema,
105
- MultipleChoiceDataSchema,
106
- MultipleChoiceOptionMediaSchema,
107
- MultipleChoiceOptionSchema,
108
- NativeControlHintSchema,
109
86
  READ_ALOUD_MAX_DIMENSION_WEIGHT,
110
87
  READ_ALOUD_MAX_REFERENCE_LENGTH,
111
88
  READ_ALOUD_MAX_SECONDS,
112
89
  READ_ALOUD_MAX_TAKES,
113
- ReadAloudDataSchema,
114
- ReadAloudSlowMediaSchema,
115
- RedactedBlankConfigSchema,
116
- RedactedDictationDataSchema,
117
- RedactedDictationSlowMediaSchema,
118
- RedactedFillInTheBlanksDataSchema,
119
- RedactedGapSelectBankSchema,
120
- RedactedGapSelectChoiceSchema,
121
- RedactedGapSelectDataSchema,
122
- RedactedGapSelectGapSchema,
123
- RedactedMediaSchema,
124
- RedactedMultipleChoiceDataSchema,
125
- RedactedMultipleChoiceOptionMediaSchema,
126
- RedactedMultipleChoiceOptionSchema,
127
- RedactedReadAloudDataSchema,
128
90
  RedactedScoringError,
129
- RedactedWrittenResponseDataSchema,
130
91
  SPEECH_ASSESSMENT_MAX_WORDS,
131
- TextMatchPolicySchema,
132
92
  UnknownActivityTypeError,
133
- WrittenResponseDataSchema,
134
- WrittenResponseRubricCriterionSchema,
135
- WrittenResponseRubricSchema,
136
93
  alignDictation,
137
94
  checkMedia,
138
95
  countWords,
@@ -155,12 +112,13 @@ import {
155
112
  multipleChoiceType,
156
113
  pathKey,
157
114
  readAloudType,
115
+ readSchema,
158
116
  refusesEmpty,
159
117
  registerActivityType,
160
118
  registeredActivityTypes,
161
119
  withValidationScope,
162
120
  writtenResponseType
163
- } from "./chunk-D3GP5MET.js";
121
+ } from "./chunk-FBKTION6.js";
164
122
 
165
123
  // src/content-hash.ts
166
124
  function canonicalJson(value, seen = /* @__PURE__ */ new Set()) {
@@ -1321,11 +1279,13 @@ function validateDraftInScope(type, draft) {
1321
1279
  }
1322
1280
  const reported = isRecord(draft) && descriptor.authoring?.checkDraft !== void 0 ? descriptor.authoring.checkDraft(draft).map(normalise) : [];
1323
1281
  const issues = [...reported];
1324
- const parsed = descriptor.schema.safeParse(draft, { reportInput: true });
1282
+ const parsed = readSchema(descriptor.schema, draft, `Activity type "${descriptor.type}"`, {
1283
+ reportInput: true
1284
+ });
1325
1285
  if (!parsed.success) {
1326
1286
  const covered = coveredPathsOf(reported);
1327
1287
  const reportedEmpty = /* @__PURE__ */ new Set();
1328
- for (const schemaIssue of parsed.error.issues) {
1288
+ for (const schemaIssue of parsed.issues) {
1329
1289
  const path = schemaIssue.path.map(String);
1330
1290
  if (covered.has(pathKey(path))) {
1331
1291
  continue;
@@ -1463,11 +1423,15 @@ function redact(data, options = {}) {
1463
1423
  const projected = redactValue(data, effectivePolicy, reveal);
1464
1424
  const result = { ...projected, redacted: true };
1465
1425
  if (reveal === "none" && descriptor.redactedSchema !== void 0) {
1466
- const parsed = descriptor.redactedSchema.safeParse(result);
1426
+ const parsed = readSchema(
1427
+ descriptor.redactedSchema,
1428
+ result,
1429
+ `Activity type "${descriptor.type}"`
1430
+ );
1467
1431
  if (!parsed.success) {
1468
1432
  throw new ActivitySchemaError(
1469
1433
  descriptor.type,
1470
- parsed.error.issues.map((issue2) => ({
1434
+ parsed.issues.map((issue2) => ({
1471
1435
  path: issue2.path.map(String),
1472
1436
  message: issue2.message,
1473
1437
  code: issue2.code
@@ -1507,11 +1471,15 @@ function assertRedacted(data) {
1507
1471
  }
1508
1472
  ]);
1509
1473
  }
1510
- const parsed = descriptor.redactedSchema.safeParse(candidate);
1474
+ const parsed = readSchema(
1475
+ descriptor.redactedSchema,
1476
+ candidate,
1477
+ `Activity type "${descriptor.type}"`
1478
+ );
1511
1479
  if (!parsed.success) {
1512
1480
  throw new ActivitySchemaError(
1513
1481
  descriptor.type,
1514
- parsed.error.issues.map((issue2) => ({
1482
+ parsed.issues.map((issue2) => ({
1515
1483
  path: issue2.path.map(String),
1516
1484
  message: issue2.message,
1517
1485
  code: issue2.code
@@ -1669,8 +1637,6 @@ export {
1669
1637
  AI_WRITING_MAX_CORRECTIONS,
1670
1638
  AI_WRITING_MAX_FIELD_LENGTH,
1671
1639
  ActivitySchemaError,
1672
- AiPermissionsSchema,
1673
- BlankConfigSchema,
1674
1640
  DEFAULT_ITEM_SCORING_POLICY,
1675
1641
  DEFAULT_PASS_THRESHOLD,
1676
1642
  DICTATION_MAX_ACCEPTED_TRANSCRIPTS,
@@ -1679,65 +1645,20 @@ export {
1679
1645
  DICTATION_MAX_TEXT_LENGTH,
1680
1646
  DICTATION_MAX_TRANSCRIPT_LENGTH,
1681
1647
  DeferredScoringError,
1682
- DictationDataSchema,
1683
- DictationEquivalenceSchema,
1684
- DictationSlowMediaSchema,
1685
- DictationToleranceSchema,
1686
- FeedbackSchema,
1687
- FillInTheBlanksDataSchema,
1688
- GapSelectBankSchema,
1689
- GapSelectChoiceSchema,
1690
- GapSelectDataSchema,
1691
- GapSelectGapSchema,
1692
1648
  INTERACTIVE_VIDEO_ITEM_TYPES,
1693
1649
  ITEM_SCORING_MAX_RETRIES,
1694
- ItemGroupSchema,
1695
- MediaPlaybackSchema,
1696
- MediaSchema,
1697
- MediaTimelineSchema,
1698
- MediaTrackSchema,
1699
- MediaUrlSchema,
1700
- MultipleChoiceDataSchema,
1701
- MultipleChoiceOptionMediaSchema,
1702
- MultipleChoiceOptionSchema,
1703
- NativeControlHintSchema,
1704
1650
  OPEN_DELIVERY_POLICY,
1705
1651
  READ_ALOUD_MAX_DIMENSION_WEIGHT,
1706
1652
  READ_ALOUD_MAX_REFERENCE_LENGTH,
1707
1653
  READ_ALOUD_MAX_SECONDS,
1708
1654
  READ_ALOUD_MAX_TAKES,
1709
- ReadAloudDataSchema,
1710
- ReadAloudSlowMediaSchema,
1711
- RedactedBlankConfigSchema,
1712
- RedactedDictationDataSchema,
1713
- RedactedDictationSlowMediaSchema,
1714
- RedactedFillInTheBlanksDataSchema,
1715
- RedactedGapSelectBankSchema,
1716
- RedactedGapSelectChoiceSchema,
1717
- RedactedGapSelectDataSchema,
1718
- RedactedGapSelectGapSchema,
1719
- RedactedItemGroupSchema,
1720
- RedactedMediaSchema,
1721
- RedactedMultipleChoiceDataSchema,
1722
- RedactedMultipleChoiceOptionMediaSchema,
1723
- RedactedMultipleChoiceOptionSchema,
1724
- RedactedReadAloudDataSchema,
1725
1655
  RedactedScoringError,
1726
- RedactedStimulusSchema,
1727
- RedactedWrittenResponseDataSchema,
1728
1656
  SPEECH_ASSESSMENT_MAX_WORDS,
1729
- StimulusSchema,
1730
1657
  TIMELINE_MAX_CHAPTERS,
1731
1658
  TIMELINE_MAX_ITEMS,
1732
1659
  TIMELINE_MAX_QUIZZES,
1733
1660
  TIMELINE_MAX_TITLE_LENGTH,
1734
- TextMatchPolicySchema,
1735
- TimelineChapterSchema,
1736
- TimelineCueSchema,
1737
1661
  UnknownActivityTypeError,
1738
- WrittenResponseDataSchema,
1739
- WrittenResponseRubricCriterionSchema,
1740
- WrittenResponseRubricSchema,
1741
1662
  XAPIVerb,
1742
1663
  XAPI_VERB_DISPLAY,
1743
1664
  aiAllowedByContent,
@@ -1829,6 +1750,8 @@ export {
1829
1750
  validateItemGroup,
1830
1751
  validateItemGroupDraft,
1831
1752
  validateItemScoringPolicy,
1753
+ validateMedia,
1754
+ validateOptionMedia,
1832
1755
  validateSpeechAssessment,
1833
1756
  validateXAPIStatement,
1834
1757
  verifyAttemptPlan,