@learnosity/lib-qti-converter 0.10.4 → 0.12.1

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