@learnosity/lib-qti-converter 0.14.0 → 0.15.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.
Files changed (39) hide show
  1. package/docs/EXAMPLES.md +13 -11
  2. package/docs/GETTING_STARTED.md +11 -0
  3. package/docs/QTI_METADATA_TO_TAGS.md +47 -4
  4. package/docs/TAGS_TO_QTI_METADATA.md +8 -7
  5. package/package.json +8 -8
  6. package/packages/cli/dist/{batchProcessors-DWG8qk7G.js → batchProcessors-B6yUImA3.js} +6 -2
  7. package/packages/cli/dist/{batchProcessors-DWG8qk7G.js.map → batchProcessors-B6yUImA3.js.map} +1 -1
  8. package/packages/cli/dist/batchWorker.js +1 -1
  9. package/packages/cli/dist/{create-prompt-DyNnKXYU.js → create-prompt-dWckcotJ.js} +45 -43
  10. package/packages/cli/dist/create-prompt-dWckcotJ.js.map +1 -0
  11. package/packages/cli/dist/{dist-D3v6G5F8.js → dist-DXDR2peT.js} +6 -6
  12. package/packages/cli/dist/{dist-D3v6G5F8.js.map → dist-DXDR2peT.js.map} +1 -1
  13. package/packages/cli/dist/{learnosityToQti-C7cTRTU2.js → learnosityToQti-DIxeAztu.js} +4 -4
  14. package/packages/cli/dist/{learnosityToQti-C7cTRTU2.js.map → learnosityToQti-DIxeAztu.js.map} +1 -1
  15. package/packages/cli/dist/{learnosityToQtiPackage-C84dQKKi.js → learnosityToQtiPackage-CMFop6H4.js} +7 -7
  16. package/packages/cli/dist/{learnosityToQtiPackage-C84dQKKi.js.map → learnosityToQtiPackage-CMFop6H4.js.map} +1 -1
  17. package/packages/cli/dist/main.js +5 -5
  18. package/packages/cli/dist/main.js.map +1 -1
  19. package/packages/cli/dist/{pathUtils-Cr9IcK0n.js → pathUtils-6nZKvVmg.js} +18 -8
  20. package/packages/cli/dist/pathUtils-6nZKvVmg.js.map +1 -0
  21. package/packages/cli/dist/{qtiPackageToLearnosity-BBfZgWBh.js → qtiPackageToLearnosity-Sk_1j12c.js} +12 -6
  22. package/packages/cli/dist/qtiPackageToLearnosity-Sk_1j12c.js.map +1 -0
  23. package/packages/cli/dist/{qtiToLearnosity-C9OW_n7Z.js → qtiToLearnosity-_tybImv1.js} +6 -5
  24. package/packages/cli/dist/qtiToLearnosity-_tybImv1.js.map +1 -0
  25. package/packages/cli/dist/{resolveOptions-D_UECo_9.js → resolveOptions-6ReJUr-D.js} +23 -17
  26. package/packages/cli/dist/resolveOptions-6ReJUr-D.js.map +1 -0
  27. package/packages/cli/dist/{rolldown-runtime-B4iAMlE-.js → rolldown-runtime-DktXgydw.js} +1 -1
  28. package/packages/cli/dist/{table-D1ydwhbX.js → table-CLUiytPO.js} +99 -48
  29. package/packages/cli/dist/table-CLUiytPO.js.map +1 -0
  30. package/packages/core/dist/index.d.ts +3 -0
  31. package/packages/core/dist/index.js +95 -40
  32. package/packages/core/dist/node.d.ts +5 -0
  33. package/packages/core/dist/node.js +96 -40
  34. package/packages/cli/dist/create-prompt-DyNnKXYU.js.map +0 -1
  35. package/packages/cli/dist/pathUtils-Cr9IcK0n.js.map +0 -1
  36. package/packages/cli/dist/qtiPackageToLearnosity-BBfZgWBh.js.map +0 -1
  37. package/packages/cli/dist/qtiToLearnosity-C9OW_n7Z.js.map +0 -1
  38. package/packages/cli/dist/resolveOptions-D_UECo_9.js.map +0 -1
  39. package/packages/cli/dist/table-D1ydwhbX.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.js";
1
+ import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-DktXgydw.js";
2
2
  import process$1 from "node:process";
3
3
  import { mkdir, writeFile } from "fs/promises";
4
4
  import { dirname, join } from "path";
