@intellectif/lk-core 0.13.0 → 0.13.1

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @intellectif/lk-core
2
2
 
3
+ ## 0.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 551b900: `validateItemGroupDraft` no longer reports a registered item type as unknown when that type's own checks throw.
8
+
9
+ Every item in a group is checked by `validateDraft` for its own type. Any error thrown on the way was caught and reported as `ig_item_type_unknown` — `"<type>" is not a registered activity type.` — a code documented for a type nobody registered. So a registered type whose `checkDraft` threw for some other reason, such as a bug in the check or input that took it past a limit like a regular expression too large to compile, was reported as unknown; so was one whose schema threw, whenever the group around it failed its own schema — a missing stimulus, say, or two questions sharing an id. An editor showed the author a problem the draft did not have, and the real error was hidden.
10
+
11
+ Now only an `UnknownActivityTypeError` for the item's own type is reported. Any other error is thrown from `validateItemGroupDraft`, whatever state the rest of the group is in, as `validateDraft` already throws it for the same item on its own. (`validateItemGroup` throws a schema's error too, but only once the group around the item passes its own schema.) An unregistered type is reported exactly as before, with the same code, severity, path and message, and every other item's problems are still listed.
12
+
13
+ A group made only of built-in types behaves as before: their checks are property-tested not to throw on any input. If you register your own types, a `checkDraft` that throws now surfaces as an error where you call `validateItemGroupDraft`. `checkDraft` must not throw on a plain object, so the fix belongs in the check.
14
+
3
15
  ## 0.13.0
4
16
 
5
17
  ### Minor Changes
@@ -219,7 +219,7 @@ declare const DictationDataSchema: z.ZodObject<{
219
219
  passThreshold: z.ZodOptional<z.ZodNumber>;
220
220
  locale: z.ZodOptional<z.ZodString>;
221
221
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
222
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
222
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
223
223
  }, z.core.$loose>;
224
224
 
225
225
  /**
@@ -318,8 +318,8 @@ declare const FillInTheBlanksDataSchema: z.ZodObject<{
318
318
  feedback: z.ZodOptional<z.ZodString>;
319
319
  }, z.core.$loose>>;
320
320
  scoringStrategy: z.ZodEnum<{
321
- "all-or-nothing": "all-or-nothing";
322
321
  partial: "partial";
322
+ "all-or-nothing": "all-or-nothing";
323
323
  }>;
324
324
  media: z.ZodOptional<z.ZodObject<{
325
325
  type: z.ZodEnum<{
@@ -358,7 +358,7 @@ declare const FillInTheBlanksDataSchema: z.ZodObject<{
358
358
  passThreshold: z.ZodOptional<z.ZodNumber>;
359
359
  locale: z.ZodOptional<z.ZodString>;
360
360
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
361
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
361
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
362
362
  }, z.core.$loose>;
363
363
 
364
364
  /**
@@ -435,8 +435,8 @@ declare const GapSelectDataSchema: z.ZodObject<{
435
435
  }, z.core.$loose>>;
436
436
  }, z.core.$loose>>>;
437
437
  scoringStrategy: z.ZodEnum<{
438
- "all-or-nothing": "all-or-nothing";
439
438
  partial: "partial";
439
+ "all-or-nothing": "all-or-nothing";
440
440
  }>;
441
441
  presentation: z.ZodOptional<z.ZodLiteral<"dropdown">>;
442
442
  shuffleChoices: z.ZodOptional<z.ZodBoolean>;
@@ -477,7 +477,7 @@ declare const GapSelectDataSchema: z.ZodObject<{
477
477
  passThreshold: z.ZodOptional<z.ZodNumber>;
478
478
  locale: z.ZodOptional<z.ZodString>;
479
479
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
480
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
480
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
481
481
  }, z.core.$loose>;
482
482
 
483
483
  /**
@@ -1072,8 +1072,8 @@ declare const MultipleChoiceDataSchema: z.ZodObject<{
1072
1072
  }, z.core.$loose>>;
1073
1073
  }, z.core.$loose>>;
1074
1074
  scoringStrategy: z.ZodEnum<{
1075
- "all-or-nothing": "all-or-nothing";
1076
1075
  partial: "partial";
1076
+ "all-or-nothing": "all-or-nothing";
1077
1077
  }>;
1078
1078
  media: z.ZodOptional<z.ZodObject<{
1079
1079
  type: z.ZodEnum<{
@@ -1113,7 +1113,7 @@ declare const MultipleChoiceDataSchema: z.ZodObject<{
1113
1113
  shuffle: z.ZodOptional<z.ZodBoolean>;
1114
1114
  locale: z.ZodOptional<z.ZodString>;
1115
1115
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1116
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1116
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1117
1117
  }, z.core.$loose>;
1118
1118
 
1119
1119
  /** A redacted Multiple Choice option: id and display text only — no `isCorrect`, no feedback. */
