@learnosity/lib-qti-converter 0.12.3 → 0.12.5

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 (27) hide show
  1. package/README.md +28 -3
  2. package/docs/EXAMPLES.md +47 -21
  3. package/docs/FAQ.md +11 -1
  4. package/docs/GETTING_STARTED.md +34 -18
  5. package/package.json +1 -1
  6. package/packages/cli/dist/{batchProcessors-BfmvnTQ5.js → batchProcessors-C8k2v0o_.js} +4 -2
  7. package/packages/cli/dist/batchProcessors-C8k2v0o_.js.map +1 -0
  8. package/packages/cli/dist/batchWorker.js +1 -1
  9. package/packages/cli/dist/{learnosityToQti-B0PoimXr.js → learnosityToQti-D3Xxswaf.js} +5 -4
  10. package/packages/cli/dist/learnosityToQti-D3Xxswaf.js.map +1 -0
  11. package/packages/cli/dist/{learnosityToQtiPackage-RyClxvZj.js → learnosityToQtiPackage-D-hlZ9yI.js} +10 -5
  12. package/packages/cli/dist/learnosityToQtiPackage-D-hlZ9yI.js.map +1 -0
  13. package/packages/cli/dist/main.js +4 -4
  14. package/packages/cli/dist/{qtiPackageToLearnosity-0rkZKKOK.js → qtiPackageToLearnosity-CHDga9lI.js} +2 -2
  15. package/packages/cli/dist/{qtiPackageToLearnosity-0rkZKKOK.js.map → qtiPackageToLearnosity-CHDga9lI.js.map} +1 -1
  16. package/packages/cli/dist/{qtiToLearnosity-jiFTBiQU.js → qtiToLearnosity-BkYlsuH0.js} +2 -2
  17. package/packages/cli/dist/{qtiToLearnosity-jiFTBiQU.js.map → qtiToLearnosity-BkYlsuH0.js.map} +1 -1
  18. package/packages/cli/dist/{resolveOptions-gH_YAxxc.js → resolveOptions-CZ4dw2gp.js} +97 -5
  19. package/packages/cli/dist/resolveOptions-CZ4dw2gp.js.map +1 -0
  20. package/packages/core/dist/index.d.ts +14 -1
  21. package/packages/core/dist/index.js +115 -12
  22. package/packages/core/dist/node.d.ts +19 -1
  23. package/packages/core/dist/node.js +119 -14
  24. package/packages/cli/dist/batchProcessors-BfmvnTQ5.js.map +0 -1
  25. package/packages/cli/dist/learnosityToQti-B0PoimXr.js.map +0 -1
  26. package/packages/cli/dist/learnosityToQtiPackage-RyClxvZj.js.map +0 -1
  27. package/packages/cli/dist/resolveOptions-gH_YAxxc.js.map +0 -1