@@ -22899,6 +22899,34 @@ function md5hex(input) {
22899
22899
  return hex;
22900
22900
  }
22901
22901
  //#endregion
22902
+ //#region ../core/src/qti-to-learnosity/utils/generateQuestionReference.ts
22903
+ /**
22904
+ * Shared utility for generating Learnosity question references.
22905
+ */
22906
+ /**
22907
+ * Generate a Learnosity question reference from the resolved item reference and
22908
+ * the question's position within that item.
22909
+ *
22910
+ * The reference is `md5hex(`${itemRef}_${index}`)`, which guarantees it is both
22911
+ * unique (scoped to the item plus the per-item ordinal) and repeatable.
22912
+ *
22913
+ * - `itemRef` is the ALREADY-RESOLVED Learnosity item reference. Because it is
22914
+ * resolved upstream, the question reference automatically inherits the user's
22915
+ * `--item-reference-source` choice (item `identifier`, a `uuid`, or the source
22916
+ * filename) without this helper needing to re-read that option.
22917
+ * - `index` is the question's 1-BASED ordinal WITHIN the item. It is reset per
22918
+ * item, not a global counter: the first question in an item is `1`, the second
22919
+ * `2`, and so on. Single-question items always use `1` (a lone question is
22920
+ * `_1`), so there is no bare, unsuffixed variant.
22921
+ *
22922
+ * @param itemRef Resolved Learnosity item reference.
22923
+ * @param index 1-based ordinal of the question within the item.
22924
+ * @returns A 32-character lowercase hex MD5 question reference.
22925
+ */
22926
+ function generateQuestionReference(itemRef, index) {
22927
+ return md5hex(`${itemRef}_${index}`);
22928
+ }
22929
+ //#endregion
22902
22930
  //#region ../core/src/qti-to-learnosity/utils/mediaFeature.ts