@@ -1217,7 +1217,7 @@ declare const RedactedMultipleChoiceDataSchema: z.ZodObject<{
1217
1217
  passThreshold: z.ZodOptional<z.ZodNumber>;
1218
1218
  locale: z.ZodOptional<z.ZodString>;
1219
1219
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1220
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1220
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1221
1221
  }, z.core.$strict>;
1222
1222
  /** A redacted blank: id and hint only — no accepted answers, no matching rules, no feedback. */
1223
1223
  declare const RedactedBlankConfigSchema: z.ZodObject<{
@@ -1273,7 +1273,7 @@ declare const RedactedFillInTheBlanksDataSchema: z.ZodObject<{
1273
1273
  passThreshold: z.ZodOptional<z.ZodNumber>;
1274
1274
  locale: z.ZodOptional<z.ZodString>;
1275
1275
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1276
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1276
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1277
1277
  }, z.core.$strict>;
1278
1278
  /** A redacted choice: exactly what it always was. Which one is correct was never stored here. */
1279
1279
  declare const RedactedGapSelectChoiceSchema: z.ZodObject<{
@@ -1373,7 +1373,7 @@ declare const RedactedGapSelectDataSchema: z.ZodObject<{
1373
1373
  passThreshold: z.ZodOptional<z.ZodNumber>;
1374
1374
  locale: z.ZodOptional<z.ZodString>;
1375
1375
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1376
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1376
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1377
1377
  }, z.core.$strict>;
1378
1378
  /**
1379
1379
  * Redacted Written Response data: the prompt, word bounds and rubric are
@@ -1435,7 +1435,7 @@ declare const RedactedWrittenResponseDataSchema: z.ZodObject<{
1435
1435
  passThreshold: z.ZodOptional<z.ZodNumber>;
1436
1436
  locale: z.ZodOptional<z.ZodString>;
1437
1437
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1438
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1438
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1439
1439
  }, z.core.$strict>;
1440
1440
  /** A redacted slow recording: unchanged — it is public, and it never carried captions or a policy. */
1441
1441
  declare const RedactedDictationSlowMediaSchema: z.ZodObject<{
@@ -1506,7 +1506,7 @@ declare const RedactedDictationDataSchema: z.ZodObject<{
1506
1506
  passThreshold: z.ZodOptional<z.ZodNumber>;
1507
1507
  locale: z.ZodOptional<z.ZodString>;
1508
1508
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1509
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1509
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1510
1510
  }, z.core.$strict>;
1511
1511
  /**
1512
1512
  * The learner-safe SHAPE of each built-in type, derived from the strict schema
@@ -1638,7 +1638,7 @@ declare const WrittenResponseDataSchema: z.ZodObject<{
1638
1638
  passThreshold: z.ZodOptional<z.ZodNumber>;
1639
1639
  locale: z.ZodOptional<z.ZodString>;
1640
1640
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1641
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1641
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1642
1642
  }, z.core.$loose>;
1643
1643
 
1644
1644
  /**
@@ -219,7 +219,7 @@ declare const DictationDataSchema: z.ZodObject<{
219
219
  passThreshold: z.ZodOptional<z.ZodNumber>;
220
220
  locale: z.ZodOptional<z.ZodString>;
221
221
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
222
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
222
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
223
223
  }, z.core.$loose>;
224
224
 
225
225
  /**
@@ -318,8 +318,8 @@ declare const FillInTheBlanksDataSchema: z.ZodObject<{
318
318
  feedback: z.ZodOptional<z.ZodString>;
319
319
  }, z.core.$loose>>;
320
320
  scoringStrategy: z.ZodEnum<{
321
- "all-or-nothing": "all-or-nothing";
322
321
  partial: "partial";
322
+ "all-or-nothing": "all-or-nothing";
323
323
  }>;
324
324
  media: z.ZodOptional<z.ZodObject<{
325
325
  type: z.ZodEnum<{
@@ -358,7 +358,7 @@ declare const FillInTheBlanksDataSchema: z.ZodObject<{
358
358
  passThreshold: z.ZodOptional<z.ZodNumber>;
359
359
  locale: z.ZodOptional<z.ZodString>;
360
360
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
361
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
361
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
362
362
  }, z.core.$loose>;
363
363
 
364
364
  /**
@@ -435,8 +435,8 @@ declare const GapSelectDataSchema: z.ZodObject<{
435
435
  }, z.core.$loose>>;
436
436
  }, z.core.$loose>>>;
437
437
  scoringStrategy: z.ZodEnum<{
438
- "all-or-nothing": "all-or-nothing";
439
438
  partial: "partial";
439
+ "all-or-nothing": "all-or-nothing";
440
440
  }>;
441
441
  presentation: z.ZodOptional<z.ZodLiteral<"dropdown">>;
442
442
  shuffleChoices: z.ZodOptional<z.ZodBoolean>;
@@ -477,7 +477,7 @@ declare const GapSelectDataSchema: z.ZodObject<{
477
477
  passThreshold: z.ZodOptional<z.ZodNumber>;
478
478
  locale: z.ZodOptional<z.ZodString>;
479
479
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
480
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
480
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
481
481
  }, z.core.$loose>;
482
482
 
483
483
  /**
@@ -1072,8 +1072,8 @@ declare const MultipleChoiceDataSchema: z.ZodObject<{
1072
1072
  }, z.core.$loose>>;
1073
1073
  }, z.core.$loose>>;
1074
1074
  scoringStrategy: z.ZodEnum<{
1075
- "all-or-nothing": "all-or-nothing";
1076
1075
  partial: "partial";
1076
+ "all-or-nothing": "all-or-nothing";
1077
1077
  }>;
1078
1078
  media: z.ZodOptional<z.ZodObject<{
1079
1079
  type: z.ZodEnum<{
@@ -1113,7 +1113,7 @@ declare const MultipleChoiceDataSchema: z.ZodObject<{
1113
1113
  shuffle: z.ZodOptional<z.ZodBoolean>;
1114
1114
  locale: z.ZodOptional<z.ZodString>;
1115
1115
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1116
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1116
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1117
1117
  }, z.core.$loose>;
1118
1118
 
1119
1119
  /** A redacted Multiple Choice option: id and display text only — no `isCorrect`, no feedback. */
@@ -1217,7 +1217,7 @@ declare const RedactedMultipleChoiceDataSchema: z.ZodObject<{
1217
1217
  passThreshold: z.ZodOptional<z.ZodNumber>;
1218
1218
  locale: z.ZodOptional<z.ZodString>;
1219
1219
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1220
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1220
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1221
1221
  }, z.core.$strict>;
1222
1222
  /** A redacted blank: id and hint only — no accepted answers, no matching rules, no feedback. */
1223
1223
  declare const RedactedBlankConfigSchema: z.ZodObject<{
@@ -1273,7 +1273,7 @@ declare const RedactedFillInTheBlanksDataSchema: z.ZodObject<{
1273
1273
  passThreshold: z.ZodOptional<z.ZodNumber>;
1274
1274
  locale: z.ZodOptional<z.ZodString>;
1275
1275
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1276
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1276
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1277
1277
  }, z.core.$strict>;
1278
1278
  /** A redacted choice: exactly what it always was. Which one is correct was never stored here. */
1279
1279
  declare const RedactedGapSelectChoiceSchema: z.ZodObject<{
@@ -1373,7 +1373,7 @@ declare const RedactedGapSelectDataSchema: z.ZodObject<{
1373
1373
  passThreshold: z.ZodOptional<z.ZodNumber>;
1374
1374
  locale: z.ZodOptional<z.ZodString>;
1375
1375
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1376
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1376
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1377
1377
  }, z.core.$strict>;
1378
1378
  /**
1379
1379
  * Redacted Written Response data: the prompt, word bounds and rubric are
@@ -1435,7 +1435,7 @@ declare const RedactedWrittenResponseDataSchema: z.ZodObject<{
1435
1435
  passThreshold: z.ZodOptional<z.ZodNumber>;
1436
1436
  locale: z.ZodOptional<z.ZodString>;
1437
1437
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1438
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1438
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1439
1439
  }, z.core.$strict>;
1440
1440
  /** A redacted slow recording: unchanged — it is public, and it never carried captions or a policy. */
1441
1441
  declare const RedactedDictationSlowMediaSchema: z.ZodObject<{
@@ -1506,7 +1506,7 @@ declare const RedactedDictationDataSchema: z.ZodObject<{
1506
1506
  passThreshold: z.ZodOptional<z.ZodNumber>;
1507
1507
  locale: z.ZodOptional<z.ZodString>;
1508
1508
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1509
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1509
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1510
1510
  }, z.core.$strict>;
1511
1511
  /**
1512
1512
  * The learner-safe SHAPE of each built-in type, derived from the strict schema
@@ -1638,7 +1638,7 @@ declare const WrittenResponseDataSchema: z.ZodObject<{
1638
1638
  passThreshold: z.ZodOptional<z.ZodNumber>;
1639
1639
  locale: z.ZodOptional<z.ZodString>;
1640
1640
  learningObjectives: z.ZodOptional<z.ZodArray<z.ZodString>>;
1641
- difficultyLevel: z.ZodOptional<z.ZodLiteral<2 | 1 | 3 | 4 | 5>>;
1641
+ difficultyLevel: z.ZodOptional<z.ZodLiteral<1 | 2 | 3 | 4 | 5>>;
1642
1642
  }, z.core.$loose>;
1643
1643
 
1644
1644
  /**
package/dist/index.cjs CHANGED
@@ -858,7 +858,10 @@ function checkItems(draft) {
858
858
  let result;
859
859
  try {
860
860
  result = validateDraft(item.type, item);
861
- } catch (e) {
861
+ } catch (error) {
862
+ if (!(error instanceof _chunkXONKWL6Dcjs.UnknownActivityTypeError) || error.activityType !== item.type) {
863
+ throw error;
864
+ }
862
865
  issues.push(
863
866
  _chunkXONKWL6Dcjs.issue.call(void 0,
864
867
  "ig_item_type_unknown",