@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.
@@ -1,3 +1,28 @@
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
1
26
  //#region src/types.d.ts
2
27
  /**
3
28
  * Diagnostic levels
@@ -54,6 +79,9 @@ declare const DiagnosticCode: {
54
79
  readonly LRN_CLOZE_VALID_RESPONSE_LEN_MISMATCH: "LRN_CLOZE_VALID_RESPONSE_LEN_MISMATCH";
55
80
  readonly LRN_CLOZE_MISSING_CORRECT_RESPONSE: "LRN_CLOZE_MISSING_CORRECT_RESPONSE";
56
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";
57
85
  readonly LRN_LONGTEXT_UNSUPPORTED_VALIDATION_KEY: "LRN_LONGTEXT_UNSUPPORTED_VALIDATION_KEY";
58
86
  readonly LRN_LONGTEXT_MAX_LENGTH_IGNORED: "LRN_LONGTEXT_MAX_LENGTH_IGNORED";
59
87
  readonly LRN_LONGTEXT_MAX_SCORE_IGNORED: "LRN_LONGTEXT_MAX_SCORE_IGNORED";
@@ -71,6 +99,7 @@ declare const DiagnosticCode: {
71
99
  readonly LRN_CLOZEASSOCIATION_MISSING_POSSIBLE_RESPONSES: "LRN_CLOZEASSOCIATION_MISSING_POSSIBLE_RESPONSES";
72
100
  readonly LRN_CLOZEASSOCIATION_UNSUPPORTED_SCORING: "LRN_CLOZEASSOCIATION_UNSUPPORTED_SCORING";
73
101
  readonly LRN_CLOZEASSOCIATION_DUPLICATE_RESPONSE: "LRN_CLOZEASSOCIATION_DUPLICATE_RESPONSE";
102
+ readonly LRN_CLASSIFICATION_CELL_ORDER_ASSUMED: "LRN_CLASSIFICATION_CELL_ORDER_ASSUMED";
74
103
  readonly LRN_TOKENHIGHLIGHT_UNSUPPORTED_SCORING: "LRN_TOKENHIGHLIGHT_UNSUPPORTED_SCORING";
75
104
  readonly LRN_TOKENHIGHLIGHT_NO_TOKENS: "LRN_TOKENHIGHLIGHT_NO_TOKENS";
76
105
  readonly LRN_TOKENHIGHLIGHT_INVALID_TOKEN_INDEX: "LRN_TOKENHIGHLIGHT_INVALID_TOKEN_INDEX";
@@ -100,6 +129,7 @@ declare const DiagnosticCode: {
100
129
  readonly QTI_TEXT_ENTRY_NO_DECLARATION: "QTI_TEXT_ENTRY_NO_DECLARATION";
101
130
  readonly QTI_TEXT_ENTRY_MULTIPLE_VALUES: "QTI_TEXT_ENTRY_MULTIPLE_VALUES";
102
131
  readonly QTI_ALT_RESPONSES_TRIMMED: "QTI_ALT_RESPONSES_TRIMMED";
132
+ readonly QTI_SHUFFLE_NOT_SUPPORTED: "QTI_SHUFFLE_NOT_SUPPORTED";
103
133
  readonly QTI_METADATA_TAG_TOO_LONG: "QTI_METADATA_TAG_TOO_LONG";
104
134
  readonly QTI_METADATA_TAG_TRUNCATED: "QTI_METADATA_TAG_TRUNCATED";
105
135
  readonly QTI_EXTENDED_TEXT_MULTIPLE_INTERACTIONS: "QTI_EXTENDED_TEXT_MULTIPLE_INTERACTIONS";
@@ -220,6 +250,12 @@ interface ConversionOptions {
220
250
  customAssetUrl?: string;
221
251
  itemReferenceSource?: ItemReferenceSource;
222
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;
223
259
  }
224
260
  /**
225
261
  * Result of a conversion operation
@@ -361,1259 +397,1196 @@ declare function createDiagnostic(level: 'error' | 'warning' | 'info', code: str
361
397
  */
362
398
  declare function mergeDiagnostics(...diagnosticArrays: Diagnostic[][]): Diagnostic[];
363
399
  //#endregion
364
- //#region src/qti-to-learnosity/types.d.ts
400
+ //#region src/learnosity-model/types.d.ts
365
401
  /**
366
- * Learnosity Item JSON types for output (QTI → Learnosity conversion)
367
- * TASK 011 / Updated for new format
402
+ * Learnosity Item Model types
403
+ *
404
+ * Strict typed models for validated Learnosity Items.
405
+ * Do not use for parsing - use parseLearnosityItem.ts instead.
368
406
  */
369
407
  /**
370
- * Learnosity tag object
408
+ * Widget type in item definition
371
409
  */
372
- type LearnosityTags = Record<string, string[]>;
410
+ type LearnosityWidgetType = 'response' | 'feature';
373
411
  /**
374
- * Learnosity Item metadata
412
+ * Widget blueprint entry
375
413
  */