22903
22931
  /**
22904
22932
  * Build a stable UUID-shaped identifier for a media feature.
@@ -23422,7 +23450,7 @@ function convertMatchToLearnosity(inputXml, diagnostics, lomTags, organisationId
23422
23450
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
23423
23451
  sourceHrefBase: assetTransformContext?.sourceHrefBase
23424
23452
  };
23425
- const questionRef = md5hex(itemRef);
23453
+ const questionRef = generateQuestionReference(itemRef, 1);
23426
23454
  const stems = parsed.stems.map((stem) => transformAssetUrls(stem.text, {
23427
23455
  organisationId,
23428
23456
  mediaVault,
@@ -23844,7 +23872,7 @@ function convertGapMatchToLearnosity(inputXml, diagnostics, lomTags, organisatio
23844
23872
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
23845
23873
  sourceHrefBase: assetTransformContext?.sourceHrefBase
23846
23874
  };
23847
- const questionRef = md5hex(itemRef);
23875
+ const questionRef = generateQuestionReference(itemRef, 1);
23848
23876
  const possibleResponses = parsed.gapTexts.map((gt) => transformAssetUrls(gt.text, {
23849
23877
  organisationId,
23850
23878
  mediaVault,
@@ -24312,7 +24340,7 @@ function convertInlineChoiceToLearnosity(inputXml, diagnostics, lomTags, organis
24312
24340
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
24313
24341
  sourceHrefBase: assetTransformContext?.sourceHrefBase
24314
24342
  };
24315
- const questionRef = md5hex(itemRef);
24343
+ const questionRef = generateQuestionReference(itemRef, 1);
24316
24344
  const possibleResponses = parsed.interactions.map((interaction) => interaction.choices.map((choice) => transformAssetUrls(choice.text, transformOpts)));
24317
24345
  const validationValue = buildValidationValues(parsed.interactions, parsed.responseDeclarations, diagnostics, transformOpts, sourceFile);
24318
24346
  if (!validationValue) return { diagnostics };
@@ -24591,7 +24619,7 @@ function convertOrderToLearnosity(inputXml, diagnostics, lomTags, organisationId
24591
24619
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
24592
24620
  sourceHrefBase: assetTransformContext?.sourceHrefBase
24593
24621
  };
24594
- const questionRef = md5hex(itemRef);
24622
+ const questionRef = generateQuestionReference(itemRef, 1);
24595
24623
  const stimulus = transformAssetUrls(parsed.stimulusText ?? "", {
24596
24624
  organisationId,
24597
24625
  mediaVault,
@@ -25042,7 +25070,7 @@ function convertHotspotToLearnosity(inputXml, diagnostics, lomTags, organisation
25042
25070
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
25043
25071
  sourceHrefBase: assetTransformContext?.sourceHrefBase
25044
25072
  };
25045
- const questionRef = md5hex(itemRef);
25073
+ const questionRef = generateQuestionReference(itemRef, 1);
25046
25074
  const stimulus = buildHotspotStimulus(parsed, organisationId, mediaVault, customAssetUrl, transformContext);
25047
25075
  const imageSource = organisationId ? transformUrl(parsed.imageSource, organisationId, mediaVault, customAssetUrl, transformContext) : parsed.imageSource;
25048
25076
  const areas = [];
@@ -25340,7 +25368,7 @@ function convertHottextToLearnosity(inputXml, diagnostics, lomTags, organisation
25340
25368
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
25341
25369
  sourceHrefBase: assetTransformContext?.sourceHrefBase
25342
25370
  };
25343
- const questionRef = md5hex(itemRef);
25371
+ const questionRef = generateQuestionReference(itemRef, 1);
25344
25372
  if (parsed.shuffle) diagnostics.push({
25345
25373
  code: DiagnosticCode.QTI_SHUFFLE_NOT_SUPPORTED,
25346
25374
  level: "warning",
@@ -25852,8 +25880,9 @@ function convertMcqToLearnosity(inputXml, diagnostics, lomTags, sourceFile, orga
25852
25880
  const questions = [];
25853
25881
  const widgets = [];
25854
25882
  const questionSpans = [];
25855
- for (const interaction of parsed.interactions) {
25856
- const questionRef = md5hex(interaction.responseIdentifier);
25883
+ for (let i = 0; i < parsed.interactions.length; i++) {
25884
+ const interaction = parsed.interactions[i];
25885
+ const questionRef = generateQuestionReference(itemRef, i + 1);
25857
25886
  const stimulus = interaction.stimulusText ? transformAssetUrls(interaction.stimulusText, {
25858
25887
  organisationId,
25859
25888
  mediaVault,
@@ -26297,7 +26326,7 @@ function convertShorttextToLearnosity(parsed, diagnostics, lomTags, organisation
26297
26326
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
26298
26327
  sourceHrefBase: assetTransformContext?.sourceHrefBase
26299
26328
  };
26300
- const questionRef = md5hex(parsed.responseIdentifier ?? parsed.identifier);
26329
+ const questionRef = generateQuestionReference(itemRef, 1);
26301
26330
  const stimulus = normalizeFinalText(transformAssetUrls((parsed.templateText || "").replace(/{{response}}(?:\s*<\/[^>]+>)*\s*$/, "").trim(), {
26302
26331
  organisationId,
26303
26332
  mediaVault,
@@ -26391,7 +26420,7 @@ function convertClozetextToLearnosity(parsed, diagnostics, lomTags, organisation
26391
26420
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
26392
26421
  sourceHrefBase: assetTransformContext?.sourceHrefBase
26393
26422
  };
26394
- const questionRef = md5hex(parsed.responseIdentifier ?? parsed.identifier);
26423
+ const questionRef = generateQuestionReference(itemRef, 1);
26395
26424
  const stimulus = parsed.stimulusText ? normalizeFinalText(transformAssetUrls(parsed.stimulusText, {
26396
26425
  organisationId,
26397
26426
  mediaVault,
@@ -26641,7 +26670,7 @@ function readAssessmentItemExtendedText(inputXml) {
26641
26670
  /**
26642
26671
  * Build multi-interaction extended text item (multiple longtextV2 questions)
26643
26672
  */
