@learnosity/lib-qti-converter 0.10.4
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/LICENSE +22 -0
- package/README.md +263 -0
- package/docs/DIAGNOSTICS.md +263 -0
- package/docs/EXAMPLES.md +869 -0
- package/docs/FAQ.md +415 -0
- package/docs/GETTING_STARTED.md +471 -0
- package/docs/LEARNOSITY_BUNDLE_FORMAT.md +338 -0
- package/docs/LEARNOSITY_SECTIONS.md +384 -0
- package/docs/QTI_METADATA_TO_TAGS.md +266 -0
- package/docs/QTI_STRUCTURE.md +353 -0
- package/docs/ROADMAP.md +232 -0
- package/docs/SUPPORTED_INTERACTIONS.md +601 -0
- package/docs/_sidebar.md +13 -0
- package/package.json +90 -0
- package/packages/cli/dist/main.js +45610 -0
- package/packages/core/dist/index.d.ts +2658 -0
- package/packages/core/dist/index.js +31706 -0
|
@@ -0,0 +1,2658 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Diagnostic levels
|
|
4
|
+
*/
|
|
5
|
+
type DiagnosticLevel = 'error' | 'warning' | 'info';
|
|
6
|
+
/**
|
|
7
|
+
* Common diagnostic codes
|
|
8
|
+
*/
|
|
9
|
+
declare const DiagnosticCode: {
|
|
10
|
+
readonly NOT_IMPLEMENTED: "NOT_IMPLEMENTED";
|
|
11
|
+
readonly CONFIG_FILE_NOT_FOUND: "CONFIG_FILE_NOT_FOUND";
|
|
12
|
+
readonly CONFIG_FILE_INVALID_JSON: "CONFIG_FILE_INVALID_JSON";
|
|
13
|
+
readonly CONFIG_SCHEMA_INVALID: "CONFIG_SCHEMA_INVALID";
|
|
14
|
+
readonly CONFIG_UNKNOWN_KEY: "CONFIG_UNKNOWN_KEY";
|
|
15
|
+
readonly CONFIG_LOADED: "CONFIG_LOADED";
|
|
16
|
+
readonly CONFIG_DISABLED: "CONFIG_DISABLED";
|
|
17
|
+
readonly PACKAGE_ZIP_ENTRY_UNSAFE: "PACKAGE_ZIP_ENTRY_UNSAFE";
|
|
18
|
+
readonly PACKAGE_MANIFEST_MISSING: "PACKAGE_MANIFEST_MISSING";
|
|
19
|
+
readonly PACKAGE_MANIFEST_INVALID_XML: "PACKAGE_MANIFEST_INVALID_XML";
|
|
20
|
+
readonly MANIFEST_RESOURCE_UNKNOWN_TYPE: "MANIFEST_RESOURCE_UNKNOWN_TYPE";
|
|
21
|
+
readonly PACKAGE_ITEM_FILE_MISSING: "PACKAGE_ITEM_FILE_MISSING";
|
|
22
|
+
readonly PACKAGE_LOADED: "PACKAGE_LOADED";
|
|
23
|
+
readonly PACKAGE_WRITTEN: "PACKAGE_WRITTEN";
|
|
24
|
+
readonly PACKAGE_STYLESHEET_INCLUDED: "PACKAGE_STYLESHEET_INCLUDED";
|
|
25
|
+
readonly LRN_SCHEMA_INVALID: "LRN_SCHEMA_INVALID";
|
|
26
|
+
readonly LRN_MISSING_REQUIRED_FIELD: "LRN_MISSING_REQUIRED_FIELD";
|
|
27
|
+
readonly LRN_WIDGET_REF_NOT_FOUND: "LRN_WIDGET_REF_NOT_FOUND";
|
|
28
|
+
readonly LRN_UNSUPPORTED_QUESTION_TYPE: "LRN_UNSUPPORTED_QUESTION_TYPE";
|
|
29
|
+
readonly LRN_UNKNOWN_KEY: "LRN_UNKNOWN_KEY";
|
|
30
|
+
readonly LRN_FEATURE_REF_NOT_FOUND: "LRN_FEATURE_REF_NOT_FOUND";
|
|
31
|
+
readonly LRN_UNSUPPORTED_FEATURE_TYPE: "LRN_UNSUPPORTED_FEATURE_TYPE";
|
|
32
|
+
readonly LRN_ITEM_SHAPE_UNRECOGNIZED: "LRN_ITEM_SHAPE_UNRECOGNIZED";
|
|
33
|
+
readonly LRN_ITEM_SHAPE_FLAT_NORMALIZED: "LRN_ITEM_SHAPE_FLAT_NORMALIZED";
|
|
34
|
+
readonly LRN_TAGS_OBJECT_NORMALIZED: "LRN_TAGS_OBJECT_NORMALIZED";
|
|
35
|
+
readonly LRN_BUNDLE_DIR_NOT_FOUND: "LRN_BUNDLE_DIR_NOT_FOUND";
|
|
36
|
+
readonly LRN_MANIFEST_MISSING: "LRN_MANIFEST_MISSING";
|
|
37
|
+
readonly LRN_MANIFEST_INVALID_JSON: "LRN_MANIFEST_INVALID_JSON";
|
|
38
|
+
readonly LRN_MANIFEST_SCHEMA_INVALID: "LRN_MANIFEST_SCHEMA_INVALID";
|
|
39
|
+
readonly LRN_PATH_UNSAFE: "LRN_PATH_UNSAFE";
|
|
40
|
+
readonly LRN_ACTIVITY_FILE_INVALID_JSON: "LRN_ACTIVITY_FILE_INVALID_JSON";
|
|
41
|
+
readonly LRN_ITEM_FILE_MISSING: "LRN_ITEM_FILE_MISSING";
|
|
42
|
+
readonly LRN_ITEM_FILE_INVALID_JSON: "LRN_ITEM_FILE_INVALID_JSON";
|
|
43
|
+
readonly LRN_ITEM_CONVERSION_FAILED: "LRN_ITEM_CONVERSION_FAILED";
|
|
44
|
+
readonly LRN_ACTIVITY_FILE_MISSING: "LRN_ACTIVITY_FILE_MISSING";
|
|
45
|
+
readonly LRN_ACTIVITY_DUPLICATE_ITEM_REF: "LRN_ACTIVITY_DUPLICATE_ITEM_REF";
|
|
46
|
+
readonly LRN_MANIFEST_UNUSED_KEY: "LRN_MANIFEST_UNUSED_KEY";
|
|
47
|
+
readonly LRN_BUNDLE_AUTO_ACTIVITY_CREATED: "LRN_BUNDLE_AUTO_ACTIVITY_CREATED";
|
|
48
|
+
readonly LRN_MULTIPLE_QUESTIONS: "LRN_MULTIPLE_QUESTIONS";
|
|
49
|
+
readonly LRN_MISSING_STIMULUS: "LRN_MISSING_STIMULUS";
|
|
50
|
+
readonly LRN_INVALID_VALIDATION: "LRN_INVALID_VALIDATION";
|
|
51
|
+
readonly LRN_MISSING_CORRECT_RESPONSE: "LRN_MISSING_CORRECT_RESPONSE";
|
|
52
|
+
readonly LRN_ACTIVITY_NO_ITEMS: "LRN_ACTIVITY_NO_ITEMS";
|
|
53
|
+
readonly LRN_CLOZE_NO_PLACEHOLDERS: "LRN_CLOZE_NO_PLACEHOLDERS";
|
|
54
|
+
readonly LRN_CLOZE_VALID_RESPONSE_LEN_MISMATCH: "LRN_CLOZE_VALID_RESPONSE_LEN_MISMATCH";
|
|
55
|
+
readonly LRN_CLOZE_MISSING_CORRECT_RESPONSE: "LRN_CLOZE_MISSING_CORRECT_RESPONSE";
|
|
56
|
+
readonly LRN_CLOZE_UNSUPPORTED_SCORING: "LRN_CLOZE_UNSUPPORTED_SCORING";
|
|
57
|
+
readonly LRN_LONGTEXT_UNSUPPORTED_VALIDATION_KEY: "LRN_LONGTEXT_UNSUPPORTED_VALIDATION_KEY";
|
|
58
|
+
readonly LRN_LONGTEXT_MAX_LENGTH_IGNORED: "LRN_LONGTEXT_MAX_LENGTH_IGNORED";
|
|
59
|
+
readonly LRN_LONGTEXT_MAX_SCORE_IGNORED: "LRN_LONGTEXT_MAX_SCORE_IGNORED";
|
|
60
|
+
readonly LRN_LONGTEXT_NO_STIMULUS: "LRN_LONGTEXT_NO_STIMULUS";
|
|
61
|
+
readonly LRN_PLAINTEXT_NO_STIMULUS: "LRN_PLAINTEXT_NO_STIMULUS";
|
|
62
|
+
readonly LRN_PLAINTEXT_PLACEHOLDER_IGNORED: "LRN_PLAINTEXT_PLACEHOLDER_IGNORED";
|
|
63
|
+
readonly LRN_PLAINTEXT_MAX_LENGTH_IGNORED: "LRN_PLAINTEXT_MAX_LENGTH_IGNORED";
|
|
64
|
+
readonly LRN_PLAINTEXT_UI_STYLE_IGNORED: "LRN_PLAINTEXT_UI_STYLE_IGNORED";
|
|
65
|
+
readonly LRN_SHORTTEXT_MISSING_CORRECT_RESPONSE: "LRN_SHORTTEXT_MISSING_CORRECT_RESPONSE";
|
|
66
|
+
readonly LRN_SHORTTEXT_UNSUPPORTED_SCORING: "LRN_SHORTTEXT_UNSUPPORTED_SCORING";
|
|
67
|
+
readonly LRN_CLOZEDROPDOWN_UNSUPPORTED_SCORING: "LRN_CLOZEDROPDOWN_UNSUPPORTED_SCORING";
|
|
68
|
+
readonly LRN_CLOZEASSOCIATION_NO_PLACEHOLDERS: "LRN_CLOZEASSOCIATION_NO_PLACEHOLDERS";
|
|
69
|
+
readonly LRN_CLOZEASSOCIATION_VALUE_COUNT_MISMATCH: "LRN_CLOZEASSOCIATION_VALUE_COUNT_MISMATCH";
|
|
70
|
+
readonly LRN_CLOZEASSOCIATION_INVALID_VALID_RESPONSE: "LRN_CLOZEASSOCIATION_INVALID_VALID_RESPONSE";
|
|
71
|
+
readonly LRN_CLOZEASSOCIATION_MISSING_POSSIBLE_RESPONSES: "LRN_CLOZEASSOCIATION_MISSING_POSSIBLE_RESPONSES";
|
|
72
|
+
readonly LRN_CLOZEASSOCIATION_UNSUPPORTED_SCORING: "LRN_CLOZEASSOCIATION_UNSUPPORTED_SCORING";
|
|
73
|
+
readonly LRN_CLOZEASSOCIATION_DUPLICATE_RESPONSE: "LRN_CLOZEASSOCIATION_DUPLICATE_RESPONSE";
|
|
74
|
+
readonly LRN_TOKENHIGHLIGHT_UNSUPPORTED_SCORING: "LRN_TOKENHIGHLIGHT_UNSUPPORTED_SCORING";
|
|
75
|
+
readonly LRN_TOKENHIGHLIGHT_NO_TOKENS: "LRN_TOKENHIGHLIGHT_NO_TOKENS";
|
|
76
|
+
readonly LRN_TOKENHIGHLIGHT_INVALID_TOKEN_INDEX: "LRN_TOKENHIGHLIGHT_INVALID_TOKEN_INDEX";
|
|
77
|
+
readonly LRN_SHAREDPASSAGE_MISSING_CONTENT: "LRN_SHAREDPASSAGE_MISSING_CONTENT";
|
|
78
|
+
readonly LRN_LAYOUT_PARSE_WARNING: "LRN_LAYOUT_PARSE_WARNING";
|
|
79
|
+
readonly LRN_LAYOUT_WIDGET_REF_MISSING: "LRN_LAYOUT_WIDGET_REF_MISSING";
|
|
80
|
+
readonly CONTENT_MATHJAX_DOM_STRIPPED: "CONTENT_MATHJAX_DOM_STRIPPED";
|
|
81
|
+
readonly CONTENT_EDITOR_ARTEFACT_STRIPPED: "CONTENT_EDITOR_ARTEFACT_STRIPPED";
|
|
82
|
+
readonly CONTENT_HTML_UNSAFE: "CONTENT_HTML_UNSAFE";
|
|
83
|
+
readonly CONTENT_TOO_LARGE_SKIPPED: "CONTENT_TOO_LARGE_SKIPPED";
|
|
84
|
+
readonly CONTENT_HTML_VOID_ELEMENT_FIXED: "CONTENT_HTML_VOID_ELEMENT_FIXED";
|
|
85
|
+
readonly CONTENT_HTML_OBSOLETE_TAG_REPLACED: "CONTENT_HTML_OBSOLETE_TAG_REPLACED";
|
|
86
|
+
readonly CONTENT_REMOTE_ASSET_NOT_PACKAGED: "CONTENT_REMOTE_ASSET_NOT_PACKAGED";
|
|
87
|
+
readonly CONTENT_SIMPLE_FEATURE_CONVERTED: "CONTENT_SIMPLE_FEATURE_CONVERTED";
|
|
88
|
+
readonly CONTENT_HTML_STIMULUS_WRAPPED: "CONTENT_HTML_STIMULUS_WRAPPED";
|
|
89
|
+
readonly QTI_NO_CHOICES: "QTI_NO_CHOICES";
|
|
90
|
+
readonly QTI_NO_CORRECT_RESPONSE: "QTI_NO_CORRECT_RESPONSE";
|
|
91
|
+
readonly QTI_MISSING_INTERACTION: "QTI_MISSING_INTERACTION";
|
|
92
|
+
readonly QTI_STIMULUS_CREATED: "QTI_STIMULUS_CREATED";
|
|
93
|
+
readonly QTI_STIMULUS_INLINED_STANDALONE: "QTI_STIMULUS_INLINED_STANDALONE";
|
|
94
|
+
readonly QTI_UNSUPPORTED_INTERACTION: "QTI_UNSUPPORTED_INTERACTION";
|
|
95
|
+
readonly QTI_MISSING_RESPONSE_DECLARATION: "QTI_MISSING_RESPONSE_DECLARATION";
|
|
96
|
+
readonly QTI_MISSING_CORRECT_RESPONSE: "QTI_MISSING_CORRECT_RESPONSE";
|
|
97
|
+
readonly QTI_CHOICE_NO_TEXT: "QTI_CHOICE_NO_TEXT";
|
|
98
|
+
readonly QTI_PROMPT_MISSING: "QTI_PROMPT_MISSING";
|
|
99
|
+
readonly QTI_DTD_NOT_ALLOWED: "QTI_DTD_NOT_ALLOWED";
|
|
100
|
+
readonly QTI_TEXT_ENTRY_NO_DECLARATION: "QTI_TEXT_ENTRY_NO_DECLARATION";
|
|
101
|
+
readonly QTI_TEXT_ENTRY_MULTIPLE_VALUES: "QTI_TEXT_ENTRY_MULTIPLE_VALUES";
|
|
102
|
+
readonly QTI_ALT_RESPONSES_TRIMMED: "QTI_ALT_RESPONSES_TRIMMED";
|
|
103
|
+
readonly QTI_METADATA_TAG_TOO_LONG: "QTI_METADATA_TAG_TOO_LONG";
|
|
104
|
+
readonly QTI_METADATA_TAG_TRUNCATED: "QTI_METADATA_TAG_TRUNCATED";
|
|
105
|
+
readonly QTI_EXTENDED_TEXT_MULTIPLE_INTERACTIONS: "QTI_EXTENDED_TEXT_MULTIPLE_INTERACTIONS";
|
|
106
|
+
readonly QTI_EXTENDED_TEXT_NO_DECLARATION: "QTI_EXTENDED_TEXT_NO_DECLARATION";
|
|
107
|
+
readonly QTI_MATCH_INVALID_STRUCTURE: "QTI_MATCH_INVALID_STRUCTURE";
|
|
108
|
+
readonly QTI_MATCH_INVALID_DIRECTED_PAIR: "QTI_MATCH_INVALID_DIRECTED_PAIR";
|
|
109
|
+
readonly QTI_MATCH_STEM_NOT_FOUND: "QTI_MATCH_STEM_NOT_FOUND";
|
|
110
|
+
readonly QTI_MATCH_OPTION_NOT_FOUND: "QTI_MATCH_OPTION_NOT_FOUND";
|
|
111
|
+
readonly QTI_ASSOCIATION_INVALID_STRUCTURE: "QTI_ASSOCIATION_INVALID_STRUCTURE";
|
|
112
|
+
readonly QTI_ASSOCIATION_INVALID_PAIR: "QTI_ASSOCIATION_INVALID_PAIR";
|
|
113
|
+
readonly QTI_ASSOCIATION_NO_CHOICES: "QTI_ASSOCIATION_NO_CHOICES";
|
|
114
|
+
readonly QTI_ASSOCIATION_CHOICE_NOT_FOUND: "QTI_ASSOCIATION_CHOICE_NOT_FOUND";
|
|
115
|
+
readonly QTI_GAPMATCH_INVALID_STRUCTURE: "QTI_GAPMATCH_INVALID_STRUCTURE";
|
|
116
|
+
readonly QTI_GAPMATCH_NO_GAPS: "QTI_GAPMATCH_NO_GAPS";
|
|
117
|
+
readonly QTI_GAPMATCH_NO_GAPTEXTS: "QTI_GAPMATCH_NO_GAPTEXTS";
|
|
118
|
+
readonly QTI_GAPMATCH_INVALID_PAIR: "QTI_GAPMATCH_INVALID_PAIR";
|
|
119
|
+
readonly QTI_GAPMATCH_GAP_NOT_FOUND: "QTI_GAPMATCH_GAP_NOT_FOUND";
|
|
120
|
+
readonly QTI_GAPMATCH_GAPTEXT_NOT_FOUND: "QTI_GAPMATCH_GAPTEXT_NOT_FOUND";
|
|
121
|
+
readonly QTI_INLINECHOICE_INVALID_STRUCTURE: "QTI_INLINECHOICE_INVALID_STRUCTURE";
|
|
122
|
+
readonly QTI_INLINECHOICE_NO_CHOICES: "QTI_INLINECHOICE_NO_CHOICES";
|
|
123
|
+
readonly QTI_INLINECHOICE_NO_INTERACTIONS: "QTI_INLINECHOICE_NO_INTERACTIONS";
|
|
124
|
+
readonly QTI_INLINECHOICE_MISSING_DECLARATION: "QTI_INLINECHOICE_MISSING_DECLARATION";
|
|
125
|
+
readonly QTI_INLINECHOICE_CHOICE_NOT_FOUND: "QTI_INLINECHOICE_CHOICE_NOT_FOUND";
|
|
126
|
+
readonly QTI_PASSAGE_ONLY_ITEM: "QTI_PASSAGE_ONLY_ITEM";
|
|
127
|
+
readonly QTI_PASSAGE_EMPTY_ITEMBODY: "QTI_PASSAGE_EMPTY_ITEMBODY";
|
|
128
|
+
readonly QTI_DRAWING_CONVERTED: "QTI_DRAWING_CONVERTED";
|
|
129
|
+
readonly QTI_MULTIPLE_INTERACTIONS: "QTI_MULTIPLE_INTERACTIONS";
|
|
130
|
+
readonly QTI_TEST_ROOT_MISSING: "QTI_TEST_ROOT_MISSING";
|
|
131
|
+
readonly QTI_TEST_NO_ITEM_REFS: "QTI_TEST_NO_ITEM_REFS";
|
|
132
|
+
readonly QTI_TEST_ITEMREF_MISSING_ID: "QTI_TEST_ITEMREF_MISSING_ID";
|
|
133
|
+
readonly QTI_PACKAGE_MANIFEST_MISSING: "QTI_PACKAGE_MANIFEST_MISSING";
|
|
134
|
+
readonly QTI_PACKAGE_TEST_NOT_FOUND: "QTI_PACKAGE_TEST_NOT_FOUND";
|
|
135
|
+
readonly QTI_PACKAGE_ITEM_NOT_FOUND: "QTI_PACKAGE_ITEM_NOT_FOUND";
|
|
136
|
+
readonly QTI_PACKAGE_MULTIPLE_TESTS: "QTI_PACKAGE_MULTIPLE_TESTS";
|
|
137
|
+
readonly QTI_PACKAGE_NO_CONTENT: "QTI_PACKAGE_NO_CONTENT";
|
|
138
|
+
readonly QTI_PACKAGE_DUPLICATE_IDENTIFIER: "QTI_PACKAGE_DUPLICATE_IDENTIFIER";
|
|
139
|
+
readonly LRN_BUNDLE_WRITTEN: "LRN_BUNDLE_WRITTEN";
|
|
140
|
+
readonly QTI_DOWNGRADE_NAMESPACE: "QTI_DOWNGRADE_NAMESPACE";
|
|
141
|
+
readonly QTI_DOWNGRADE_SCHEMA_LOCATION: "QTI_DOWNGRADE_SCHEMA_LOCATION";
|
|
142
|
+
readonly QTI_DOWNGRADE_IDENTIFIER_SANITIZED: "QTI_DOWNGRADE_IDENTIFIER_SANITIZED";
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* A structured diagnostic message
|
|
146
|
+
*/
|
|
147
|
+
interface Diagnostic {
|
|
148
|
+
level: DiagnosticLevel;
|
|
149
|
+
code: string;
|
|
150
|
+
message: string;
|
|
151
|
+
file: string;
|
|
152
|
+
context?: Record<string, unknown>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Diagnostic issue entry for the diagnostics report
|
|
156
|
+
*/
|
|
157
|
+
interface DiagnosticIssue {
|
|
158
|
+
code: string;
|
|
159
|
+
message: string;
|
|
160
|
+
file: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Structured diagnostics report with metadata
|
|
164
|
+
*/
|
|
165
|
+
interface DiagnosticsReport {
|
|
166
|
+
directory_input: string;
|
|
167
|
+
directory_output: string;
|
|
168
|
+
total_items_found: number;
|
|
169
|
+
total_items_processed: number;
|
|
170
|
+
total_items_converted: number;
|
|
171
|
+
total_items_failed: number;
|
|
172
|
+
total_activities_found: number;
|
|
173
|
+
total_activities_converted: number;
|
|
174
|
+
total_activities_failed: number;
|
|
175
|
+
converted_items: string[];
|
|
176
|
+
failed_items: string[];
|
|
177
|
+
converted_activities: string[];
|
|
178
|
+
failed_activities: string[];
|
|
179
|
+
issues: {
|
|
180
|
+
errors: DiagnosticIssue[];
|
|
181
|
+
info: DiagnosticIssue[];
|
|
182
|
+
warnings: DiagnosticIssue[];
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* QTI version
|
|
187
|
+
*/
|
|
188
|
+
type QtiVersion = '2.1' | '2.2';
|
|
189
|
+
/**
|
|
190
|
+
* Output format for package/multi-file outputs
|
|
191
|
+
*/
|
|
192
|
+
type OutputFormat = 'dir' | 'zip' | 'stdout';
|
|
193
|
+
/**
|
|
194
|
+
* Diagnostics output destination
|
|
195
|
+
*/
|
|
196
|
+
type DiagnosticsOutput = 'stderr' | 'file' | 'both' | 'none';
|
|
197
|
+
/**
|
|
198
|
+
* Item reference source for QTI → Learnosity conversion
|
|
199
|
+
*/
|
|
200
|
+
type ItemReferenceSource = 'sourceFilename' | 'qti' | 'uuid';
|
|
201
|
+
/**
|
|
202
|
+
* Item filename source for output JSON file naming (QTI → Learnosity)
|
|
203
|
+
*/
|
|
204
|
+
type ItemFilenameSource = 'sourceFilename' | 'qti';
|
|
205
|
+
/**
|
|
206
|
+
* Shared conversion options
|
|
207
|
+
*/
|
|
208
|
+
interface ConversionOptions {
|
|
209
|
+
qtiVersion: QtiVersion;
|
|
210
|
+
/** @deprecated CLI-only — ignored when using the library API */
|
|
211
|
+
outputFormat?: OutputFormat;
|
|
212
|
+
/** @deprecated CLI-only — ignored when using the library API */
|
|
213
|
+
diagnostics?: DiagnosticsOutput;
|
|
214
|
+
/** @deprecated CLI-only — ignored when using the library API */
|
|
215
|
+
verbose?: boolean;
|
|
216
|
+
pretty?: boolean;
|
|
217
|
+
inputPath?: string;
|
|
218
|
+
organisationId?: number;
|
|
219
|
+
mediaVault?: boolean;
|
|
220
|
+
customAssetUrl?: string;
|
|
221
|
+
itemReferenceSource?: ItemReferenceSource;
|
|
222
|
+
truncateTags?: boolean;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Result of a conversion operation
|
|
226
|
+
*/
|
|
227
|
+
interface ConversionResult<T> {
|
|
228
|
+
output: T;
|
|
229
|
+
diagnostics: Diagnostic[];
|
|
230
|
+
}
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/diagnostics/formatDiagnosticsReport.d.ts
|
|
233
|
+
/**
|
|
234
|
+
* Options for formatting diagnostics report
|
|
235
|
+
*/
|
|
236
|
+
interface FormatDiagnosticsReportOptions {
|
|
237
|
+
/** Input directory or file path that was processed */
|
|
238
|
+
inputPath: string;
|
|
239
|
+
/** Output directory or file path where results were written */
|
|
240
|
+
outputPath: string;
|
|
241
|
+
/** Total item files found in directory */
|
|
242
|
+
totalItemsFound: number;
|
|
243
|
+
/** Total activity files found in directory */
|
|
244
|
+
totalActivitiesFound?: number;
|
|
245
|
+
/** Array of item file paths that were successfully converted (relative to inputPath) */
|
|
246
|
+
convertedFiles: string[];
|
|
247
|
+
/** Array of item file paths that failed conversion (relative to inputPath) */
|
|
248
|
+
failedFiles: string[];
|
|
249
|
+
/** Array of activity/test file paths that were successfully converted (relative to inputPath) */
|
|
250
|
+
convertedActivities?: string[];
|
|
251
|
+
/** Array of activity/test file paths that failed conversion (relative to inputPath) */
|
|
252
|
+
failedActivities?: string[];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Format diagnostics array into structured report with metadata
|
|
256
|
+
*/
|
|
257
|
+
declare function formatDiagnosticsReport(diagnostics: Diagnostic[], options: FormatDiagnosticsReportOptions): DiagnosticsReport;
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/utils/diagnosticHelpers.d.ts
|
|
260
|
+
/**
|
|
261
|
+
* Add file context to diagnostics
|
|
262
|
+
* Maps diagnostics to include a specific source file path
|
|
263
|
+
*
|
|
264
|
+
* @param diagnostics - Array of diagnostics to contextualize
|
|
265
|
+
* @param sourceFile - Source file path to add to each diagnostic
|
|
266
|
+
* @returns New array of diagnostics with file context
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* const parsed = readAssessmentItem(xml);
|
|
270
|
+
* const contextual = addFileContext(parsed.diagnostics, 'item_001.xml');
|
|
271
|
+
* allDiagnostics.push(...contextual);
|
|
272
|
+
*/
|
|
273
|
+
declare function addFileContext(diagnostics: Diagnostic[], sourceFile: string): Diagnostic[];
|
|
274
|
+
/**
|
|
275
|
+
* Add file context to diagnostics if sourceFile is provided
|
|
276
|
+
* Convenience wrapper for optional file context
|
|
277
|
+
*
|
|
278
|
+
* @param diagnostics - Array of diagnostics to contextualize
|
|
279
|
+
* @param sourceFile - Optional source file path
|
|
280
|
+
* @returns Diagnostics with file context if sourceFile provided, otherwise original diagnostics
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* const parsed = readAssessmentItem(xml);
|
|
284
|
+
* const contextual = addFileContextIfProvided(parsed.diagnostics, opts.sourceFile);
|
|
285
|
+
* allDiagnostics.push(...contextual);
|
|
286
|
+
*/
|
|
287
|
+
declare function addFileContextIfProvided(diagnostics: Diagnostic[], sourceFile?: string): Diagnostic[];
|
|
288
|
+
/**
|
|
289
|
+
* Check if diagnostics contain any errors
|
|
290
|
+
*
|
|
291
|
+
* @param diagnostics - Array of diagnostics to check
|
|
292
|
+
* @returns True if any diagnostic has level 'error'
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* if (hasErrors(diagnostics)) {
|
|
296
|
+
* return { diagnostics };
|
|
297
|
+
* }
|
|
298
|
+
*/
|
|
299
|
+
declare function hasErrors(diagnostics: Diagnostic[]): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Filter diagnostics by level
|
|
302
|
+
*
|
|
303
|
+
* @param diagnostics - Array of diagnostics to filter
|
|
304
|
+
* @param level - Diagnostic level to filter by
|
|
305
|
+
* @returns Filtered array of diagnostics
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* const errors = filterByLevel(diagnostics, 'error');
|
|
309
|
+
* const warnings = filterByLevel(diagnostics, 'warning');
|
|
310
|
+
*/
|
|
311
|
+
declare function filterByLevel(diagnostics: Diagnostic[], level: 'error' | 'warning' | 'info'): Diagnostic[];
|
|
312
|
+
/**
|
|
313
|
+
* Filter diagnostics by code
|
|
314
|
+
*
|
|
315
|
+
* @param diagnostics - Array of diagnostics to filter
|
|
316
|
+
* @param codes - Diagnostic codes to exclude
|
|
317
|
+
* @returns Filtered array of diagnostics
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* // Filter out redundant diagnostics
|
|
321
|
+
* const filtered = filterOutCodes(diagnostics, ['QTI_UNSUPPORTED_INTERACTION', 'QTI_MISSING_INTERACTION']);
|
|
322
|
+
*/
|
|
323
|
+
declare function filterOutCodes(diagnostics: Diagnostic[], codes: string[]): Diagnostic[];
|
|
324
|
+
/**
|
|
325
|
+
* Count diagnostics by level
|
|
326
|
+
*
|
|
327
|
+
* @param diagnostics - Array of diagnostics to count
|
|
328
|
+
* @returns Object with counts for each level
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* const counts = countByLevel(diagnostics);
|
|
332
|
+
* console.log(`Errors: ${counts.errors}, Warnings: ${counts.warnings}`);
|
|
333
|
+
*/
|
|
334
|
+
declare function countByLevel(diagnostics: Diagnostic[]): {
|
|
335
|
+
errors: number;
|
|
336
|
+
warnings: number;
|
|
337
|
+
info: number;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Create a diagnostic with common fields
|
|
341
|
+
*
|
|
342
|
+
* @param level - Diagnostic level
|
|
343
|
+
* @param code - Diagnostic code
|
|
344
|
+
* @param message - Diagnostic message
|
|
345
|
+
* @param file - Source file path
|
|
346
|
+
* @param context - Optional additional context
|
|
347
|
+
* @returns Diagnostic object
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* diagnostics.push(createDiagnostic('error', 'QTI_INVALID_XML', 'Malformed XML', 'item.xml'));
|
|
351
|
+
*/
|
|
352
|
+
declare function createDiagnostic(level: 'error' | 'warning' | 'info', code: string, message: string, file: string, context?: Record<string, unknown>): Diagnostic;
|
|
353
|
+
/**
|
|
354
|
+
* Merge multiple diagnostic arrays
|
|
355
|
+
*
|
|
356
|
+
* @param diagnosticArrays - Arrays of diagnostics to merge
|
|
357
|
+
* @returns Single merged array
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* const allDiagnostics = mergeDiagnostics(parseResult.diagnostics, mapResult.diagnostics, serializeResult.diagnostics);
|
|
361
|
+
*/
|
|
362
|
+
declare function mergeDiagnostics(...diagnosticArrays: Diagnostic[][]): Diagnostic[];
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/qti-to-learnosity/types.d.ts
|
|
365
|
+
/**
|
|
366
|
+
* Learnosity Item JSON types for output (QTI → Learnosity conversion)
|
|
367
|
+
* TASK 011 / Updated for new format
|
|
368
|
+
*/
|
|
369
|
+
/**
|
|
370
|
+
* Learnosity tag object
|
|
371
|
+
*/
|
|
372
|
+
type LearnosityTags = Record<string, string[]>;
|
|
373
|
+
/**
|
|
374
|
+
* Learnosity Item metadata
|
|
375
|
+
*/
|
|
376
|
+
interface LearnosityItemMetadata$1 {
|
|
377
|
+
reference: string;
|
|
378
|
+
title?: string;
|
|
379
|
+
content?: string;
|
|
380
|
+
definition: {
|
|
381
|
+
widgets: {
|
|
382
|
+
reference: string;
|
|
383
|
+
widget_type?: string;
|
|
384
|
+
}[];
|
|
385
|
+
};
|
|
386
|
+
status?: 'published';
|
|
387
|
+
tags?: LearnosityTags;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Learnosity feature JSON structure for file output
|
|
391
|
+
*/
|
|
392
|
+
interface LearnosityFeatureJson {
|
|
393
|
+
reference: string;
|
|
394
|
+
type: string;
|
|
395
|
+
widget_type: 'feature';
|
|
396
|
+
data: {
|
|
397
|
+
type: string;
|
|
398
|
+
content?: string;
|
|
399
|
+
heading?: string;
|
|
400
|
+
[key: string]: unknown;
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Learnosity Item JSON structure for file output
|
|
405
|
+
*/
|
|
406
|
+
interface LearnosityItemJson {
|
|
407
|
+
item: LearnosityItemMetadata$1;
|
|
408
|
+
questions: LearnosityQuestionJson[];
|
|
409
|
+
features: LearnosityFeatureJson[];
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Learnosity Question JSON (MCQ, clozetext, longtextV2, shorttext, choicematrix, clozeassociation, or clozedropdown)
|
|
413
|
+
*/
|
|
414
|
+
type LearnosityQuestionJson = LearnosityMcqQuestionJson | LearnosityClozetextQuestionJson | LearnosityLongtextV2QuestionJson | LearnosityShorttextQuestionJson | LearnosityChoicematrixQuestionJson | LearnosityClozeassociationQuestionJson | LearnosityClozedropdownQuestionJson | LearnosityImageclozeassociationV2QuestionJson;
|
|
415
|
+
/**
|
|
416
|
+
* Learnosity MCQ Question JSON
|
|
417
|
+
*/
|
|
418
|
+
interface LearnosityMcqQuestionJson {
|
|
419
|
+
reference: string;
|
|
420
|
+
widget_type?: string;
|
|
421
|
+
type: 'mcq';
|
|
422
|
+
data: {
|
|
423
|
+
type: 'mcq';
|
|
424
|
+
stimulus: string;
|
|
425
|
+
options: {
|
|
426
|
+
label: string;
|
|
427
|
+
value: string;
|
|
428
|
+
}[];
|
|
429
|
+
validation?: {
|
|
430
|
+
scoring_type?: 'exactMatch';
|
|
431
|
+
valid_response?: {
|
|
432
|
+
value: string | string[];
|
|
433
|
+
score: number;
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
metadata?: {
|
|
438
|
+
distractor_rationale?: string;
|
|
439
|
+
distractor_rationale_response_level?: Record<string, string>;
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Learnosity clozetext Question JSON
|
|
444
|
+
*/
|
|
445
|
+
interface LearnosityClozetextQuestionJson {
|
|
446
|
+
reference: string;
|
|
447
|
+
widget_type?: string;
|
|
448
|
+
type: 'clozetext';
|
|
449
|
+
data: {
|
|
450
|
+
type: 'clozetext';
|
|
451
|
+
stimulus?: string;
|
|
452
|
+
instructor_stimulus?: string;
|
|
453
|
+
template: string;
|
|
454
|
+
validation?: {
|
|
455
|
+
scoring_type?: 'exactMatch';
|
|
456
|
+
valid_response?: {
|
|
457
|
+
value: string[];
|
|
458
|
+
score: number;
|
|
459
|
+
};
|
|
460
|
+
alt_responses?: {
|
|
461
|
+
value: string[];
|
|
462
|
+
score: number;
|
|
463
|
+
}[];
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Learnosity longtextV2 Question JSON (essay/extended response)
|
|
469
|
+
*/
|
|
470
|
+
interface LearnosityLongtextV2QuestionJson {
|
|
471
|
+
reference: string;
|
|
472
|
+
widget_type?: string;
|
|
473
|
+
type: 'longtextV2';
|
|
474
|
+
data: {
|
|
475
|
+
type: 'longtextV2';
|
|
476
|
+
stimulus?: string;
|
|
477
|
+
max_length?: number;
|
|
478
|
+
validation?: {
|
|
479
|
+
max_score?: number;
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Learnosity shorttext Question JSON (short answer)
|
|
485
|
+
*/
|
|
486
|
+
interface LearnosityShorttextQuestionJson {
|
|
487
|
+
reference: string;
|
|
488
|
+
widget_type?: string;
|
|
489
|
+
type: 'shorttext';
|
|
490
|
+
data: {
|
|
491
|
+
type: 'shorttext';
|
|
492
|
+
stimulus: string;
|
|
493
|
+
instructor_stimulus?: string;
|
|
494
|
+
validation?: {
|
|
495
|
+
scoring_type?: 'exactMatch';
|
|
496
|
+
valid_response?: {
|
|
497
|
+
value: string | string[];
|
|
498
|
+
score: number;
|
|
499
|
+
};
|
|
500
|
+
alt_responses?: {
|
|
501
|
+
value: string | string[];
|
|
502
|
+
score: number;
|
|
503
|
+
}[];
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Learnosity choicematrix Question JSON (matching/matrix)
|
|
509
|
+
*/
|
|
510
|
+
interface LearnosityChoicematrixQuestionJson {
|
|
511
|
+
reference: string;
|
|
512
|
+
widget_type?: string;
|
|
513
|
+
type: 'choicematrix';
|
|
514
|
+
data: {
|
|
515
|
+
type: 'choicematrix';
|
|
516
|
+
stimulus: string;
|
|
517
|
+
stems: string[];
|
|
518
|
+
options: string[];
|
|
519
|
+
validation?: {
|
|
520
|
+
scoring_type?: 'exactMatch';
|
|
521
|
+
valid_response?: {
|
|
522
|
+
score: number;
|
|
523
|
+
value: number[][];
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
ui_style?: {
|
|
527
|
+
type: 'table' | 'inline';
|
|
528
|
+
horizontal_lines?: boolean;
|
|
529
|
+
};
|
|
530
|
+
shuffle_options?: boolean;
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Learnosity clozeassociation Question JSON (drag-and-drop cloze)
|
|
535
|
+
*/
|
|
536
|
+
interface LearnosityClozeassociationQuestionJson {
|
|
537
|
+
reference: string;
|
|
538
|
+
widget_type?: string;
|
|
539
|
+
type: 'clozeassociation';
|
|
540
|
+
data: {
|
|
541
|
+
type: 'clozeassociation';
|
|
542
|
+
template: string;
|
|
543
|
+
possible_responses: string[];
|
|
544
|
+
shuffle_options?: boolean;
|
|
545
|
+
stimulus?: string;
|
|
546
|
+
validation?: {
|
|
547
|
+
scoring_type?: 'exactMatch';
|
|
548
|
+
valid_response?: {
|
|
549
|
+
value: string[];
|
|
550
|
+
score: number;
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Learnosity clozedropdown Question JSON (dropdown cloze)
|
|
557
|
+
*/
|
|
558
|
+
interface LearnosityClozedropdownQuestionJson {
|
|
559
|
+
reference: string;
|
|
560
|
+
widget_type?: string;
|
|
561
|
+
type: 'clozedropdown';
|
|
562
|
+
data: {
|
|
563
|
+
type: 'clozedropdown';
|
|
564
|
+
template: string;
|
|
565
|
+
possible_responses: string[][];
|
|
566
|
+
stimulus?: string;
|
|
567
|
+
validation?: {
|
|
568
|
+
scoring_type?: 'exactMatch';
|
|
569
|
+
valid_response?: {
|
|
570
|
+
value: string[];
|
|
571
|
+
score: number;
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Learnosity imageclozeassociationV2 Question JSON (graphic gap match)
|
|
578
|
+
*/
|
|
579
|
+
interface LearnosityImageclozeassociationV2QuestionJson {
|
|
580
|
+
reference: string;
|
|
581
|
+
widget_type?: string;
|
|
582
|
+
type: 'imageclozeassociationV2';
|
|
583
|
+
data: Record<string, unknown>;
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/qti-package/types.d.ts
|
|
587
|
+
/**
|
|
588
|
+
* QTI Content Package types for IMS Content Packaging
|
|
589
|
+
*/
|
|
590
|
+
/**
|
|
591
|
+
* Metadata about a ZIP entry
|
|
592
|
+
*/
|
|
593
|
+
interface ZipEntryMeta {
|
|
594
|
+
/** Normalized path (forward slashes, relative, no ..) */
|
|
595
|
+
file: string;
|
|
596
|
+
/** Entry size in bytes */
|
|
597
|
+
size: number;
|
|
598
|
+
/** Raw buffer data */
|
|
599
|
+
data: Buffer;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Reference to an assessment item XML file
|
|
603
|
+
*/
|
|
604
|
+
interface AssessmentItemRef {
|
|
605
|
+
/** Unique identifier for this item */
|
|
606
|
+
identifier: string;
|
|
607
|
+
/** Path to the .xml file */
|
|
608
|
+
href: string;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Reference to an asset (image, CSS, etc.)
|
|
612
|
+
*/
|
|
613
|
+
interface AssetRef {
|
|
614
|
+
/** Unique identifier for this asset */
|
|
615
|
+
identifier: string;
|
|
616
|
+
/** Path to the asset file */
|
|
617
|
+
href: string;
|
|
618
|
+
/** MIME type if known */
|
|
619
|
+
type?: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* A resource in the manifest
|
|
623
|
+
*/
|
|
624
|
+
interface ManifestResource {
|
|
625
|
+
/** Unique identifier for this resource */
|
|
626
|
+
identifier: string;
|
|
627
|
+
/** Resource type (e.g., "imsqti_item_xmlv2p2", "webcontent") */
|
|
628
|
+
type: string;
|
|
629
|
+
/** Primary file for this resource */
|
|
630
|
+
href: string;
|
|
631
|
+
/** Additional files referenced by this resource */
|
|
632
|
+
files?: string[];
|
|
633
|
+
/** Dependencies on other resources */
|
|
634
|
+
dependencies?: Array<{
|
|
635
|
+
identifierref: string;
|
|
636
|
+
}>;
|
|
637
|
+
/** Raw XML content of the metadata block (if present) */
|
|
638
|
+
metadataXml?: string;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Parsed QTI Content Package
|
|
642
|
+
*/
|
|
643
|
+
interface QtiContentPackage {
|
|
644
|
+
/** Path to the ZIP file (for diagnostics) */
|
|
645
|
+
zipPath: string;
|
|
646
|
+
/** Parsed manifest resources */
|
|
647
|
+
resources: ManifestResource[];
|
|
648
|
+
/** All ZIP entries (path -> metadata) */
|
|
649
|
+
entries: Map<string, ZipEntryMeta>;
|
|
650
|
+
/** Assessment items extracted from manifest */
|
|
651
|
+
items: AssessmentItemRef[];
|
|
652
|
+
/** Assets extracted from manifest */
|
|
653
|
+
assets: AssetRef[];
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/qti-package/pathSafety.d.ts
|
|
657
|
+
/**
|
|
658
|
+
* ZIP entry path safety validation (zip-slip protection)
|
|
659
|
+
*/
|
|
660
|
+
/**
|
|
661
|
+
* Validates that a ZIP entry path is safe to extract
|
|
662
|
+
*
|
|
663
|
+
* Rejects:
|
|
664
|
+
* - Absolute paths (starting with / or drive letter)
|
|
665
|
+
* - Path traversal attempts (..)
|
|
666
|
+
* - Backslashes (normalizes to forward slashes)
|
|
667
|
+
*
|
|
668
|
+
* @param entryPath Raw path from ZIP entry
|
|
669
|
+
* @returns Normalized safe path, or null if unsafe
|
|
670
|
+
*/
|
|
671
|
+
declare function validateZipEntryPath(entryPath: string): string | null;
|
|
672
|
+
/**
|
|
673
|
+
* Checks if a path is safe for extraction
|
|
674
|
+
*
|
|
675
|
+
* @param entryPath Raw path from ZIP entry
|
|
676
|
+
* @returns true if safe, false if unsafe
|
|
677
|
+
*/
|
|
678
|
+
declare function isPathSafe$1(entryPath: string): boolean;
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/qti-package/readZip.d.ts
|
|
681
|
+
/**
|
|
682
|
+
* Result of reading a ZIP file
|
|
683
|
+
*/
|
|
684
|
+
interface ReadZipResult {
|
|
685
|
+
/** Entries mapped by normalized path */
|
|
686
|
+
entries: Map<string, ZipEntryMeta>;
|
|
687
|
+
/** Diagnostics from reading (warnings for unsafe entries) */
|
|
688
|
+
diagnostics: Diagnostic[];
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Reads a ZIP file and extracts all entries with safety validation
|
|
692
|
+
*
|
|
693
|
+
* Rejects entries with:
|
|
694
|
+
* - Absolute paths
|
|
695
|
+
* - Path traversal attempts (..)
|
|
696
|
+
* - Invalid path structure
|
|
697
|
+
*
|
|
698
|
+
* @param zipPath Path to the ZIP file
|
|
699
|
+
* @returns Map of safe entries and diagnostics
|
|
700
|
+
*/
|
|
701
|
+
declare function readZip(zipPath: string): ReadZipResult;
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region src/qti-package/writeZip.d.ts
|
|
704
|
+
/**
|
|
705
|
+
* Deterministic ZIP writing with sorted entries and fixed timestamps
|
|
706
|
+
*/
|
|
707
|
+
/**
|
|
708
|
+
* File entry to write to ZIP
|
|
709
|
+
*/
|
|
710
|
+
interface ZipFileEntry {
|
|
711
|
+
/** Path in the ZIP (forward slashes, relative) */
|
|
712
|
+
path: string;
|
|
713
|
+
/** File content as Buffer or string */
|
|
714
|
+
content: Buffer | string;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Writes files to a ZIP archive with deterministic output
|
|
718
|
+
*
|
|
719
|
+
* Features:
|
|
720
|
+
* - Entries sorted alphabetically by path
|
|
721
|
+
* - Fixed timestamp (2000-01-01 00:00:00 UTC) for reproducibility
|
|
722
|
+
* - Consistent compression settings
|
|
723
|
+
*
|
|
724
|
+
* @param zipPath Output ZIP file path
|
|
725
|
+
* @param files Array of files to include
|
|
726
|
+
*/
|
|
727
|
+
declare function writeZip(zipPath: string, files: ZipFileEntry[]): void;
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/qti-package/parseManifest.d.ts
|
|
730
|
+
/**
|
|
731
|
+
* Result of parsing a manifest
|
|
732
|
+
*/
|
|
733
|
+
interface ParseManifestResult {
|
|
734
|
+
/** Parsed resources */
|
|
735
|
+
resources: ManifestResource[];
|
|
736
|
+
/** Diagnostics from parsing */
|
|
737
|
+
diagnostics: Diagnostic[];
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Parses an imsmanifest.xml file to extract resources
|
|
741
|
+
*
|
|
742
|
+
* Extracts:
|
|
743
|
+
* - Resource identifier, type, href
|
|
744
|
+
* - Associated file references
|
|
745
|
+
* - Metadata XML blocks (for LOM metadata extraction)
|
|
746
|
+
*
|
|
747
|
+
* @param manifestXml XML content of imsmanifest.xml
|
|
748
|
+
* @param zipPath Path to ZIP (for diagnostics)
|
|
749
|
+
* @returns Parsed resources and diagnostics
|
|
750
|
+
*/
|
|
751
|
+
declare function parseManifest(manifestXml: string, zipPath: string): ParseManifestResult;
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region src/qti-package/buildManifest.d.ts
|
|
754
|
+
/**
|
|
755
|
+
* Generates a minimal valid imsmanifest.xml from resources
|
|
756
|
+
*
|
|
757
|
+
* Creates IMS Content Packaging 1.2 compliant manifest with:
|
|
758
|
+
* - Standard namespace declarations
|
|
759
|
+
* - Organization structure (empty)
|
|
760
|
+
* - Resources section with provided resources
|
|
761
|
+
*
|
|
762
|
+
* @param resources Array of resources to include
|
|
763
|
+
* @returns XML string for imsmanifest.xml
|
|
764
|
+
*/
|
|
765
|
+
declare function buildManifest(resources: ManifestResource[]): string;
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/qti-package/loadPackage.d.ts
|
|
768
|
+
/**
|
|
769
|
+
* Result of loading a QTI Content Package
|
|
770
|
+
*/
|
|
771
|
+
interface LoadPackageResult {
|
|
772
|
+
/** Loaded package (undefined if errors occurred) */
|
|
773
|
+
package?: QtiContentPackage;
|
|
774
|
+
/** Diagnostics from loading */
|
|
775
|
+
diagnostics: Diagnostic[];
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Loads a QTI Content Package from a ZIP file
|
|
779
|
+
*
|
|
780
|
+
* Steps:
|
|
781
|
+
* 1. Read ZIP with safety validation
|
|
782
|
+
* 2. Find and parse imsmanifest.xml
|
|
783
|
+
* 3. Extract item and asset references
|
|
784
|
+
* 4. Validate referenced files exist
|
|
785
|
+
*
|
|
786
|
+
* @param zipPath Path to the ZIP file
|
|
787
|
+
* @returns Loaded package and diagnostics
|
|
788
|
+
*/
|
|
789
|
+
declare function loadQtiContentPackage(zipPath: string): LoadPackageResult;
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/qti-package/savePackage.d.ts
|
|
792
|
+
/**
|
|
793
|
+
* Result of saving a QTI Content Package
|
|
794
|
+
*/
|
|
795
|
+
interface SavePackageResult {
|
|
796
|
+
/** Diagnostics from saving */
|
|
797
|
+
diagnostics: Diagnostic[];
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Saves a QTI Content Package to a ZIP file or directory
|
|
801
|
+
*
|
|
802
|
+
* Steps:
|
|
803
|
+
* 1. Build imsmanifest.xml from resources
|
|
804
|
+
* 2. Collect all file entries
|
|
805
|
+
* 3. Write to ZIP or directory based on output path
|
|
806
|
+
*
|
|
807
|
+
* @param pkg Package to save
|
|
808
|
+
* @param outputPath Output ZIP file path or directory path
|
|
809
|
+
* @returns Diagnostics from saving
|
|
810
|
+
*/
|
|
811
|
+
declare function saveQtiContentPackage(pkg: QtiContentPackage, outputPath: string): SavePackageResult;
|
|
812
|
+
//#endregion
|
|
813
|
+
//#region src/qti-to-learnosity/convertQtiPackageToLearnosityBundle.d.ts
|
|
814
|
+
interface ConvertQtiPackageToLearnosityBundleOptions {
|
|
815
|
+
qtiVersion?: '2.1' | '2.2';
|
|
816
|
+
organisationId?: number;
|
|
817
|
+
mediaVault?: boolean;
|
|
818
|
+
customAssetUrl?: string;
|
|
819
|
+
itemReferenceSource?: ItemReferenceSource;
|
|
820
|
+
itemFilenameSource?: ItemFilenameSource;
|
|
821
|
+
packageVersion?: string;
|
|
822
|
+
truncateTags?: boolean;
|
|
823
|
+
}
|
|
824
|
+
interface ConvertQtiPackageToLearnosityBundleResult {
|
|
825
|
+
bundle?: {
|
|
826
|
+
manifest: unknown;
|
|
827
|
+
activities: Map<string, unknown>;
|
|
828
|
+
items: Map<string, unknown>;
|
|
829
|
+
assets: Map<string, Uint8Array>;
|
|
830
|
+
itemFilenames?: Map<string, string>;
|
|
831
|
+
};
|
|
832
|
+
diagnostics: Diagnostic[];
|
|
833
|
+
convertedSourceFiles?: string[];
|
|
834
|
+
failedSourceFiles?: string[];
|
|
835
|
+
convertedActivityFiles?: string[];
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Convert QTI Content Package to Learnosity Bundle
|
|
839
|
+
*/
|
|
840
|
+
declare function convertQtiPackageToLearnosityBundle(input: {
|
|
841
|
+
zipBytes?: Uint8Array;
|
|
842
|
+
dirPath?: string;
|
|
843
|
+
}, opts?: ConvertQtiPackageToLearnosityBundleOptions): ConvertQtiPackageToLearnosityBundleResult;
|
|
844
|
+
//#endregion
|
|
845
|
+
//#region src/conversions.d.ts
|
|
846
|
+
/**
|
|
847
|
+
* Convert QTI XML to Learnosity JSON
|
|
848
|
+
* @param input - QTI XML string
|
|
849
|
+
* @param opts - Conversion options
|
|
850
|
+
* @returns Learnosity JSON and diagnostics
|
|
851
|
+
*/
|
|
852
|
+
declare function convertQtiToLearnosity(input: string, opts: ConversionOptions): Promise<ConversionResult<LearnosityItemJson | undefined>>;
|
|
853
|
+
/**
|
|
854
|
+
* Convert Learnosity JSON to QTI XML
|
|
855
|
+
* @param input - Learnosity JSON object
|
|
856
|
+
* @param opts - Conversion options
|
|
857
|
+
* @returns QTI XML string and diagnostics
|
|
858
|
+
*/
|
|
859
|
+
declare function convertLearnosityToQti(input: LearnosityItemJson | Record<string, unknown>, opts: ConversionOptions): Promise<ConversionResult<string>>;
|
|
860
|
+
/**
|
|
861
|
+
* Options for converting a QTI Content Package to a Learnosity bundle
|
|
862
|
+
*/
|
|
863
|
+
interface ConvertQtiPackageToLearnosityOptions {
|
|
864
|
+
/** Path to QTI package directory, or path to a .zip file */
|
|
865
|
+
inputPath?: string;
|
|
866
|
+
/** Raw ZIP bytes (alternative to inputPath for in-memory ZIP data) */
|
|
867
|
+
zipBytes?: Uint8Array;
|
|
868
|
+
/** Output path to write the Learnosity bundle (directory or .zip). Omit to skip writing. */
|
|
869
|
+
outputPath?: string;
|
|
870
|
+
/** Organisation ID for Learnosity CDN asset URLs */
|
|
871
|
+
organisationId?: number;
|
|
872
|
+
/** Use media-vault subdomain instead of assets for CDN URLs */
|
|
873
|
+
mediaVault?: boolean;
|
|
874
|
+
/** Custom base URL for assets (overrides default Learnosity CDN and mediaVault) */
|
|
875
|
+
customAssetUrl?: string;
|
|
876
|
+
/** How to generate item references (default: 'sourceFilename') */
|
|
877
|
+
itemReferenceSource?: ItemReferenceSource;
|
|
878
|
+
/** How to generate output filenames (defaults to itemReferenceSource) */
|
|
879
|
+
itemFilenameSource?: ItemFilenameSource;
|
|
880
|
+
/** Truncate tag types and names to 255 characters instead of failing */
|
|
881
|
+
truncateTags?: boolean;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Result of converting a QTI Content Package to Learnosity
|
|
885
|
+
*/
|
|
886
|
+
interface ConvertQtiPackageToLearnosityResult {
|
|
887
|
+
/**
|
|
888
|
+
* The converted Learnosity bundle (in-memory).
|
|
889
|
+
* Only populated when no `outputPath` was provided (in-memory mode).
|
|
890
|
+
* Undefined when writing to disk (use the output files instead) or if conversion failed.
|
|
891
|
+
*/
|
|
892
|
+
bundle?: ConvertQtiPackageToLearnosityBundleResult['bundle'];
|
|
893
|
+
/** All diagnostics from conversion and writing */
|
|
894
|
+
diagnostics: Diagnostic[];
|
|
895
|
+
/** Item source file paths that were successfully converted */
|
|
896
|
+
convertedSourceFiles?: string[];
|
|
897
|
+
/** Item source file paths that failed conversion */
|
|
898
|
+
failedSourceFiles?: string[];
|
|
899
|
+
/** Activity/test source file paths that were converted */
|
|
900
|
+
convertedActivityFiles?: string[];
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Convert a QTI Content Package to a Learnosity bundle.
|
|
904
|
+
*
|
|
905
|
+
* Accepts either a path to a directory/ZIP or raw ZIP bytes. Converts all items
|
|
906
|
+
* and activities in the package. Optionally writes the result to disk.
|
|
907
|
+
*
|
|
908
|
+
* **Output behaviour:**
|
|
909
|
+
* - With `outputPath`: writes the bundle to disk and returns only `diagnostics` + summary
|
|
910
|
+
* (`convertedSourceFiles`, `failedSourceFiles`). `bundle` will be `undefined`.
|
|
911
|
+
* - Without `outputPath`: returns the full in-memory `bundle` for programmatic use.
|
|
912
|
+
*
|
|
913
|
+
* @param opts - Conversion options including input, output, and conversion settings
|
|
914
|
+
* @returns Diagnostics + summary always; `bundle` only when no `outputPath` is given
|
|
915
|
+
*/
|
|
916
|
+
declare function convertQtiPackageToLearnosity(opts: ConvertQtiPackageToLearnosityOptions): Promise<ConvertQtiPackageToLearnosityResult>;
|
|
917
|
+
/**
|
|
918
|
+
* Options for converting a Learnosity bundle to a QTI Content Package
|
|
919
|
+
*/
|
|
920
|
+
interface ConvertLearnosityToQtiPackageOptions {
|
|
921
|
+
/** Path to the Learnosity bundle directory */
|
|
922
|
+
inputPath: string;
|
|
923
|
+
/** Activity reference(s) to convert. Omit to convert all activities in the bundle. */
|
|
924
|
+
activityRefs?: string[];
|
|
925
|
+
/** Output path to write the QTI package (.zip or directory). Omit to skip writing. */
|
|
926
|
+
outputPath?: string;
|
|
927
|
+
/** QTI version (default: '2.1') */
|
|
928
|
+
qtiVersion?: QtiVersion;
|
|
929
|
+
/** Pretty-print XML output */
|
|
930
|
+
pretty?: boolean;
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Result of converting a Learnosity bundle to a QTI Content Package
|
|
934
|
+
*/
|
|
935
|
+
interface ConvertLearnosityToQtiPackageResult {
|
|
936
|
+
/** The built QTI Content Package (in-memory). Undefined if conversion failed. */
|
|
937
|
+
package?: QtiContentPackage;
|
|
938
|
+
/** All diagnostics from loading, conversion, building, and writing */
|
|
939
|
+
diagnostics: Diagnostic[];
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Convert a Learnosity bundle to a QTI Content Package.
|
|
943
|
+
*
|
|
944
|
+
* Loads the bundle from disk, converts the specified activities (or all), builds
|
|
945
|
+
* the QTI Content Package, and optionally writes it to disk.
|
|
946
|
+
*
|
|
947
|
+
* @param opts - Conversion options including input, output, and conversion settings
|
|
948
|
+
* @returns The built QTI Content Package (in-memory) and diagnostics
|
|
949
|
+
*/
|
|
950
|
+
declare function convertLearnosityToQtiPackage(opts: ConvertLearnosityToQtiPackageOptions): ConvertLearnosityToQtiPackageResult;
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region src/learnosity-model/types.d.ts
|
|
953
|
+
/**
|
|
954
|
+
* Learnosity Item Model types
|
|
955
|
+
*
|
|
956
|
+
* Strict typed models for validated Learnosity Items.
|
|
957
|
+
* Do not use for parsing - use parseLearnosityItem.ts instead.
|
|
958
|
+
*/
|
|
959
|
+
/**
|
|
960
|
+
* Widget type in item definition
|
|
961
|
+
*/
|
|
962
|
+
type LearnosityWidgetType = 'response' | 'feature';
|
|
963
|
+
/**
|
|
964
|
+
* Widget blueprint entry
|
|
965
|
+
*/
|
|
966
|
+
interface LearnosityWidgetBlueprint {
|
|
967
|
+
reference: string;
|
|
968
|
+
widget_type: LearnosityWidgetType;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Item tag
|
|
972
|
+
*/
|
|
973
|
+
interface LearnosityTag {
|
|
974
|
+
type: string;
|
|
975
|
+
name: string;
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Item definition
|
|
979
|
+
*/
|
|
980
|
+
interface LearnosityItemDefinition {
|
|
981
|
+
widgets: LearnosityWidgetBlueprint[];
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Item metadata
|
|
985
|
+
*/
|
|
986
|
+
interface LearnosityItemMetadata {
|
|
987
|
+
reference: string;
|
|
988
|
+
content: string;
|
|
989
|
+
title?: string | null;
|
|
990
|
+
description?: string;
|
|
991
|
+
tags?: LearnosityTag[];
|
|
992
|
+
tagsObject?: Record<string, string[]>;
|
|
993
|
+
status?: string;
|
|
994
|
+
definition: LearnosityItemDefinition;
|
|
995
|
+
distractor_rationale?: string;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* MCQ option
|
|
999
|
+
*/
|
|
1000
|
+
interface LearnosityMcqOption {
|
|
1001
|
+
label: string;
|
|
1002
|
+
value: string | number;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* MCQ validation
|
|
1006
|
+
*/
|
|
1007
|
+
interface LearnosityMcqValidation {
|
|
1008
|
+
scoring_type?: string;
|
|
1009
|
+
valid_response?: {
|
|
1010
|
+
value?: (string | number)[];
|
|
1011
|
+
score?: number;
|
|
1012
|
+
};
|
|
1013
|
+
penalty?: number;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* MCQ UI style
|
|
1017
|
+
*/
|
|
1018
|
+
interface LearnosityMcqUiStyle {
|
|
1019
|
+
type?: string;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Common metadata for all question types
|
|
1023
|
+
*/
|
|
1024
|
+
interface LearnosityQuestionMetadata {
|
|
1025
|
+
distractor_rationale?: string;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* MCQ metadata for feedback (extends common metadata with per-option feedback)
|
|
1029
|
+
*/
|
|
1030
|
+
interface LearnosityMcqMetadata extends LearnosityQuestionMetadata {
|
|
1031
|
+
distractor_rationale_response_level?: string[] | Record<string, string>;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* MCQ question data (only supported type in v1)
|
|
1035
|
+
*/
|
|
1036
|
+
interface LearnosityMcqData {
|
|
1037
|
+
type: 'mcq';
|
|
1038
|
+
stimulus: string;
|
|
1039
|
+
instructor_stimulus?: string;
|
|
1040
|
+
options: LearnosityMcqOption[];
|
|
1041
|
+
validation?: LearnosityMcqValidation;
|
|
1042
|
+
ui_style?: LearnosityMcqUiStyle;
|
|
1043
|
+
multiple_responses?: boolean;
|
|
1044
|
+
min_selection?: number;
|
|
1045
|
+
max_selection?: number;
|
|
1046
|
+
shuffle_options?: boolean;
|
|
1047
|
+
metadata?: LearnosityMcqMetadata;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Clozetext validation
|
|
1051
|
+
*/
|
|
1052
|
+
interface LearnosityClozetextValidation {
|
|
1053
|
+
scoring_type?: string;
|
|
1054
|
+
valid_response?: {
|
|
1055
|
+
value?: (string | null)[];
|
|
1056
|
+
score?: number;
|
|
1057
|
+
};
|
|
1058
|
+
penalty?: number;
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Clozetext response container (shared settings for all response fields)
|
|
1062
|
+
*/
|
|
1063
|
+
interface LearnosityClozetextResponseContainer {
|
|
1064
|
+
input_type?: 'text' | 'number';
|
|
1065
|
+
max_length?: number;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Clozetext question data (vNext)
|
|
1069
|
+
*/
|
|
1070
|
+
interface LearnosityClozetextData {
|
|
1071
|
+
type: 'clozetext';
|
|
1072
|
+
stimulus?: string;
|
|
1073
|
+
instructor_stimulus?: string;
|
|
1074
|
+
template: string;
|
|
1075
|
+
validation?: LearnosityClozetextValidation;
|
|
1076
|
+
case_sensitive?: boolean;
|
|
1077
|
+
ui_style?: Record<string, unknown>;
|
|
1078
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1079
|
+
response_container?: LearnosityClozetextResponseContainer;
|
|
1080
|
+
response_containers?: LearnosityClozetextResponseContainer[];
|
|
1081
|
+
max_length?: number;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* LongtextV2 validation
|
|
1085
|
+
*/
|
|
1086
|
+
interface LearnosityLongtextV2Validation {
|
|
1087
|
+
max_score?: number;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* LongtextV2 question data (vNext, essay/extended response)
|
|
1091
|
+
*/
|
|
1092
|
+
interface LearnosityLongtextV2Data {
|
|
1093
|
+
type: 'longtextV2';
|
|
1094
|
+
stimulus?: string;
|
|
1095
|
+
instructor_stimulus?: string;
|
|
1096
|
+
placeholder?: string;
|
|
1097
|
+
max_length?: number;
|
|
1098
|
+
validation?: LearnosityLongtextV2Validation;
|
|
1099
|
+
ui_style?: Record<string, unknown>;
|
|
1100
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* FormulaessayV2 question data (alias of longtextV2, produces extendedTextInteraction)
|
|
1104
|
+
*/
|
|
1105
|
+
interface LearnosityFormulaessayV2Data {
|
|
1106
|
+
type: 'formulaessayV2';
|
|
1107
|
+
stimulus?: string;
|
|
1108
|
+
instructor_stimulus?: string;
|
|
1109
|
+
placeholder?: string;
|
|
1110
|
+
max_length?: number;
|
|
1111
|
+
validation?: LearnosityLongtextV2Validation;
|
|
1112
|
+
ui_style?: Record<string, unknown>;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* ChemistryessayV2 question data (alias of longtextV2, produces extendedTextInteraction)
|
|
1116
|
+
*/
|
|
1117
|
+
interface LearnosityChemistryessayV2Data {
|
|
1118
|
+
type: 'chemistryessayV2';
|
|
1119
|
+
stimulus?: string;
|
|
1120
|
+
instructor_stimulus?: string;
|
|
1121
|
+
placeholder?: string;
|
|
1122
|
+
max_length?: number;
|
|
1123
|
+
validation?: LearnosityLongtextV2Validation;
|
|
1124
|
+
ui_style?: Record<string, unknown>;
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Plaintext UI style
|
|
1128
|
+
*/
|
|
1129
|
+
interface LearnosityPlaintextUiStyle {
|
|
1130
|
+
min_height?: string;
|
|
1131
|
+
max_height?: string;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Plaintext question data (plain text input, no formatting)
|
|
1135
|
+
*/
|
|
1136
|
+
interface LearnosityPlaintextData {
|
|
1137
|
+
type: 'plaintext';
|
|
1138
|
+
stimulus?: string;
|
|
1139
|
+
instructor_stimulus?: string;
|
|
1140
|
+
placeholder?: string;
|
|
1141
|
+
max_length?: number;
|
|
1142
|
+
ui_style?: LearnosityPlaintextUiStyle;
|
|
1143
|
+
show_copy?: boolean;
|
|
1144
|
+
show_cut?: boolean;
|
|
1145
|
+
show_paste?: boolean;
|
|
1146
|
+
spellcheck?: boolean;
|
|
1147
|
+
character_map?: string[];
|
|
1148
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Shorttext validation
|
|
1152
|
+
*/
|
|
1153
|
+
interface LearnosityShorttextValidation {
|
|
1154
|
+
scoring_type?: string;
|
|
1155
|
+
valid_response?: {
|
|
1156
|
+
value?: string | string[];
|
|
1157
|
+
score?: number;
|
|
1158
|
+
};
|
|
1159
|
+
penalty?: number;
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Shorttext question data (single short answer)
|
|
1163
|
+
*/
|
|
1164
|
+
interface LearnosityShorttextData {
|
|
1165
|
+
type: 'shorttext';
|
|
1166
|
+
stimulus: string;
|
|
1167
|
+
instructor_stimulus?: string;
|
|
1168
|
+
placeholder?: string;
|
|
1169
|
+
max_length?: number;
|
|
1170
|
+
validation?: LearnosityShorttextValidation;
|
|
1171
|
+
case_sensitive?: boolean;
|
|
1172
|
+
ui_style?: Record<string, unknown>;
|
|
1173
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Clozedropdown validation
|
|
1177
|
+
*/
|
|
1178
|
+
interface LearnosityClozedropdownValidation {
|
|
1179
|
+
scoring_type?: string;
|
|
1180
|
+
valid_response?: {
|
|
1181
|
+
value?: string[];
|
|
1182
|
+
score?: number;
|
|
1183
|
+
};
|
|
1184
|
+
penalty?: number;
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Clozedropdown question data (inline dropdown/select menus in text)
|
|
1188
|
+
*/
|
|
1189
|
+
interface LearnosityClozedropdownData {
|
|
1190
|
+
type: 'clozedropdown';
|
|
1191
|
+
stimulus?: string;
|
|
1192
|
+
instructor_stimulus?: string;
|
|
1193
|
+
template: string;
|
|
1194
|
+
possible_responses: string[][];
|
|
1195
|
+
validation?: LearnosityClozedropdownValidation;
|
|
1196
|
+
ui_style?: Record<string, unknown>;
|
|
1197
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Clozeassociation validation
|
|
1201
|
+
*/
|
|
1202
|
+
interface LearnosityClozeassociationValidation {
|
|
1203
|
+
scoring_type?: string;
|
|
1204
|
+
valid_response?: {
|
|
1205
|
+
value?: string[];
|
|
1206
|
+
score?: number;
|
|
1207
|
+
};
|
|
1208
|
+
penalty?: number;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Clozeassociation possible response group (for grouped UI display)
|
|
1212
|
+
*/
|
|
1213
|
+
interface LearnosityClozeassociationResponseGroup {
|
|
1214
|
+
title: string;
|
|
1215
|
+
responses: string[];
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Normalized possible responses for clozeassociation (internal representation)
|
|
1219
|
+
*/
|
|
1220
|
+
interface NormalizedClozeassociationPossibleResponses {
|
|
1221
|
+
mode: 'flat' | 'grouped';
|
|
1222
|
+
flat: string[];
|
|
1223
|
+
groups?: LearnosityClozeassociationResponseGroup[];
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Clozeassociation question data (drag and drop into gaps)
|
|
1227
|
+
* Supports two modes:
|
|
1228
|
+
* 1. Flat: possible_responses array (legacy)
|
|
1229
|
+
* 2. Grouped: group_possible_responses=true + possible_response_groups array
|
|
1230
|
+
*/
|
|
1231
|
+
interface LearnosityClozeassociationData {
|
|
1232
|
+
type: 'clozeassociation';
|
|
1233
|
+
stimulus?: string;
|
|
1234
|
+
instructor_stimulus?: string;
|
|
1235
|
+
template: string;
|
|
1236
|
+
possible_responses?: string[];
|
|
1237
|
+
group_possible_responses?: boolean;
|
|
1238
|
+
possible_response_groups?: LearnosityClozeassociationResponseGroup[];
|
|
1239
|
+
shuffle_options?: boolean;
|
|
1240
|
+
duplicate_responses?: boolean;
|
|
1241
|
+
validation?: LearnosityClozeassociationValidation;
|
|
1242
|
+
ui_style?: Record<string, unknown>;
|
|
1243
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Sharedpassage feature data (rich text passage)
|
|
1247
|
+
*/
|
|
1248
|
+
interface LearnositySharedpassageData {
|
|
1249
|
+
type: 'sharedpassage';
|
|
1250
|
+
heading?: string;
|
|
1251
|
+
content: string;
|
|
1252
|
+
instructor_stimulus?: string;
|
|
1253
|
+
paginated_content?: boolean;
|
|
1254
|
+
pages?: string[];
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Audioplayer feature data
|
|
1258
|
+
*/
|
|
1259
|
+
interface LearnosityAudioplayerData {
|
|
1260
|
+
type: 'audioplayer';
|
|
1261
|
+
src: string;
|
|
1262
|
+
player?: string;
|
|
1263
|
+
counter?: {
|
|
1264
|
+
length?: number;
|
|
1265
|
+
};
|
|
1266
|
+
ui_style?: {
|
|
1267
|
+
responsive_layout?: boolean;
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Videoplayer feature data
|
|
1272
|
+
*/
|
|
1273
|
+
interface LearnosityVideoplayerData {
|
|
1274
|
+
type: 'videoplayer';
|
|
1275
|
+
src: string;
|
|
1276
|
+
player_type?: 'hosted-video' | 'youtube' | 'vimeo';
|
|
1277
|
+
text_alternative?: {
|
|
1278
|
+
caption?: {
|
|
1279
|
+
src?: string;
|
|
1280
|
+
};
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Orderlist validation
|
|
1285
|
+
*/
|
|
1286
|
+
interface LearnosityOrderlistValidation {
|
|
1287
|
+
scoring_type?: string;
|
|
1288
|
+
valid_response?: {
|
|
1289
|
+
value: number[];
|
|
1290
|
+
score?: number;
|
|
1291
|
+
};
|
|
1292
|
+
unscored?: boolean;
|
|
1293
|
+
penalty?: number;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Orderlist question data (ordering/sequencing)
|
|
1297
|
+
*/
|
|
1298
|
+
interface LearnosityOrderlistData {
|
|
1299
|
+
type: 'orderlist';
|
|
1300
|
+
stimulus?: string;
|
|
1301
|
+
instructor_stimulus?: string;
|
|
1302
|
+
list: string[];
|
|
1303
|
+
validation?: LearnosityOrderlistValidation;
|
|
1304
|
+
shuffle_options?: boolean;
|
|
1305
|
+
ui_style?: Record<string, unknown>;
|
|
1306
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Tokenhighlight validation
|
|
1310
|
+
*/
|
|
1311
|
+
interface LearnosityTokenhighlightValidation {
|
|
1312
|
+
scoring_type?: string;
|
|
1313
|
+
valid_response?: {
|
|
1314
|
+
value: number[];
|
|
1315
|
+
score?: number;
|
|
1316
|
+
};
|
|
1317
|
+
penalty?: number;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Tokenhighlight question data (highlight selectable tokens in text)
|
|
1321
|
+
*/
|
|
1322
|
+
interface LearnosityTokenhighlightData {
|
|
1323
|
+
type: 'tokenhighlight';
|
|
1324
|
+
stimulus?: string;
|
|
1325
|
+
instructor_stimulus?: string;
|
|
1326
|
+
template: string;
|
|
1327
|
+
tokenization?: 'custom' | string;
|
|
1328
|
+
validation?: LearnosityTokenhighlightValidation;
|
|
1329
|
+
ui_style?: Record<string, unknown>;
|
|
1330
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Choicematrix validation
|
|
1334
|
+
*/
|
|
1335
|
+
interface LearnosityChoicematrixValidation {
|
|
1336
|
+
scoring_type?: 'exactMatch';
|
|
1337
|
+
valid_response?: {
|
|
1338
|
+
value?: number[][];
|
|
1339
|
+
score?: number;
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Choicematrix UI style
|
|
1344
|
+
*/
|
|
1345
|
+
interface LearnosityChoicematrixUiStyle {
|
|
1346
|
+
type?: 'table' | 'inline';
|
|
1347
|
+
horizontal_lines?: boolean;
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* Choicematrix question data (matrix of options per stem/row)
|
|
1351
|
+
*/
|
|
1352
|
+
interface LearnosityChoicematrixData {
|
|
1353
|
+
type: 'choicematrix';
|
|
1354
|
+
stimulus?: string;
|
|
1355
|
+
instructor_stimulus?: string;
|
|
1356
|
+
stems: string[];
|
|
1357
|
+
options: string[];
|
|
1358
|
+
shuffle_options?: boolean;
|
|
1359
|
+
multiple_responses?: boolean;
|
|
1360
|
+
ui_style?: LearnosityChoicematrixUiStyle;
|
|
1361
|
+
validation?: LearnosityChoicematrixValidation;
|
|
1362
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1363
|
+
}
|
|
1364
|
+
/** * Hotspot image
|
|
1365
|
+
*/
|
|
1366
|
+
interface LearnosityHotspotImage {
|
|
1367
|
+
source: string;
|
|
1368
|
+
width: number;
|
|
1369
|
+
height: number;
|
|
1370
|
+
alt?: string;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Hotspot polygon point (percentages)
|
|
1374
|
+
*/
|
|
1375
|
+
interface LearnosityHotspotPoint {
|
|
1376
|
+
x: number;
|
|
1377
|
+
y: number;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Hotspot validation
|
|
1381
|
+
*/
|
|
1382
|
+
interface LearnosityHotspotValidation {
|
|
1383
|
+
scoring_type?: 'exactMatch';
|
|
1384
|
+
valid_response?: {
|
|
1385
|
+
value?: (string | number)[];
|
|
1386
|
+
score?: number;
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Hotspot question data (click areas on image)
|
|
1391
|
+
*/
|
|
1392
|
+
interface LearnosityHotspotData {
|
|
1393
|
+
type: 'hotspot';
|
|
1394
|
+
stimulus?: string;
|
|
1395
|
+
instructor_stimulus?: string;
|
|
1396
|
+
image: LearnosityHotspotImage;
|
|
1397
|
+
areas: LearnosityHotspotPoint[][];
|
|
1398
|
+
multiple_responses?: boolean;
|
|
1399
|
+
validation?: LearnosityHotspotValidation;
|
|
1400
|
+
ui_style?: Record<string, unknown>;
|
|
1401
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1402
|
+
}
|
|
1403
|
+
/** * Imageclozeassociation image definition
|
|
1404
|
+
*/
|
|
1405
|
+
interface LearnosityImageclozeassociationV2Image {
|
|
1406
|
+
src: string;
|
|
1407
|
+
width?: number;
|
|
1408
|
+
height?: number;
|
|
1409
|
+
alt?: string;
|
|
1410
|
+
title?: string;
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Imageclozeassociation response container (drop zone)
|
|
1414
|
+
*/
|
|
1415
|
+
interface LearnosityImageclozeassociationV2ResponseContainer {
|
|
1416
|
+
x: number;
|
|
1417
|
+
y: number;
|
|
1418
|
+
width: string;
|
|
1419
|
+
height: string;
|
|
1420
|
+
aria_label?: string;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Imageclozeassociation possible response group (for grouped UI display)
|
|
1424
|
+
*/
|
|
1425
|
+
interface LearnosityImageclozeassociationV2ResponseGroup {
|
|
1426
|
+
title: string;
|
|
1427
|
+
responses: string[];
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Imageclozeassociation validation
|
|
1431
|
+
*/
|
|
1432
|
+
interface LearnosityImageclozeassociationV2Validation {
|
|
1433
|
+
scoring_type?: 'exactMatch' | 'partialMatch' | 'partialMatchV2' | 'partialMatchPerResponse';
|
|
1434
|
+
valid_response?: {
|
|
1435
|
+
value?: string[][];
|
|
1436
|
+
score?: number;
|
|
1437
|
+
};
|
|
1438
|
+
penalty?: number;
|
|
1439
|
+
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Imageclozeassociation question data (drag text onto image zones)
|
|
1442
|
+
*/
|
|
1443
|
+
interface LearnosityImageclozeassociationV2Data {
|
|
1444
|
+
type: 'imageclozeassociationV2';
|
|
1445
|
+
stimulus?: string;
|
|
1446
|
+
instructor_stimulus?: string;
|
|
1447
|
+
image: LearnosityImageclozeassociationV2Image;
|
|
1448
|
+
possible_responses?: string[];
|
|
1449
|
+
possible_response_groups?: LearnosityImageclozeassociationV2ResponseGroup[];
|
|
1450
|
+
group_possible_responses?: boolean;
|
|
1451
|
+
response_containers: LearnosityImageclozeassociationV2ResponseContainer[];
|
|
1452
|
+
response_container?: Record<string, unknown>;
|
|
1453
|
+
validation?: LearnosityImageclozeassociationV2Validation;
|
|
1454
|
+
duplicate_responses?: boolean;
|
|
1455
|
+
shuffle_options?: boolean;
|
|
1456
|
+
max_response_per_zone?: number;
|
|
1457
|
+
ui_style?: Record<string, unknown>;
|
|
1458
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* Fileupload question data (file upload)
|
|
1462
|
+
*/
|
|
1463
|
+
interface LearnosityFileuploadData {
|
|
1464
|
+
type: 'fileupload';
|
|
1465
|
+
stimulus?: string;
|
|
1466
|
+
instructor_stimulus?: string;
|
|
1467
|
+
max_files?: number;
|
|
1468
|
+
allow_jpg?: boolean;
|
|
1469
|
+
allow_png?: boolean;
|
|
1470
|
+
allow_gif?: boolean;
|
|
1471
|
+
allow_pdf?: boolean;
|
|
1472
|
+
allow_txt?: boolean;
|
|
1473
|
+
allow_csv?: boolean;
|
|
1474
|
+
allow_rtf?: boolean;
|
|
1475
|
+
allow_xps?: boolean;
|
|
1476
|
+
allow_zip?: boolean;
|
|
1477
|
+
allow_ms_word?: boolean;
|
|
1478
|
+
allow_ms_excel?: boolean;
|
|
1479
|
+
allow_ms_powerpoint?: boolean;
|
|
1480
|
+
allow_ms_publisher?: boolean;
|
|
1481
|
+
allow_open_office?: boolean;
|
|
1482
|
+
allow_video?: boolean;
|
|
1483
|
+
allow_matlab?: boolean;
|
|
1484
|
+
allow_altera_quartus?: boolean;
|
|
1485
|
+
allow_verilog?: boolean;
|
|
1486
|
+
allow_c?: boolean;
|
|
1487
|
+
allow_h?: boolean;
|
|
1488
|
+
allow_s?: boolean;
|
|
1489
|
+
allow_v?: boolean;
|
|
1490
|
+
allow_cpp?: boolean;
|
|
1491
|
+
allow_assembly?: boolean;
|
|
1492
|
+
allow_labview?: boolean;
|
|
1493
|
+
allow_psd?: boolean;
|
|
1494
|
+
allow_ai?: boolean;
|
|
1495
|
+
photo_capture?: boolean;
|
|
1496
|
+
ui_style?: Record<string, unknown>;
|
|
1497
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Drawing image specification
|
|
1501
|
+
*/
|
|
1502
|
+
interface LearnosityDrawingImage {
|
|
1503
|
+
source?: string;
|
|
1504
|
+
src?: string;
|
|
1505
|
+
width?: number;
|
|
1506
|
+
height?: number;
|
|
1507
|
+
alt?: string;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Drawing question data (freehand drawing with optional background image)
|
|
1511
|
+
*/
|
|
1512
|
+
interface LearnosityDrawingData {
|
|
1513
|
+
type: 'drawing';
|
|
1514
|
+
stimulus?: string;
|
|
1515
|
+
instructor_stimulus?: string;
|
|
1516
|
+
image?: LearnosityDrawingImage;
|
|
1517
|
+
line_color?: string[];
|
|
1518
|
+
drawing_tools?: string[];
|
|
1519
|
+
text_formatting_options?: string[];
|
|
1520
|
+
ui_style?: Record<string, unknown>;
|
|
1521
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Classification validation
|
|
1525
|
+
*/
|
|
1526
|
+
interface LearnosityClassificationValidation {
|
|
1527
|
+
scoring_type?: string;
|
|
1528
|
+
valid_response?: {
|
|
1529
|
+
score?: number;
|
|
1530
|
+
value?: number[][];
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Classification question data (maps from QTI associationInteraction)
|
|
1535
|
+
*/
|
|
1536
|
+
interface LearnosityClassificationData {
|
|
1537
|
+
type: 'classification';
|
|
1538
|
+
stimulus?: string;
|
|
1539
|
+
possible_responses?: string[];
|
|
1540
|
+
column_headers?: string[];
|
|
1541
|
+
ui_style?: {
|
|
1542
|
+
column_count?: number;
|
|
1543
|
+
row_count?: number;
|
|
1544
|
+
};
|
|
1545
|
+
shuffle_items?: boolean;
|
|
1546
|
+
validation?: LearnosityClassificationValidation;
|
|
1547
|
+
metadata?: LearnosityQuestionMetadata;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Supported question types
|
|
1551
|
+
*/
|
|
1552
|
+
type LearnosityQuestionType = 'mcq' | 'clozetext' | 'longtextV2' | 'formulaessayV2' | 'chemistryessayV2' | 'plaintext' | 'shorttext' | 'clozedropdown' | 'clozeassociation' | 'orderlist' | 'tokenhighlight' | 'choicematrix' | 'hotspot' | 'imageclozeassociationV2' | 'fileupload' | 'drawing' | 'classification';
|
|
1553
|
+
/**
|
|
1554
|
+
* Supported feature types
|
|
1555
|
+
*/
|
|
1556
|
+
type LearnosityFeatureType = 'sharedpassage' | 'audioplayer' | 'videoplayer' | string;
|
|
1557
|
+
/**
|
|
1558
|
+
* Question data union
|
|
1559
|
+
*/
|
|
1560
|
+
type LearnosityQuestionData = LearnosityMcqData | LearnosityClozetextData | LearnosityLongtextV2Data | LearnosityFormulaessayV2Data | LearnosityChemistryessayV2Data | LearnosityPlaintextData | LearnosityShorttextData | LearnosityClozedropdownData | LearnosityClozeassociationData | LearnosityOrderlistData | LearnosityTokenhighlightData | LearnosityChoicematrixData | LearnosityHotspotData | LearnosityImageclozeassociationV2Data | LearnosityFileuploadData | LearnosityDrawingData | LearnosityClassificationData;
|
|
1561
|
+
/**
|
|
1562
|
+
* Question (response widget)
|
|
1563
|
+
*/
|
|
1564
|
+
interface LearnosityQuestion {
|
|
1565
|
+
reference: string;
|
|
1566
|
+
widget_type: 'response';
|
|
1567
|
+
type: LearnosityQuestionType;
|
|
1568
|
+
data: LearnosityQuestionData;
|
|
1569
|
+
metadata?: Record<string, unknown>;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Feature widget (preserved but not interpreted in v1)
|
|
1573
|
+
*/
|
|
1574
|
+
interface LearnosityFeature {
|
|
1575
|
+
reference: string;
|
|
1576
|
+
widget_type: 'feature';
|
|
1577
|
+
type: LearnosityFeatureType;
|
|
1578
|
+
data?: LearnositySharedpassageData | LearnosityAudioplayerData | LearnosityVideoplayerData | unknown;
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Layout widget reference (for multi-widget items)
|
|
1582
|
+
*/
|
|
1583
|
+
type LearnosityLayoutWidget = {
|
|
1584
|
+
kind: 'question';
|
|
1585
|
+
ref: string;
|
|
1586
|
+
} | {
|
|
1587
|
+
kind: 'feature';
|
|
1588
|
+
ref: string;
|
|
1589
|
+
};
|
|
1590
|
+
/**
|
|
1591
|
+
* Layout column (for multi-widget items)
|
|
1592
|
+
*/
|
|
1593
|
+
interface LearnosityLayoutColumn {
|
|
1594
|
+
index: 1 | 2;
|
|
1595
|
+
widgets: LearnosityLayoutWidget[];
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Item layout (extracted from item.content HTML)
|
|
1599
|
+
*/
|
|
1600
|
+
interface LearnosityLayout {
|
|
1601
|
+
columns: LearnosityLayoutColumn[];
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Validated and normalized Learnosity Item Model
|
|
1605
|
+
*/
|
|
1606
|
+
interface LearnosityItemModel {
|
|
1607
|
+
item: LearnosityItemMetadata;
|
|
1608
|
+
questions: LearnosityQuestion[];
|
|
1609
|
+
features: LearnosityFeature[];
|
|
1610
|
+
layout?: LearnosityLayout;
|
|
1611
|
+
/**
|
|
1612
|
+
* Indices for efficient lookup
|
|
1613
|
+
*/
|
|
1614
|
+
questionsByRef: Map<string, LearnosityQuestion>;
|
|
1615
|
+
featuresByRef: Map<string, LearnosityFeature>;
|
|
1616
|
+
}
|
|
1617
|
+
//#endregion
|
|
1618
|
+
//#region src/learnosity-model/parseLearnosityItem.d.ts
|
|
1619
|
+
/**
|
|
1620
|
+
* Result of parsing a Learnosity item
|
|
1621
|
+
*/
|
|
1622
|
+
interface ParseLearnosityItemResult {
|
|
1623
|
+
model?: LearnosityItemModel;
|
|
1624
|
+
diagnostics: Diagnostic[];
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Parse and validate Learnosity Item JSON
|
|
1628
|
+
*
|
|
1629
|
+
* @param input Unknown input (should be Learnosity Item JSON)
|
|
1630
|
+
* @returns Validated model if successful, diagnostics in all cases
|
|
1631
|
+
*/
|
|
1632
|
+
declare function parseLearnosityItem(input: unknown): ParseLearnosityItemResult;
|
|
1633
|
+
//#endregion
|
|
1634
|
+
//#region src/learnosity-bundle/types.d.ts
|
|
1635
|
+
/**
|
|
1636
|
+
* Types for Learnosity export bundle model (manifest + activities + items + assets)
|
|
1637
|
+
* Part of TASK 004D
|
|
1638
|
+
*/
|
|
1639
|
+
/**
|
|
1640
|
+
* Item reference entry in manifest activity
|
|
1641
|
+
*/
|
|
1642
|
+
interface LearnosityManifestItemRef {
|
|
1643
|
+
reference: string;
|
|
1644
|
+
id?: string;
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Activity entry in manifest
|
|
1648
|
+
*/
|
|
1649
|
+
interface LearnosityManifestActivity {
|
|
1650
|
+
items: LearnosityManifestItemRef[];
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Validated Learnosity manifest model (from manifest.json)
|
|
1654
|
+
*/
|
|
1655
|
+
interface LearnosityManifestModel {
|
|
1656
|
+
activities: Record<string, LearnosityManifestActivity>;
|
|
1657
|
+
items?: unknown;
|
|
1658
|
+
assets?: unknown;
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* Activity index entry (ordered item references)
|
|
1662
|
+
*/
|
|
1663
|
+
interface LearnosityActivityIndexEntry {
|
|
1664
|
+
activityRef: string;
|
|
1665
|
+
itemRefs: string[];
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Complete Learnosity bundle model (manifest + loaded JSON files + indices)
|
|
1669
|
+
*/
|
|
1670
|
+
interface LearnosityBundleModel {
|
|
1671
|
+
/** Validated manifest model */
|
|
1672
|
+
manifest: LearnosityManifestModel;
|
|
1673
|
+
/** All activity references from manifest */
|
|
1674
|
+
activityRefs: string[];
|
|
1675
|
+
/** Map: activityRef → ordered item reference list */
|
|
1676
|
+
activityItemRefs: Map<string, string[]>;
|
|
1677
|
+
/** Map: activityRef → raw activity JSON (if file exists) */
|
|
1678
|
+
activitiesJsonByRef: Map<string, unknown>;
|
|
1679
|
+
/** Map: itemRef → raw item JSON (if file exists) */
|
|
1680
|
+
itemsJsonByRef: Map<string, unknown>;
|
|
1681
|
+
/** Map: itemRef → actual filename on disk (e.g., "items/hash.json") */
|
|
1682
|
+
itemRefToFilename: Map<string, string>;
|
|
1683
|
+
}
|
|
1684
|
+
//#endregion
|
|
1685
|
+
//#region src/learnosity-bundle/loadLearnosityBundle.d.ts
|
|
1686
|
+
/**
|
|
1687
|
+
* Load a Learnosity export bundle from a directory
|
|
1688
|
+
*
|
|
1689
|
+
* @param bundleDir - Absolute path to bundle directory
|
|
1690
|
+
* @returns { bundle?, diagnostics[] }
|
|
1691
|
+
*/
|
|
1692
|
+
declare function loadLearnosityBundle(bundleDir: string): {
|
|
1693
|
+
bundle?: LearnosityBundleModel;
|
|
1694
|
+
diagnostics: Diagnostic[];
|
|
1695
|
+
};
|
|
1696
|
+
//#endregion
|
|
1697
|
+
//#region src/learnosity-bundle/writeLearnosityBundle.d.ts
|
|
1698
|
+
interface WriteBundleOptions {
|
|
1699
|
+
/** Directory or ZIP path to write bundle to */
|
|
1700
|
+
outDir: string;
|
|
1701
|
+
/** Whether to output as ZIP file (default: false, outputs as directory) */
|
|
1702
|
+
isZipOutput?: boolean;
|
|
1703
|
+
}
|
|
1704
|
+
interface WriteBundleResult {
|
|
1705
|
+
diagnostics: Diagnostic[];
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Write Learnosity Bundle to directory or ZIP
|
|
1709
|
+
*/
|
|
1710
|
+
declare function writeLearnosityBundle(bundle: {
|
|
1711
|
+
manifest: unknown;
|
|
1712
|
+
activities: Map<string, unknown>;
|
|
1713
|
+
items: Map<string, unknown>;
|
|
1714
|
+
assets: Map<string, Uint8Array>;
|
|
1715
|
+
itemFilenames?: Map<string, string>;
|
|
1716
|
+
}, options: WriteBundleOptions): Promise<WriteBundleResult>;
|
|
1717
|
+
//#endregion
|
|
1718
|
+
//#region src/learnosity-bundle/pathSafetyFs.d.ts
|
|
1719
|
+
/**
|
|
1720
|
+
* Path safety validation for filesystem operations
|
|
1721
|
+
* Part of TASK 004D - prevents directory traversal attacks similar to zip-slip protection
|
|
1722
|
+
*/
|
|
1723
|
+
/**
|
|
1724
|
+
* Validate that a relative path is safe to use within a base directory
|
|
1725
|
+
*
|
|
1726
|
+
* Safety rules:
|
|
1727
|
+
* - Must be relative (no absolute paths)
|
|
1728
|
+
* - No ".." traversal
|
|
1729
|
+
* - No symlinks
|
|
1730
|
+
* - Normalized separators
|
|
1731
|
+
*
|
|
1732
|
+
* @param relativePath - Path to validate (relative to baseDir)
|
|
1733
|
+
* @param baseDir - Base directory that all paths must stay within
|
|
1734
|
+
* @returns true if safe, false otherwise
|
|
1735
|
+
*/
|
|
1736
|
+
declare function isPathSafe(relativePath: string, baseDir: string): boolean;
|
|
1737
|
+
/**
|
|
1738
|
+
* Check if a path points to a symlink
|
|
1739
|
+
*
|
|
1740
|
+
* @param fullPath - Absolute path to check
|
|
1741
|
+
* @returns true if symlink, false otherwise (or if path doesn't exist)
|
|
1742
|
+
*/
|
|
1743
|
+
declare function isSymlink(fullPath: string): boolean;
|
|
1744
|
+
/**
|
|
1745
|
+
* Safely resolve a relative path within a base directory
|
|
1746
|
+
* Returns null if the path is unsafe or points to a symlink
|
|
1747
|
+
*
|
|
1748
|
+
* @param relativePath - Path to resolve (relative to baseDir)
|
|
1749
|
+
* @param baseDir - Base directory
|
|
1750
|
+
* @returns Absolute path if safe, null otherwise
|
|
1751
|
+
*/
|
|
1752
|
+
declare function safeResolve(relativePath: string, baseDir: string): string | null;
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region src/qti-ast/types.d.ts
|
|
1755
|
+
/**
|
|
1756
|
+
* Internal QTI AST types
|
|
1757
|
+
* Neutral representation independent of source (Learnosity) or target (QTI XML)
|
|
1758
|
+
* Part of TASK 004B
|
|
1759
|
+
*/
|
|
1760
|
+
/**
|
|
1761
|
+
* Interaction type
|
|
1762
|
+
*/
|
|
1763
|
+
type InteractionType = 'choice' | 'textEntry' | 'extendedText' | 'inlineChoice' | 'gapMatch' | 'order' | 'hottext' | 'hotspot' | 'graphicGapMatch' | 'match' | 'upload' | 'drawing' | 'associate';
|
|
1764
|
+
/**
|
|
1765
|
+
* Choice in a choice interaction
|
|
1766
|
+
*/
|
|
1767
|
+
interface QtiChoice {
|
|
1768
|
+
identifier: string;
|
|
1769
|
+
content: string;
|
|
1770
|
+
feedbackBlockIdentifier?: string;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Modal feedback (general feedback shown after submission)
|
|
1774
|
+
*/
|
|
1775
|
+
interface QtiModalFeedback {
|
|
1776
|
+
identifier: string;
|
|
1777
|
+
outcomeIdentifier: string;
|
|
1778
|
+
showHide: 'show' | 'hide';
|
|
1779
|
+
content: string;
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Block feedback (per-choice feedback)
|
|
1783
|
+
*/
|
|
1784
|
+
interface QtiFeedbackBlock {
|
|
1785
|
+
identifier: string;
|
|
1786
|
+
showHide: 'show' | 'hide';
|
|
1787
|
+
content: string;
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Correct response for an interaction
|
|
1791
|
+
*/
|
|
1792
|
+
interface QtiCorrectResponse {
|
|
1793
|
+
values: string[];
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Map entry for partial credit scoring
|
|
1797
|
+
*/
|
|
1798
|
+
interface QtiMapEntry {
|
|
1799
|
+
mapKey: string;
|
|
1800
|
+
mappedValue: number;
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Mapping for partial credit scoring
|
|
1804
|
+
*/
|
|
1805
|
+
interface QtiMapping {
|
|
1806
|
+
lowerBound: number;
|
|
1807
|
+
upperBound: number;
|
|
1808
|
+
defaultValue: number;
|
|
1809
|
+
mapEntries: QtiMapEntry[];
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Choice interaction (MCQ)
|
|
1813
|
+
*/
|
|
1814
|
+
interface QtiChoiceInteraction {
|
|
1815
|
+
type: 'choice';
|
|
1816
|
+
responseIdentifier: string;
|
|
1817
|
+
prompt?: string;
|
|
1818
|
+
shuffle: boolean;
|
|
1819
|
+
minChoices?: number;
|
|
1820
|
+
maxChoices: number;
|
|
1821
|
+
cardinality: 'single' | 'multiple';
|
|
1822
|
+
choices: QtiChoice[];
|
|
1823
|
+
correctResponse?: QtiCorrectResponse;
|
|
1824
|
+
mapping?: QtiMapping;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Text entry in a text entry interaction (clozetext)
|
|
1828
|
+
*/
|
|
1829
|
+
interface QtiTextEntry {
|
|
1830
|
+
responseIdentifier: string;
|
|
1831
|
+
correctResponse?: string;
|
|
1832
|
+
correctResponses?: string[];
|
|
1833
|
+
mapping?: QtiMapping;
|
|
1834
|
+
format?: 'String' | 'Integer';
|
|
1835
|
+
expectedLength?: number;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Text entry interaction
|
|
1839
|
+
* - Clozetext mode: template required, multiple textEntries
|
|
1840
|
+
* - Shorttext mode: prompt required, single entry in textEntries
|
|
1841
|
+
*/
|
|
1842
|
+
interface QtiTextEntryInteraction {
|
|
1843
|
+
type: 'textEntry';
|
|
1844
|
+
responseIdentifier: string;
|
|
1845
|
+
prompt?: string;
|
|
1846
|
+
template?: string;
|
|
1847
|
+
textEntries?: QtiTextEntry[];
|
|
1848
|
+
correctResponses?: string[];
|
|
1849
|
+
mapping?: QtiMapping;
|
|
1850
|
+
placeholderText?: string;
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Extended text interaction (essay/long answer)
|
|
1854
|
+
*/
|
|
1855
|
+
interface QtiExtendedTextInteraction {
|
|
1856
|
+
type: 'extendedText';
|
|
1857
|
+
responseIdentifier: string;
|
|
1858
|
+
prompt?: string;
|
|
1859
|
+
expectedLength?: number;
|
|
1860
|
+
textFormat?: string;
|
|
1861
|
+
placeholderText?: string;
|
|
1862
|
+
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Inline choice (single option in a dropdown)
|
|
1865
|
+
*/
|
|
1866
|
+
interface QtiInlineChoice {
|
|
1867
|
+
identifier: string;
|
|
1868
|
+
content: string;
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Inline choice entry (dropdown with options)
|
|
1872
|
+
*/
|
|
1873
|
+
interface QtiInlineChoiceEntry {
|
|
1874
|
+
responseIdentifier: string;
|
|
1875
|
+
shuffle: boolean;
|
|
1876
|
+
inlineChoices: QtiInlineChoice[];
|
|
1877
|
+
correctResponse?: string;
|
|
1878
|
+
mapping?: QtiMapping;
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Inline choice interaction (dropdown in text, clozedropdown)
|
|
1882
|
+
*/
|
|
1883
|
+
interface QtiInlineChoiceInteraction {
|
|
1884
|
+
type: 'inlineChoice';
|
|
1885
|
+
responseIdentifier: string;
|
|
1886
|
+
prompt?: string;
|
|
1887
|
+
template?: string;
|
|
1888
|
+
inlineChoiceEntries?: QtiInlineChoiceEntry[];
|
|
1889
|
+
shuffle: boolean;
|
|
1890
|
+
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Gap text (draggable option for gapMatch)
|
|
1893
|
+
*/
|
|
1894
|
+
interface QtiGapText {
|
|
1895
|
+
identifier: string;
|
|
1896
|
+
content: string;
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Gap entry (drop zone in gapMatch)
|
|
1900
|
+
*/
|
|
1901
|
+
interface QtiGapEntry {
|
|
1902
|
+
identifier: string;
|
|
1903
|
+
correctResponse?: string;
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Gap match interaction (drag and drop into gaps, clozeassociation)
|
|
1907
|
+
*/
|
|
1908
|
+
interface QtiGapMatchInteraction {
|
|
1909
|
+
type: 'gapMatch';
|
|
1910
|
+
responseIdentifier: string;
|
|
1911
|
+
prompt?: string;
|
|
1912
|
+
template?: string;
|
|
1913
|
+
gapTexts?: QtiGapText[];
|
|
1914
|
+
gapEntries?: QtiGapEntry[];
|
|
1915
|
+
shuffle: boolean;
|
|
1916
|
+
mapping?: QtiMapping;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Order interaction (ordering/sequencing, orderlist)
|
|
1920
|
+
*/
|
|
1921
|
+
interface QtiOrderInteraction {
|
|
1922
|
+
type: 'order';
|
|
1923
|
+
responseIdentifier: string;
|
|
1924
|
+
prompt?: string;
|
|
1925
|
+
choices: QtiChoice[];
|
|
1926
|
+
correctResponse?: string[];
|
|
1927
|
+
shuffle: boolean;
|
|
1928
|
+
orientation?: 'vertical' | 'horizontal';
|
|
1929
|
+
mapping?: QtiMapping;
|
|
1930
|
+
}
|
|
1931
|
+
/**
|
|
1932
|
+
* Hottext element (selectable text region in hottextInteraction)
|
|
1933
|
+
*/
|
|
1934
|
+
interface QtiHottext {
|
|
1935
|
+
identifier: string;
|
|
1936
|
+
content: string;
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Hottext interaction (highlight/select text regions, tokenhighlight)
|
|
1940
|
+
*/
|
|
1941
|
+
interface QtiHottextInteraction {
|
|
1942
|
+
type: 'hottext';
|
|
1943
|
+
responseIdentifier: string;
|
|
1944
|
+
prompt?: string;
|
|
1945
|
+
template: string;
|
|
1946
|
+
hottexts: QtiHottext[];
|
|
1947
|
+
correctResponse?: string[];
|
|
1948
|
+
cardinality: 'single' | 'multiple';
|
|
1949
|
+
mapping?: QtiMapping;
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Associable hotspot (drop zone in graphicGapMatch)
|
|
1953
|
+
*/
|
|
1954
|
+
interface QtiAssociableHotspot {
|
|
1955
|
+
identifier: string;
|
|
1956
|
+
shape: 'rect' | 'circle' | 'poly' | 'ellipse' | 'default';
|
|
1957
|
+
coords: string;
|
|
1958
|
+
matchMax: number;
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Gap image (draggable image choice in graphicGapMatch)
|
|
1962
|
+
*/
|
|
1963
|
+
interface QtiGapImg {
|
|
1964
|
+
identifier: string;
|
|
1965
|
+
objectData: string;
|
|
1966
|
+
objectType: string;
|
|
1967
|
+
altText: string;
|
|
1968
|
+
matchMax: number;
|
|
1969
|
+
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Directed pair (zone-choice pairing)
|
|
1972
|
+
*/
|
|
1973
|
+
interface QtiDirectedPair {
|
|
1974
|
+
sourceId: string;
|
|
1975
|
+
targetId: string;
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Graphic gap match interaction (drag text/images onto image zones, imageclozeassociationV2)
|
|
1979
|
+
*/
|
|
1980
|
+
/**
|
|
1981
|
+
* Hotspot choice (polygon area on image)
|
|
1982
|
+
*/
|
|
1983
|
+
interface QtiHotspotChoice {
|
|
1984
|
+
identifier: string;
|
|
1985
|
+
shape: 'poly';
|
|
1986
|
+
coords: string;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Hotspot interaction (click areas on image)
|
|
1990
|
+
*/
|
|
1991
|
+
interface QtiHotspotInteraction {
|
|
1992
|
+
type: 'hotspot';
|
|
1993
|
+
responseIdentifier: string;
|
|
1994
|
+
prompt?: string;
|
|
1995
|
+
backgroundImage: {
|
|
1996
|
+
src: string;
|
|
1997
|
+
type: string;
|
|
1998
|
+
width: number;
|
|
1999
|
+
height: number;
|
|
2000
|
+
};
|
|
2001
|
+
hotspotChoices: QtiHotspotChoice[];
|
|
2002
|
+
correctResponse?: string[];
|
|
2003
|
+
maxChoices: number;
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Graphic gap match interaction (drag-and-drop onto image zones)
|
|
2007
|
+
*/
|
|
2008
|
+
interface QtiGraphicGapMatchInteraction {
|
|
2009
|
+
type: 'graphicGapMatch';
|
|
2010
|
+
responseIdentifier: string;
|
|
2011
|
+
prompt?: string;
|
|
2012
|
+
backgroundImage: {
|
|
2013
|
+
src: string;
|
|
2014
|
+
type: string;
|
|
2015
|
+
width?: number;
|
|
2016
|
+
height?: number;
|
|
2017
|
+
alt: string;
|
|
2018
|
+
};
|
|
2019
|
+
hotspots: QtiAssociableHotspot[];
|
|
2020
|
+
gapImgs: QtiGapImg[];
|
|
2021
|
+
correctResponse?: QtiDirectedPair[];
|
|
2022
|
+
shuffle: boolean;
|
|
2023
|
+
mapping?: QtiMapping;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Outcome declaration (for scoring)
|
|
2027
|
+
*/
|
|
2028
|
+
interface QtiOutcomeDeclaration {
|
|
2029
|
+
identifier: string;
|
|
2030
|
+
baseType: 'float' | 'integer' | 'string' | 'boolean';
|
|
2031
|
+
cardinality: 'single' | 'multiple' | 'ordered';
|
|
2032
|
+
defaultValue?: number | string;
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Simple associable choice (for matchInteraction)
|
|
2036
|
+
*/
|
|
2037
|
+
interface QtiSimpleAssociableChoice {
|
|
2038
|
+
identifier: string;
|
|
2039
|
+
content: string;
|
|
2040
|
+
matchMax: number;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Directed pair (source-target association for matchInteraction correctResponse)
|
|
2044
|
+
*/
|
|
2045
|
+
interface QtiDirectedPairMatch {
|
|
2046
|
+
sourceId: string;
|
|
2047
|
+
targetId: string;
|
|
2048
|
+
}
|
|
2049
|
+
/**
|
|
2050
|
+
* Match interaction (matrix/matching question, choicematrix)
|
|
2051
|
+
*/
|
|
2052
|
+
interface QtiMatchInteraction {
|
|
2053
|
+
type: 'match';
|
|
2054
|
+
responseIdentifier: string;
|
|
2055
|
+
prompt?: string;
|
|
2056
|
+
shuffle: boolean;
|
|
2057
|
+
maxAssociations: number;
|
|
2058
|
+
sourceSet: QtiSimpleAssociableChoice[];
|
|
2059
|
+
targetSet: QtiSimpleAssociableChoice[];
|
|
2060
|
+
correctResponse?: QtiDirectedPairMatch[];
|
|
2061
|
+
}
|
|
2062
|
+
/**
|
|
2063
|
+
* Upload interaction (file upload, fileupload)
|
|
2064
|
+
*/
|
|
2065
|
+
interface QtiUploadInteraction {
|
|
2066
|
+
type: 'upload';
|
|
2067
|
+
responseIdentifier: string;
|
|
2068
|
+
prompt?: string;
|
|
2069
|
+
mimeTypes?: string[];
|
|
2070
|
+
maxFiles?: number;
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* Associable choice (for associateInteraction)
|
|
2074
|
+
* Represents both column/category choices and draggable item choices.
|
|
2075
|
+
*/
|
|
2076
|
+
interface QtiAssociableChoice {
|
|
2077
|
+
identifier: string;
|
|
2078
|
+
content: string;
|
|
2079
|
+
matchMax: number;
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Associate interaction (drag-and-drop classification, classification)
|
|
2083
|
+
*/
|
|
2084
|
+
interface QtiAssociateInteraction {
|
|
2085
|
+
type: 'associate';
|
|
2086
|
+
responseIdentifier: string;
|
|
2087
|
+
prompt?: string;
|
|
2088
|
+
choices: QtiAssociableChoice[];
|
|
2089
|
+
correctResponse?: Array<{
|
|
2090
|
+
firstId: string;
|
|
2091
|
+
secondId: string;
|
|
2092
|
+
}>;
|
|
2093
|
+
maxAssociations: number;
|
|
2094
|
+
shuffle: boolean;
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Drawing interaction (freehand drawing, drawing)
|
|
2098
|
+
*/
|
|
2099
|
+
interface QtiDrawingInteraction {
|
|
2100
|
+
type: 'drawing';
|
|
2101
|
+
responseIdentifier: string;
|
|
2102
|
+
prompt?: string;
|
|
2103
|
+
backgroundImage?: {
|
|
2104
|
+
src: string;
|
|
2105
|
+
width?: number;
|
|
2106
|
+
height?: number;
|
|
2107
|
+
alt?: string;
|
|
2108
|
+
};
|
|
2109
|
+
drawingTools?: string[];
|
|
2110
|
+
textFormattingOptions?: string[];
|
|
2111
|
+
lineColor?: string[];
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Union type for all interactions
|
|
2115
|
+
*/
|
|
2116
|
+
type QtiInteraction = QtiChoiceInteraction | QtiTextEntryInteraction | QtiExtendedTextInteraction | QtiInlineChoiceInteraction | QtiGapMatchInteraction | QtiOrderInteraction | QtiHottextInteraction | QtiHotspotInteraction | QtiGraphicGapMatchInteraction | QtiMatchInteraction | QtiUploadInteraction | QtiDrawingInteraction | QtiAssociateInteraction;
|
|
2117
|
+
/**
|
|
2118
|
+
* Widget reference for layout (question or feature)
|
|
2119
|
+
*/
|
|
2120
|
+
interface QtiLayoutWidget {
|
|
2121
|
+
kind: 'question' | 'feature';
|
|
2122
|
+
ref: string;
|
|
2123
|
+
interaction?: QtiInteraction;
|
|
2124
|
+
stimulusRef?: string;
|
|
2125
|
+
}
|
|
2126
|
+
/**
|
|
2127
|
+
* Column in a multi-column layout
|
|
2128
|
+
*/
|
|
2129
|
+
interface QtiLayoutColumn {
|
|
2130
|
+
index: 1 | 2;
|
|
2131
|
+
widgets: QtiLayoutWidget[];
|
|
2132
|
+
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Item layout structure
|
|
2135
|
+
*/
|
|
2136
|
+
interface QtiLayout {
|
|
2137
|
+
columns: QtiLayoutColumn[];
|
|
2138
|
+
contentHtml: string;
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* LOM classification for a tag type
|
|
2142
|
+
*/
|
|
2143
|
+
interface QtiLomClassification {
|
|
2144
|
+
tagType: string;
|
|
2145
|
+
tagNames: string[];
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* LOM metadata for an assessment item
|
|
2149
|
+
*/
|
|
2150
|
+
interface QtiLomMetadata {
|
|
2151
|
+
identifier: string;
|
|
2152
|
+
classifications: QtiLomClassification[];
|
|
2153
|
+
}
|
|
2154
|
+
/**
|
|
2155
|
+
* Response processing strategy
|
|
2156
|
+
*/
|
|
2157
|
+
type ResponseProcessingStrategy = 'template' | 'ruleGroup';
|
|
2158
|
+
/**
|
|
2159
|
+
* Response processing configuration
|
|
2160
|
+
*/
|
|
2161
|
+
interface QtiResponseProcessing {
|
|
2162
|
+
strategy: ResponseProcessingStrategy;
|
|
2163
|
+
templateUrl?: string;
|
|
2164
|
+
ruleGroups?: QtiResponseCondition[];
|
|
2165
|
+
penaltyValue?: number;
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* Response condition (if/elseif/else structure)
|
|
2169
|
+
*/
|
|
2170
|
+
interface QtiResponseCondition {
|
|
2171
|
+
responseIf: QtiResponseIf;
|
|
2172
|
+
responseElseIf?: QtiResponseElseIf[];
|
|
2173
|
+
responseElse?: QtiResponseElse;
|
|
2174
|
+
}
|
|
2175
|
+
/**
|
|
2176
|
+
* Response if block
|
|
2177
|
+
*/
|
|
2178
|
+
interface QtiResponseIf {
|
|
2179
|
+
condition: QtiExpression;
|
|
2180
|
+
actions: QtiAction[];
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Response else-if block
|
|
2184
|
+
*/
|
|
2185
|
+
interface QtiResponseElseIf {
|
|
2186
|
+
condition: QtiExpression;
|
|
2187
|
+
actions: QtiAction[];
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Response else block
|
|
2191
|
+
*/
|
|
2192
|
+
interface QtiResponseElse {
|
|
2193
|
+
actions: QtiAction[];
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* QTI expression (for conditions)
|
|
2197
|
+
*/
|
|
2198
|
+
type QtiExpression = QtiStringMatch | QtiVariable | QtiCorrect | QtiBaseValue | QtiSubtract | QtiMax;
|
|
2199
|
+
/**
|
|
2200
|
+
* String match expression
|
|
2201
|
+
*/
|
|
2202
|
+
interface QtiStringMatch {
|
|
2203
|
+
type: 'stringMatch';
|
|
2204
|
+
caseSensitive: boolean;
|
|
2205
|
+
variable: string;
|
|
2206
|
+
correct: string;
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Variable reference
|
|
2210
|
+
*/
|
|
2211
|
+
interface QtiVariable {
|
|
2212
|
+
type: 'variable';
|
|
2213
|
+
identifier: string;
|
|
2214
|
+
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Correct response reference
|
|
2217
|
+
*/
|
|
2218
|
+
interface QtiCorrect {
|
|
2219
|
+
type: 'correct';
|
|
2220
|
+
identifier: string;
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* Base value (literal)
|
|
2224
|
+
*/
|
|
2225
|
+
interface QtiBaseValue {
|
|
2226
|
+
type: 'baseValue';
|
|
2227
|
+
baseType: 'float' | 'integer' | 'string' | 'boolean';
|
|
2228
|
+
value: string | number | boolean;
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Subtract expression
|
|
2232
|
+
*/
|
|
2233
|
+
interface QtiSubtract {
|
|
2234
|
+
type: 'subtract';
|
|
2235
|
+
operands: [QtiExpression, QtiExpression];
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Max expression
|
|
2239
|
+
*/
|
|
2240
|
+
interface QtiMax {
|
|
2241
|
+
type: 'max';
|
|
2242
|
+
operands: QtiExpression[];
|
|
2243
|
+
}
|
|
2244
|
+
/**
|
|
2245
|
+
* QTI action (outcome updates)
|
|
2246
|
+
*/
|
|
2247
|
+
type QtiAction = QtiSetOutcomeValue;
|
|
2248
|
+
/**
|
|
2249
|
+
* Set outcome value action
|
|
2250
|
+
*/
|
|
2251
|
+
interface QtiSetOutcomeValue {
|
|
2252
|
+
type: 'setOutcomeValue';
|
|
2253
|
+
identifier: string;
|
|
2254
|
+
expression: QtiExpression;
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Assessment item AST
|
|
2258
|
+
*/
|
|
2259
|
+
interface QtiAssessmentItem {
|
|
2260
|
+
identifier: string;
|
|
2261
|
+
title?: string;
|
|
2262
|
+
adaptive: boolean;
|
|
2263
|
+
timeDependent: boolean;
|
|
2264
|
+
instructorStimulus?: string;
|
|
2265
|
+
interaction?: QtiInteraction;
|
|
2266
|
+
interactions?: QtiInteraction[];
|
|
2267
|
+
layout?: QtiLayout;
|
|
2268
|
+
stimulusRefs?: string[];
|
|
2269
|
+
stimuli?: Map<string, QtiAssessmentStimulus>;
|
|
2270
|
+
features?: Map<string, any>;
|
|
2271
|
+
outcomeDeclaration?: QtiOutcomeDeclaration;
|
|
2272
|
+
modalFeedback?: QtiModalFeedback[];
|
|
2273
|
+
feedbackBlock?: QtiFeedbackBlock[];
|
|
2274
|
+
lomMetadata?: QtiLomMetadata;
|
|
2275
|
+
responseProcessing?: QtiResponseProcessing;
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Assessment stimulus AST (QTI 2.2 shared stimulus)
|
|
2279
|
+
* Used for sharedpassage features
|
|
2280
|
+
*/
|
|
2281
|
+
interface QtiAssessmentStimulus {
|
|
2282
|
+
identifier: string;
|
|
2283
|
+
title?: string;
|
|
2284
|
+
instructorStimulus?: string;
|
|
2285
|
+
stimulusBody: string;
|
|
2286
|
+
}
|
|
2287
|
+
//#endregion
|
|
2288
|
+
//#region src/qti-ast/assessmentTestTypes.d.ts
|
|
2289
|
+
/**
|
|
2290
|
+
* QTI 2.2 assessmentTest AST types (TASK 005)
|
|
2291
|
+
*
|
|
2292
|
+
* Represents the structure of QTI assessmentTest independent of XML serialization.
|
|
2293
|
+
*/
|
|
2294
|
+
/**
|
|
2295
|
+
* Reference to an assessmentItem in the test
|
|
2296
|
+
*/
|
|
2297
|
+
interface QtiItemRef {
|
|
2298
|
+
/** Unique identifier for this item reference */
|
|
2299
|
+
identifier: string;
|
|
2300
|
+
/** Relative path to the assessmentItem XML file */
|
|
2301
|
+
href: string;
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
* Selection constraints for random item selection within a section
|
|
2305
|
+
*/
|
|
2306
|
+
interface QtiSelection {
|
|
2307
|
+
/** Number of items to select */
|
|
2308
|
+
select: number;
|
|
2309
|
+
/** Whether to allow selecting the same item multiple times */
|
|
2310
|
+
withReplacement?: boolean;
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* A section within a test part containing item references
|
|
2314
|
+
*/
|
|
2315
|
+
interface QtiAssessmentSection {
|
|
2316
|
+
/** Unique identifier for this section */
|
|
2317
|
+
identifier: string;
|
|
2318
|
+
/** Human-readable title */
|
|
2319
|
+
title: string;
|
|
2320
|
+
/** Whether section is visible to candidate */
|
|
2321
|
+
visible: boolean;
|
|
2322
|
+
/** Item references in this section */
|
|
2323
|
+
itemRefs: QtiItemRef[];
|
|
2324
|
+
/** Whether to shuffle items within this section */
|
|
2325
|
+
shuffle?: boolean;
|
|
2326
|
+
/** Optional time limits for this section */
|
|
2327
|
+
timeLimits?: QtiTimeLimits;
|
|
2328
|
+
/** Optional selection constraints for random item selection */
|
|
2329
|
+
selection?: QtiSelection;
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* A part of an assessment test
|
|
2333
|
+
*/
|
|
2334
|
+
interface QtiTestPart {
|
|
2335
|
+
/** Unique identifier for this test part */
|
|
2336
|
+
identifier: string;
|
|
2337
|
+
/** Navigation mode (linear or nonlinear) */
|
|
2338
|
+
navigationMode: 'linear' | 'nonlinear';
|
|
2339
|
+
/** Submission mode (individual or simultaneous) */
|
|
2340
|
+
submissionMode: 'individual' | 'simultaneous';
|
|
2341
|
+
/** Assessment sections in this test part */
|
|
2342
|
+
sections: QtiAssessmentSection[];
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Time limits for an assessment test
|
|
2346
|
+
*/
|
|
2347
|
+
interface QtiTimeLimits {
|
|
2348
|
+
/** Maximum time allowed in seconds */
|
|
2349
|
+
maxTime: number;
|
|
2350
|
+
/** Whether late submission is allowed after time expires */
|
|
2351
|
+
allowLateSubmission: boolean;
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* QTI 2.2 assessmentTest structure
|
|
2355
|
+
*/
|
|
2356
|
+
interface QtiAssessmentTest {
|
|
2357
|
+
/** Unique identifier for the test */
|
|
2358
|
+
identifier: string;
|
|
2359
|
+
/** Human-readable title */
|
|
2360
|
+
title: string;
|
|
2361
|
+
/** Optional time limits */
|
|
2362
|
+
timeLimits?: QtiTimeLimits;
|
|
2363
|
+
/** Test parts */
|
|
2364
|
+
testParts: QtiTestPart[];
|
|
2365
|
+
}
|
|
2366
|
+
//#endregion
|
|
2367
|
+
//#region src/qti-ast/downgradeToQti21.d.ts
|
|
2368
|
+
interface DowngradeResult<T> {
|
|
2369
|
+
/** Downgraded AST (modified in place or cloned) */
|
|
2370
|
+
ast: T;
|
|
2371
|
+
/** Diagnostics about lossy conversions */
|
|
2372
|
+
diagnostics: Diagnostic[];
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Downgrade QTI 2.2 assessmentItem to QTI 2.1
|
|
2376
|
+
*
|
|
2377
|
+
* Main differences:
|
|
2378
|
+
* - Namespace changes
|
|
2379
|
+
* - Stricter identifier rules
|
|
2380
|
+
* - Schema location changes
|
|
2381
|
+
*
|
|
2382
|
+
* @param item - QTI 2.2 assessmentItem AST
|
|
2383
|
+
* @returns { downgraded item, diagnostics }
|
|
2384
|
+
*/
|
|
2385
|
+
declare function downgradeAssessmentItemToQti21(item: QtiAssessmentItem): DowngradeResult<QtiAssessmentItem>;
|
|
2386
|
+
/**
|
|
2387
|
+
* Downgrade QTI 2.2 assessmentTest to QTI 2.1
|
|
2388
|
+
*
|
|
2389
|
+
* @param test - QTI 2.2 assessmentTest AST
|
|
2390
|
+
* @returns { downgraded test, diagnostics }
|
|
2391
|
+
*/
|
|
2392
|
+
declare function downgradeAssessmentTestToQti21(test: QtiAssessmentTest): DowngradeResult<QtiAssessmentTest>;
|
|
2393
|
+
//#endregion
|
|
2394
|
+
//#region src/learnosity-mapper/mapLearnosityToAst.d.ts
|
|
2395
|
+
/**
|
|
2396
|
+
* Map a validated Learnosity Item Model to a QTI AST
|
|
2397
|
+
*
|
|
2398
|
+
* @param model - Validated Learnosity Item Model
|
|
2399
|
+
* @returns { ast?, diagnostics[] }
|
|
2400
|
+
*/
|
|
2401
|
+
declare function mapLearnosityToAst(model: LearnosityItemModel | null | undefined): {
|
|
2402
|
+
ast?: QtiAssessmentItem;
|
|
2403
|
+
diagnostics: Diagnostic[];
|
|
2404
|
+
};
|
|
2405
|
+
//#endregion
|
|
2406
|
+
//#region src/learnosity-mapper/mapActivityToTest.d.ts
|
|
2407
|
+
interface MapActivityToTestResult {
|
|
2408
|
+
test?: QtiAssessmentTest;
|
|
2409
|
+
diagnostics: Diagnostic[];
|
|
2410
|
+
}
|
|
2411
|
+
/**
|
|
2412
|
+
* Learnosity section configuration for navigation
|
|
2413
|
+
*/
|
|
2414
|
+
interface LearnositySectionNavigation {
|
|
2415
|
+
/** Whether backward navigation is allowed (true = nonlinear, false = linear) */
|
|
2416
|
+
allowBackward?: boolean;
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Learnosity section configuration for time limits
|
|
2420
|
+
*/
|
|
2421
|
+
interface LearnositySectionTime {
|
|
2422
|
+
/** Maximum time in seconds */
|
|
2423
|
+
maxTime?: number;
|
|
2424
|
+
/** Time limit type (hard or soft) - maps to allowLateSubmission */
|
|
2425
|
+
limitType?: 'hard' | 'soft';
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Learnosity section configuration
|
|
2429
|
+
*/
|
|
2430
|
+
interface LearnositySectionConfig {
|
|
2431
|
+
/** Navigation settings */
|
|
2432
|
+
navigation?: LearnositySectionNavigation;
|
|
2433
|
+
/** Time limit settings */
|
|
2434
|
+
time?: LearnositySectionTime;
|
|
2435
|
+
/** Whether to shuffle items within the section */
|
|
2436
|
+
shuffleItems?: boolean;
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* A section within a Learnosity activity
|
|
2440
|
+
*/
|
|
2441
|
+
interface LearnositySection {
|
|
2442
|
+
/** Ordered list of item references in this section */
|
|
2443
|
+
items: string[];
|
|
2444
|
+
/** Optional section configuration */
|
|
2445
|
+
config?: LearnositySectionConfig;
|
|
2446
|
+
}
|
|
2447
|
+
interface ActivityData {
|
|
2448
|
+
/** Activity reference/identifier */
|
|
2449
|
+
reference: string;
|
|
2450
|
+
/** Optional title (deprecated - use data.config.title instead) */
|
|
2451
|
+
title?: string;
|
|
2452
|
+
/** Ordered list of item references (for flat activities without sections) */
|
|
2453
|
+
itemRefs?: string[];
|
|
2454
|
+
/** Optional: max time in seconds from data.config.time.max_time (for flat activities) */
|
|
2455
|
+
maxTime?: number;
|
|
2456
|
+
/** Optional: sections array (for activities with sections instead of flat items) */
|
|
2457
|
+
sections?: LearnositySection[];
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Maps a Learnosity Activity to QTI assessmentTest AST
|
|
2461
|
+
*
|
|
2462
|
+
* Supports two activity formats:
|
|
2463
|
+
* 1. Flat activities with itemRefs array - creates single section
|
|
2464
|
+
* 2. Section-based activities with sections array - creates multiple sections
|
|
2465
|
+
*
|
|
2466
|
+
* For section-based activities:
|
|
2467
|
+
* - Each Learnosity section maps to a QTI assessmentSection
|
|
2468
|
+
* - Section navigation.allowBackward determines testPart navigationMode
|
|
2469
|
+
* - Section time.maxTime maps to section-level timeLimits
|
|
2470
|
+
* - Section shuffleItems maps to section shuffle attribute
|
|
2471
|
+
*
|
|
2472
|
+
* @param activity - Activity data with reference and item list or sections
|
|
2473
|
+
* @returns { test?, diagnostics[] }
|
|
2474
|
+
*/
|
|
2475
|
+
declare function mapActivityToTest(activity: ActivityData): MapActivityToTestResult;
|
|
2476
|
+
//#endregion
|
|
2477
|
+
//#region src/learnosity-mapper/convertActivity.d.ts
|
|
2478
|
+
interface ConvertedItem {
|
|
2479
|
+
/** Item reference from Learnosity */
|
|
2480
|
+
reference: string;
|
|
2481
|
+
/** QTI XML content */
|
|
2482
|
+
xml: string;
|
|
2483
|
+
/** QTI AST (for accessing metadata like LOM) */
|
|
2484
|
+
ast?: QtiAssessmentItem;
|
|
2485
|
+
/** Diagnostics from this item's conversion */
|
|
2486
|
+
diagnostics: Diagnostic[];
|
|
2487
|
+
}
|
|
2488
|
+
interface ConvertActivityResult {
|
|
2489
|
+
/** Generated assessmentTest XML */
|
|
2490
|
+
testXml?: string;
|
|
2491
|
+
/** QTI assessmentTest AST */
|
|
2492
|
+
test?: QtiAssessmentTest;
|
|
2493
|
+
/** Converted items with XML */
|
|
2494
|
+
items: ConvertedItem[];
|
|
2495
|
+
/** Stimulus resources (sharedpassages) with XML */
|
|
2496
|
+
stimuli: {
|
|
2497
|
+
reference: string;
|
|
2498
|
+
xml: string;
|
|
2499
|
+
}[];
|
|
2500
|
+
/** All diagnostics from conversion */
|
|
2501
|
+
diagnostics: Diagnostic[];
|
|
2502
|
+
}
|
|
2503
|
+
interface ConvertActivityOptions {
|
|
2504
|
+
/** Format XML with newlines and indentation */
|
|
2505
|
+
pretty?: boolean;
|
|
2506
|
+
/** QTI version (2.1 or 2.2) */
|
|
2507
|
+
version?: QtiVersion;
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Convert a Learnosity Activity to QTI 2.2/2.1 assessmentTest + items
|
|
2511
|
+
*
|
|
2512
|
+
* @param bundle - Loaded Learnosity bundle
|
|
2513
|
+
* @param activityRef - Activity reference to convert
|
|
2514
|
+
* @param options - Conversion options
|
|
2515
|
+
* @returns { testXml?, test?, items[], diagnostics[] }
|
|
2516
|
+
*/
|
|
2517
|
+
declare function convertActivity(bundle: LearnosityBundleModel, activityRef: string, options?: ConvertActivityOptions): ConvertActivityResult;
|
|
2518
|
+
//#endregion
|
|
2519
|
+
//#region src/learnosity-mapper/buildPackageFromActivity.d.ts
|
|
2520
|
+
interface BuildPackageFromActivityOptions {
|
|
2521
|
+
/** Source bundle directory for copying assets */
|
|
2522
|
+
bundleDir: string;
|
|
2523
|
+
/** Activity reference used as package identifier */
|
|
2524
|
+
activityRef: string;
|
|
2525
|
+
/** QTI version (2.1 or 2.2) */
|
|
2526
|
+
version?: QtiVersion;
|
|
2527
|
+
}
|
|
2528
|
+
interface BuildPackageFromActivityResult {
|
|
2529
|
+
package?: QtiContentPackage;
|
|
2530
|
+
diagnostics: Diagnostic[];
|
|
2531
|
+
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Build an IMS Content Package from a converted Activity
|
|
2534
|
+
*
|
|
2535
|
+
* Creates a package containing:
|
|
2536
|
+
* - imsmanifest.xml (generated by saveQtiContentPackage)
|
|
2537
|
+
* - assessmentTest.xml
|
|
2538
|
+
* - items/*.xml (one per item)
|
|
2539
|
+
* - assets/* (copied from bundle)
|
|
2540
|
+
*
|
|
2541
|
+
* @param conversion - Result from convertActivity
|
|
2542
|
+
* @param options - Build options including bundle directory
|
|
2543
|
+
* @returns { package?, diagnostics[] }
|
|
2544
|
+
*/
|
|
2545
|
+
declare function buildPackageFromActivity(conversion: ConvertActivityResult, options: BuildPackageFromActivityOptions): BuildPackageFromActivityResult;
|
|
2546
|
+
//#endregion
|
|
2547
|
+
//#region src/learnosity-mapper/sanitizeFolderName.d.ts
|
|
2548
|
+
/**
|
|
2549
|
+
* Sanitize activity reference for use as folder name
|
|
2550
|
+
*/
|
|
2551
|
+
/**
|
|
2552
|
+
* Sanitize a string for use as a folder name
|
|
2553
|
+
*
|
|
2554
|
+
* Rules:
|
|
2555
|
+
* - Trim whitespace
|
|
2556
|
+
* - Replace path separators (/ \) with _
|
|
2557
|
+
* - Replace any characters not in [A-Za-z0-9._-] with _
|
|
2558
|
+
* - Collapse multiple _ to single _
|
|
2559
|
+
* - If empty after sanitization, use fallback
|
|
2560
|
+
*
|
|
2561
|
+
* @param input - Raw string to sanitize
|
|
2562
|
+
* @param fallback - Fallback value if sanitization produces empty string
|
|
2563
|
+
* @returns Sanitized folder name
|
|
2564
|
+
*/
|
|
2565
|
+
declare function sanitizeFolderName(input: string, fallback?: string): string;
|
|
2566
|
+
/**
|
|
2567
|
+
* Ensure folder name uniqueness by tracking used names
|
|
2568
|
+
*
|
|
2569
|
+
* @param desiredName - Desired folder name
|
|
2570
|
+
* @param usedNames - Set of already-used folder names
|
|
2571
|
+
* @returns Unique folder name (may have suffix like _2, _3)
|
|
2572
|
+
*/
|
|
2573
|
+
declare function ensureUniqueFolderName(desiredName: string, usedNames: Set<string>): string;
|
|
2574
|
+
//#endregion
|
|
2575
|
+
//#region src/qti-serializer/serializeAssessmentItem.d.ts
|
|
2576
|
+
/**
|
|
2577
|
+
* Serialize a QTI AST to QTI 2.2 or 2.1 XML
|
|
2578
|
+
*
|
|
2579
|
+
* @param ast - QTI assessment item AST (in 2.2 format)
|
|
2580
|
+
* @param options - Serialization options
|
|
2581
|
+
* @returns { xml?, diagnostics[] }
|
|
2582
|
+
*/
|
|
2583
|
+
declare function serializeAssessmentItem(ast: QtiAssessmentItem, options?: {
|
|
2584
|
+
pretty?: boolean;
|
|
2585
|
+
version?: QtiVersion;
|
|
2586
|
+
}): {
|
|
2587
|
+
xml?: string;
|
|
2588
|
+
diagnostics: Diagnostic[];
|
|
2589
|
+
};
|
|
2590
|
+
//#endregion
|
|
2591
|
+
//#region src/qti-serializer/serializeAssessmentTest.d.ts
|
|
2592
|
+
interface SerializeTestOptions {
|
|
2593
|
+
/** Format with newlines and indentation */
|
|
2594
|
+
pretty?: boolean;
|
|
2595
|
+
/** QTI version (2.1 or 2.2) */
|
|
2596
|
+
version?: QtiVersion;
|
|
2597
|
+
}
|
|
2598
|
+
interface SerializeTestResult {
|
|
2599
|
+
xml?: string;
|
|
2600
|
+
diagnostics: Diagnostic[];
|
|
2601
|
+
}
|
|
2602
|
+
/**
|
|
2603
|
+
* Serialize a QTI assessmentTest to XML string
|
|
2604
|
+
*
|
|
2605
|
+
* @param test - QTI assessmentTest AST (in 2.2 format)
|
|
2606
|
+
* @param options - Serialization options
|
|
2607
|
+
* @returns { xml?, diagnostics[] }
|
|
2608
|
+
*/
|
|
2609
|
+
declare function serializeAssessmentTest(test: QtiAssessmentTest, options?: SerializeTestOptions): SerializeTestResult;
|
|
2610
|
+
//#endregion
|
|
2611
|
+
//#region src/qti-to-learnosity/convertQtiToLearnosity.d.ts
|
|
2612
|
+
interface ConvertOptions {
|
|
2613
|
+
qtiVersion?: QtiVersion;
|
|
2614
|
+
inputPath?: string;
|
|
2615
|
+
sourceFile?: string;
|
|
2616
|
+
organisationId?: number;
|
|
2617
|
+
mediaVault?: boolean;
|
|
2618
|
+
customAssetUrl?: string;
|
|
2619
|
+
itemReferenceSource?: ItemReferenceSource;
|
|
2620
|
+
truncateTags?: boolean;
|
|
2621
|
+
}
|
|
2622
|
+
interface ConvertResult$1 {
|
|
2623
|
+
item?: LearnosityItemJson;
|
|
2624
|
+
diagnostics: Diagnostic[];
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* Convert QTI assessmentItem XML to Learnosity Item JSON
|
|
2628
|
+
* Supports choiceInteraction (MCQ), textEntryInteraction (clozetext), extendedTextInteraction (longtextV2), matchInteraction (choicematrix), gapMatchInteraction (clozeassociation), inlineChoiceInteraction (clozedropdown), orderInteraction (orderlist), hotspotInteraction (hotspot), hottextInteraction (tokenhighlight), associateInteraction (classification)
|
|
2629
|
+
*/
|
|
2630
|
+
declare function convertQtiAssessmentItemToLearnosity(inputXml: string, opts?: ConvertOptions): ConvertResult$1;
|
|
2631
|
+
//#endregion
|
|
2632
|
+
//#region src/qti-to-learnosity/convertAssessmentTestToActivity.d.ts
|
|
2633
|
+
type LearnosityActivityJson = {
|
|
2634
|
+
rendering_type: 'assess';
|
|
2635
|
+
items: Array<{
|
|
2636
|
+
id: string;
|
|
2637
|
+
reference: string;
|
|
2638
|
+
}>;
|
|
2639
|
+
config: {
|
|
2640
|
+
configuration: Record<string, unknown>;
|
|
2641
|
+
navigation: Record<string, unknown>;
|
|
2642
|
+
regions: 'main';
|
|
2643
|
+
title: string | null;
|
|
2644
|
+
subtitle: string | null;
|
|
2645
|
+
};
|
|
2646
|
+
};
|
|
2647
|
+
interface ConvertResult {
|
|
2648
|
+
activity?: LearnosityActivityJson;
|
|
2649
|
+
diagnostics: Diagnostic[];
|
|
2650
|
+
}
|
|
2651
|
+
/**
|
|
2652
|
+
* Convert QTI assessmentTest XML to Learnosity Activity JSON
|
|
2653
|
+
* Supports simple linear tests only (v1)
|
|
2654
|
+
*/
|
|
2655
|
+
declare function convertAssessmentTestToLearnosityActivity(inputXml: string): ConvertResult;
|
|
2656
|
+
//#endregion
|
|
2657
|
+
export { ActivityData, AssessmentItemRef, AssetRef, BuildPackageFromActivityOptions, BuildPackageFromActivityResult, type ConversionOptions, type ConversionResult, ConvertActivityOptions, ConvertActivityResult, type ConvertLearnosityToQtiPackageOptions, type ConvertLearnosityToQtiPackageResult, type ConvertQtiPackageToLearnosityOptions, type ConvertQtiPackageToLearnosityResult, ConvertedItem, type Diagnostic, DiagnosticCode, type DiagnosticIssue, type DiagnosticLevel, type DiagnosticsOutput, type DiagnosticsReport, DowngradeResult, type FormatDiagnosticsReportOptions, InteractionType, type ItemFilenameSource, type ItemReferenceSource, LearnosityActivityIndexEntry, type LearnosityActivityJson, LearnosityAudioplayerData, LearnosityBundleModel, LearnosityChemistryessayV2Data, LearnosityChoicematrixData, LearnosityChoicematrixUiStyle, LearnosityChoicematrixValidation, LearnosityClassificationData, LearnosityClassificationValidation, LearnosityClozeassociationData, LearnosityClozeassociationResponseGroup, LearnosityClozeassociationValidation, LearnosityClozedropdownData, LearnosityClozedropdownValidation, LearnosityClozetextData, LearnosityClozetextResponseContainer, LearnosityClozetextValidation, LearnosityDrawingData, LearnosityDrawingImage, LearnosityFeature, LearnosityFeatureType, LearnosityFileuploadData, LearnosityFormulaessayV2Data, LearnosityHotspotData, LearnosityHotspotImage, LearnosityHotspotPoint, LearnosityHotspotValidation, LearnosityImageclozeassociationV2Data, LearnosityImageclozeassociationV2Image, LearnosityImageclozeassociationV2ResponseContainer, LearnosityImageclozeassociationV2ResponseGroup, LearnosityImageclozeassociationV2Validation, LearnosityItemDefinition, type LearnosityItemJson, LearnosityItemMetadata, LearnosityItemModel, LearnosityLayout, LearnosityLayoutColumn, LearnosityLayoutWidget, LearnosityLongtextV2Data, LearnosityLongtextV2Validation, LearnosityManifestActivity, LearnosityManifestItemRef, LearnosityManifestModel, LearnosityMcqData, LearnosityMcqMetadata, LearnosityMcqOption, LearnosityMcqUiStyle, LearnosityMcqValidation, LearnosityOrderlistData, LearnosityOrderlistValidation, LearnosityPlaintextData, LearnosityPlaintextUiStyle, LearnosityQuestion, LearnosityQuestionData, type LearnosityQuestionJson, LearnosityQuestionMetadata, LearnosityQuestionType, LearnositySection, LearnositySectionConfig, LearnositySectionNavigation, LearnositySectionTime, LearnositySharedpassageData, LearnosityShorttextData, LearnosityShorttextValidation, LearnosityTag, LearnosityTokenhighlightData, LearnosityTokenhighlightValidation, LearnosityVideoplayerData, LearnosityWidgetBlueprint, LearnosityWidgetType, LoadPackageResult, ManifestResource, MapActivityToTestResult, NormalizedClozeassociationPossibleResponses, type OutputFormat, ParseLearnosityItemResult, ParseManifestResult, QtiAction, QtiAssessmentItem, QtiAssessmentSection, QtiAssessmentStimulus, QtiAssessmentTest, QtiAssociableChoice, QtiAssociableHotspot, QtiAssociateInteraction, QtiBaseValue, QtiChoice, QtiChoiceInteraction, QtiContentPackage, QtiCorrect, QtiCorrectResponse, QtiDirectedPair, QtiDirectedPairMatch, QtiDrawingInteraction, QtiExpression, QtiExtendedTextInteraction, QtiFeedbackBlock, QtiGapEntry, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicGapMatchInteraction, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceEntry, QtiInlineChoiceInteraction, QtiInteraction, QtiItemRef, QtiLayout, QtiLayoutColumn, QtiLayoutWidget, QtiLomClassification, QtiLomMetadata, QtiMapEntry, QtiMapping, QtiMatchInteraction, QtiMax, QtiModalFeedback, QtiOrderInteraction, QtiOutcomeDeclaration, QtiResponseCondition, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiResponseProcessing, QtiSelection, QtiSetOutcomeValue, QtiSimpleAssociableChoice, QtiStringMatch, QtiSubtract, QtiTestPart, QtiTextEntry, QtiTextEntryInteraction, QtiTimeLimits, QtiUploadInteraction, QtiVariable, type QtiVersion, ReadZipResult, ResponseProcessingStrategy, SavePackageResult, SerializeTestOptions, SerializeTestResult, WriteBundleOptions, WriteBundleResult, ZipEntryMeta, ZipFileEntry, addFileContext, addFileContextIfProvided, buildManifest, buildPackageFromActivity, convertActivity, convertAssessmentTestToLearnosityActivity, convertLearnosityToQti, convertLearnosityToQtiPackage, convertQtiAssessmentItemToLearnosity, convertQtiPackageToLearnosity, convertQtiPackageToLearnosityBundle, convertQtiToLearnosity, countByLevel, createDiagnostic, downgradeAssessmentItemToQti21, downgradeAssessmentTestToQti21, ensureUniqueFolderName, filterByLevel, filterOutCodes, formatDiagnosticsReport, hasErrors, isPathSafe as isBundlePathSafe, isPathSafe$1 as isPathSafe, isSymlink, loadLearnosityBundle, loadQtiContentPackage, mapActivityToTest, mapLearnosityToAst, mergeDiagnostics, parseLearnosityItem, parseManifest, readZip, safeResolve, sanitizeFolderName, saveQtiContentPackage, serializeAssessmentItem, serializeAssessmentTest, validateZipEntryPath, writeLearnosityBundle, writeZip };
|
|
2658
|
+
//# sourceMappingURL=index.d.ts.map
|