lens-content-processor 0.74.0 → 0.76.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/dist/bundler/video.d.ts +29 -2
- package/dist/bundler/video.js +162 -8
- package/dist/bundler/video.js.map +1 -1
- package/dist/content-schema.js +16 -2
- package/dist/content-schema.js.map +1 -1
- package/dist/flattener/index.js +15 -7
- package/dist/flattener/index.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +87 -14
- package/dist/index.js.map +1 -1
- package/dist/parser/learning-outcome.d.ts +3 -0
- package/dist/parser/learning-outcome.js +12 -1
- package/dist/parser/learning-outcome.js.map +1 -1
- package/dist/parser/lens.d.ts +7 -0
- package/dist/parser/lens.js +26 -2
- package/dist/parser/lens.js.map +1 -1
- package/dist/validator/uuid.d.ts +16 -0
- package/dist/validator/uuid.js +63 -7
- package/dist/validator/uuid.js.map +1 -1
- package/package.json +1 -1
package/dist/validator/uuid.js
CHANGED
|
@@ -9,6 +9,35 @@ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12
|
|
|
9
9
|
export function isValidUuid(value) {
|
|
10
10
|
return UUID_REGEX.test(value);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The fields two copies must agree on, each with how an author would name it.
|
|
14
|
+
* (`graded` is left out: it follows from these.)
|
|
15
|
+
*/
|
|
16
|
+
const QUESTION_IDENTITY = {
|
|
17
|
+
questionType: "question type (the '#### Question: …' header)",
|
|
18
|
+
content: "content",
|
|
19
|
+
assessmentInstructions: "assessment-instructions",
|
|
20
|
+
maxChars: "max-chars", // enforced on every save, against the copy in that module
|
|
21
|
+
maxWords: "max-words",
|
|
22
|
+
enforceVoice: "enforce-voice",
|
|
23
|
+
options: "options", // choice
|
|
24
|
+
correctOptions: "which options are marked [x]",
|
|
25
|
+
multi: "multi",
|
|
26
|
+
maxSelect: "max-select",
|
|
27
|
+
freeformOption: "freeform option",
|
|
28
|
+
items: "items or their order", // ranking: the authored order is the answer
|
|
29
|
+
blanks: "blanks or their accepted answers", // fillblank
|
|
30
|
+
scale: "scale", // rating, with what its points mean
|
|
31
|
+
labels: "labels",
|
|
32
|
+
lowLabel: "low-label",
|
|
33
|
+
highLabel: "high-label",
|
|
34
|
+
};
|
|
35
|
+
/** Authored names of the identity fields where two copies of a question differ. */
|
|
36
|
+
function questionDifferences(a, b) {
|
|
37
|
+
return Object.entries(QUESTION_IDENTITY)
|
|
38
|
+
.filter(([k]) => JSON.stringify(a.fields[k]) !== JSON.stringify(b.fields[k]))
|
|
39
|
+
.map(([, name]) => name);
|
|
40
|
+
}
|
|
12
41
|
/**
|
|
13
42
|
* Validate a collection of UUIDs for format and uniqueness.
|
|
14
43
|
*/
|
|
@@ -31,14 +60,41 @@ export function validateUuids(entries) {
|
|
|
31
60
|
const existing = seenUuids.get(lowerUuid);
|
|
32
61
|
if (existing) {
|
|
33
62
|
// Allow same-file, same-field duplicates (e.g., contentId shared across submodule groups)
|
|
34
|
-
if (existing.file
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
63
|
+
if (existing.file === entry.file && existing.field === entry.field) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (existing.question && entry.question) {
|
|
67
|
+
// Same-file question duplicates never get here (collectResponseSegmentIds)
|
|
68
|
+
// Only lens questions may share: a shared test question would count
|
|
69
|
+
// one answer once per test that holds it (scoring keys items by id),
|
|
70
|
+
// and survey answers are stored per survey.
|
|
71
|
+
const contexts = [existing.question.context, entry.question.context];
|
|
72
|
+
if (contexts.some((c) => c !== "lens")) {
|
|
73
|
+
errors.push({
|
|
74
|
+
file: entry.file,
|
|
75
|
+
message: `Response segment id '${entry.uuid}' is also used in ${existing.file}; only lens questions may share an id, not ${contexts.filter((c) => c !== "lens")[0]} questions`,
|
|
76
|
+
suggestion: "Give this question its own UUID",
|
|
77
|
+
severity: "error",
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const differs = questionDifferences(existing.question, entry.question);
|
|
82
|
+
if (differs.length > 0) {
|
|
83
|
+
errors.push({
|
|
84
|
+
file: entry.file,
|
|
85
|
+
message: `Response segment id '${entry.uuid}' is also used in ${existing.file}, but the two questions differ in: ${differs.join(", ")}`,
|
|
86
|
+
suggestion: "A shared id makes the copies one question with one answer and score. Make what is asked and graded identical, or give this question its own UUID",
|
|
87
|
+
severity: "error",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
41
91
|
}
|
|
92
|
+
errors.push({
|
|
93
|
+
file: entry.file,
|
|
94
|
+
message: `Duplicate UUID '${entry.uuid}' - also used in ${existing.file} (${existing.field})`,
|
|
95
|
+
suggestion: "Each UUID must be unique across the entire vault",
|
|
96
|
+
severity: "error",
|
|
97
|
+
});
|
|
42
98
|
}
|
|
43
99
|
else {
|
|
44
100
|
seenUuids.set(lowerUuid, entry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/validator/uuid.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,GACd,iEAAiE,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/validator/uuid.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,GACd,iEAAiE,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAyBD;;;GAGG;AACH,MAAM,iBAAiB,GAA2B;IAChD,YAAY,EAAE,+CAA+C;IA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