26644
- function buildMultiExtendedTextItem(parsed, inputXml, stimulusOverride, diagnostics, lomTags, organisationId, mediaVault, customAssetUrl, itemReferenceSource, sourceFile, assetTransformContext) {
26673
+ function buildMultiExtendedTextItem(parsed, _inputXml, stimulusOverride, diagnostics, lomTags, organisationId, mediaVault, customAssetUrl, itemReferenceSource, sourceFile, assetTransformContext) {
26645
26674
  const itemRef = assetTransformContext?.finalItemReference ?? generateItemReference(parsed.identifier ?? "unknown", itemReferenceSource, sourceFile);
26646
26675
  const transformContext = {
26647
26676
  finalItemReference: itemRef,
@@ -26651,9 +26680,8 @@ function buildMultiExtendedTextItem(parsed, inputXml, stimulusOverride, diagnost
26651
26680
  const questions = [];
26652
26681
  const widgets = [];
26653
26682
  const questionSpans = [];
26654
- const responseIdentifiers = extractResponseIdentifiers(inputXml, "extendedTextInteraction");
26655
26683
  for (let i = 0; i < stimulusOverride.length; i++) {
26656
- const questionRef = md5hex(responseIdentifiers[i] || `RESPONSE_${i}`);
26684
+ const questionRef = generateQuestionReference(itemRef, i + 1);
26657
26685
  const stimulus = transformAssetUrls(stimulusOverride[i], {
26658
26686
  organisationId,
26659
26687
  mediaVault,
@@ -26695,16 +26723,6 @@ function buildMultiExtendedTextItem(parsed, inputXml, stimulusOverride, diagnost
26695
26723
  };
26696
26724
  }
26697
26725
  /**
26698
- * Extract responseIdentifier values from interactions in XML
26699
- */
26700
- function extractResponseIdentifiers(inputXml, interactionTag) {
26701
- const responseIdentifiers = [];
26702
- const interactionPattern = new RegExp(`<${assertXmlTagName(interactionTag)}[^>]+responseIdentifier=["']([^"']+)["']`, "g");
26703
- let match;
26704
- while ((match = interactionPattern.exec(inputXml)) !== null) responseIdentifiers.push(match[1]);
26705
- return responseIdentifiers;
26706
- }
26707
- /**
26708
26726
  * Convert extended text (extendedTextInteraction) to Learnosity longtextV2
26709
26727
  * TASK 036: Added stimulusOverride parameter for composite items
26710
26728
  */
@@ -26720,7 +26738,7 @@ function convertExtendedTextToLearnosity(inputXml, diagnostics, lomTags, sourceF
26720
26738
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
26721
26739
  sourceHrefBase: assetTransformContext?.sourceHrefBase
26722
26740
  };
26723
- const questionRef = md5hex(parsed.responseIdentifier ?? parsed.identifier ?? "unknown");
26741
+ const questionRef = generateQuestionReference(itemRef, 1);
26724
26742
  const stimulusRaw = stimulusOverride && stimulusOverride.length === 1 ? stimulusOverride[0] : parsed.stimulusText;
26725
26743
  const stimulus = stimulusRaw ? transformAssetUrls(stimulusRaw, {
26726
26744
  organisationId,
@@ -27096,7 +27114,7 @@ function convertGraphicGapMatchToLearnosity(inputXml, diagnostics, _lomTags, org
27096
27114
  };
27097
27115
  });
27098
27116
  const validationValue = buildValidationValue$1(parsed.hotspots, parsed.correctPairs, gapImgIdToResponse);
27099
- const questionRef = md5hex(parsed.identifier ?? "graphicgapmatch");
27117
+ const questionRef = generateQuestionReference(itemRef, 1);
27100
27118
  const question = {
27101
27119
  type: "imageclozeassociationV2",
27102
27120
  image: {
@@ -27470,7 +27488,7 @@ function convertDrawingToLearnosity(inputXml, diagnostics, lomTags, organisation
27470
27488
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
27471
27489
  sourceHrefBase: assetTransformContext?.sourceHrefBase
27472
27490
  };
27473
- const questionRef = md5hex(itemRef + (parsed.responseIdentifier ?? "drawing"));
27491
+ const questionRef = generateQuestionReference(itemRef, 1);
27474
27492
  const questionData = { type: "drawing" };
27475
27493
  const stimulus = buildDrawingStimulus(parsed, organisationId, mediaVault, customAssetUrl, transformContext);
27476
27494
  if (stimulus !== void 0) questionData.stimulus = stimulus;
@@ -27783,7 +27801,7 @@ function convertAssociationToLearnosity(inputXml, diagnostics, lomTags, organisa
27783
27801
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
27784
27802
  sourceHrefBase: assetTransformContext?.sourceHrefBase
27785
27803
  };
27786
- const questionRef = md5hex(itemRef);
27804
+ const questionRef = generateQuestionReference(itemRef, 1);
27787
27805
  const stimulus = transformAssetUrls(parsed.stimulusText ? `<p>${parsed.stimulusText}</p>` : "", {
27788
27806
  organisationId,
27789
27807
  mediaVault,
@@ -28250,6 +28268,7 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
28250
28268
  }
28251
28269
  const allQuestions = [];
28252
28270
  const allWidgets = [];
28271
+ let placeholderRefCounter = 0;
28253
28272
  const processResult = (result, subDiagnostics) => {
28254
28273
  if (result.item) {
28255
28274
  allQuestions.push(...result.item.questions);
@@ -28306,7 +28325,7 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
28306
28325
  if (groupEntries.length > 0) {
28307
28326
  const correctResponses = [];
28308
28327
  for (const entry of groupEntries) if (entry.correctResponse) correctResponses.push(entry.correctResponse);
28309
- const questionRef = md5hex(group.responseIdentifiers[0] || (parsed.identifier ?? "textentry"));
28328
+ const questionRef = `__mixed_placeholder_${placeholderRefCounter++}`;
28310
28329
  const templateParts = [];
28311
28330
  const groupWrapperOpen = group.wrapperOpens[0];
28312
28331
  if (groupWrapperOpen) templateParts.push(groupWrapperOpen);
@@ -28470,6 +28489,17 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
28470
28489
  });
28471
28490
  return { diagnostics };
28472
28491
  }
28492
+ const reassignedWidgets = /* @__PURE__ */ new Set();
28493
+ allQuestions.forEach((question, idx) => {
28494
+ const oldRef = question.reference;
28495
+ const newRef = generateQuestionReference(itemRef, idx + 1);
28496
+ const widget = allWidgets.find((w) => w.widget_type === "response" && w.reference === oldRef && !reassignedWidgets.has(w));
28497
+ if (widget) {
28498
+ widget.reference = newRef;
28499
+ reassignedWidgets.add(widget);
28500
+ }
28501
+ question.reference = newRef;
28502
+ });
28473
28503
  const allFeatures = [];
28474
28504
  if (hasPassageContent(inputXml)) {
28475
28505
  if (extractPassageFromItemBody(inputXml)) {
@@ -28744,6 +28774,18 @@ function readAssessmentItemPassage(inputXml) {
28744
28774
  */
28745
28775
  const MAX_TAG_LENGTH = 255;
28746
28776
  /**
28777
+ * Split a tag value on commas into separate trimmed values.
28778
+ *
28779
+ * When `splitCsvTags` is false the value is returned unchanged as a single
28780
+ * element. When true, the value is split on literal commas, each part is
28781
+ * trimmed, and empty parts (from leading/trailing/double commas) are dropped.
28782
+ * A value without a comma yields a single trimmed element.
28783
+ */
28784
+ function splitTagValue(value, splitCsvTags) {
28785
+ if (!splitCsvTags) return [value];
28786
+ return value.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
28787
+ }
28788
+ /**
28747
28789
  * Validate and optionally truncate tag types and tag names
28748
28790
  *
28749
28791
  * @param tags - Tags to validate
@@ -28805,9 +28847,10 @@ function validateAndProcessTags(tags, options = {}) {
28805
28847
  * Extracts csm:labelledGUID entries as Learnosity tags
28806
28848
  *
28807
28849
  * @param metadataXml - XML containing Common Cartridge metadata
28850
+ * @param splitCsvTags - Split comma-separated GUID values into separate elements (default: true)
28808
28851
  * @returns Tags object with type->name[] mapping
28809
28852
  */
28810
- function parseCommonCartridgeTags(metadataXml) {
28853
+ function parseCommonCartridgeTags(metadataXml, splitCsvTags = true) {
28811
28854
  const tags = {};
28812
28855
  const stack = [];
28813
28856
  let inLabel = false;
@@ -28836,7 +28879,7 @@ function parseCommonCartridgeTags(metadataXml) {
28836
28879
  inLabel = false;
28837
28880
  } else if (localName === "GUID" && inGuid) {
28838
28881
  const guidValue = textBuf.join("").trim();
28839
- if (currentLabel && guidValue) addTagValue(tags, currentLabel, guidValue);
28882
+ if (currentLabel && guidValue) addTagValue(tags, currentLabel, guidValue, splitCsvTags);
28840
28883
  inGuid = false;
28841
28884
  } else if (localName === "labelledGUID") currentLabel = "";
28842
28885
  stack.pop();
@@ -28848,17 +28891,23 @@ function parseCommonCartridgeTags(metadataXml) {
28848
28891
  return tags;
28849
28892
  }
28850
28893
  /**
28851
- * Add a tag value to the tags object with deduplication
28894
+ * Add a tag value to the tags object, splitting comma-separated values when
28895
+ * enabled and deduplicating in insertion order.
28896
+ *
28897
+ * @param splitCsvTags - Split a comma-separated value into separate elements (default: true)
28852
28898
  */
28853
- function addTagValue(tags, source, value) {
28854
- tags[source] = tags[source] ?? [];
28855
- if (!tags[source].includes(value)) tags[source].push(value);
28899
+ function addTagValue(tags, source, value, splitCsvTags = true) {
28900
+ const existing = tags[source] = tags[source] ?? [];
28901
+ for (const part of splitTagValue(value, splitCsvTags)) if (!existing.includes(part)) existing.push(part);
28856
28902
  }
28857
28903
  /**
28858
28904
  * Parse LOM XML and extract tags for Learnosity
28859
28905
  * Extracts classification/taxonPath entries grouped by source langstring
28906
+ *
28907
+ * @param lomXml - XML containing LOM metadata
28908
+ * @param splitCsvTags - Split comma-separated taxon entry values into separate elements (default: true)
28860
28909
  */
28861
- function parseLomXml(lomXml) {
28910
+ function parseLomXml(lomXml, splitCsvTags = true) {
28862
28911
  const tags = {};
28863
28912
  const stack = [];
28864
28913
  let inTaxonPathSource = false;
@@ -28890,7 +28939,7 @@ function parseLomXml(lomXml) {
28890
28939
  inTaxonPathSource = false;
28891
28940
  } else if (inTaxonEntry) {
28892
28941
  const value = textBuf.join("").trim();
28893
- if (value && currentSource) addTagValue(tags, currentSource, value);
28942
+ if (value && currentSource) addTagValue(tags, currentSource, value, splitCsvTags);
28894
28943
  inTaxonEntry = false;
28895
28944
  }
28896
28945
  }
@@ -28915,8 +28964,9 @@ function parseLomXml(lomXml) {
28915
28964
  * @returns Merged tags object and diagnostics
28916
28965
  */
28917
28966
  function parseMetadataTags(metadataXml, options = {}) {
28918
- const lomTags = parseLomXml(metadataXml);
28919
- const ccTags = parseCommonCartridgeTags(metadataXml);
28967
+ const splitCsvTags = options.splitCsvTags ?? true;
28968
+ const lomTags = parseLomXml(metadataXml, splitCsvTags);
28969
+ const ccTags = parseCommonCartridgeTags(metadataXml, splitCsvTags);
28920
28970
  const mergedTags = { ...lomTags };
28921
28971
  for (const [tagType, tagValues] of Object.entries(ccTags)) {
28922
28972
  const values = tagValues;
@@ -28989,7 +29039,7 @@ function convertUploadToLearnosity(inputXml, diagnostics, lomTags, organisationI
28989
29039
  preserveAssetFilenames: assetTransformContext?.preserveAssetFilenames ?? false,
28990
29040
  sourceHrefBase: assetTransformContext?.sourceHrefBase
28991
29041
  };
28992
- const questionRef = md5hex(itemRef + (parsed.responseIdentifier ?? "fileupload"));
29042
+ const questionRef = generateQuestionReference(itemRef, 1);
28993
29043
  const questionData = { type: "fileupload" };
28994
29044
  if (parsed.stimulus) try {
28995
29045
  questionData.stimulus = transformAssetUrls(parsed.stimulus, {
@@ -29308,6 +29358,7 @@ function convertQtiAssessmentItemToLearnosity(inputXml, opts = {}) {
29308
29358
  if (lomXml) try {
29309
29359
  const tagResult = parseMetadataTags(lomXml, {
29310
29360
  truncateTags: opts.truncateTags,
29361
+ splitCsvTags: opts.splitCsvTags,
29311
29362
  filePath: opts.inputPath
29312
29363
  });
29313
29364
  lomTags = tagResult.tags;
@@ -29908,7 +29959,7 @@ var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29908
29959
  //#endregion
29909
29960
  //#region ../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js
29910
29961
  var require_supports_colors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29911
- var os$1 = __require("os");
29962
+ var os = __require("os");
29912
29963
  var hasFlag = require_has_flag();
29913
29964
  var env = process.env;
29914
29965
  var forceColor = void 0;
@@ -29931,7 +29982,7 @@ var require_supports_colors = /* @__PURE__ */ __commonJSMin(((exports, module) =
29931
29982
  if (stream && !stream.isTTY && forceColor !== true) return 0;
29932
29983
  var min = forceColor ? 1 : 0;
29933
29984
  if (process.platform === "win32") {
29934
- var osRelease = os$1.release().split(".");
29985
+ var osRelease = os.release().split(".");
29935
29986
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
29936
29987
  return 1;
29937
29988
  }
@@ -31106,7 +31157,7 @@ var require_cli_table3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
31106
31157
  module.exports = require_table();
31107
31158
  }));
31108
31159
  //#endregion
31109
- //#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/utilities.js
31160
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/utilities.js
31110
31161
  var import_cli_table3 = /* @__PURE__ */ __toESM(require_cli_table3(), 1);
31111
31162
  function stringReplaceAll(string, substring, postfix) {
31112
31163
  let index = string.indexOf(substring);
@@ -31135,7 +31186,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
31135
31186
  return returnValue;
31136
31187
  }
31137
31188
  //#endregion
31138
- //#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/ansi-styles/index.js
31189
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/ansi-styles/index.js
31139
31190
  const ANSI_BACKGROUND_OFFSET = 10;
31140
31191
  const ANSI_UNDERLINE_OFFSET = 20;
31141
31192
  const wrapAnsi16 = (offset = 0) => (code) => `\u{1B}[${code + offset}m`;
@@ -31330,7 +31381,7 @@ function assembleStyles() {
31330
31381
  }
31331
31382
  const ansiStyles = assembleStyles();
31332
31383
  //#endregion
31333
- //#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/vendor/supports-color/index.js
31384
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/vendor/supports-color/index.js
31334
31385
  function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
31335
31386
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
31336
31387
  const position = argv.indexOf(prefix + flag);
@@ -31418,7 +31469,7 @@ function createSupportsColor(stream, options = {}) {
31418
31469
  }));
31419
31470
  }
31420
31471
  //#endregion
31421
- //#region ../../node_modules/.pnpm/chalk@6.0.0/node_modules/chalk/source/index.js
31472
+ //#region ../../node_modules/.pnpm/chalk@6.0.1/node_modules/chalk/source/index.js
31422
31473
  const { stdout: stdoutColor, stderr: stderrColor } = {
31423
31474
  stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
31424
31475
  stderr: createSupportsColor({ isTTY: tty.isatty(2) })
@@ -31552,7 +31603,7 @@ const createStyler = (open, close, parent) => {
31552
31603
  const createBuilder = (self, _styler, _isEmpty) => {
31553
31604
  const builder = (...arguments_) => {
31554
31605
  if (arguments_.length === 1) return applyStyle(builder, "" + arguments_[0]);
31555
- if (arguments_.length === 2) return applyStyle(builder, arguments_[0] + " " + arguments_[1]);
31606
+ if (arguments_.length === 2) return applyStyle(builder, `${arguments_[0] ?? ""} ${arguments_[1] ?? ""}`);
31556
31607
  return applyStyle(builder, arguments_.join(" "));
31557
31608
  };
31558
31609
  Object.setPrototypeOf(builder, proto);
@@ -31681,4 +31732,4 @@ function formatDiagnosticsSummaryTable(diagnostics) {
31681
31732
  //#endregion
31682
31733
  export { mapLearnosityToAst as C, DiagnosticCode as D, parseLearnosityItem as E, downgradeAssessmentTestToQti21 as S, sanitizeHtmlContent as T, md5hex as _, require_cli_table3 as a, serializeAssessmentItem as b, transformForwardAssetUrlsInXml as c, getAllPassageDataPaths as d, generateItemReference as f, serializeQtiAssetIdentity as g, selectQtiAssetFilename as h, chalk as i, convertQtiAssessmentItemToLearnosity as l, isSupportedQtiAssetPath as m, formatDiagnosticsSummaryTable as n, require_string_width as o, canonicalizeQtiAssetHref as p, formatDiagnosticsTable as r, writeDiagnostics as s, countErrors as t, parseMetadataTags as u, getAttr$3 as v, normalizeXhtmlVoidElements as w, escapeXml as x, require_saxes as y };
31683
31734
 
31684
- //# sourceMappingURL=table-D1ydwhbX.js.map
31735
+ //# sourceMappingURL=table-CLUiytPO.js.map