376
- interface LearnosityItemMetadata$1 {
414
+ interface LearnosityWidgetBlueprint {
377
415
  reference: string;
378
- title?: string;
379
- content?: string;
380
- definition: {
381
- widgets: {
382
- reference: string;
383
- widget_type?: string;
384
- }[];
385
- };
386
- status?: 'published';
387
- tags?: LearnosityTags;
416
+ widget_type: LearnosityWidgetType;
388
417
  }
389
418
  /**
390
- * Learnosity feature JSON structure for file output
419
+ * Item tag
391
420
  */
392
- interface LearnosityFeatureJson {
393
- reference: string;
421
+ interface LearnosityTag {
394
422
  type: string;
395
- widget_type: 'feature';
396
- data: {
397
- type: string;
398
- content?: string;
399
- heading?: string;
400
- [key: string]: unknown;
401
- };
423
+ name: string;
402
424
  }
403
425
  /**
404
- * Learnosity Item JSON structure for file output
426
+ * Item definition
405
427
  */
406
- interface LearnosityItemJson {
407
- item: LearnosityItemMetadata$1;
408
- questions: LearnosityQuestionJson[];
409
- features: LearnosityFeatureJson[];
428
+ interface LearnosityItemDefinition {
429
+ widgets: LearnosityWidgetBlueprint[];
410
430
  }
411
431
  /**
412
- * Learnosity Question JSON (MCQ, clozetext, longtextV2, shorttext, choicematrix, clozeassociation, or clozedropdown)
432
+ * Item metadata
413
433
  */
414
- type LearnosityQuestionJson = LearnosityMcqQuestionJson | LearnosityClozetextQuestionJson | LearnosityLongtextV2QuestionJson | LearnosityShorttextQuestionJson | LearnosityChoicematrixQuestionJson | LearnosityClozeassociationQuestionJson | LearnosityClozedropdownQuestionJson | LearnosityImageclozeassociationV2QuestionJson;
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
+ }
415
445
  /**
416
- * Learnosity MCQ Question JSON
446
+ * MCQ option
417
447
  */
418
- interface LearnosityMcqQuestionJson {
419
- reference: string;
420
- widget_type?: string;
421
- type: 'mcq';
422
- data: {
423
- type: 'mcq';
424
- stimulus: string;
425
- options: {
426
- label: string;
427
- value: string;
428
- }[];
429
- validation?: {
430
- scoring_type?: 'exactMatch';
431
- valid_response?: {
432
- value: string | string[];
433
- score: number;
434
- };
435
- };
436
- };
437
- metadata?: {
438
- distractor_rationale?: string;
439
- distractor_rationale_response_level?: Record<string, string>;
440
- };
448
+ interface LearnosityMcqOption {
449
+ label: string;
450
+ value: string | number;
441
451
  }
442
452
  /**
443
- * Learnosity clozetext Question JSON
453
+ * MCQ validation
444
454
  */
445
- interface LearnosityClozetextQuestionJson {
446
- reference: string;
447
- widget_type?: string;
448
- type: 'clozetext';
449
- data: {
450
- type: 'clozetext';
451
- stimulus?: string;
452
- instructor_stimulus?: string;
453
- template: string;
454
- validation?: {
455
- scoring_type?: 'exactMatch';
456
- valid_response?: {
457
- value: string[];
458
- score: number;
459
- };
460
- alt_responses?: {
461
- value: string[];
462
- score: number;
463
- }[];
464
- };
455
+ interface LearnosityMcqValidation {
456
+ scoring_type?: string;
457
+ valid_response?: {
458
+ value?: (string | number)[];
459
+ score?: number;
465
460
  };
461
+ penalty?: number;
466
462
  }
467
463
  /**
468
- * Learnosity longtextV2 Question JSON (essay/extended response)
464
+ * MCQ UI style
469
465
  */
470
- interface LearnosityLongtextV2QuestionJson {
471
- reference: string;
472
- widget_type?: string;
473
- type: 'longtextV2';
474
- data: {
475
- type: 'longtextV2';
476
- stimulus?: string;
477
- max_length?: number;
478
- validation?: {
479
- max_score?: number;
480
- };
481
- };
466
+ interface LearnosityMcqUiStyle {
467
+ type?: string;
482
468
  }
483
469
  /**
484
- * Learnosity shorttext Question JSON (short answer)
470
+ * Common metadata for all question types
485
471
  */
486
- interface LearnosityShorttextQuestionJson {
487
- reference: string;
488
- widget_type?: string;
489
- type: 'shorttext';
490
- data: {
491
- type: 'shorttext';
492
- stimulus: string;
493
- instructor_stimulus?: string;
494
- validation?: {
495
- scoring_type?: 'exactMatch';
496
- valid_response?: {
497
- value: string | string[];
498
- score: number;
499
- };
500
- alt_responses?: {
501
- value: string | string[];
502
- score: number;
503
- }[];
504
- };
505
- };
472
+ interface LearnosityQuestionMetadata {
473
+ distractor_rationale?: string;
506
474
  }
507
475
  /**
508
- * Learnosity choicematrix Question JSON (matching/matrix)
476
+ * MCQ metadata for feedback (extends common metadata with per-option feedback)
509
477
  */
510
- interface LearnosityChoicematrixQuestionJson {
511
- reference: string;
512
- widget_type?: string;
513
- type: 'choicematrix';
514
- data: {
515
- type: 'choicematrix';
516
- stimulus: string;
517
- stems: string[];
518
- options: string[];
519
- validation?: {
520
- scoring_type?: 'exactMatch';
521
- valid_response?: {
522
- score: number;
523
- value: number[][];
524
- };
525
- };
526
- ui_style?: {
527
- type: 'table' | 'inline';
528
- horizontal_lines?: boolean;
529
- };
530
- shuffle_options?: boolean;
531
- };
478
+ interface LearnosityMcqMetadata extends LearnosityQuestionMetadata {
479
+ distractor_rationale_response_level?: string[] | Record<string, string>;
532
480
  }
533
481
  /**
534
- * Learnosity clozeassociation Question JSON (drag-and-drop cloze)
482
+ * MCQ question data (only supported type in v1)
535
483
  */
536
- interface LearnosityClozeassociationQuestionJson {
537
- reference: string;
538
- widget_type?: string;
539
- type: 'clozeassociation';
540
- data: {
541
- type: 'clozeassociation';
542
- template: string;
543
- possible_responses: string[];
544
- shuffle_options?: boolean;
545
- stimulus?: string;
546
- validation?: {
547
- scoring_type?: 'exactMatch';
548
- valid_response?: {
549
- value: string[];
550
- score: number;
551
- };
552
- };
553
- };
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;
554
496
  }
555
497
  /**
556
- * Learnosity clozedropdown Question JSON (dropdown cloze)
498
+ * Clozetext validation
557
499
  */
558
- interface LearnosityClozedropdownQuestionJson {
559
- reference: string;
560
- widget_type?: string;
561
- type: 'clozedropdown';
562
- data: {
563
- type: 'clozedropdown';
564
- template: string;
565
- possible_responses: string[][];
566
- stimulus?: string;
567
- validation?: {
568
- scoring_type?: 'exactMatch';
569
- valid_response?: {
570
- value: string[];
571
- score: number;
572
- };
573
- };
500
+ interface LearnosityClozetextValidation {
501
+ scoring_type?: string;
502
+ valid_response?: {
503
+ value?: (string | null)[];
504
+ score?: number;
574
505
  };
506
+ penalty?: number;
575
507
  }
576
508
  /**
577
- * Learnosity imageclozeassociationV2 Question JSON (graphic gap match)
509
+ * Clozetext response container (shared settings for all response fields)
578
510
  */
579
- interface LearnosityImageclozeassociationV2QuestionJson {
580
- reference: string;
581
- widget_type?: string;
582
- type: 'imageclozeassociationV2';
583
- data: Record<string, unknown>;
511
+ interface LearnosityClozetextResponseContainer {
512
+ input_type?: 'text' | 'number';
513
+ max_length?: number;
584
514
  }
585
- //#endregion
586
- //#region src/qti-package/types.d.ts
587
515
  /**
588
- * QTI Content Package types for IMS Content Packaging
516
+ * Clozetext question data (vNext)
589
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
+ }
590
531
  /**
591
- * Metadata about a ZIP entry
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).
592
536
  */
593
- interface ZipEntryMeta {
594
- /** Normalized path (forward slashes, relative, no ..) */
595
- file: string;
596
- /** Entry size in bytes */
597
- size: number;
598
- /** Raw buffer data */
599
- data: Buffer;
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;
600
565
  }
601
566
  /**
602
- * Reference to an assessment item XML file
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).
603
571
  */
604
- interface AssessmentItemRef {
605
- /** Unique identifier for this item */
606
- identifier: string;
607
- /** Path to the .xml file */
608
- href: string;
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;
609
607
  }
610
608
  /**
611
- * Reference to an asset (image, CSS, etc.)
609
+ * LongtextV2 validation
612
610
  */
613
- interface AssetRef {
614
- /** Unique identifier for this asset */
615
- identifier: string;
616
- /** Path to the asset file */
617
- href: string;
618
- /** MIME type if known */
619
- type?: string;
611
+ interface LearnosityLongtextV2Validation {
612
+ max_score?: number;
620
613
  }
621
614
  /**
622
- * A resource in the manifest
615
+ * LongtextV2 question data (vNext, essay/extended response)
623
616
  */
624
- interface ManifestResource {
625
- /** Unique identifier for this resource */
626
- identifier: string;
627
- /** Resource type (e.g., "imsqti_item_xmlv2p2", "webcontent") */
628
- type: string;
629
- /** Primary file for this resource */
630
- href: string;
631
- /** Additional files referenced by this resource */
632
- files?: string[];
633
- /** Dependencies on other resources */
634
- dependencies?: Array<{
635
- identifierref: string;
636
- }>;
637
- /** Raw XML content of the metadata block (if present) */
638
- metadataXml?: string;
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;
639
626
  }
640
627
  /**
641
- * Parsed QTI Content Package
628
+ * FormulaessayV2 question data (alias of longtextV2, produces extendedTextInteraction)
642
629
  */
643
- interface QtiContentPackage {
644
- /** Path to the ZIP file (for diagnostics) */
645
- zipPath: string;
646
- /** Parsed manifest resources */
647
- resources: ManifestResource[];
648
- /** All ZIP entries (path -> metadata) */
649
- entries: Map<string, ZipEntryMeta>;
650
- /** Assessment items extracted from manifest */
651
- items: AssessmentItemRef[];
652
- /** Assets extracted from manifest */
653
- assets: AssetRef[];
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>;
654
638
  }
655
- //#endregion
656
- //#region src/qti-package/pathSafety.d.ts
657
639
  /**
658
- * ZIP entry path safety validation (zip-slip protection)
640
+ * ChemistryessayV2 question data (alias of longtextV2, produces extendedTextInteraction)
659
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
+ }
660
651
  /**
661
- * Validates that a ZIP entry path is safe to extract
662
- *
663
- * Rejects:
664
- * - Absolute paths (starting with / or drive letter)
665
- * - Path traversal attempts (..)
666
- * - Backslashes (normalizes to forward slashes)
667
- *
668
- * @param entryPath Raw path from ZIP entry
669
- * @returns Normalized safe path, or null if unsafe
652
+ * Plaintext UI style
670
653
  */
671
- declare function validateZipEntryPath(entryPath: string): string | null;
654
+ interface LearnosityPlaintextUiStyle {
655
+ min_height?: string;
656
+ max_height?: string;
657
+ }
672
658
  /**
673
- * Checks if a path is safe for extraction
674
- *
675
- * @param entryPath Raw path from ZIP entry
676
- * @returns true if safe, false if unsafe
659
+ * Plaintext question data (plain text input, no formatting)
677
660
  */
678
- declare function isPathSafe$1(entryPath: string): boolean;
679
- //#endregion
680
- //#region src/qti-package/readZip.d.ts
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
+ }
681
675
  /**
682
- * Result of reading a ZIP file
676
+ * Shorttext validation
683
677
  */
684
- interface ReadZipResult {
685
- /** Entries mapped by normalized path */
686
- entries: Map<string, ZipEntryMeta>;
687
- /** Diagnostics from reading (warnings for unsafe entries) */
688
- diagnostics: Diagnostic[];
678
+ interface LearnosityShorttextValidation {
679
+ scoring_type?: string;
680
+ valid_response?: {
681
+ value?: string | string[];
682
+ score?: number;
683
+ };
684
+ penalty?: number;
689
685
  }
690
686
  /**
691
- * Reads a ZIP file and extracts all entries with safety validation
692
- *
693
- * Rejects entries with:
694
- * - Absolute paths
695
- * - Path traversal attempts (..)
696
- * - Invalid path structure
697
- *
698
- * @param zipPath Path to the ZIP file
699
- * @returns Map of safe entries and diagnostics
687
+ * Shorttext question data (single short answer)
700
688
  */
701
- declare function readZip(zipPath: string): ReadZipResult;
702
- //#endregion
703
- //#region src/qti-package/writeZip.d.ts
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
+ }
704
700
  /**
705
- * Deterministic ZIP writing with sorted entries and fixed timestamps
701
+ * Clozedropdown validation
706
702
  */
703
+ interface LearnosityClozedropdownValidation {
704
+ scoring_type?: string;
705
+ valid_response?: {
706
+ value?: string[];
707
+ score?: number;
708
+ };
709
+ penalty?: number;
710
+ }
707
711
  /**
708
- * File entry to write to ZIP
712
+ * Clozedropdown question data (inline dropdown/select menus in text)
709
713
  */
710
- interface ZipFileEntry {
711
- /** Path in the ZIP (forward slashes, relative) */
712
- path: string;
713
- /** File content as Buffer or string */
714
- content: Buffer | string;
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;
715
724
  }
716
725
  /**
717
- * Writes files to a ZIP archive with deterministic output
718
- *
719
- * Features:
720
- * - Entries sorted alphabetically by path
721
- * - Fixed timestamp (2000-01-01 00:00:00 UTC) for reproducibility
722
- * - Consistent compression settings
723
- *
724
- * @param zipPath Output ZIP file path
725
- * @param files Array of files to include
726
+ * Clozeassociation validation
726
727
  */
727
- declare function writeZip(zipPath: string, files: ZipFileEntry[]): void;
728
- //#endregion
729
- //#region src/qti-package/parseManifest.d.ts
728
+ interface LearnosityClozeassociationValidation {
729
+ scoring_type?: string;
730
+ valid_response?: {
731
+ value?: string[];
732
+ score?: number;
733
+ };
734
+ penalty?: number;
735
+ }
730
736
  /**
731
- * Result of parsing a manifest
737
+ * Clozeassociation possible response group (for grouped UI display)
732
738
  */
733
- interface ParseManifestResult {
734
- /** Parsed resources */
735
- resources: ManifestResource[];
736
- /** Diagnostics from parsing */
737
- diagnostics: Diagnostic[];
739
+ interface LearnosityClozeassociationResponseGroup {
740
+ title: string;
741
+ responses: string[];
738
742
  }
739
743
  /**
740
- * Parses an imsmanifest.xml file to extract resources
741
- *
742
- * Extracts:
743
- * - Resource identifier, type, href
744
- * - Associated file references
745
- * - Metadata XML blocks (for LOM metadata extraction)
746
- *
747
- * @param manifestXml XML content of imsmanifest.xml
748
- * @param zipPath Path to ZIP (for diagnostics)
749
- * @returns Parsed resources and diagnostics
744
+ * Normalized possible responses for clozeassociation (internal representation)
750
745
  */
751
- declare function parseManifest(manifestXml: string, zipPath: string): ParseManifestResult;
752
- //#endregion
753
- //#region src/qti-package/buildManifest.d.ts
754
- /**
755
- * Generates a minimal valid imsmanifest.xml from resources
756
- *
757
- * Creates IMS Content Packaging 1.2 compliant manifest with:
758
- * - Standard namespace declarations
759
- * - Organization structure (empty)
760
- * - Resources section with provided resources
761
- *
762
- * @param resources Array of resources to include
763
- * @returns XML string for imsmanifest.xml
764
- */
765
- declare function buildManifest(resources: ManifestResource[]): string;
766
- //#endregion
767
- //#region src/qti-package/loadPackage.d.ts
768
- /**
769
- * Result of loading a QTI Content Package
770
- */
771
- interface LoadPackageResult {
772
- /** Loaded package (undefined if errors occurred) */
773
- package?: QtiContentPackage;
774
- /** Diagnostics from loading */
775
- diagnostics: Diagnostic[];
746
+ interface NormalizedClozeassociationPossibleResponses {
747
+ mode: 'flat' | 'grouped';
748
+ flat: string[];
749
+ groups?: LearnosityClozeassociationResponseGroup[];
776
750
  }
777
751
  /**
778
- * Loads a QTI Content Package from a ZIP file
779
- *
780
- * Steps:
781
- * 1. Read ZIP with safety validation
782
- * 2. Find and parse imsmanifest.xml
783
- * 3. Extract item and asset references
784
- * 4. Validate referenced files exist
785
- *
786
- * @param zipPath Path to the ZIP file
787
- * @returns Loaded package and diagnostics
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
788
756
  */
789
- declare function loadQtiContentPackage(zipPath: string): LoadPackageResult;
790
- //#endregion
791
- //#region src/qti-package/savePackage.d.ts
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
+ }
792
771
  /**
793
- * Result of saving a QTI Content Package
772
+ * Sharedpassage feature data (rich text passage)
794
773
  */
795
- interface SavePackageResult {
796
- /** Diagnostics from saving */
797
- diagnostics: Diagnostic[];
774
+ interface LearnositySharedpassageData {
775
+ type: 'sharedpassage';
776
+ heading?: string;
777
+ content: string;
778
+ instructor_stimulus?: string;
779
+ paginated_content?: boolean;
780
+ pages?: string[];
798
781
  }
799
782
  /**
800
- * Saves a QTI Content Package to a ZIP file or directory
801
- *
802
- * Steps:
803
- * 1. Build imsmanifest.xml from resources
804
- * 2. Collect all file entries
805
- * 3. Write to ZIP or directory based on output path
806
- *
807
- * @param pkg Package to save
808
- * @param outputPath Output ZIP file path or directory path
809
- * @returns Diagnostics from saving
783
+ * Audioplayer feature data
810
784
  */
811
- declare function saveQtiContentPackage(pkg: QtiContentPackage, outputPath: string): SavePackageResult;
812
- //#endregion
813
- //#region src/qti-to-learnosity/convertQtiPackageToLearnosityBundle.d.ts
814
- interface ConvertQtiPackageToLearnosityBundleOptions {
815
- qtiVersion?: '2.1' | '2.2';
816
- organisationId?: number;
817
- mediaVault?: boolean;
818
- customAssetUrl?: string;
819
- itemReferenceSource?: ItemReferenceSource;
820
- itemFilenameSource?: ItemFilenameSource;
821
- packageVersion?: string;
822
- truncateTags?: boolean;
823
- }
824
- interface ConvertQtiPackageToLearnosityBundleResult {
825
- bundle?: {
826
- manifest: unknown;
827
- activities: Map<string, unknown>;
828
- items: Map<string, unknown>;
829
- assets: Map<string, Uint8Array>;
830
- itemFilenames?: Map<string, string>;
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;
831
794
  };
832
- diagnostics: Diagnostic[];
833
- convertedSourceFiles?: string[];
834
- failedSourceFiles?: string[];
835
- convertedActivityFiles?: string[];
836
795
  }
837
796
  /**
838
- * Convert QTI Content Package to Learnosity Bundle
839
- */
840
- declare function convertQtiPackageToLearnosityBundle(input: {
841
- zipBytes?: Uint8Array;
842
- dirPath?: string;
843
- }, opts?: ConvertQtiPackageToLearnosityBundleOptions): ConvertQtiPackageToLearnosityBundleResult;
844
- //#endregion
845
- //#region src/conversions.d.ts
846
- /**
847
- * Convert QTI XML to Learnosity JSON
848
- * @param input - QTI XML string
849
- * @param opts - Conversion options
850
- * @returns Learnosity JSON and diagnostics
851
- */
852
- declare function convertQtiToLearnosity(input: string, opts: ConversionOptions): Promise<ConversionResult<LearnosityItemJson | undefined>>;
853
- /**
854
- * Convert Learnosity JSON to QTI XML
855
- * @param input - Learnosity JSON object
856
- * @param opts - Conversion options
857
- * @returns QTI XML string and diagnostics
858
- */
859
- declare function convertLearnosityToQti(input: LearnosityItemJson | Record<string, unknown>, opts: ConversionOptions): Promise<ConversionResult<string>>;
860
- /**
861
- * Options for converting a QTI Content Package to a Learnosity bundle
797
+ * Videoplayer feature data
862
798
  */
863
- interface ConvertQtiPackageToLearnosityOptions {
864
- /** Path to QTI package directory, or path to a .zip file */
865
- inputPath?: string;
866
- /** Raw ZIP bytes (alternative to inputPath for in-memory ZIP data) */
867
- zipBytes?: Uint8Array;
868
- /** Output path to write the Learnosity bundle (directory or .zip). Omit to skip writing. */
869
- outputPath?: string;
870
- /** Organisation ID for Learnosity CDN asset URLs */
871
- organisationId?: number;
872
- /** Use media-vault subdomain instead of assets for CDN URLs */
873
- mediaVault?: boolean;
874
- /** Custom base URL for assets (overrides default Learnosity CDN and mediaVault) */
875
- customAssetUrl?: string;
876
- /** How to generate item references (default: 'sourceFilename') */
877
- itemReferenceSource?: ItemReferenceSource;
878
- /** How to generate output filenames (defaults to itemReferenceSource) */
879
- itemFilenameSource?: ItemFilenameSource;
880
- /** Truncate tag types and names to 255 characters instead of failing */
881
- truncateTags?: boolean;
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
+ };
882
808
  }
883
809
  /**
884
- * Result of converting a QTI Content Package to Learnosity
810
+ * Orderlist validation
885
811
  */
886
- interface ConvertQtiPackageToLearnosityResult {
887
- /**
888
- * The converted Learnosity bundle (in-memory).
889
- * Only populated when no `outputPath` was provided (in-memory mode).
890
- * Undefined when writing to disk (use the output files instead) or if conversion failed.
891
- */
892
- bundle?: ConvertQtiPackageToLearnosityBundleResult['bundle'];
893
- /** All diagnostics from conversion and writing */
894
- diagnostics: Diagnostic[];
895
- /** Item source file paths that were successfully converted */
896
- convertedSourceFiles?: string[];
897
- /** Item source file paths that failed conversion */
898
- failedSourceFiles?: string[];
899
- /** Activity/test source file paths that were converted */
900
- convertedActivityFiles?: string[];
812
+ interface LearnosityOrderlistValidation {
813
+ scoring_type?: string;
814
+ valid_response?: {
815
+ value: number[];
816
+ score?: number;
817
+ };
818
+ unscored?: boolean;
819
+ penalty?: number;
901
820
  }
902
821
  /**
903
- * Convert a QTI Content Package to a Learnosity bundle.
904
- *
905
- * Accepts either a path to a directory/ZIP or raw ZIP bytes. Converts all items
906
- * and activities in the package. Optionally writes the result to disk.
907
- *
908
- * **Output behaviour:**
909
- * - With `outputPath`: writes the bundle to disk and returns only `diagnostics` + summary
910
- * (`convertedSourceFiles`, `failedSourceFiles`). `bundle` will be `undefined`.
911
- * - Without `outputPath`: returns the full in-memory `bundle` for programmatic use.
912
- *
913
- * @param opts - Conversion options including input, output, and conversion settings
914
- * @returns Diagnostics + summary always; `bundle` only when no `outputPath` is given
915
- */
916
- declare function convertQtiPackageToLearnosity(opts: ConvertQtiPackageToLearnosityOptions): Promise<ConvertQtiPackageToLearnosityResult>;
917
- /**
918
- * Options for converting a Learnosity bundle to a QTI Content Package
822
+ * Orderlist question data (ordering/sequencing)
919
823
  */
920
- interface ConvertLearnosityToQtiPackageOptions {
921
- /** Path to the Learnosity bundle directory */
922
- inputPath: string;
923
- /** Activity reference(s) to convert. Omit to convert all activities in the bundle. */
924
- activityRefs?: string[];
925
- /** Output path to write the QTI package (.zip or directory). Omit to skip writing. */
926
- outputPath?: string;
927
- /** QTI version (default: '2.1') */
928
- qtiVersion?: QtiVersion;
929
- /** Pretty-print XML output */
930
- pretty?: boolean;
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;
931
833
  }
932
834
  /**
933
- * Result of converting a Learnosity bundle to a QTI Content Package
835
+ * Tokenhighlight validation
934
836
  */
935
- interface ConvertLearnosityToQtiPackageResult {
936
- /** The built QTI Content Package (in-memory). Undefined if conversion failed. */
937
- package?: QtiContentPackage;
938
- /** All diagnostics from loading, conversion, building, and writing */
939
- diagnostics: Diagnostic[];
837
+ interface LearnosityTokenhighlightValidation {
838
+ scoring_type?: string;
839
+ valid_response?: {
840
+ value: number[];
841
+ score?: number;
842
+ };
843
+ penalty?: number;
940
844
  }
941
845
  /**
942
- * Convert a Learnosity bundle to a QTI Content Package.
943
- *
944
- * Loads the bundle from disk, converts the specified activities (or all), builds
945
- * the QTI Content Package, and optionally writes it to disk.
946
- *
947
- * @param opts - Conversion options including input, output, and conversion settings
948
- * @returns The built QTI Content Package (in-memory) and diagnostics
949
- */
950
- declare function convertLearnosityToQtiPackage(opts: ConvertLearnosityToQtiPackageOptions): ConvertLearnosityToQtiPackageResult;
951
- //#endregion
952
- //#region src/learnosity-model/types.d.ts
953
- /**
954
- * Learnosity Item Model types
955
- *
956
- * Strict typed models for validated Learnosity Items.
957
- * Do not use for parsing - use parseLearnosityItem.ts instead.
958
- */
959
- /**
960
- * Widget type in item definition
846
+ * Tokenhighlight question data (highlight selectable tokens in text)
961
847
  */
962
- type LearnosityWidgetType = 'response' | 'feature';
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
+ }
963
858
  /**
964
- * Widget blueprint entry
859
+ * Choicematrix validation
965
860
  */
966
- interface LearnosityWidgetBlueprint {
967
- reference: string;
968
- widget_type: LearnosityWidgetType;
861
+ interface LearnosityChoicematrixValidation {
862
+ scoring_type?: 'exactMatch';
863
+ valid_response?: {
864
+ value?: number[][];
865
+ score?: number;
866
+ };
969
867
  }
970
868
  /**
971
- * Item tag
869
+ * Choicematrix UI style
972
870
  */
973
- interface LearnosityTag {
974
- type: string;
975
- name: string;
871
+ interface LearnosityChoicematrixUiStyle {
872
+ type?: 'table' | 'inline';
873
+ horizontal_lines?: boolean;
976
874
  }
977
875
  /**
978
- * Item definition
876
+ * Choicematrix question data (matrix of options per stem/row)
979
877
  */
980
- interface LearnosityItemDefinition {
981
- widgets: LearnosityWidgetBlueprint[];
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;
982
889
  }
983
- /**
984
- * Item metadata
890
+ /** * Hotspot image
985
891
  */
986
- interface LearnosityItemMetadata {
987
- reference: string;
988
- content: string;
989
- title?: string | null;
990
- description?: string;
991
- tags?: LearnosityTag[];
992
- tagsObject?: Record<string, string[]>;
993
- status?: string;
994
- definition: LearnosityItemDefinition;
995
- distractor_rationale?: string;
892
+ interface LearnosityHotspotImage {
893
+ source: string;
894
+ width: number;
895
+ height: number;
896
+ alt?: string;
996
897
  }
997
898
  /**
998
- * MCQ option
899
+ * Hotspot polygon point (percentages)
999
900
  */
1000
- interface LearnosityMcqOption {
1001
- label: string;
1002
- value: string | number;
901
+ interface LearnosityHotspotPoint {
902
+ x: number;
903
+ y: number;
1003
904
  }
1004
905
  /**
1005
- * MCQ validation
906
+ * Hotspot validation
1006
907
  */
1007
- interface LearnosityMcqValidation {
1008
- scoring_type?: string;
908
+ interface LearnosityHotspotValidation {
909
+ scoring_type?: 'exactMatch';
1009
910
  valid_response?: {
1010
911
  value?: (string | number)[];
1011
912
  score?: number;
1012
913
  };
1013
- penalty?: number;
1014
914
  }
1015
915
  /**
1016
- * MCQ UI style
916
+ * Hotspot question data (click areas on image)
1017
917
  */
1018
- interface LearnosityMcqUiStyle {
1019
- type?: string;
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;
1020
928
  }
1021
- /**
1022
- * Common metadata for all question types
929
+ /** * Imageclozeassociation image definition
1023
930
  */
1024
- interface LearnosityQuestionMetadata {
1025
- distractor_rationale?: string;
931
+ interface LearnosityImageclozeassociationV2Image {
932
+ src: string;
933
+ width?: number;
934
+ height?: number;
935
+ alt?: string;
936
+ title?: string;
1026
937
  }
1027
938
  /**
1028
- * MCQ metadata for feedback (extends common metadata with per-option feedback)
939
+ * Imageclozeassociation response container (drop zone)
1029
940
  */
1030
- interface LearnosityMcqMetadata extends LearnosityQuestionMetadata {
1031
- distractor_rationale_response_level?: string[] | Record<string, string>;
941
+ interface LearnosityImageclozeassociationV2ResponseContainer {
942
+ x: number;
943
+ y: number;
944
+ width: string;
945
+ height: string;
946
+ aria_label?: string;
1032
947
  }
1033
948
  /**
1034
- * MCQ question data (only supported type in v1)
949
+ * Imageclozeassociation possible response group (for grouped UI display)
1035
950
  */
1036
- interface LearnosityMcqData {
1037
- type: 'mcq';
1038
- stimulus: string;
1039
- instructor_stimulus?: string;
1040
- options: LearnosityMcqOption[];
1041
- validation?: LearnosityMcqValidation;
1042
- ui_style?: LearnosityMcqUiStyle;
1043
- multiple_responses?: boolean;
1044
- min_selection?: number;
1045
- max_selection?: number;
1046
- shuffle_options?: boolean;
1047
- metadata?: LearnosityMcqMetadata;
951
+ interface LearnosityImageclozeassociationV2ResponseGroup {
952
+ title: string;
953
+ responses: string[];
1048
954
  }
1049
955
  /**
1050
- * Clozetext validation
956
+ * Imageclozeassociation validation
1051
957
  */
1052
- interface LearnosityClozetextValidation {
1053
- scoring_type?: string;
958
+ interface LearnosityImageclozeassociationV2Validation {
959
+ scoring_type?: 'exactMatch' | 'partialMatch' | 'partialMatchV2' | 'partialMatchPerResponse';
1054
960
  valid_response?: {
1055
- value?: (string | null)[];
961
+ value?: string[][];
1056
962
  score?: number;
1057
963
  };
1058
964
  penalty?: number;
1059
965
  }
1060
966
  /**
1061
- * Clozetext response container (shared settings for all response fields)
1062
- */
1063
- interface LearnosityClozetextResponseContainer {
1064
- input_type?: 'text' | 'number';
1065
- max_length?: number;
1066
- }
1067
- /**
1068
- * Clozetext question data (vNext)
967
+ * Imageclozeassociation question data (drag text onto image zones)
1069
968
  */
1070
- interface LearnosityClozetextData {
1071
- type: 'clozetext';
969
+ interface LearnosityImageclozeassociationV2Data {
970
+ type: 'imageclozeassociationV2';
1072
971
  stimulus?: string;
1073
972
  instructor_stimulus?: string;
1074
- template: string;
1075
- validation?: LearnosityClozetextValidation;
1076
- case_sensitive?: boolean;
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;
1077
983
  ui_style?: Record<string, unknown>;
1078
984
  metadata?: LearnosityQuestionMetadata;
1079
- response_container?: LearnosityClozetextResponseContainer;
1080
- response_containers?: LearnosityClozetextResponseContainer[];
1081
- max_length?: number;
1082
985
  }
1083
986
  /**
1084
- * LongtextV2 validation
1085
- */
1086
- interface LearnosityLongtextV2Validation {
1087
- max_score?: number;
1088
- }
1089
- /**
1090
- * LongtextV2 question data (vNext, essay/extended response)
987
+ * Fileupload question data (file upload)
1091
988
  */
1092
- interface LearnosityLongtextV2Data {
1093
- type: 'longtextV2';
989
+ interface LearnosityFileuploadData {
990
+ type: 'fileupload';
1094
991
  stimulus?: string;
1095
992
  instructor_stimulus?: string;
1096
- placeholder?: string;
1097
- max_length?: number;
1098
- validation?: LearnosityLongtextV2Validation;
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;
1099
1022
  ui_style?: Record<string, unknown>;
1100
1023
  metadata?: LearnosityQuestionMetadata;
1101
1024
  }
1102
1025
  /**
1103
- * FormulaessayV2 question data (alias of longtextV2, produces extendedTextInteraction)
1026
+ * Drawing image specification
1104
1027
  */
1105
- interface LearnosityFormulaessayV2Data {
1106
- type: 'formulaessayV2';
1107
- stimulus?: string;
1108
- instructor_stimulus?: string;
1109
- placeholder?: string;
1110
- max_length?: number;
1111
- validation?: LearnosityLongtextV2Validation;
1112
- ui_style?: Record<string, unknown>;
1028
+ interface LearnosityDrawingImage {
1029
+ source?: string;
1030
+ src?: string;
1031
+ width?: number;
1032
+ height?: number;
1033
+ alt?: string;
1113
1034
  }
1114
1035
  /**
1115
- * ChemistryessayV2 question data (alias of longtextV2, produces extendedTextInteraction)
1036
+ * Drawing question data (freehand drawing with optional background image)
1116
1037
  */
1117
- interface LearnosityChemistryessayV2Data {
1118
- type: 'chemistryessayV2';
1038
+ interface LearnosityDrawingData {
1039
+ type: 'drawing';
1119
1040
  stimulus?: string;
1120
1041
  instructor_stimulus?: string;
1121
- placeholder?: string;
1122
- max_length?: number;
1123
- validation?: LearnosityLongtextV2Validation;
1042
+ image?: LearnosityDrawingImage;
1043
+ line_color?: string[];
1044
+ drawing_tools?: string[];
1045
+ text_formatting_options?: string[];
1124
1046
  ui_style?: Record<string, unknown>;
1125
- }
1126
- /**
1127
- * Plaintext UI style
1128
- */
1129
- interface LearnosityPlaintextUiStyle {
1130
- min_height?: string;
1131
- max_height?: string;
1132
- }
1133
- /**
1134
- * Plaintext question data (plain text input, no formatting)
1135
- */
1136
- interface LearnosityPlaintextData {
1137
- type: 'plaintext';
1138
- stimulus?: string;
1139
- instructor_stimulus?: string;
1140
- placeholder?: string;
1141
- max_length?: number;
1142
- ui_style?: LearnosityPlaintextUiStyle;
1143
- show_copy?: boolean;
1144
- show_cut?: boolean;
1145
- show_paste?: boolean;
1146
- spellcheck?: boolean;
1147
- character_map?: string[];
1148
1047
  metadata?: LearnosityQuestionMetadata;
1149
1048
  }
1150
1049
  /**
1151
- * Shorttext validation
1050
+ * Classification validation
1152
1051
  */
1153
- interface LearnosityShorttextValidation {
1052
+ interface LearnosityClassificationValidation {
1154
1053
  scoring_type?: string;
1155
1054
  valid_response?: {
1156
- value?: string | string[];
1157
1055
  score?: number;
1056
+ value?: Array<number[] | null>;
1158
1057
  };
1159
- penalty?: number;
1160
1058
  }
1161
1059
  /**
1162
- * Shorttext question data (single short answer)
1060
+ * Classification question data (maps from QTI associationInteraction)
1163
1061
  */
1164
- interface LearnosityShorttextData {
1165
- type: 'shorttext';
1166
- stimulus: string;
1062
+ interface LearnosityClassificationData {
1063
+ type: 'classification';
1167
1064
  instructor_stimulus?: string;
1168
- placeholder?: string;
1169
- max_length?: number;
1170
- validation?: LearnosityShorttextValidation;
1171
- case_sensitive?: boolean;
1172
- ui_style?: Record<string, unknown>;
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;
1173
1079
  metadata?: LearnosityQuestionMetadata;
1174
1080
  }
1175
1081
  /**
1176
- * Clozedropdown validation
1082
+ * Supported question types
1177
1083
  */
1178
- interface LearnosityClozedropdownValidation {
1179
- scoring_type?: string;
1180
- valid_response?: {
1181
- value?: string[];
1182
- score?: number;
1183
- };
1184
- penalty?: number;
1185
- }
1084
+ type LearnosityQuestionType = 'mcq' | 'clozetext' | 'clozeformula' | 'clozeformulaV2' | 'formulaV2' | 'imageclozeformulaV2' | 'longtextV2' | 'formulaessayV2' | 'chemistryessayV2' | 'plaintext' | 'shorttext' | 'clozedropdown' | 'clozeassociation' | 'orderlist' | 'tokenhighlight' | 'choicematrix' | 'hotspot' | 'imageclozeassociationV2' | 'fileupload' | 'drawing' | 'classification';
1186
1085
  /**
1187
- * Clozedropdown question data (inline dropdown/select menus in text)
1086
+ * Supported feature types
1188
1087
  */
1189
- interface LearnosityClozedropdownData {
1190
- type: 'clozedropdown';
1191
- stimulus?: string;
1192
- instructor_stimulus?: string;
1193
- template: string;
1194
- possible_responses: string[][];
1195
- validation?: LearnosityClozedropdownValidation;
1196
- ui_style?: Record<string, unknown>;
1197
- metadata?: LearnosityQuestionMetadata;
1198
- }
1088
+ type LearnosityFeatureType = 'sharedpassage' | 'audioplayer' | 'videoplayer' | string;
1199
1089
  /**
1200
- * Clozeassociation validation
1090
+ * Question data union
1201
1091
  */
1202
- interface LearnosityClozeassociationValidation {
1203
- scoring_type?: string;
1204
- valid_response?: {
1205
- value?: string[];
1206
- score?: number;
1207
- };
1208
- penalty?: number;
1209
- }
1092
+ type LearnosityQuestionData = LearnosityMcqData | LearnosityClozetextData | LearnosityClozeformulaData | LearnosityImageClozeformulaV2Data | LearnosityLongtextV2Data | LearnosityFormulaessayV2Data | LearnosityChemistryessayV2Data | LearnosityPlaintextData | LearnosityShorttextData | LearnosityClozedropdownData | LearnosityClozeassociationData | LearnosityOrderlistData | LearnosityTokenhighlightData | LearnosityChoicematrixData | LearnosityHotspotData | LearnosityImageclozeassociationV2Data | LearnosityFileuploadData | LearnosityDrawingData | LearnosityClassificationData;
1210
1093
  /**
1211
- * Clozeassociation possible response group (for grouped UI display)
1094
+ * Question (response widget)
1212
1095
  */
1213
- interface LearnosityClozeassociationResponseGroup {
1214
- title: string;
1215
- responses: string[];
1096
+ interface LearnosityQuestion {
1097
+ reference: string;
1098
+ widget_type: 'response';
1099
+ type: LearnosityQuestionType;
1100
+ data: LearnosityQuestionData;
1101
+ metadata?: Record<string, unknown>;
1216
1102
  }
1217
1103
  /**
1218
- * Normalized possible responses for clozeassociation (internal representation)
1104
+ * Feature widget (preserved but not interpreted in v1)
1219
1105
  */
1220
- interface NormalizedClozeassociationPossibleResponses {
1221
- mode: 'flat' | 'grouped';
1222
- flat: string[];
1223
- groups?: LearnosityClozeassociationResponseGroup[];
1106
+ interface LearnosityFeature {
1107
+ reference: string;
1108
+ widget_type: 'feature';
1109
+ type: LearnosityFeatureType;
1110
+ data?: LearnositySharedpassageData | LearnosityAudioplayerData | LearnosityVideoplayerData | unknown;
1224
1111
  }
1225
1112
  /**
1226
- * Clozeassociation question data (drag and drop into gaps)
1227
- * Supports two modes:
1228
- * 1. Flat: possible_responses array (legacy)
1229
- * 2. Grouped: group_possible_responses=true + possible_response_groups array
1113
+ * Layout widget reference (for multi-widget items)
1230
1114
  */
1231
- interface LearnosityClozeassociationData {
1232
- type: 'clozeassociation';
1233
- stimulus?: string;
1234
- instructor_stimulus?: string;
1235
- template: string;
1236
- possible_responses?: string[];
1237
- group_possible_responses?: boolean;
1238
- possible_response_groups?: LearnosityClozeassociationResponseGroup[];
1239
- shuffle_options?: boolean;
1240
- duplicate_responses?: boolean;
1241
- validation?: LearnosityClozeassociationValidation;
1242
- ui_style?: Record<string, unknown>;
1243
- metadata?: LearnosityQuestionMetadata;
1244
- }
1115
+ type LearnosityLayoutWidget = {
1116
+ kind: 'question';
1117
+ ref: string;
1118
+ } | {
1119
+ kind: 'feature';
1120
+ ref: string;
1121
+ };
1245
1122
  /**
1246
- * Sharedpassage feature data (rich text passage)
1123
+ * Layout column (for multi-widget items)
1247
1124
  */
1248
- interface LearnositySharedpassageData {
1249
- type: 'sharedpassage';
1250
- heading?: string;
1251
- content: string;
1252
- instructor_stimulus?: string;
1253
- paginated_content?: boolean;
1254
- pages?: string[];
1125
+ interface LearnosityLayoutColumn {
1126
+ index: 1 | 2;
1127
+ widgets: LearnosityLayoutWidget[];
1255
1128
  }
1256
1129
  /**
1257
- * Audioplayer feature data
1130
+ * Item layout (extracted from item.content HTML)
1258
1131
  */
1259
- interface LearnosityAudioplayerData {
1260
- type: 'audioplayer';
1261
- src: string;
1262
- player?: string;
1263
- counter?: {
1264
- length?: number;
1265
- };
1266
- ui_style?: {
1267
- responsive_layout?: boolean;
1268
- };
1132
+ interface LearnosityLayout {
1133
+ columns: LearnosityLayoutColumn[];
1269
1134
  }
1270
1135
  /**
1271
- * Videoplayer feature data
1136
+ * Validated and normalized Learnosity Item Model
1272
1137
  */
1273
- interface LearnosityVideoplayerData {
1274
- type: 'videoplayer';
1275
- src: string;
1276
- player_type?: 'hosted-video' | 'youtube' | 'vimeo';
1277
- text_alternative?: {
1278
- caption?: {
1279
- src?: string;
1280
- };
1281
- };
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>;
1282
1148
  }
1149
+ //#endregion
1150
+ //#region src/qti-to-learnosity/types.d.ts
1283
1151
  /**
1284
- * Orderlist validation
1152
+ * Learnosity Item JSON types for output (QTI → Learnosity conversion)
1153
+ * TASK 011 / Updated for new format
1285
1154
  */
1286
- interface LearnosityOrderlistValidation {
1287
- scoring_type?: string;
1288
- valid_response?: {
1289
- value: number[];
1290
- score?: number;
1291
- };
1292
- unscored?: boolean;
1293
- penalty?: number;
1294
- }
1295
1155
  /**
1296
- * Orderlist question data (ordering/sequencing)
1156
+ * Learnosity tag object
1297
1157
  */
1298
- interface LearnosityOrderlistData {
1299
- type: 'orderlist';
1300
- stimulus?: string;
1301
- instructor_stimulus?: string;
1302
- list: string[];
1303
- validation?: LearnosityOrderlistValidation;
1304
- shuffle_options?: boolean;
1305
- ui_style?: Record<string, unknown>;
1306
- metadata?: LearnosityQuestionMetadata;
1307
- }
1158
+ type LearnosityTags = Record<string, string[]>;
1308
1159
  /**
1309
- * Tokenhighlight validation
1160
+ * Learnosity Item metadata
1310
1161
  */
1311
- interface LearnosityTokenhighlightValidation {
1312
- scoring_type?: string;
1313
- valid_response?: {
1314
- value: number[];
1315
- score?: number;
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
+ }[];
1316
1171
  };
1317
- penalty?: number;
1318
- }
1319
- /**
1320
- * Tokenhighlight question data (highlight selectable tokens in text)
1321
- */
1322
- interface LearnosityTokenhighlightData {
1323
- type: 'tokenhighlight';
1324
- stimulus?: string;
1325
- instructor_stimulus?: string;
1326
- template: string;
1327
- tokenization?: 'custom' | string;
1328
- validation?: LearnosityTokenhighlightValidation;
1329
- ui_style?: Record<string, unknown>;
1330
- metadata?: LearnosityQuestionMetadata;
1172
+ status?: 'published';
1173
+ tags?: LearnosityTags;
1331
1174
  }
1332
1175
  /**
1333
- * Choicematrix validation
1176
+ * Learnosity feature JSON structure for file output
1334
1177
  */
1335
- interface LearnosityChoicematrixValidation {
1336
- scoring_type?: 'exactMatch';
1337
- valid_response?: {
1338
- value?: number[][];
1339
- score?: number;
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;
1340
1187
  };
1341
1188
  }
1342
1189
  /**
1343
- * Choicematrix UI style
1190
+ * Learnosity Item JSON structure for file output
1344
1191
  */
1345
- interface LearnosityChoicematrixUiStyle {
1346
- type?: 'table' | 'inline';
1347
- horizontal_lines?: boolean;
1192
+ interface LearnosityItemJson {
1193
+ item: LearnosityItemMetadata$1;
1194
+ questions: LearnosityQuestionJson[];
1195
+ features: LearnosityFeatureJson[];
1348
1196
  }
1349
1197
  /**
1350
- * Choicematrix question data (matrix of options per stem/row)
1198
+ * Learnosity Question JSON (MCQ, clozetext, longtextV2, shorttext, choicematrix, clozeassociation, or clozedropdown)
1351
1199
  */
1352
- interface LearnosityChoicematrixData {
1353
- type: 'choicematrix';
1354
- stimulus?: string;
1355
- instructor_stimulus?: string;
1356
- stems: string[];
1357
- options: string[];
1358
- shuffle_options?: boolean;
1359
- multiple_responses?: boolean;
1360
- ui_style?: LearnosityChoicematrixUiStyle;
1361
- validation?: LearnosityChoicematrixValidation;
1362
- metadata?: LearnosityQuestionMetadata;
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;
1363
1207
  }
1364
- /** * Hotspot image
1365
- */
1366
- interface LearnosityHotspotImage {
1367
- source: string;
1368
- width: number;
1369
- height: number;
1370
- alt?: string;
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;
1371
1242
  }
1372
1243
  /**
1373
- * Hotspot polygon point (percentages)
1244
+ * Learnosity MCQ Question JSON
1374
1245
  */
1375
- interface LearnosityHotspotPoint {
1376
- x: number;
1377
- y: number;
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
+ };
1378
1270
  }
1379
1271
  /**
1380
- * Hotspot validation
1272
+ * Learnosity clozetext Question JSON
1381
1273
  */
1382
- interface LearnosityHotspotValidation {
1383
- scoring_type?: 'exactMatch';
1384
- valid_response?: {
1385
- value?: (string | number)[];
1386
- score?: number;
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
+ };
1387
1294
  };
1388
1295
  }
1389
1296
  /**
1390
- * Hotspot question data (click areas on image)
1297
+ * Learnosity longtextV2 Question JSON (essay/extended response)
1391
1298
  */
1392
- interface LearnosityHotspotData {
1393
- type: 'hotspot';
1394
- stimulus?: string;
1395
- instructor_stimulus?: string;
1396
- image: LearnosityHotspotImage;
1397
- areas: LearnosityHotspotPoint[][];
1398
- multiple_responses?: boolean;
1399
- validation?: LearnosityHotspotValidation;
1400
- ui_style?: Record<string, unknown>;
1401
- metadata?: LearnosityQuestionMetadata;
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
+ };
1402
1311
  }
1403
- /** * Imageclozeassociation image definition
1312
+ /**
1313
+ * Learnosity shorttext Question JSON (short answer)
1404
1314
  */
1405
- interface LearnosityImageclozeassociationV2Image {
1406
- src: string;
1407
- width?: number;
1408
- height?: number;
1409
- alt?: string;
1410
- title?: string;
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
+ };
1411
1335
  }
1412
1336
  /**
1413
- * Imageclozeassociation response container (drop zone)
1337
+ * Learnosity choicematrix Question JSON (matching/matrix)
1414
1338
  */
1415
- interface LearnosityImageclozeassociationV2ResponseContainer {
1416
- x: number;
1417
- y: number;
1418
- width: string;
1419
- height: string;
1420
- aria_label?: string;
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
+ };
1421
1361
  }
1422
1362
  /**
1423
- * Imageclozeassociation possible response group (for grouped UI display)
1363
+ * Learnosity clozeassociation Question JSON (drag-and-drop cloze)
1424
1364
  */
1425
- interface LearnosityImageclozeassociationV2ResponseGroup {
1426
- title: string;
1427
- responses: string[];
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
+ };
1428
1383
  }
1429
1384
  /**
1430
- * Imageclozeassociation validation
1385
+ * Learnosity clozedropdown Question JSON (dropdown cloze)
1431
1386
  */
1432
- interface LearnosityImageclozeassociationV2Validation {
1433
- scoring_type?: 'exactMatch' | 'partialMatch' | 'partialMatchV2' | 'partialMatchPerResponse';
1434
- valid_response?: {
1435
- value?: string[][];
1436
- score?: number;
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
+ };
1437
1404
  };
1438
- penalty?: number;
1439
1405
  }
1440
1406
  /**
1441
- * Imageclozeassociation question data (drag text onto image zones)
1407
+ * Learnosity imageclozeassociationV2 Question JSON (graphic gap match)
1442
1408
  */
1443
- interface LearnosityImageclozeassociationV2Data {
1409
+ interface LearnosityImageclozeassociationV2QuestionJson {
1410
+ reference: string;
1411
+ widget_type?: string;
1444
1412
  type: 'imageclozeassociationV2';
1445
- stimulus?: string;
1446
- instructor_stimulus?: string;
1447
- image: LearnosityImageclozeassociationV2Image;
1448
- possible_responses?: string[];
1449
- possible_response_groups?: LearnosityImageclozeassociationV2ResponseGroup[];
1450
- group_possible_responses?: boolean;
1451
- response_containers: LearnosityImageclozeassociationV2ResponseContainer[];
1452
- response_container?: Record<string, unknown>;
1453
- validation?: LearnosityImageclozeassociationV2Validation;
1454
- duplicate_responses?: boolean;
1455
- shuffle_options?: boolean;
1456
- max_response_per_zone?: number;
1457
- ui_style?: Record<string, unknown>;
1458
- metadata?: LearnosityQuestionMetadata;
1413
+ data: Record<string, unknown>;
1459
1414
  }
1415
+ //#endregion
1416
+ //#region src/conversions.d.ts
1460
1417
  /**
1461
- * Fileupload question data (file upload)
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
1462
1427
  */
1463
- interface LearnosityFileuploadData {
1464
- type: 'fileupload';
1465
- stimulus?: string;
1466
- instructor_stimulus?: string;
1467
- max_files?: number;
1468
- allow_jpg?: boolean;
1469
- allow_png?: boolean;
1470
- allow_gif?: boolean;
1471
- allow_pdf?: boolean;
1472
- allow_txt?: boolean;
1473
- allow_csv?: boolean;
1474
- allow_rtf?: boolean;
1475
- allow_xps?: boolean;
1476
- allow_zip?: boolean;
1477
- allow_ms_word?: boolean;
1478
- allow_ms_excel?: boolean;
1479
- allow_ms_powerpoint?: boolean;
1480
- allow_ms_publisher?: boolean;
1481
- allow_open_office?: boolean;
1482
- allow_video?: boolean;
1483
- allow_matlab?: boolean;
1484
- allow_altera_quartus?: boolean;
1485
- allow_verilog?: boolean;
1486
- allow_c?: boolean;
1487
- allow_h?: boolean;
1488
- allow_s?: boolean;
1489
- allow_v?: boolean;
1490
- allow_cpp?: boolean;
1491
- allow_assembly?: boolean;
1492
- allow_labview?: boolean;
1493
- allow_psd?: boolean;
1494
- allow_ai?: boolean;
1495
- photo_capture?: boolean;
1496
- ui_style?: Record<string, unknown>;
1497
- metadata?: LearnosityQuestionMetadata;
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;
1498
1451
  }
1499
1452
  /**
1500
- * Drawing image specification
1453
+ * Reference to an assessment item XML file
1501
1454
  */
1502
- interface LearnosityDrawingImage {
1503
- source?: string;
1504
- src?: string;
1505
- width?: number;
1506
- height?: number;
1507
- alt?: string;
1455
+ interface AssessmentItemRef {
1456
+ /** Unique identifier for this item */
1457
+ identifier: string;
1458
+ /** Path to the .xml file */
1459
+ href: string;
1508
1460
  }
1509
1461
  /**
1510
- * Drawing question data (freehand drawing with optional background image)
1462
+ * Reference to an asset (image, CSS, etc.)
1511
1463
  */
1512
- interface LearnosityDrawingData {
1513
- type: 'drawing';
1514
- stimulus?: string;
1515
- instructor_stimulus?: string;
1516
- image?: LearnosityDrawingImage;
1517
- line_color?: string[];
1518
- drawing_tools?: string[];
1519
- text_formatting_options?: string[];
1520
- ui_style?: Record<string, unknown>;
1521
- metadata?: LearnosityQuestionMetadata;
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;
1522
1471
  }
1523
1472
  /**
1524
- * Classification validation
1473
+ * A resource in the manifest
1525
1474
  */
1526
- interface LearnosityClassificationValidation {
1527
- scoring_type?: string;
1528
- valid_response?: {
1529
- score?: number;
1530
- value?: number[][];
1531
- };
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;
1532
1490
  }
1533
1491
  /**
1534
- * Classification question data (maps from QTI associationInteraction)
1492
+ * Parsed QTI Content Package
1535
1493
  */
1536
- interface LearnosityClassificationData {
1537
- type: 'classification';
1538
- stimulus?: string;
1539
- possible_responses?: string[];
1540
- column_headers?: string[];
1541
- ui_style?: {
1542
- column_count?: number;
1543
- row_count?: number;
1544
- };
1545
- shuffle_items?: boolean;
1546
- validation?: LearnosityClassificationValidation;
1547
- metadata?: LearnosityQuestionMetadata;
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[];
1548
1505
  }
1506
+ //#endregion
1507
+ //#region src/qti-package/pathSafety.d.ts
1549
1508
  /**
1550
- * Supported question types
1509
+ * ZIP entry path safety validation (zip-slip protection)
1551
1510
  */
1552
- type LearnosityQuestionType = 'mcq' | 'clozetext' | 'longtextV2' | 'formulaessayV2' | 'chemistryessayV2' | 'plaintext' | 'shorttext' | 'clozedropdown' | 'clozeassociation' | 'orderlist' | 'tokenhighlight' | 'choicematrix' | 'hotspot' | 'imageclozeassociationV2' | 'fileupload' | 'drawing' | 'classification';
1553
1511
  /**
1554
- * Supported feature types
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
1555
1521
  */
1556
- type LearnosityFeatureType = 'sharedpassage' | 'audioplayer' | 'videoplayer' | string;
1522
+ declare function validateZipEntryPath(entryPath: string): string | null;
1557
1523
  /**
1558
- * Question data union
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
1559
1528
  */
1560
- type LearnosityQuestionData = LearnosityMcqData | LearnosityClozetextData | LearnosityLongtextV2Data | LearnosityFormulaessayV2Data | LearnosityChemistryessayV2Data | LearnosityPlaintextData | LearnosityShorttextData | LearnosityClozedropdownData | LearnosityClozeassociationData | LearnosityOrderlistData | LearnosityTokenhighlightData | LearnosityChoicematrixData | LearnosityHotspotData | LearnosityImageclozeassociationV2Data | LearnosityFileuploadData | LearnosityDrawingData | LearnosityClassificationData;
1529
+ declare function isPathSafe(entryPath: string): boolean;
1530
+ //#endregion
1531
+ //#region src/qti-package/parseManifest.d.ts
1561
1532
  /**
1562
- * Question (response widget)
1533
+ * Result of parsing a manifest
1563
1534
  */
1564
- interface LearnosityQuestion {
1565
- reference: string;
1566
- widget_type: 'response';
1567
- type: LearnosityQuestionType;
1568
- data: LearnosityQuestionData;
1569
- metadata?: Record<string, unknown>;
1535
+ interface ParseManifestResult {
1536
+ /** Parsed resources */
1537
+ resources: ManifestResource[];
1538
+ /** Diagnostics from parsing */
1539
+ diagnostics: Diagnostic[];
1570
1540
  }
1571
1541
  /**
1572
- * Feature widget (preserved but not interpreted in v1)
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
1573
1552
  */
1574
- interface LearnosityFeature {
1575
- reference: string;
1576
- widget_type: 'feature';
1577
- type: LearnosityFeatureType;
1578
- data?: LearnositySharedpassageData | LearnosityAudioplayerData | LearnosityVideoplayerData | unknown;
1579
- }
1553
+ declare function parseManifest(manifestXml: string, zipPath: string): ParseManifestResult;
1554
+ //#endregion
1555
+ //#region src/qti-package/buildManifest.d.ts
1580
1556
  /**
1581
- * Layout widget reference (for multi-widget items)
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
1582
1566
  */
1583
- type LearnosityLayoutWidget = {
1584
- kind: 'question';
1585
- ref: string;
1586
- } | {
1587
- kind: 'feature';
1588
- ref: string;
1589
- };
1567
+ declare function buildManifest(resources: ManifestResource[]): string;
1568
+ //#endregion
1569
+ //#region src/qti-package/testDependencies.d.ts
1590
1570
  /**
1591
- * Layout column (for multi-widget items)
1571
+ * Extract item and stimulus dependencies from QTI assessmentTest XML,
1572
+ * and map hrefs to manifest resource identifiers.
1592
1573
  */
1593
- interface LearnosityLayoutColumn {
1594
- index: 1 | 2;
1595
- widgets: LearnosityLayoutWidget[];
1596
- }
1597
1574
  /**
1598
- * Item layout (extracted from item.content HTML)
1575
+ * Extract assessmentItemRef and assessmentStimulusRef hrefs from test XML
1599
1576
  */
1600
- interface LearnosityLayout {
1601
- columns: LearnosityLayoutColumn[];
1602
- }
1577
+ declare function extractTestDependencies(testXml: string): {
1578
+ itemHrefs: string[];
1579
+ stimulusHrefs: string[];
1580
+ };
1603
1581
  /**
1604
- * Validated and normalized Learnosity Item Model
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"
1605
1588
  */
1606
- interface LearnosityItemModel {
1607
- item: LearnosityItemMetadata;
1608
- questions: LearnosityQuestion[];
1609
- features: LearnosityFeature[];
1610
- layout?: LearnosityLayout;
1611
- /**
1612
- * Indices for efficient lookup
1613
- */
1614
- questionsByRef: Map<string, LearnosityQuestion>;
1615
- featuresByRef: Map<string, LearnosityFeature>;
1616
- }
1589
+ declare function mapHrefToResourceId(href: string): string | null;
1617
1590
  //#endregion
1618
1591
  //#region src/learnosity-model/parseLearnosityItem.d.ts
1619
1592
  /**
@@ -1682,75 +1655,6 @@ interface LearnosityBundleModel {
1682
1655
  itemRefToFilename: Map<string, string>;
1683
1656
  }
1684
1657
  //#endregion
1685
- //#region src/learnosity-bundle/loadLearnosityBundle.d.ts
1686
- /**
1687
- * Load a Learnosity export bundle from a directory
1688
- *
1689
- * @param bundleDir - Absolute path to bundle directory
1690
- * @returns { bundle?, diagnostics[] }
1691
- */
1692
- declare function loadLearnosityBundle(bundleDir: string): {
1693
- bundle?: LearnosityBundleModel;
1694
- diagnostics: Diagnostic[];
1695
- };
1696
- //#endregion
1697
- //#region src/learnosity-bundle/writeLearnosityBundle.d.ts
1698
- interface WriteBundleOptions {
1699
- /** Directory or ZIP path to write bundle to */
1700
- outDir: string;
1701
- /** Whether to output as ZIP file (default: false, outputs as directory) */
1702
- isZipOutput?: boolean;
1703
- }
1704
- interface WriteBundleResult {
1705
- diagnostics: Diagnostic[];
1706
- }
1707
- /**
1708
- * Write Learnosity Bundle to directory or ZIP
1709
- */
1710
- declare function writeLearnosityBundle(bundle: {
1711
- manifest: unknown;
1712
- activities: Map<string, unknown>;
1713
- items: Map<string, unknown>;
1714
- assets: Map<string, Uint8Array>;
1715
- itemFilenames?: Map<string, string>;
1716
- }, options: WriteBundleOptions): Promise<WriteBundleResult>;
1717
- //#endregion
1718
- //#region src/learnosity-bundle/pathSafetyFs.d.ts
1719
- /**
1720
- * Path safety validation for filesystem operations
1721
- * Part of TASK 004D - prevents directory traversal attacks similar to zip-slip protection
1722
- */
1723
- /**
1724
- * Validate that a relative path is safe to use within a base directory
1725
- *
1726
- * Safety rules:
1727
- * - Must be relative (no absolute paths)
1728
- * - No ".." traversal
1729
- * - No symlinks
1730
- * - Normalized separators
1731
- *
1732
- * @param relativePath - Path to validate (relative to baseDir)
1733
- * @param baseDir - Base directory that all paths must stay within
1734
- * @returns true if safe, false otherwise
1735
- */
1736
- declare function isPathSafe(relativePath: string, baseDir: string): boolean;
1737
- /**
1738
- * Check if a path points to a symlink
1739
- *
1740
- * @param fullPath - Absolute path to check
1741
- * @returns true if symlink, false otherwise (or if path doesn't exist)
1742
- */
1743
- declare function isSymlink(fullPath: string): boolean;
1744
- /**
1745
- * Safely resolve a relative path within a base directory
1746
- * Returns null if the path is unsafe or points to a symlink
1747
- *
1748
- * @param relativePath - Path to resolve (relative to baseDir)
1749
- * @param baseDir - Base directory
1750
- * @returns Absolute path if safe, null otherwise
1751
- */
1752
- declare function safeResolve(relativePath: string, baseDir: string): string | null;
1753
- //#endregion
1754
1658
  //#region src/qti-ast/types.d.ts
1755
1659
  /**
1756
1660
  * Internal QTI AST types
@@ -1833,6 +1737,7 @@ interface QtiTextEntry {
1833
1737
  mapping?: QtiMapping;
1834
1738
  format?: 'String' | 'Integer';
1835
1739
  expectedLength?: number;
1740
+ cssClass?: string;
1836
1741
  }
1837
1742
  /**
1838
1743
  * Text entry interaction
@@ -2068,6 +1973,7 @@ interface QtiUploadInteraction {
2068
1973
  prompt?: string;
2069
1974
  mimeTypes?: string[];
2070
1975
  maxFiles?: number;
1976
+ allowedFileTypes?: string[];
2071
1977
  }
2072
1978
  /**
2073
1979
  * Associable choice (for associateInteraction)
@@ -2516,34 +2422,6 @@ interface ConvertActivityOptions {
2516
2422
  */
2517
2423
  declare function convertActivity(bundle: LearnosityBundleModel, activityRef: string, options?: ConvertActivityOptions): ConvertActivityResult;
2518
2424
  //#endregion
2519
- //#region src/learnosity-mapper/buildPackageFromActivity.d.ts
2520
- interface BuildPackageFromActivityOptions {
2521
- /** Source bundle directory for copying assets */
2522
- bundleDir: string;
2523
- /** Activity reference used as package identifier */
2524
- activityRef: string;
2525
- /** QTI version (2.1 or 2.2) */
2526
- version?: QtiVersion;
2527
- }
2528
- interface BuildPackageFromActivityResult {
2529
- package?: QtiContentPackage;
2530
- diagnostics: Diagnostic[];
2531
- }
2532
- /**
2533
- * Build an IMS Content Package from a converted Activity
2534
- *
2535
- * Creates a package containing:
2536
- * - imsmanifest.xml (generated by saveQtiContentPackage)
2537
- * - assessmentTest.xml
2538
- * - items/*.xml (one per item)
2539
- * - assets/* (copied from bundle)
2540
- *
2541
- * @param conversion - Result from convertActivity
2542
- * @param options - Build options including bundle directory
2543
- * @returns { package?, diagnostics[] }
2544
- */
2545
- declare function buildPackageFromActivity(conversion: ConvertActivityResult, options: BuildPackageFromActivityOptions): BuildPackageFromActivityResult;
2546
- //#endregion
2547
2425
  //#region src/learnosity-mapper/sanitizeFolderName.d.ts
2548
2426
  /**
2549
2427
  * Sanitize activity reference for use as folder name
@@ -2572,6 +2450,28 @@ declare function sanitizeFolderName(input: string, fallback?: string): string;
2572
2450
  */
2573
2451
  declare function ensureUniqueFolderName(desiredName: string, usedNames: Set<string>): string;
2574
2452
  //#endregion
2453
+ //#region src/learnosity-mapper/buildPackageFromActivityTypes.d.ts
2454
+ interface BuildPackageFromActivityResult {
2455
+ package?: QtiContentPackage;
2456
+ diagnostics: Diagnostic[];
2457
+ }
2458
+ //#endregion
2459
+ //#region src/learnosity-mapper/mergeActivityPackage.d.ts
2460
+ /**
2461
+ * Rewrite item/stimulus/asset hrefs inside an assessmentTest that has been moved
2462
+ * into tests/<folderName>/ (two levels deep) so they resolve against the package root.
2463
+ */
2464
+ declare function rewriteTestHrefs(testXml: string): string;
2465
+ /**
2466
+ * Merge one activity's package (`packageResult`) into the combined `pkg`.
2467
+ *
2468
+ * The activity's assessmentTest is relocated to tests/<folderName>/assessmentTest.xml,
2469
+ * its hrefs rewritten, and the test resource is given ordered dependencies
2470
+ * (normalize CSS first, then stimulus then item resources). Item resources gain a
2471
+ * dependency on the normalize CSS. Duplicate resources (by identifier) are skipped.
2472
+ */
2473
+ declare function mergeActivityPackage(pkg: QtiContentPackage, folderName: string, packageResult: BuildPackageFromActivityResult, addedResourceIds: Set<string>): void;
2474
+ //#endregion
2575
2475
  //#region src/qti-serializer/serializeAssessmentItem.d.ts
2576
2476
  /**
2577
2477
  * Serialize a QTI AST to QTI 2.2 or 2.1 XML
@@ -2608,6 +2508,15 @@ interface SerializeTestResult {
2608
2508
  */
2609
2509
  declare function serializeAssessmentTest(test: QtiAssessmentTest, options?: SerializeTestOptions): SerializeTestResult;
2610
2510
  //#endregion
2511
+ //#region src/qti-to-learnosity/convertShared.d.ts
2512
+ /**
2513
+ * Result of converting a single QTI assessmentItem to a Learnosity item.
2514
+ */
2515
+ interface ConvertResult$1 {
2516
+ item?: LearnosityItemJson;
2517
+ diagnostics: Diagnostic[];
2518
+ }
2519
+ //#endregion
2611
2520
  //#region src/qti-to-learnosity/convertQtiToLearnosity.d.ts
2612
2521
  interface ConvertOptions {
2613
2522
  qtiVersion?: QtiVersion;
@@ -2618,10 +2527,7 @@ interface ConvertOptions {
2618
2527
  customAssetUrl?: string;
2619
2528
  itemReferenceSource?: ItemReferenceSource;
2620
2529
  truncateTags?: boolean;
2621
- }
2622
- interface ConvertResult$1 {
2623
- item?: LearnosityItemJson;
2624
- diagnostics: Diagnostic[];
2530
+ fileAccess?: FileAccess;
2625
2531
  }
2626
2532
  /**
2627
2533
  * Convert QTI assessmentItem XML to Learnosity Item JSON
@@ -2654,5 +2560,50 @@ interface ConvertResult {
2654
2560
  */
2655
2561
  declare function convertAssessmentTestToLearnosityActivity(inputXml: string): ConvertResult;
2656
2562
  //#endregion
2657
- export { ActivityData, AssessmentItemRef, AssetRef, BuildPackageFromActivityOptions, BuildPackageFromActivityResult, type ConversionOptions, type ConversionResult, ConvertActivityOptions, ConvertActivityResult, type ConvertLearnosityToQtiPackageOptions, type ConvertLearnosityToQtiPackageResult, type ConvertQtiPackageToLearnosityOptions, type ConvertQtiPackageToLearnosityResult, ConvertedItem, type Diagnostic, DiagnosticCode, type DiagnosticIssue, type DiagnosticLevel, type DiagnosticsOutput, type DiagnosticsReport, DowngradeResult, type FormatDiagnosticsReportOptions, InteractionType, type ItemFilenameSource, type ItemReferenceSource, LearnosityActivityIndexEntry, type LearnosityActivityJson, LearnosityAudioplayerData, LearnosityBundleModel, LearnosityChemistryessayV2Data, LearnosityChoicematrixData, LearnosityChoicematrixUiStyle, LearnosityChoicematrixValidation, LearnosityClassificationData, LearnosityClassificationValidation, LearnosityClozeassociationData, LearnosityClozeassociationResponseGroup, LearnosityClozeassociationValidation, LearnosityClozedropdownData, LearnosityClozedropdownValidation, LearnosityClozetextData, LearnosityClozetextResponseContainer, LearnosityClozetextValidation, LearnosityDrawingData, LearnosityDrawingImage, LearnosityFeature, LearnosityFeatureType, LearnosityFileuploadData, LearnosityFormulaessayV2Data, LearnosityHotspotData, LearnosityHotspotImage, LearnosityHotspotPoint, LearnosityHotspotValidation, LearnosityImageclozeassociationV2Data, LearnosityImageclozeassociationV2Image, LearnosityImageclozeassociationV2ResponseContainer, LearnosityImageclozeassociationV2ResponseGroup, LearnosityImageclozeassociationV2Validation, LearnosityItemDefinition, type LearnosityItemJson, LearnosityItemMetadata, LearnosityItemModel, LearnosityLayout, LearnosityLayoutColumn, LearnosityLayoutWidget, LearnosityLongtextV2Data, LearnosityLongtextV2Validation, LearnosityManifestActivity, LearnosityManifestItemRef, LearnosityManifestModel, LearnosityMcqData, LearnosityMcqMetadata, LearnosityMcqOption, LearnosityMcqUiStyle, LearnosityMcqValidation, LearnosityOrderlistData, LearnosityOrderlistValidation, LearnosityPlaintextData, LearnosityPlaintextUiStyle, LearnosityQuestion, LearnosityQuestionData, type LearnosityQuestionJson, LearnosityQuestionMetadata, LearnosityQuestionType, LearnositySection, LearnositySectionConfig, LearnositySectionNavigation, LearnositySectionTime, LearnositySharedpassageData, LearnosityShorttextData, LearnosityShorttextValidation, LearnosityTag, LearnosityTokenhighlightData, LearnosityTokenhighlightValidation, LearnosityVideoplayerData, LearnosityWidgetBlueprint, LearnosityWidgetType, LoadPackageResult, ManifestResource, MapActivityToTestResult, NormalizedClozeassociationPossibleResponses, type OutputFormat, ParseLearnosityItemResult, ParseManifestResult, QtiAction, QtiAssessmentItem, QtiAssessmentSection, QtiAssessmentStimulus, QtiAssessmentTest, QtiAssociableChoice, QtiAssociableHotspot, QtiAssociateInteraction, QtiBaseValue, QtiChoice, QtiChoiceInteraction, QtiContentPackage, QtiCorrect, QtiCorrectResponse, QtiDirectedPair, QtiDirectedPairMatch, QtiDrawingInteraction, QtiExpression, QtiExtendedTextInteraction, QtiFeedbackBlock, QtiGapEntry, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicGapMatchInteraction, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceEntry, QtiInlineChoiceInteraction, QtiInteraction, QtiItemRef, QtiLayout, QtiLayoutColumn, QtiLayoutWidget, QtiLomClassification, QtiLomMetadata, QtiMapEntry, QtiMapping, QtiMatchInteraction, QtiMax, QtiModalFeedback, QtiOrderInteraction, QtiOutcomeDeclaration, QtiResponseCondition, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiResponseProcessing, QtiSelection, QtiSetOutcomeValue, QtiSimpleAssociableChoice, QtiStringMatch, QtiSubtract, QtiTestPart, QtiTextEntry, QtiTextEntryInteraction, QtiTimeLimits, QtiUploadInteraction, QtiVariable, type QtiVersion, ReadZipResult, ResponseProcessingStrategy, SavePackageResult, SerializeTestOptions, SerializeTestResult, WriteBundleOptions, WriteBundleResult, ZipEntryMeta, ZipFileEntry, addFileContext, addFileContextIfProvided, buildManifest, buildPackageFromActivity, convertActivity, convertAssessmentTestToLearnosityActivity, convertLearnosityToQti, convertLearnosityToQtiPackage, convertQtiAssessmentItemToLearnosity, convertQtiPackageToLearnosity, convertQtiPackageToLearnosityBundle, convertQtiToLearnosity, countByLevel, createDiagnostic, downgradeAssessmentItemToQti21, downgradeAssessmentTestToQti21, ensureUniqueFolderName, filterByLevel, filterOutCodes, formatDiagnosticsReport, hasErrors, isPathSafe as isBundlePathSafe, isPathSafe$1 as isPathSafe, isSymlink, loadLearnosityBundle, loadQtiContentPackage, mapActivityToTest, mapLearnosityToAst, mergeDiagnostics, parseLearnosityItem, parseManifest, readZip, safeResolve, sanitizeFolderName, saveQtiContentPackage, serializeAssessmentItem, serializeAssessmentTest, validateZipEntryPath, writeLearnosityBundle, writeZip };
2563
+ //#region src/qti-to-learnosity/convertQtiPackageToLearnosityBundle.d.ts
2564
+ /** A package entry (ZIP or directory) with raw bytes. Buffer satisfies this too. */
2565
+ interface PackageEntry {
2566
+ file: string;
2567
+ size: number;
2568
+ data: Uint8Array;
2569
+ }
2570
+ interface ConvertQtiPackageToLearnosityBundleOptions {
2571
+ qtiVersion?: '2.1' | '2.2';
2572
+ organisationId?: number;
2573
+ mediaVault?: boolean;
2574
+ customAssetUrl?: string;
2575
+ itemReferenceSource?: ItemReferenceSource;
2576
+ itemFilenameSource?: ItemFilenameSource;
2577
+ packageVersion?: string;
2578
+ truncateTags?: boolean;
2579
+ /** Base directory for resolving item source paths (Node disk conversion). */
2580
+ sourceDir?: string;
2581
+ /** Injected filesystem access for passage/LOM lookups (Node only). */
2582
+ fileAccess?: FileAccess;
2583
+ /** Label used in diagnostics `file` fields (e.g. the source path or zip name). */
2584
+ sourceLabel?: string;
2585
+ }
2586
+ interface ConvertQtiPackageToLearnosityBundleResult {
2587
+ bundle?: {
2588
+ manifest: unknown;
2589
+ activities: Map<string, unknown>;
2590
+ items: Map<string, unknown>;
2591
+ assets: Map<string, Uint8Array>;
2592
+ itemFilenames?: Map<string, string>;
2593
+ };
2594
+ diagnostics: Diagnostic[];
2595
+ convertedSourceFiles?: string[];
2596
+ failedSourceFiles?: string[];
2597
+ convertedActivityFiles?: string[];
2598
+ }
2599
+ /**
2600
+ * Convert QTI Content Package to Learnosity Bundle
2601
+ */
2602
+ declare function convertQtiPackageToLearnosityBundle(input: {
2603
+ zipBytes: Uint8Array;
2604
+ } | {
2605
+ entries: ReadonlyMap<string, PackageEntry>;
2606
+ }, opts?: ConvertQtiPackageToLearnosityBundleOptions): ConvertQtiPackageToLearnosityBundleResult;
2607
+ //#endregion
2608
+ export { ActivityData, AssessmentItemRef, AssetRef, type ConversionOptions, type ConversionResult, ConvertActivityOptions, ConvertActivityResult, type ConvertQtiPackageToLearnosityBundleOptions, type ConvertQtiPackageToLearnosityBundleResult, 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, 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, ResponseProcessingStrategy, SerializeTestOptions, SerializeTestResult, ZipEntryMeta, addFileContext, addFileContextIfProvided, buildManifest, convertActivity, convertAssessmentTestToLearnosityActivity, convertLearnosityToQti, convertQtiAssessmentItemToLearnosity, convertQtiPackageToLearnosityBundle, convertQtiToLearnosity, countByLevel, createDiagnostic, downgradeAssessmentItemToQti21, downgradeAssessmentTestToQti21, ensureUniqueFolderName, extractTestDependencies, filterByLevel, filterOutCodes, formatDiagnosticsReport, hasErrors, isPathSafe, mapActivityToTest, mapHrefToResourceId, mapLearnosityToAst, mergeActivityPackage, mergeDiagnostics, parseLearnosityItem, parseManifest, rewriteTestHrefs, sanitizeFolderName, serializeAssessmentItem, serializeAssessmentTest, validateZipEntryPath };
2658
2609
  //# sourceMappingURL=index.d.ts.map