@@ -1494,6 +1494,8 @@ interface ManifestResource {
1494
1494
  interface QtiContentPackage {
1495
1495
  /** Path to the ZIP file (for diagnostics) */
1496
1496
  zipPath: string;
1497
+ /** QTI version of the package (drives manifest namespaces/schemaLocation). Defaults to 2.2 when absent. */
1498
+ version?: '2.1' | '2.2';
1497
1499
  /** Parsed manifest resources */
1498
1500
  resources: ManifestResource[];
1499
1501
  /** All ZIP entries (path -> metadata) */
@@ -1561,10 +1563,15 @@ declare function parseManifest(manifestXml: string, zipPath: string): ParseManif
1561
1563
  * - Organization structure (empty)
1562
1564
  * - Resources section with provided resources
1563
1565
  *
1566
+ * The QTI metadata namespace and schema location are version-aware so the
1567
+ * manifest references the QTI 2.1 or QTI 2.2 metadata schema matching the
1568
+ * resource types in the package.
1569
+ *
1564
1570
  * @param resources Array of resources to include
1571
+ * @param version QTI version of the package ('2.1' or '2.2'). Defaults to '2.2'.
1565
1572
  * @returns XML string for imsmanifest.xml
1566
1573
  */
1567
- declare function buildManifest(resources: ManifestResource[]): string;
1574
+ declare function buildManifest(resources: ManifestResource[], version?: '2.1' | '2.2'): string;
1568
1575
  //#endregion
1569
1576
  //#region src/qti-package/testDependencies.d.ts
1570
1577
  /**
@@ -2411,6 +2418,12 @@ interface ConvertActivityOptions {
2411
2418
  pretty?: boolean;
2412
2419
  /** QTI version (2.1 or 2.2) */
2413
2420
  version?: QtiVersion;
2421
+ /**
2422
+ * Base URL/prefix that replaces the asset reference prefix up to the
2423
+ * filename for images/audio/video (default: `./assets`). For example
2424
+ * `https://cdn.example.com/media` produces `https://cdn.example.com/media/<filename>`.
2425
+ */
2426
+ customAssetUrl?: string;
2414
2427
  }
2415
2428
  /**
2416
2429
  * Convert a Learnosity Activity to QTI 2.2/2.1 assessmentTest + items
@@ -20443,7 +20443,7 @@ function buildAssessmentItemXml(ast, pretty, version) {
20443
20443
  itemBody: "",
20444
20444
  modalFeedback: []
20445
20445
  };
20446
- sections.stylesheets.push(`${indent}<stylesheet href="assets/css/lrn-normalize.css" type="text/css"/>${nl}`);
20446
+ sections.stylesheets.push(`${indent}<stylesheet href="./assets/css/lrn-normalize.css" type="text/css"/>${nl}`);
20447
20447
  if (ast.layout && ast.interactions) buildMultiWidgetItemSections(ast, diagnostics, sections, indent, indent2, indent3, nl);
20448
20448
  else if (!ast.layout && ast.interactions && ast.interactions.length > 1) buildSequentialInteractionsSections(ast, diagnostics, sections, indent, indent2, indent3, nl);
20449
20449
  else {
@@ -23130,7 +23130,7 @@ const MEDIA_SRC_PATTERN = /(<(?:img|audio|video|source)\s+[^>]*src=["'])([^"']+)
23130
23130
  * "images/photo.png" → "photo.png"
23131
23131
  * "/assets/video.mp4" → "video.mp4"
23132
23132
  */
23133
- function extractFilename(url) {
23133
+ function extractFilename$1(url) {
23134
23134
  const segments = url.split("?")[0].split("#")[0].split("/");
23135
23135
  return segments[segments.length - 1];
23136
23136
  }
@@ -23157,7 +23157,7 @@ function transformUrl(url, organisationId, mediaVault = false, customAssetUrl) {
23157
23157
  if (url.includes("assets.learnosity.com") || url.includes("media-vault.learnosity.com")) return url;
23158
23158
  if (url.match(/^https?:\/\//i)) return url;
23159
23159
  if (url.startsWith("data:")) return url;
23160
- const filename = extractFilename(url);
23160
+ const filename = extractFilename$1(url);
23161
23161
  if (!isSupportedAsset(filename)) return url;
23162
23162
  return buildLearnosityAssetUrl(filename, organisationId, mediaVault, customAssetUrl);
23163
23163
  }
@@ -29030,6 +29030,97 @@ function convertQtiAssessmentItemToLearnosity(inputXml, opts = {}) {
29030
29030
  }
29031
29031
  }
29032
29032
  //#endregion
29033
+ //#region src/learnosity-mapper/forwardAssetUrlTransform.ts
29034
+ /**
29035
+ * Forward-direction (Learnosity → QTI) asset URL transformation.
29036
+ *
29037
+ * Learnosity item/stimulus content references assets using Learnosity's own
29038
+ * path convention (for example `/vendor/learnosity/itembank/assets/<hash>_<name>.mp3`).
29039
+ * When converting to a QTI Content Package, those references must point at the
29040
+ * assets that ship inside the package.
29041
+ *
29042
+ * This module rewrites the *prefix* of an asset reference while preserving the
29043
+ * final path segment (the filename), mirroring the reverse-direction helper in
29044
+ * `qti-to-learnosity/utils/assetUrlTransform.ts`.
29045
+ *
29046
+ * Rules:
29047
+ * - Default prefix is `./assets/` so a reference resolves to `./assets/<filename>`.
29048
+ * - A caller-supplied `customAssetUrl` replaces the entire prefix up to the
29049
+ * filename, e.g. `https://cdn.example.com/media` → `https://cdn.example.com/media/<filename>`.
29050
+ * - Remote (`http(s)://`), protocol-relative (`//`) and `data:` URIs are left
29051
+ * untouched.
29052
+ * - References that already point at internal package paths (`assets/`,
29053
+ * `./assets/`, `stimuli/`, `items/`, or a relative `../` path) are left
29054
+ * untouched so we never rewrite converter-generated internal references
29055
+ * (e.g. `assets/gapimgs/...`, `assets/css/lrn-normalize.css`).
29056
+ */
29057
+ /** Default output prefix applied when no `customAssetUrl` is provided. */
29058
+ const DEFAULT_FORWARD_ASSET_PREFIX = "./assets";
29059
+ /**
29060
+ * Extract the filename (last path segment) from a URL/path, ignoring any query
29061
+ * string or hash fragment.
29062
+ *
29063
+ * Examples:
29064
+ * "/vendor/learnosity/itembank/assets/hash_name.mp3" → "hash_name.mp3"
29065
+ * "images/photo.png?v=2" → "photo.png"
29066
+ */
29067
+ function extractFilename(url) {
29068
+ const segments = url.split("?")[0].split("#")[0].split("/");
29069
+ return segments[segments.length - 1];
29070
+ }
29071
+ /**
29072
+ * Determine whether a reference is one we should leave untouched (remote/data
29073
+ * URIs and converter-generated internal package paths).
29074
+ */
29075
+ function isNonRewritableReference(url) {
29076
+ const trimmed = url.trim();
29077
+ if (trimmed === "") return true;
29078
+ if (/^https?:\/\//i.test(trimmed) || trimmed.startsWith("//") || trimmed.startsWith("data:")) return true;
29079
+ if (trimmed.startsWith("assets/") || trimmed.startsWith("./assets/") || trimmed.startsWith("stimuli/") || trimmed.startsWith("items/") || trimmed.startsWith("tests/") || trimmed.startsWith("../")) return true;
29080
+ return false;
29081
+ }
29082
+ /**
29083
+ * Build the output base prefix (without a trailing slash).
29084
+ */
29085
+ function resolveBasePrefix(customAssetUrl) {
29086
+ const base = customAssetUrl && customAssetUrl.trim() !== "" ? customAssetUrl.trim() : DEFAULT_FORWARD_ASSET_PREFIX;
29087
+ return base.endsWith("/") ? base.slice(0, -1) : base;
29088
+ }
29089
+ /**
29090
+ * Rewrite a single asset reference to the forward-direction package prefix.
29091
+ *
29092
+ * @param url - The incoming Learnosity asset reference.
29093
+ * @param customAssetUrl - Optional base URL/prefix that replaces everything up
29094
+ * to the filename. Defaults to `./assets`.
29095
+ * @returns The rewritten reference, or the original string when it should not
29096
+ * be rewritten.
29097
+ */
29098
+ function transformForwardAssetUrl(url, customAssetUrl) {
29099
+ if (isNonRewritableReference(url)) return url;
29100
+ const filename = extractFilename(url);
29101
+ if (filename === "") return url;
29102
+ return `${resolveBasePrefix(customAssetUrl)}/${filename}`;
29103
+ }
29104
+ /**
29105
+ * Rewrite every asset reference found in a fragment of QTI XML / XHTML.
29106
+ *
29107
+ * Handles the attributes used by the forward serializers and mappers:
29108
+ * - `src="..."` (img, qh5:source, qh5:track, audio/video source)
29109
+ * - `data="..."` (object elements, e.g. media fallbacks, image backgrounds)
29110
+ * - `href="..."` (download fallback anchors for media)
29111
+ *
29112
+ * Internal references (`stimuli/...`, `assets/...`, the CSS stylesheet, gap
29113
+ * images, etc.) are preserved by {@link transformForwardAssetUrl}.
29114
+ */
29115
+ function transformForwardAssetUrlsInXml(xml, customAssetUrl) {
29116
+ if (!xml) return xml;
29117
+ return xml.replace(/\b(src|data|href)=("|')([^"']*)\2/gi, (match, attr, quote, value) => {
29118
+ const rewritten = transformForwardAssetUrl(value, customAssetUrl);
29119
+ if (rewritten === value) return match;
29120
+ return `${attr}=${quote}${rewritten}${quote}`;
29121
+ });
29122
+ }
29123
+ //#endregion
29033
29124
  //#region src/conversions.ts
29034
29125
  /**
29035
29126
  * Convert QTI XML to Learnosity JSON.
@@ -29096,8 +29187,9 @@ function convertLearnosityToQti(input, opts) {
29096
29187
  output: "",
29097
29188
  diagnostics: allDiagnostics
29098
29189
  });
29190
+ const output = transformForwardAssetUrlsInXml(serializeResult.xml, opts.customAssetUrl);
29099
29191
  return Promise.resolve({
29100
- output: serializeResult.xml,
29192
+ output,
29101
29193
  diagnostics: allDiagnostics
29102
29194
  });
29103
29195
  }
@@ -29293,22 +29385,32 @@ function uuidv4() {
29293
29385
  * - Organization structure (empty)
29294
29386
  * - Resources section with provided resources
29295
29387
  *
29388
+ * The QTI metadata namespace and schema location are version-aware so the
29389
+ * manifest references the QTI 2.1 or QTI 2.2 metadata schema matching the
29390
+ * resource types in the package.
29391
+ *
29296
29392
  * @param resources Array of resources to include
29393
+ * @param version QTI version of the package ('2.1' or '2.2'). Defaults to '2.2'.
29297
29394
  * @returns XML string for imsmanifest.xml
29298
29395
  */
29299
- function buildManifest(resources) {
29396
+ function buildManifest(resources, version = "2.2") {
29300
29397
  const lines = [];
29398
+ const qtiVersionTag = version === "2.1" ? "v2p1" : "v2p2";
29399
+ const qtiMetadataNs = `http://www.imsglobal.org/xsd/imsqti_metadata_${qtiVersionTag}`;
29400
+ const qtiMetadataXsd = `http://www.imsglobal.org/xsd/qti/qti${qtiVersionTag}/imsqti_metadata_${qtiVersionTag}.xsd`;
29301
29401
  lines.push("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
29302
29402
  const manifestId = `MANIFEST-${uuidv4()}`;
29303
29403
  lines.push("<manifest");
29304
29404
  lines.push(` identifier="${manifestId}"`);
29305
29405
  lines.push(" xmlns=\"http://www.imsglobal.org/xsd/imscp_v1p1\"");
29306
29406
  lines.push(" xmlns:imsmd=\"http://www.imsglobal.org/xsd/imsmd_v1p2\"");
29307
- lines.push(" xmlns:imsqti=\"http://www.imsglobal.org/xsd/imsqti_v2p2\"");
29407
+ lines.push(` xmlns:imsqti="${qtiMetadataNs}"`);
29308
29408
  lines.push(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
29309
- lines.push(" xsi:schemaLocation=\"http://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/imscp_v1p1.xsd\">");
29409
+ lines.push(" xsi:schemaLocation=\"http://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/imscp_v1p1.xsd");
29410
+ lines.push(" http://www.imsglobal.org/xsd/imsmd_v1p2 http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd");
29411
+ lines.push(` ${qtiMetadataNs} ${qtiMetadataXsd}">`);
29310
29412
  lines.push(" <metadata>");
29311
- lines.push(" <schema>QTIv2.2 Package</schema>");
29413
+ lines.push(` <schema>QTIv${version} Package</schema>`);
29312
29414
  lines.push(" <schemaversion>1.0.0</schemaversion>");
29313
29415
  lines.push(" </metadata>");
29314
29416
  lines.push(" <organizations/>");
@@ -29753,6 +29855,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29753
29855
  const stimuliByRef = /* @__PURE__ */ new Map();
29754
29856
  const pretty = options.pretty ?? false;
29755
29857
  const version = options.version ?? "2.2";
29858
+ const customAssetUrl = options.customAssetUrl;
29756
29859
  const itemRefs = bundle.activityItemRefs.get(activityRef);
29757
29860
  if (!itemRefs) {
29758
29861
  diagnostics.push({
@@ -29787,7 +29890,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29787
29890
  diagnostics.push(...itemDiagnostics);
29788
29891
  if (parseResult.diagnostics.some((d) => d.code === DiagnosticCode.LRN_UNSUPPORTED_QUESTION_TYPE)) continue;
29789
29892
  if (!parseResult.model) continue;
29790
- collectStimuliFromFeatures(parseResult.model.features, stimuliByRef, stimuli, diagnostics);
29893
+ collectStimuliFromFeatures(parseResult.model.features, stimuliByRef, stimuli, diagnostics, customAssetUrl);
29791
29894
  const mapResult = mapLearnosityToAst(parseResult.model);
29792
29895
  const mapDiagnostics = mapResult.diagnostics.map((d) => ({
29793
29896
  ...d,
@@ -29806,7 +29909,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29806
29909
  diagnostics.push(...serializeDiagnostics);
29807
29910
  if (serializeResult.xml) items.push({
29808
29911
  reference: itemRef,
29809
- xml: serializeResult.xml,
29912
+ xml: transformForwardAssetUrlsInXml(serializeResult.xml, customAssetUrl),
29810
29913
  ast: mapResult.ast,
29811
29914
  diagnostics: [
29812
29915
  ...parseResult.diagnostics,
@@ -29871,7 +29974,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29871
29974
  /**
29872
29975
  * Collect sharedpassage features and convert them to stimulus entries (deduplicated)
29873
29976
  */
29874
- function collectStimuliFromFeatures(features, stimuliByRef, stimuli, diagnostics) {
29977
+ function collectStimuliFromFeatures(features, stimuliByRef, stimuli, diagnostics, customAssetUrl) {
29875
29978
  for (const feature of features) {
29876
29979
  if (feature.type !== "sharedpassage" || !feature.data || typeof feature.data !== "object" || !("type" in feature.data)) continue;
29877
29980
  if (stimuliByRef.has(feature.reference)) continue;
@@ -29879,7 +29982,7 @@ function collectStimuliFromFeatures(features, stimuliByRef, stimuli, diagnostics
29879
29982
  if (stimulusAst) {
29880
29983
  const stimulusEntry = {
29881
29984
  reference: feature.reference,
29882
- xml: serializeAssessmentStimulusAsHtml(stimulusAst)
29985
+ xml: transformForwardAssetUrlsInXml(serializeAssessmentStimulusAsHtml(stimulusAst), customAssetUrl)
29883
29986
  };
29884
29987
  stimuliByRef.set(feature.reference, stimulusEntry);
29885
29988
  stimuli.push(stimulusEntry);
@@ -1494,6 +1494,8 @@ interface ManifestResource {
1494
1494
  interface QtiContentPackage {
1495
1495
  /** Path to the ZIP file (for diagnostics) */
1496
1496
  zipPath: string;
1497
+ /** QTI version of the package (drives manifest namespaces/schemaLocation). Defaults to 2.2 when absent. */
1498
+ version?: '2.1' | '2.2';
1497
1499
  /** Parsed manifest resources */
1498
1500
  resources: ManifestResource[];
1499
1501
  /** All ZIP entries (path -> metadata) */
@@ -1561,10 +1563,15 @@ declare function parseManifest(manifestXml: string, zipPath: string): ParseManif
1561
1563
  * - Organization structure (empty)
1562
1564
  * - Resources section with provided resources
1563
1565
  *
1566
+ * The QTI metadata namespace and schema location are version-aware so the
1567
+ * manifest references the QTI 2.1 or QTI 2.2 metadata schema matching the
1568
+ * resource types in the package.
1569
+ *
1564
1570
  * @param resources Array of resources to include
1571
+ * @param version QTI version of the package ('2.1' or '2.2'). Defaults to '2.2'.
1565
1572
  * @returns XML string for imsmanifest.xml
1566
1573
  */
1567
- declare function buildManifest(resources: ManifestResource[]): string;
1574
+ declare function buildManifest(resources: ManifestResource[], version?: '2.1' | '2.2'): string;
1568
1575
  //#endregion
1569
1576
  //#region src/qti-package/testDependencies.d.ts
1570
1577
  /**
@@ -2411,6 +2418,12 @@ interface ConvertActivityOptions {
2411
2418
  pretty?: boolean;
2412
2419
  /** QTI version (2.1 or 2.2) */
2413
2420
  version?: QtiVersion;
2421
+ /**
2422
+ * Base URL/prefix that replaces the asset reference prefix up to the
2423
+ * filename for images/audio/video (default: `./assets`). For example
2424
+ * `https://cdn.example.com/media` produces `https://cdn.example.com/media/<filename>`.
2425
+ */
2426
+ customAssetUrl?: string;
2414
2427
  }
2415
2428
  /**
2416
2429
  * Convert a Learnosity Activity to QTI 2.2/2.1 assessmentTest + items
@@ -2884,6 +2897,11 @@ interface ConvertLearnosityToQtiPackageOptions {
2884
2897
  qtiVersion?: QtiVersion;
2885
2898
  /** Pretty-print XML output */
2886
2899
  pretty?: boolean;
2900
+ /**
2901
+ * Base URL/prefix that replaces the asset reference prefix up to the
2902
+ * filename for images/audio/video (default: `./assets`).
2903
+ */
2904
+ customAssetUrl?: string;
2887
2905
  }
2888
2906
  /**
2889
2907
  * Result of converting a Learnosity bundle to a QTI Content Package
@@ -20450,7 +20450,7 @@ function buildAssessmentItemXml(ast, pretty, version) {
20450
20450
  itemBody: "",
20451
20451
  modalFeedback: []
20452
20452
  };
20453
- sections.stylesheets.push(`${indent}<stylesheet href="assets/css/lrn-normalize.css" type="text/css"/>${nl}`);
20453
+ sections.stylesheets.push(`${indent}<stylesheet href="./assets/css/lrn-normalize.css" type="text/css"/>${nl}`);
20454
20454
  if (ast.layout && ast.interactions) buildMultiWidgetItemSections(ast, diagnostics, sections, indent, indent2, indent3, nl);
20455
20455
  else if (!ast.layout && ast.interactions && ast.interactions.length > 1) buildSequentialInteractionsSections(ast, diagnostics, sections, indent, indent2, indent3, nl);
20456
20456
  else {
@@ -23137,7 +23137,7 @@ const MEDIA_SRC_PATTERN = /(<(?:img|audio|video|source)\s+[^>]*src=["'])([^"']+)
23137
23137
  * "images/photo.png" → "photo.png"
23138
23138
  * "/assets/video.mp4" → "video.mp4"
23139
23139
  */
23140
- function extractFilename(url) {
23140
+ function extractFilename$1(url) {
23141
23141
  const segments = url.split("?")[0].split("#")[0].split("/");
23142
23142
  return segments[segments.length - 1];
23143
23143
  }
@@ -23164,7 +23164,7 @@ function transformUrl(url, organisationId, mediaVault = false, customAssetUrl) {
23164
23164
  if (url.includes("assets.learnosity.com") || url.includes("media-vault.learnosity.com")) return url;
23165
23165
  if (url.match(/^https?:\/\//i)) return url;
23166
23166
  if (url.startsWith("data:")) return url;
23167
- const filename = extractFilename(url);
23167
+ const filename = extractFilename$1(url);
23168
23168
  if (!isSupportedAsset(filename)) return url;
23169
23169
  return buildLearnosityAssetUrl(filename, organisationId, mediaVault, customAssetUrl);
23170
23170
  }
@@ -29037,6 +29037,97 @@ function convertQtiAssessmentItemToLearnosity(inputXml, opts = {}) {
29037
29037
  }
29038
29038
  }
29039
29039
  //#endregion
29040
+ //#region src/learnosity-mapper/forwardAssetUrlTransform.ts
29041
+ /**
29042
+ * Forward-direction (Learnosity → QTI) asset URL transformation.
29043
+ *
29044
+ * Learnosity item/stimulus content references assets using Learnosity's own
29045
+ * path convention (for example `/vendor/learnosity/itembank/assets/<hash>_<name>.mp3`).
29046
+ * When converting to a QTI Content Package, those references must point at the
29047
+ * assets that ship inside the package.
29048
+ *
29049
+ * This module rewrites the *prefix* of an asset reference while preserving the
29050
+ * final path segment (the filename), mirroring the reverse-direction helper in
29051
+ * `qti-to-learnosity/utils/assetUrlTransform.ts`.
29052
+ *
29053
+ * Rules:
29054
+ * - Default prefix is `./assets/` so a reference resolves to `./assets/<filename>`.
29055
+ * - A caller-supplied `customAssetUrl` replaces the entire prefix up to the
29056
+ * filename, e.g. `https://cdn.example.com/media` → `https://cdn.example.com/media/<filename>`.
29057
+ * - Remote (`http(s)://`), protocol-relative (`//`) and `data:` URIs are left
29058
+ * untouched.
29059
+ * - References that already point at internal package paths (`assets/`,
29060
+ * `./assets/`, `stimuli/`, `items/`, or a relative `../` path) are left
29061
+ * untouched so we never rewrite converter-generated internal references
29062
+ * (e.g. `assets/gapimgs/...`, `assets/css/lrn-normalize.css`).
29063
+ */
29064
+ /** Default output prefix applied when no `customAssetUrl` is provided. */
29065
+ const DEFAULT_FORWARD_ASSET_PREFIX = "./assets";
29066
+ /**
29067
+ * Extract the filename (last path segment) from a URL/path, ignoring any query
29068
+ * string or hash fragment.
29069
+ *
29070
+ * Examples:
29071
+ * "/vendor/learnosity/itembank/assets/hash_name.mp3" → "hash_name.mp3"
29072
+ * "images/photo.png?v=2" → "photo.png"
29073
+ */
29074
+ function extractFilename(url) {
29075
+ const segments = url.split("?")[0].split("#")[0].split("/");
29076
+ return segments[segments.length - 1];
29077
+ }
29078
+ /**
29079
+ * Determine whether a reference is one we should leave untouched (remote/data
29080
+ * URIs and converter-generated internal package paths).
29081
+ */
29082
+ function isNonRewritableReference(url) {
29083
+ const trimmed = url.trim();
29084
+ if (trimmed === "") return true;
29085
+ if (/^https?:\/\//i.test(trimmed) || trimmed.startsWith("//") || trimmed.startsWith("data:")) return true;
29086
+ if (trimmed.startsWith("assets/") || trimmed.startsWith("./assets/") || trimmed.startsWith("stimuli/") || trimmed.startsWith("items/") || trimmed.startsWith("tests/") || trimmed.startsWith("../")) return true;
29087
+ return false;
29088
+ }
29089
+ /**
29090
+ * Build the output base prefix (without a trailing slash).
29091
+ */
29092
+ function resolveBasePrefix(customAssetUrl) {
29093
+ const base = customAssetUrl && customAssetUrl.trim() !== "" ? customAssetUrl.trim() : DEFAULT_FORWARD_ASSET_PREFIX;
29094
+ return base.endsWith("/") ? base.slice(0, -1) : base;
29095
+ }
29096
+ /**
29097
+ * Rewrite a single asset reference to the forward-direction package prefix.
29098
+ *
29099
+ * @param url - The incoming Learnosity asset reference.
29100
+ * @param customAssetUrl - Optional base URL/prefix that replaces everything up
29101
+ * to the filename. Defaults to `./assets`.
29102
+ * @returns The rewritten reference, or the original string when it should not
29103
+ * be rewritten.
29104
+ */
29105
+ function transformForwardAssetUrl(url, customAssetUrl) {
29106
+ if (isNonRewritableReference(url)) return url;
29107
+ const filename = extractFilename(url);
29108
+ if (filename === "") return url;
29109
+ return `${resolveBasePrefix(customAssetUrl)}/${filename}`;
29110
+ }
29111
+ /**
29112
+ * Rewrite every asset reference found in a fragment of QTI XML / XHTML.
29113
+ *
29114
+ * Handles the attributes used by the forward serializers and mappers:
29115
+ * - `src="..."` (img, qh5:source, qh5:track, audio/video source)
29116
+ * - `data="..."` (object elements, e.g. media fallbacks, image backgrounds)
29117
+ * - `href="..."` (download fallback anchors for media)
29118
+ *
29119
+ * Internal references (`stimuli/...`, `assets/...`, the CSS stylesheet, gap
29120
+ * images, etc.) are preserved by {@link transformForwardAssetUrl}.
29121
+ */
29122
+ function transformForwardAssetUrlsInXml(xml, customAssetUrl) {
29123
+ if (!xml) return xml;
29124
+ return xml.replace(/\b(src|data|href)=("|')([^"']*)\2/gi, (match, attr, quote, value) => {
29125
+ const rewritten = transformForwardAssetUrl(value, customAssetUrl);
29126
+ if (rewritten === value) return match;
29127
+ return `${attr}=${quote}${rewritten}${quote}`;
29128
+ });
29129
+ }
29130
+ //#endregion
29040
29131
  //#region src/conversions.ts
29041
29132
  /**
29042
29133
  * Convert QTI XML to Learnosity JSON.
@@ -29103,8 +29194,9 @@ function convertLearnosityToQti(input, opts) {
29103
29194
  output: "",
29104
29195
  diagnostics: allDiagnostics
29105
29196
  });
29197
+ const output = transformForwardAssetUrlsInXml(serializeResult.xml, opts.customAssetUrl);
29106
29198
  return Promise.resolve({
29107
- output: serializeResult.xml,
29199
+ output,
29108
29200
  diagnostics: allDiagnostics
29109
29201
  });
29110
29202
  }
@@ -29300,22 +29392,32 @@ function uuidv4() {
29300
29392
  * - Organization structure (empty)
29301
29393
  * - Resources section with provided resources
29302
29394
  *
29395
+ * The QTI metadata namespace and schema location are version-aware so the
29396
+ * manifest references the QTI 2.1 or QTI 2.2 metadata schema matching the
29397
+ * resource types in the package.
29398
+ *
29303
29399
  * @param resources Array of resources to include
29400
+ * @param version QTI version of the package ('2.1' or '2.2'). Defaults to '2.2'.
29304
29401
  * @returns XML string for imsmanifest.xml
29305
29402
  */
29306
- function buildManifest(resources) {
29403
+ function buildManifest(resources, version = "2.2") {
29307
29404
  const lines = [];
29405
+ const qtiVersionTag = version === "2.1" ? "v2p1" : "v2p2";
29406
+ const qtiMetadataNs = `http://www.imsglobal.org/xsd/imsqti_metadata_${qtiVersionTag}`;
29407
+ const qtiMetadataXsd = `http://www.imsglobal.org/xsd/qti/qti${qtiVersionTag}/imsqti_metadata_${qtiVersionTag}.xsd`;
29308
29408
  lines.push("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
29309
29409
  const manifestId = `MANIFEST-${uuidv4()}`;
29310
29410
  lines.push("<manifest");
29311
29411
  lines.push(` identifier="${manifestId}"`);
29312
29412
  lines.push(" xmlns=\"http://www.imsglobal.org/xsd/imscp_v1p1\"");
29313
29413
  lines.push(" xmlns:imsmd=\"http://www.imsglobal.org/xsd/imsmd_v1p2\"");
29314
- lines.push(" xmlns:imsqti=\"http://www.imsglobal.org/xsd/imsqti_v2p2\"");
29414
+ lines.push(` xmlns:imsqti="${qtiMetadataNs}"`);
29315
29415
  lines.push(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
29316
- lines.push(" xsi:schemaLocation=\"http://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/imscp_v1p1.xsd\">");
29416
+ lines.push(" xsi:schemaLocation=\"http://www.imsglobal.org/xsd/imscp_v1p1 http://www.imsglobal.org/xsd/imscp_v1p1.xsd");
29417
+ lines.push(" http://www.imsglobal.org/xsd/imsmd_v1p2 http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd");
29418
+ lines.push(` ${qtiMetadataNs} ${qtiMetadataXsd}">`);
29317
29419
  lines.push(" <metadata>");
29318
- lines.push(" <schema>QTIv2.2 Package</schema>");
29420
+ lines.push(` <schema>QTIv${version} Package</schema>`);
29319
29421
  lines.push(" <schemaversion>1.0.0</schemaversion>");
29320
29422
  lines.push(" </metadata>");
29321
29423
  lines.push(" <organizations/>");
@@ -29760,6 +29862,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29760
29862
  const stimuliByRef = /* @__PURE__ */ new Map();
29761
29863
  const pretty = options.pretty ?? false;
29762
29864
  const version = options.version ?? "2.2";
29865
+ const customAssetUrl = options.customAssetUrl;
29763
29866
  const itemRefs = bundle.activityItemRefs.get(activityRef);
29764
29867
  if (!itemRefs) {
29765
29868
  diagnostics.push({
@@ -29794,7 +29897,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29794
29897
  diagnostics.push(...itemDiagnostics);
29795
29898
  if (parseResult.diagnostics.some((d) => d.code === DiagnosticCode.LRN_UNSUPPORTED_QUESTION_TYPE)) continue;
29796
29899
  if (!parseResult.model) continue;
29797
- collectStimuliFromFeatures(parseResult.model.features, stimuliByRef, stimuli, diagnostics);
29900
+ collectStimuliFromFeatures(parseResult.model.features, stimuliByRef, stimuli, diagnostics, customAssetUrl);
29798
29901
  const mapResult = mapLearnosityToAst(parseResult.model);
29799
29902
  const mapDiagnostics = mapResult.diagnostics.map((d) => ({
29800
29903
  ...d,
@@ -29813,7 +29916,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29813
29916
  diagnostics.push(...serializeDiagnostics);
29814
29917
  if (serializeResult.xml) items.push({
29815
29918
  reference: itemRef,
29816
- xml: serializeResult.xml,
29919
+ xml: transformForwardAssetUrlsInXml(serializeResult.xml, customAssetUrl),
29817
29920
  ast: mapResult.ast,
29818
29921
  diagnostics: [
29819
29922
  ...parseResult.diagnostics,
@@ -29878,7 +29981,7 @@ function convertActivity(bundle, activityRef, options = {}) {
29878
29981
  /**
29879
29982
  * Collect sharedpassage features and convert them to stimulus entries (deduplicated)
29880
29983
  */
29881
- function collectStimuliFromFeatures(features, stimuliByRef, stimuli, diagnostics) {
29984
+ function collectStimuliFromFeatures(features, stimuliByRef, stimuli, diagnostics, customAssetUrl) {
29882
29985
  for (const feature of features) {
29883
29986
  if (feature.type !== "sharedpassage" || !feature.data || typeof feature.data !== "object" || !("type" in feature.data)) continue;
29884
29987
  if (stimuliByRef.has(feature.reference)) continue;
@@ -29886,7 +29989,7 @@ function collectStimuliFromFeatures(features, stimuliByRef, stimuli, diagnostics
29886
29989
  if (stimulusAst) {
29887
29990
  const stimulusEntry = {
29888
29991
  reference: feature.reference,
29889
- xml: serializeAssessmentStimulusAsHtml(stimulusAst)
29992
+ xml: transformForwardAssetUrlsInXml(serializeAssessmentStimulusAsHtml(stimulusAst), customAssetUrl)
29890
29993
  };
29891
29994
  stimuliByRef.set(feature.reference, stimulusEntry);
29892
29995
  stimuli.push(stimulusEntry);
@@ -32000,7 +32103,7 @@ function loadQtiContentPackage(zipPath) {
32000
32103
  */
32001
32104
  function saveQtiContentPackage(pkg, outputPath) {
32002
32105
  const diagnostics = [];
32003
- const manifestXml = buildManifest(pkg.resources);
32106
+ const manifestXml = buildManifest(pkg.resources, pkg.version ?? "2.2");
32004
32107
  const files = [];
32005
32108
  files.push({
32006
32109
  path: "imsmanifest.xml",
@@ -32958,6 +33061,7 @@ function convertLearnosityToQtiPackage(opts) {
32958
33061
  }
32959
33062
  const pkg = {
32960
33063
  zipPath: "",
33064
+ version: qtiVersion,
32961
33065
  resources: [],
32962
33066
  entries: /* @__PURE__ */ new Map(),
32963
33067
  items: [],
@@ -32968,7 +33072,8 @@ function convertLearnosityToQtiPackage(opts) {
32968
33072
  for (const activityRef of activityRefs) {
32969
33073
  const conversion = convertActivity(bundle, activityRef, {
32970
33074
  pretty: opts.pretty,
32971
- version: qtiVersion
33075
+ version: qtiVersion,
33076
+ customAssetUrl: opts.customAssetUrl
32972
33077
  });
32973
33078
  allDiagnostics.push(...conversion.diagnostics);
32974
33079
  if (conversion.items.length === 0 && !conversion.testXml) continue;
@@ -1 +0,0 @@
1
- {"version":3,"file":"batchProcessors-BfmvnTQ5.js","names":[],"sources":["../src/utils/batchProcessors.ts"],"sourcesContent":["/**\n * Per-package conversion tasks, shared by the serial batch path\n * (`processBatch`) and the parallel worker path (`processBatchParallel` via\n * `batchWorker`). Extracting them here keeps a single implementation per\n * direction — the same code runs inline or inside a worker thread.\n */\n\nimport {\n loadPackageDirectory,\n convertQtiPackageToLearnosityBundle,\n writeLearnosityBundle,\n loadLearnosityBundle,\n convertActivity,\n buildPackageFromActivity,\n mergeActivityPackage,\n sanitizeFolderName,\n ensureUniqueFolderName,\n saveQtiContentPackage,\n nodeFileAccess,\n type Diagnostic,\n type ItemFilenameSource,\n type ItemReferenceSource,\n type LearnosityBundleModel,\n type QtiContentPackage,\n} from '@learnosity/converter-core/node';\nimport type { DetectedPackage } from './packageScanner.js';\nimport { writeDiagnostics } from '../io/writeDiagnostics.js';\nimport { formatDiagnosticsSummaryTable } from '../ux/table.js';\n\n/** Options accepted by the per-package processors (subset of resolved CLI options). */\nexport interface BatchPackageOptions {\n organisationId?: number;\n mediaVault?: boolean;\n customAssetUrl?: string;\n itemReferenceSource?: ItemReferenceSource;\n itemFilenameSource?: ItemFilenameSource;\n truncateTags?: boolean;\n version?: string;\n pretty?: boolean;\n qtiVersion?: '2.1' | '2.2';\n}\n\n/** Result of processing one package (matches PackageProcessor's return shape). */\nexport interface PackageResult {\n success: boolean;\n errorCount: number;\n warningCount: number;\n convertedItemCount?: number;\n failedItemCount?: number;\n message?: string;\n}\n\n/** A single package conversion task dispatched to a worker. */\nexport interface BatchTask {\n direction: 'qti-to-learnosity' | 'learnosity-to-qti';\n pkg: DetectedPackage;\n packageOutputPath: string;\n options: BatchPackageOptions;\n}\n\n/** Run one batch task in-process (used by the worker and directly in tests). */\nexport async function runBatchTask(task: BatchTask, quiet = true): Promise<PackageResult> {\n if (task.direction === 'qti-to-learnosity') {\n return processQtiPackageToLearnosity(task.pkg, task.packageOutputPath, task.options, quiet);\n }\n\n return processLearnosityToQtiPackage(task.pkg, task.packageOutputPath, task.options, quiet);\n}\n\nfunction displayDiagnosticsSummary(diagnostics: Diagnostic[], quiet: boolean): void {\n if (quiet) {\n return;\n }\n\n const summaryTable = formatDiagnosticsSummaryTable(diagnostics);\n\n if (summaryTable) {\n console.log(' Diagnostics:');\n console.log(\n summaryTable\n .split('\\n')\n .map((line) => ' ' + line)\n .join('\\n')\n );\n console.log('');\n }\n}\n\n/** Convert one QTI Content Package directory to a Learnosity bundle on disk. */\nexport async function processQtiPackageToLearnosity(\n pkg: DetectedPackage,\n packageOutputPath: string,\n options: BatchPackageOptions,\n quiet: boolean\n): Promise<PackageResult> {\n // Convert the package\n const loaded = loadPackageDirectory(pkg.path);\n const convertResult = loaded.entries\n ? convertQtiPackageToLearnosityBundle(\n { entries: loaded.entries },\n {\n organisationId: options.organisationId,\n mediaVault: options.mediaVault,\n customAssetUrl: options.customAssetUrl,\n itemReferenceSource: options.itemReferenceSource,\n itemFilenameSource: options.itemFilenameSource,\n truncateTags: options.truncateTags,\n packageVersion: options.version,\n sourceDir: pkg.path,\n fileAccess: nodeFileAccess,\n }\n )\n : { diagnostics: loaded.diagnostics };\n\n const errors = convertResult.diagnostics.filter((d) => d.level === 'error');\n const warnings = convertResult.diagnostics.filter((d) => d.level === 'warning');\n const hasValidBundle = convertResult.bundle && convertResult.bundle.items.size > 0;\n\n const convertedFiles = convertResult.convertedSourceFiles || [];\n const failedFiles = convertResult.failedSourceFiles || [];\n\n // Count items that have error-level diagnostics (includes both\n // completely failed items and items that converted with errors)\n const filesWithErrors = new Set<string>();\n\n for (const d of convertResult.diagnostics) {\n if (d.level === 'error' && d.file) {\n filesWithErrors.add(d.file);\n }\n }\n\n const convertedWithErrors = convertedFiles.filter((f) => filesWithErrors.has(f)).length;\n const erroredItemCount = failedFiles.length + convertedWithErrors;\n const cleanItemCount = convertedFiles.length - convertedWithErrors;\n\n if (errors.length > 0 && !hasValidBundle) {\n return {\n success: false,\n errorCount: errors.length,\n warningCount: warnings.length,\n convertedItemCount: cleanItemCount,\n failedItemCount: erroredItemCount,\n message: 'Conversion failed',\n };\n }\n\n // Write the bundle\n const writeResult = await writeLearnosityBundle(convertResult.bundle!, {\n outDir: packageOutputPath,\n isZipOutput: false,\n });\n\n const writeErrors = writeResult.diagnostics.filter((d) => d.level === 'error');\n\n if (writeErrors.length > 0) {\n return {\n success: false,\n errorCount: errors.length + writeErrors.length,\n warningCount: warnings.length,\n convertedItemCount: cleanItemCount,\n failedItemCount: erroredItemCount,\n message: 'Write failed',\n };\n }\n\n // In batch mode, always write diagnostics.json to each package directory\n const diagnosticsPath = `${packageOutputPath}/diagnostics.json`;\n const allDiagnostics = [...convertResult.diagnostics, ...writeResult.diagnostics];\n const convertedActivityFiles = convertResult.convertedActivityFiles || [];\n\n await writeDiagnostics(allDiagnostics, 'file', diagnosticsPath, packageOutputPath, false, {\n inputPath: pkg.path,\n outputPath: packageOutputPath,\n totalItemsFound: convertedFiles.length + failedFiles.length,\n totalActivitiesFound: convertedActivityFiles.length,\n convertedFiles,\n failedFiles,\n convertedActivities: convertedActivityFiles,\n });\n\n // Show condensed diagnostics summary\n if (!quiet) {\n const summaryTable = formatDiagnosticsSummaryTable(allDiagnostics);\n\n if (summaryTable) {\n console.log(' Diagnostics:');\n console.log(\n summaryTable\n .split('\\n')\n .map((line) => ' ' + line)\n .join('\\n')\n );\n console.log('');\n }\n }\n\n return {\n success: true,\n errorCount: errors.length,\n warningCount: warnings.length,\n convertedItemCount: cleanItemCount,\n failedItemCount: erroredItemCount,\n };\n}\n\n/** Convert one Learnosity bundle directory to a QTI Content Package on disk. */\nexport async function processLearnosityToQtiPackage(\n pkg: DetectedPackage,\n packageOutputPath: string,\n options: BatchPackageOptions,\n quiet: boolean\n): Promise<PackageResult> {\n // Load the bundle\n const loadResult = loadLearnosityBundle(pkg.path);\n\n if (!loadResult.bundle) {\n const errorCount = loadResult.diagnostics.filter((d) => d.level === 'error').length;\n\n displayDiagnosticsSummary(loadResult.diagnostics, quiet);\n\n return {\n success: false,\n errorCount,\n warningCount: 0,\n message: 'Bundle load error',\n };\n }\n\n const bundle = loadResult.bundle;\n const allDiagnostics: Diagnostic[] = [...loadResult.diagnostics];\n\n // Convert all activities in the bundle\n const allConvertedActivities: {\n activityRef: string;\n folderName: string;\n conversion: ReturnType<typeof convertActivity>;\n }[] = [];\n\n // Folder names for tests/<folderName>/assessmentTest.xml must be unique per package\n const usedFolderNames = new Set<string>();\n\n // Track item outcomes for the diagnostics report. Items shared by several\n // activities are counted once, hence the sets.\n const convertedItemRefs = new Set<string>();\n const failedItemRefs = new Set<string>();\n\n for (const activityRef of bundle.activityRefs) {\n const convertResult = convertActivity(bundle, activityRef, {\n pretty: options.pretty,\n version: options.qtiVersion,\n });\n\n allDiagnostics.push(...convertResult.diagnostics);\n\n const itemRefs = bundle.activityItemRefs.get(activityRef) ?? [];\n const successfulItemRefs = new Set(convertResult.items.map((item) => item.reference));\n\n for (const itemRef of itemRefs) {\n if (successfulItemRefs.has(itemRef)) {\n convertedItemRefs.add(itemRef);\n } else {\n failedItemRefs.add(itemRef);\n }\n }\n\n if (convertResult.items.length > 0) {\n const sanitizedName = sanitizeFolderName(\n activityRef,\n `activity_${allConvertedActivities.length + 1}`\n );\n const folderName = ensureUniqueFolderName(sanitizedName, usedFolderNames);\n\n allConvertedActivities.push({ activityRef, folderName, conversion: convertResult });\n }\n }\n\n // An item that converted in one activity is not a failure elsewhere.\n for (const itemRef of convertedItemRefs) {\n failedItemRefs.delete(itemRef);\n }\n\n const convertedFiles = itemRefsToFilenames(bundle, convertedItemRefs);\n const failedFiles = itemRefsToFilenames(bundle, failedItemRefs);\n const convertedActivityFiles = allConvertedActivities.map(\n ({ activityRef }) => `activities/${activityRef}.json`\n );\n const failedActivityFiles = bundle.activityRefs\n .filter((ref) => !allConvertedActivities.some((a) => a.activityRef === ref))\n .map((ref) => `activities/${ref}.json`);\n const totalItemsConverted = convertedItemRefs.size;\n const totalItemsFailed = failedItemRefs.size;\n\n // In batch mode, always write diagnostics.json to each package directory,\n // including when the package fails, so the report explains what happened.\n // Reads allDiagnostics when called, so later diagnostics are included.\n const writePackageDiagnostics = () =>\n writeDiagnostics(\n allDiagnostics,\n 'file',\n `${packageOutputPath}/diagnostics.json`,\n packageOutputPath,\n false,\n {\n inputPath: pkg.path,\n outputPath: packageOutputPath,\n totalItemsFound: totalItemsConverted + totalItemsFailed,\n totalActivitiesFound: bundle.activityRefs.length,\n convertedFiles,\n failedFiles,\n convertedActivities: convertedActivityFiles,\n failedActivities: failedActivityFiles,\n }\n );\n\n if (allConvertedActivities.length === 0) {\n const errorCount = allDiagnostics.filter((d) => d.level === 'error').length;\n\n await writePackageDiagnostics();\n\n return {\n success: false,\n errorCount,\n warningCount: allDiagnostics.filter((d) => d.level === 'warning').length,\n convertedItemCount: 0,\n failedItemCount: totalItemsFailed,\n message: 'No activities converted',\n };\n }\n\n // Build package with all activities\n const pkgData: QtiContentPackage = {\n zipPath: '',\n resources: [],\n entries: new Map(),\n items: [],\n assets: [],\n };\n\n const addedResourceIds = new Set<string>();\n\n for (const { activityRef, folderName, conversion } of allConvertedActivities) {\n const packageResult = buildPackageFromActivity(conversion, {\n bundleDir: pkg.path,\n activityRef,\n version: options.qtiVersion,\n });\n\n allDiagnostics.push(...packageResult.diagnostics);\n\n // Relocates the assessmentTest to tests/<folderName>/assessmentTest.xml and\n // wires manifest dependencies, matching the single-package output layout.\n mergeActivityPackage(pkgData, folderName, packageResult, addedResourceIds);\n }\n\n // Save the package\n const saveResult = saveQtiContentPackage(pkgData, packageOutputPath);\n\n allDiagnostics.push(...saveResult.diagnostics);\n\n const errors = allDiagnostics.filter((d) => d.level === 'error');\n const warnings = allDiagnostics.filter((d) => d.level === 'warning');\n\n await writePackageDiagnostics();\n\n displayDiagnosticsSummary(allDiagnostics, quiet);\n\n if (errors.length > 0) {\n return {\n success: false,\n errorCount: errors.length,\n warningCount: warnings.length,\n convertedItemCount: totalItemsConverted,\n failedItemCount: totalItemsFailed,\n message: 'Conversion failed',\n };\n }\n\n return {\n success: true,\n errorCount: 0,\n warningCount: warnings.length,\n convertedItemCount: totalItemsConverted,\n failedItemCount: totalItemsFailed,\n };\n}\n\n/**\n * Map item references to the filenames they were loaded from, for the\n * diagnostics report. Falls back to the reference when the bundle has no\n * filename recorded, so counts always match the listed items.\n */\nfunction itemRefsToFilenames(bundle: LearnosityBundleModel, itemRefs: Set<string>): string[] {\n return [...itemRefs].map((itemRef) => bundle.itemRefToFilename.get(itemRef) ?? itemRef);\n}\n"],"mappings":";;;;;;;;;;AA6DA,eAAsB,aAAa,MAAiB,QAAQ,MAA8B;CACtF,IAAI,KAAK,cAAc,qBACnB,OAAO,8BAA8B,KAAK,KAAK,KAAK,mBAAmB,KAAK,SAAS,KAAK;CAG9F,OAAO,8BAA8B,KAAK,KAAK,KAAK,mBAAmB,KAAK,SAAS,KAAK;AAC9F;AAEA,SAAS,0BAA0B,aAA2B,OAAsB;CAChF,IAAI,OACA;CAGJ,MAAM,eAAe,8BAA8B,WAAW;CAE9D,IAAI,cAAc;EACd,QAAQ,IAAI,gBAAgB;EAC5B,QAAQ,IACJ,aACK,MAAM,IAAI,CAAC,CACX,KAAK,SAAS,OAAO,IAAI,CAAC,CAC1B,KAAK,IAAI,CAClB;EACA,QAAQ,IAAI,EAAE;CAClB;AACJ;;AAGA,eAAsB,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}
@@ -1 +0,0 @@
1
- {"version":3,"file":"learnosityToQti-B0PoimXr.js","names":[],"sources":["../src/commands/learnosityToQti.ts"],"sourcesContent":["import type { Command } from 'commander';\nimport type { ConversionOptions, Diagnostic } from '@learnosity/converter-core';\nimport { convertLearnosityToQti } from '@learnosity/converter-core';\nimport { copyFile, mkdir } from 'fs/promises';\nimport { dirname, join, basename } from 'path';\nimport { readInput, parseJsonInput } from '../io/readInput.js';\nimport { writeOutput } from '../io/writeOutput.js';\nimport { writeDiagnostics } from '../io/writeDiagnostics.js';\nimport { showBanner } from '../ux/banner.js';\nimport { showResolvedOptions } from '../ux/resolvedOptions.js';\nimport { ProgressTracker } from '../ux/progress.js';\nimport { formatDiagnosticsTable, countErrors } from '../ux/table.js';\nimport { loadConfig } from '../options/loadConfig.js';\nimport { resolveOptions } from '../options/resolveOptions.js';\nimport type { CliOptions } from '../options/types.js';\n\n/**\n * Register learnosity-to-qti command\n */\nexport function registerLearnosityToQtiCommand(program: Command, version: string): void {\n program\n .command('learnosity-to-qti')\n .description('Convert a single Learnosity item to QTI')\n .option('--in <path>', 'Input file path or \"-\" for stdin')\n .option('--out <path>', 'Output file path or \"-\" for stdout')\n .option('--qti-version <version>', 'QTI version (2.1 or 2.2, default: 2.2)')\n .option(\n '--output-format <format>',\n 'Output format (dir|zip|stdout, default: auto-detect from output path)'\n )\n .option(\n '--diagnostics <mode>',\n 'Diagnostics output (stderr|file|both|none, default: file for file output, stderr for stdout)'\n )\n .option('--fail-on-warn', 'Exit with error code 1 if warnings exist (default: false)')\n .option('--config <path>', 'Path to config file')\n .option('--no-config', 'Disable config file loading')\n .option('-i, --interactive', 'Enable interactive prompts (default: false)')\n .option('--verbose', 'Verbose output (default: false)')\n .option('--pretty', 'Pretty-print JSON output (default: false)')\n .option('-q, --quiet', 'Suppress non-essential output (default: false)')\n .option(\n '--include-learnosity-source',\n 'Copy input file to source/ folder alongside output (default: false)'\n )\n .action(async (opts: CliOptions) => {\n await executeLearnosityToQti(opts, version);\n });\n}\n\nasync function copySourceFile(inputPath: string, outputPath: string): Promise<void> {\n const outputDir = dirname(outputPath);\n\n // Both paths are CLI arguments the operator chose. 'source' is a literal and\n // basename() strips any directory part of inputPath, so the copy stays inside\n // the requested output directory.\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n const sourceDir = join(outputDir, 'source');\n\n await mkdir(sourceDir, { recursive: true });\n // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal, javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal\n await copyFile(inputPath, join(sourceDir, basename(inputPath)));\n}\n\n/**\n * Execute learnosity-to-qti conversion\n */\nasync function executeLearnosityToQti(cliOpts: CliOptions, version: string): Promise<void> {\n const allDiagnostics: Diagnostic[] = [];\n const quiet = cliOpts.quiet ?? false;\n\n try {\n showBanner('learnosity-to-qti', version, quiet);\n\n // Load config\n const {\n config,\n diagnostics: configDiagnostics,\n configPath,\n } = await loadConfig(cliOpts.config, cliOpts.noConfig);\n\n allDiagnostics.push(...configDiagnostics);\n\n // Check for config errors\n const configErrors = configDiagnostics.filter((d) => d.level === 'error');\n\n if (configErrors.length > 0) {\n console.log('\\n' + formatDiagnosticsTable(configDiagnostics));\n process.exit(1);\n }\n\n // Resolve options\n const {\n options: resolved,\n diagnostics: resolveDiagnostics,\n withSources,\n } = await resolveOptions(cliOpts, config, false, configPath);\n\n allDiagnostics.push(...resolveDiagnostics);\n\n // Show resolved options\n showResolvedOptions(resolved, withSources, quiet);\n\n const progress = new ProgressTracker(resolved.verbose);\n\n // Read and parse input\n progress.startStage('Reading input...');\n const inputText = await readInput(resolved.inputPath);\n const input = parseJsonInput(inputText);\n\n progress.succeedStage('Input read');\n\n // Convert\n progress.startStage('Converting Learnosity to QTI...');\n const conversionOpts: ConversionOptions = {\n qtiVersion: resolved.qtiVersion,\n outputFormat: resolved.outputFormat,\n diagnostics: resolved.diagnostics,\n verbose: resolved.verbose,\n pretty: resolved.pretty,\n };\n const result = await convertLearnosityToQti(input, conversionOpts);\n\n // Set diagnostics file to input filename only\n const inputFilename = resolved.inputPath.split('/').pop() ?? resolved.inputPath;\n const prefixedDiagnostics = result.diagnostics.map((d) => ({\n ...d,\n file: inputFilename,\n }));\n\n allDiagnostics.push(...prefixedDiagnostics);\n progress.succeedStage('Conversion complete');\n\n // Check for errors before writing output\n const errorCount = countErrors(allDiagnostics);\n\n if (errorCount > 0) {\n progress.failStage('Conversion failed');\n console.log('\\n' + formatDiagnosticsTable(allDiagnostics));\n process.exit(1);\n }\n\n // Write output only if no errors\n if (result.output) {\n progress.startStage('Writing output...');\n await writeOutput(resolved.outputPath, result.output, resolved.pretty);\n progress.succeedStage('Output written');\n }\n\n // Copy source file if requested\n if (\n cliOpts.includeLearnositySource &&\n resolved.inputPath !== '-' &&\n resolved.outputPath !== '-'\n ) {\n progress.startStage('Copying source file...');\n await copySourceFile(resolved.inputPath, resolved.outputPath);\n progress.succeedStage('Source file copied');\n }\n\n // Write diagnostics\n if (resolved.diagnostics !== 'none') {\n progress.startStage('Writing diagnostics...');\n const hasErrors = allDiagnostics.some((d) => d.level === 'error');\n\n await writeDiagnostics(\n allDiagnostics,\n resolved.diagnostics,\n resolved.diagnosticsPath,\n resolved.outputPath,\n resolved.verbose,\n {\n inputPath: resolved.inputPath,\n outputPath: resolved.outputPath,\n totalItemsFound: 1,\n convertedFiles: hasErrors ? [] : [inputFilename],\n failedFiles: hasErrors ? [inputFilename] : [],\n }\n );\n progress.succeedStage('Diagnostics written');\n }\n\n // Display diagnostics table only if mode is stderr or both\n if (resolved.diagnostics === 'stderr' || resolved.diagnostics === 'both') {\n console.log('\\n' + formatDiagnosticsTable(allDiagnostics));\n }\n\n // Check for warnings if fail-on-warn\n const warningCount = allDiagnostics.filter((d) => d.level === 'warning').length;\n\n if (warningCount > 0 && cliOpts.failOnWarn) {\n process.stderr.write(\n `\\n${warningCount} warning(s) found - exiting with error (--fail-on-warn)\\n`\n );\n process.exit(1);\n }\n\n process.exit(0);\n } catch (error) {\n if (error instanceof Error && error.name === 'ExitPromptError') {\n process.exit(130);\n }\n console.error('\\n' + (error instanceof Error ? error.message : 'Unknown error'));\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,+BAA+B,SAAkB,SAAuB;CACpF,QACK,QAAQ,mBAAmB,CAAC,CAC5B,YAAY,yCAAyC,CAAC,CACtD,OAAO,eAAe,oCAAkC,CAAC,CACzD,OAAO,gBAAgB,sCAAoC,CAAC,CAC5D,OAAO,2BAA2B,wCAAwC,CAAC,CAC3E,OACG,4BACA,uEACJ,CAAC,CACA,OACG,wBACA,8FACJ,CAAC,CACA,OAAO,kBAAkB,2DAA2D,CAAC,CACrF,OAAO,mBAAmB,qBAAqB,CAAC,CAChD,OAAO,eAAe,6BAA6B,CAAC,CACpD,OAAO,qBAAqB,6CAA6C,CAAC,CAC1E,OAAO,aAAa,iCAAiC,CAAC,CACtD,OAAO,YAAY,2CAA2C,CAAC,CAC/D,OAAO,eAAe,gDAAgD,CAAC,CACvE,OACG,+BACA,qEACJ,CAAC,CACA,OAAO,OAAO,SAAqB;EAChC,MAAM,uBAAuB,MAAM,OAAO;CAC9C,CAAC;AACT;AAEA,eAAe,eAAe,WAAmB,YAAmC;CAChF,MAAM,YAAY,QAAQ,UAAU;CAMpC,MAAM,YAAY,KAAK,WAAW,QAAQ;CAE1C,MAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;CAE1C,MAAM,SAAS,WAAW,KAAK,WAAW,SAAS,SAAS,CAAC,CAAC;AAClE;;;;AAKA,eAAe,uBAAuB,SAAqB,SAAgC;CACvF,MAAM,iBAA+B,CAAC;CACtC,MAAM,QAAQ,QAAQ,SAAS;CAE/B,IAAI;EACA,WAAW,qBAAqB,SAAS,KAAK;EAG9C,MAAM,EACF,QACA,aAAa,mBACb,eACA,MAAM,WAAW,QAAQ,QAAQ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