@learnosity/lib-qti-converter 0.12.5 → 0.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/cli/dist/{learnosityToQti-D3Xxswaf.js → learnosityToQti-CXDJoJpl.js} +3 -3
- package/packages/cli/dist/{learnosityToQti-D3Xxswaf.js.map → learnosityToQti-CXDJoJpl.js.map} +1 -1
- package/packages/cli/dist/{learnosityToQtiPackage-D-hlZ9yI.js → learnosityToQtiPackage-7v-s4ybk.js} +2 -2
- package/packages/cli/dist/{learnosityToQtiPackage-D-hlZ9yI.js.map → learnosityToQtiPackage-7v-s4ybk.js.map} +1 -1
- package/packages/cli/dist/main.js +4 -4
- package/packages/cli/dist/{pathUtils-CwZnJ55s.js → pathUtils-CgoDQyJk.js} +2 -1
- package/packages/cli/dist/pathUtils-CgoDQyJk.js.map +1 -0
- package/packages/cli/dist/{qtiPackageToLearnosity-CHDga9lI.js → qtiPackageToLearnosity-hT4QZ7YX.js} +2 -2
- package/packages/cli/dist/{qtiPackageToLearnosity-CHDga9lI.js.map → qtiPackageToLearnosity-hT4QZ7YX.js.map} +1 -1
- package/packages/cli/dist/{qtiToLearnosity-BkYlsuH0.js → qtiToLearnosity-BU7mHhIu.js} +3 -3
- package/packages/cli/dist/{qtiToLearnosity-BkYlsuH0.js.map → qtiToLearnosity-BU7mHhIu.js.map} +1 -1
- package/packages/cli/dist/{resolveOptions-CZ4dw2gp.js → resolveOptions-ehwJSkQy.js} +25 -9
- package/packages/cli/dist/{resolveOptions-CZ4dw2gp.js.map → resolveOptions-ehwJSkQy.js.map} +1 -1
- package/packages/core/dist/index.d.ts +24 -0
- package/packages/core/dist/index.js +54 -9
- package/packages/core/dist/node.d.ts +24 -0
- package/packages/core/dist/node.js +246 -13
- package/packages/cli/dist/pathUtils-CwZnJ55s.js.map +0 -1
package/packages/cli/dist/{qtiToLearnosity-BkYlsuH0.js.map → qtiToLearnosity-BU7mHhIu.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qtiToLearnosity-BkYlsuH0.js","names":[],"sources":["../src/commands/qtiToLearnosity.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Command } from 'commander';\nimport type { ConversionOptions, Diagnostic } from '@learnosity/converter-core';\nimport { convertQtiToLearnosity } from '@learnosity/converter-core';\nimport { nodeFileAccess } from '@learnosity/converter-core/node';\nimport { readInput } 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 qti-to-learnosity command\n */\nexport function registerQtiToLearnosityCommand(program: Command, version: string): void {\n program\n .command('qti-to-learnosity')\n .description('Convert a single QTI file to Learnosity JSON')\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(\n '--organisation_id <number>',\n 'Organisation ID for Learnosity CDN asset URLs',\n parseInt\n )\n .option('--org_id <number>', 'Alias for --organisation_id', parseInt)\n .option('--mediavault', 'Use media-vault subdomain instead of assets (default: false)')\n .option(\n '--custom-asset-url <url>',\n 'Custom asset URL prefix to override default Learnosity CDN'\n )\n .option(\n '--item-reference-source <source>',\n 'How to generate item references: sourceFilename (default), qti (identifier), or uuid'\n )\n .option(\n '--truncate-tags',\n 'Truncate tag types and names to 255 characters instead of failing (default: false)'\n )\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 .action(async (opts: CliOptions) => {\n await executeQtiToLearnosity(opts, version);\n });\n}\n\nasync function resolveOutputFilePath(outputPath: string, itemReference?: string): Promise<string> {\n if (outputPath === '-' || !itemReference) {\n return outputPath;\n }\n\n const fs = await import('fs/promises');\n\n try {\n const stat = await fs.stat(outputPath);\n\n if (stat.isDirectory()) {\n return `${outputPath}/${itemReference}.json`;\n }\n } catch {\n if (outputPath.endsWith('/') || !outputPath.includes('.')) {\n return `${outputPath}${outputPath.endsWith('/') ? '' : '/'}${itemReference}.json`;\n }\n }\n\n return outputPath;\n}\n\n/**\n * Execute qti-to-learnosity conversion\n */\nasync function executeQtiToLearnosity(cliOpts: CliOptions, version: string): Promise<void> {\n const allDiagnostics: Diagnostic[] = [];\n const quiet = cliOpts.quiet ?? false;\n\n try {\n showBanner('qti-to-learnosity', 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 input\n progress.startStage('Reading input...');\n const input = await readInput(resolved.inputPath);\n\n progress.succeedStage('Input read');\n\n // Convert\n progress.startStage('Converting QTI to Learnosity...');\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 inputPath: resolved.inputPath,\n organisationId: resolved.organisationId, // TASK 030\n mediaVault: resolved.mediaVault,\n customAssetUrl: resolved.customAssetUrl,\n itemReferenceSource: resolved.itemReferenceSource,\n truncateTags: resolved.truncateTags,\n fileAccess: nodeFileAccess,\n };\n const result = await convertQtiToLearnosity(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 // Determine output path - use MD5-based filename if output is a directory\n const itemReference = (result.output as any).reference;\n const finalOutputPath = await resolveOutputFilePath(resolved.outputPath, itemReference);\n\n // Write output\n progress.startStage('Writing output...');\n await writeOutput(finalOutputPath, result.output, resolved.pretty);\n progress.succeedStage('Output written');\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 const errorCount = countErrors(allDiagnostics);\n\n process.exit(errorCount > 0 ? 1 : 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":";;;;;;;;AAoBA,SAAgB,+BAA+B,SAAkB,SAAuB;CACpF,QACK,QAAQ,mBAAmB,CAAC,CAC5B,YAAY,8CAA8C,CAAC,CAC3D,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,OACG,8BACA,iDACA,QACJ,CAAC,CACA,OAAO,qBAAqB,+BAA+B,QAAQ,CAAC,CACpE,OAAO,gBAAgB,8DAA8D,CAAC,CACtF,OACG,4BACA,4DACJ,CAAC,CACA,OACG,oCACA,sFACJ,CAAC,CACA,OACG,mBACA,oFACJ,CAAC,CACA,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,OAAO,OAAO,SAAqB;EAChC,MAAM,uBAAuB,MAAM,OAAO;CAC9C,CAAC;AACT;AAEA,eAAe,sBAAsB,YAAoB,eAAyC;CAC9F,IAAI,eAAe,OAAO,CAAC,eACvB,OAAO;CAGX,MAAM,KAAK,MAAM,OAAO;CAExB,IAAI;EAGA,KAAI,MAFe,GAAG,KAAK,UAAU,EAAA,CAE5B,YAAY,GACjB,OAAO,GAAG,WAAW,GAAG,cAAc;CAE9C,QAAQ;EACJ,IAAI,WAAW,SAAS,GAAG,KAAK,CAAC,WAAW,SAAS,GAAG,GACpD,OAAO,GAAG,aAAa,WAAW,SAAS,GAAG,IAAI,KAAK,MAAM,cAAc;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B;EAC1C,SAAS,aAAa,qBAAqB;EAG3C,MAAM,gBAAiB,OAAO,OAAe;EAC7C,MAAM,kBAAkB,MAAM,sBAAsB,SAAS,YAAY,aAAa;EAGtF,SAAS,WAAW,mBAAmB;EACvC,MAAM,YAAY,iBAAiB,OAAO,QAAQ,SAAS,MAAM;EACjE,SAAS,aAAa,gBAAgB;EAGtC,IAAI,SAAS,gBAAgB,QAAQ;GACjC,SAAS,WAAW,wBAAwB;GAC5C,MAAM,YAAY,eAAe,MAAM,MAAM,EAAE,UAAU,OAAO;GAEhE,MAAM,iBACF,gBACA,SAAS,aACT,SAAS,iBACT,SAAS,YACT,SAAS,SACT;IACI,WAAW,SAAS;IACpB,YAAY,SAAS;IACrB,iBAAiB;IACjB,gBAAgB,YAAY,CAAC,IAAI,CAAC,aAAa;IAC/C,aAAa,YAAY,CAAC,aAAa,IAAI,CAAC;GAChD,CACJ;GACA,SAAS,aAAa,qBAAqB;EAC/C;EAGA,IAAI,SAAS,gBAAgB,YAAY,SAAS,gBAAgB,QAC9D,QAAQ,IAAI,OAAO,uBAAuB,cAAc,CAAC;EAG7D,MAAM,aAAa,YAAY,cAAc;EAE7C,QAAQ,KAAK,aAAa,IAAI,IAAI,CAAC;CACvC,SAAS,OAAO;EACZ,IAAI,iBAAiB,SAAS,MAAM,SAAS,mBACzC,QAAQ,KAAK,GAAG;EAEpB,QAAQ,MAAM,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,gBAAgB;EAC/E,QAAQ,KAAK,CAAC;CAClB;AACJ"}
|
|
1
|
+
{"version":3,"file":"qtiToLearnosity-BU7mHhIu.js","names":[],"sources":["../src/commands/qtiToLearnosity.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Command } from 'commander';\nimport type { ConversionOptions, Diagnostic } from '@learnosity/converter-core';\nimport { convertQtiToLearnosity } from '@learnosity/converter-core';\nimport { nodeFileAccess } from '@learnosity/converter-core/node';\nimport { readInput } 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 qti-to-learnosity command\n */\nexport function registerQtiToLearnosityCommand(program: Command, version: string): void {\n program\n .command('qti-to-learnosity')\n .description('Convert a single QTI file to Learnosity JSON')\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(\n '--organisation_id <number>',\n 'Organisation ID for Learnosity CDN asset URLs',\n parseInt\n )\n .option('--org_id <number>', 'Alias for --organisation_id', parseInt)\n .option('--mediavault', 'Use media-vault subdomain instead of assets (default: false)')\n .option(\n '--custom-asset-url <url>',\n 'Custom asset URL prefix to override default Learnosity CDN'\n )\n .option(\n '--item-reference-source <source>',\n 'How to generate item references: sourceFilename (default), qti (identifier), or uuid'\n )\n .option(\n '--truncate-tags',\n 'Truncate tag types and names to 255 characters instead of failing (default: false)'\n )\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 .action(async (opts: CliOptions) => {\n await executeQtiToLearnosity(opts, version);\n });\n}\n\nasync function resolveOutputFilePath(outputPath: string, itemReference?: string): Promise<string> {\n if (outputPath === '-' || !itemReference) {\n return outputPath;\n }\n\n const fs = await import('fs/promises');\n\n try {\n const stat = await fs.stat(outputPath);\n\n if (stat.isDirectory()) {\n return `${outputPath}/${itemReference}.json`;\n }\n } catch {\n if (outputPath.endsWith('/') || !outputPath.includes('.')) {\n return `${outputPath}${outputPath.endsWith('/') ? '' : '/'}${itemReference}.json`;\n }\n }\n\n return outputPath;\n}\n\n/**\n * Execute qti-to-learnosity conversion\n */\nasync function executeQtiToLearnosity(cliOpts: CliOptions, version: string): Promise<void> {\n const allDiagnostics: Diagnostic[] = [];\n const quiet = cliOpts.quiet ?? false;\n\n try {\n showBanner('qti-to-learnosity', 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 input\n progress.startStage('Reading input...');\n const input = await readInput(resolved.inputPath);\n\n progress.succeedStage('Input read');\n\n // Convert\n progress.startStage('Converting QTI to Learnosity...');\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 inputPath: resolved.inputPath,\n organisationId: resolved.organisationId, // TASK 030\n mediaVault: resolved.mediaVault,\n customAssetUrl: resolved.customAssetUrl,\n itemReferenceSource: resolved.itemReferenceSource,\n truncateTags: resolved.truncateTags,\n fileAccess: nodeFileAccess,\n };\n const result = await convertQtiToLearnosity(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 // Determine output path - use MD5-based filename if output is a directory\n const itemReference = (result.output as any).reference;\n const finalOutputPath = await resolveOutputFilePath(resolved.outputPath, itemReference);\n\n // Write output\n progress.startStage('Writing output...');\n await writeOutput(finalOutputPath, result.output, resolved.pretty);\n progress.succeedStage('Output written');\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 const errorCount = countErrors(allDiagnostics);\n\n process.exit(errorCount > 0 ? 1 : 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":";;;;;;;;AAoBA,SAAgB,+BAA+B,SAAkB,SAAuB;CACpF,QACK,QAAQ,mBAAmB,CAAC,CAC5B,YAAY,8CAA8C,CAAC,CAC3D,OAAO,eAAe,oCAAkC,CAAC,CACzD,OAAO,gBAAgB,sCAAoC,CAAC,CAC5D,OAAO,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EAAE,UAAU,OAAO;GAEhE,MAAM,iBACF,gBACA,SAAS,aACT,SAAS,iBACT,SAAS,YACT,SAAS,SACT;IACI,WAAW,SAAS;IACpB,YAAY,SAAS;IACrB,iBAAiB;IACjB,gBAAgB,YAAY,CAAC,IAAI,CAAC,aAAa;IAC/C,aAAa,YAAY,CAAC,aAAa,IAAI,CAAC;GAChD,CACJ;GACA,SAAS,aAAa,qBAAqB;EAC/C;EAGA,IAAI,SAAS,gBAAgB,YAAY,SAAS,gBAAgB,QAC9D,QAAQ,IAAI,OAAO,uBAAuB,cAAc,CAAC;EAG7D,MAAM,aAAa,YAAY,cAAc;EAE7C,QAAQ,KAAK,aAAa,IAAI,IAAI,CAAC;CACvC,SAAS,OAAO;EACZ,IAAI,iBAAiB,SAAS,MAAM,SAAS,mBACzC,QAAQ,KAAK,GAAG;EAEpB,QAAQ,MAAM,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,gBAAgB;EAC/E,QAAQ,KAAK,CAAC;CAClB;AACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
2
|
import { r as onExit } from "./create-prompt-DU9wLVhI.js";
|
|
3
3
|
import { t as dist_default } from "./dist-DjpU2mIj.js";
|
|
4
|
-
import { a as chalk, c as DiagnosticCode, i as boxen, l as dist_default$1, o as eastAsianWidth, s as stripAnsi, t as expandTilde } from "./pathUtils-
|
|
4
|
+
import { a as chalk, c as DiagnosticCode, i as boxen, l as dist_default$1, o as eastAsianWidth, s as stripAnsi, t as expandTilde } from "./pathUtils-CgoDQyJk.js";
|
|
5
5
|
import { a as require_cli_table3, i as chalk$1 } from "./table-DYcNeyJ_.js";
|
|
6
6
|
import process$1 from "node:process";
|
|
7
7
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -24581,13 +24581,28 @@ function buildHotspotValidation(correctResponses, choiceIdToIndex) {
|
|
|
24581
24581
|
/**
|
|
24582
24582
|
* Convert hotspotInteraction to Learnosity hotspot
|
|
24583
24583
|
*/
|
|
24584
|
-
function convertHotspotToLearnosity(inputXml, diagnostics, lomTags, organisationId, sourceFile, mediaVault, customAssetUrl, itemReferenceSource) {
|
|
24584
|
+
function convertHotspotToLearnosity(inputXml, diagnostics, lomTags, organisationId, sourceFile, mediaVault, customAssetUrl, itemReferenceSource, fileAccess, packageRoot) {
|
|
24585
24585
|
const parsed = readAssessmentItemHotspot(inputXml);
|
|
24586
24586
|
const updatedDiagnostics = addFileContextIfProvided(parsed.diagnostics, sourceFile);
|
|
24587
24587
|
diagnostics.push(...updatedDiagnostics);
|
|
24588
24588
|
if (hasErrors(diagnostics)) return { diagnostics };
|
|
24589
|
-
if (!parsed.identifier || !parsed.responseIdentifier || !parsed.imageSource
|
|
24589
|
+
if (!parsed.identifier || !parsed.responseIdentifier || !parsed.imageSource) return { diagnostics };
|
|
24590
24590
|
if (parsed.hotspotChoices.length === 0) return { diagnostics };
|
|
24591
|
+
if (!parsed.imageWidth || !parsed.imageHeight) {
|
|
24592
|
+
const resolved = fileAccess?.resolveImageDimensions?.(parsed.imageSource, sourceFile, packageRoot);
|
|
24593
|
+
if (resolved) {
|
|
24594
|
+
parsed.imageWidth = parsed.imageWidth || resolved.width;
|
|
24595
|
+
parsed.imageHeight = parsed.imageHeight || resolved.height;
|
|
24596
|
+
} else {
|
|
24597
|
+
diagnostics.push({
|
|
24598
|
+
code: DiagnosticCode.LRN_MISSING_REQUIRED_FIELD,
|
|
24599
|
+
level: "error",
|
|
24600
|
+
file: sourceFile ?? "hotspotInteraction",
|
|
24601
|
+
message: `hotspotInteraction image "${parsed.imageSource}" is missing width/height attributes and its dimensions could not be determined from the image file. Hotspot coordinate conversion requires image dimensions.`
|
|
24602
|
+
});
|
|
24603
|
+
return { diagnostics };
|
|
24604
|
+
}
|
|
24605
|
+
}
|
|
24591
24606
|
const itemRef = generateItemReference(parsed.identifier, itemReferenceSource, sourceFile);
|
|
24592
24607
|
const questionRef = md5hex(itemRef);
|
|
24593
24608
|
const stimulus = buildHotspotStimulus(parsed, organisationId, mediaVault, customAssetUrl);
|
|
@@ -27692,6 +27707,7 @@ function computeClosingTags(html) {
|
|
|
27692
27707
|
*/
|
|
27693
27708
|
function getConverterMap() {
|
|
27694
27709
|
const wrapSourceFirst = (fn) => (xml, diag, tags, orgId, sf, mv, cau, irs, stimuli) => fn(xml, diag, tags, sf, orgId, mv, cau, irs, stimuli);
|
|
27710
|
+
const hotspotConverter = (xml, diag, tags, orgId, sf, mv, cau, irs, _stimuli, fileAccess, packageRoot) => convertHotspotToLearnosity(xml, diag, tags, orgId, sf, mv, cau, irs, fileAccess, packageRoot);
|
|
27695
27711
|
return {
|
|
27696
27712
|
choiceInteraction: wrapSourceFirst(convertMcqToLearnosity),
|
|
27697
27713
|
textEntryInteraction: wrapSourceFirst(convertTextEntryToLearnosity),
|
|
@@ -27700,7 +27716,7 @@ function getConverterMap() {
|
|
|
27700
27716
|
gapMatchInteraction: convertGapMatchToLearnosity,
|
|
27701
27717
|
inlineChoiceInteraction: convertInlineChoiceToLearnosity,
|
|
27702
27718
|
orderInteraction: convertOrderToLearnosity,
|
|
27703
|
-
hotspotInteraction:
|
|
27719
|
+
hotspotInteraction: hotspotConverter,
|
|
27704
27720
|
hottextInteraction: convertHottextToLearnosity,
|
|
27705
27721
|
graphicGapMatchInteraction: convertGraphicGapMatchToLearnosity,
|
|
27706
27722
|
drawingInteraction: convertDrawingToLearnosity,
|
|
@@ -27714,7 +27730,7 @@ const CONVERTER_MAP = getConverterMap();
|
|
|
27714
27730
|
* Strategy: Call each individual converter for its interaction type,
|
|
27715
27731
|
* then combine all questions and widgets into a single composite item
|
|
27716
27732
|
*/
|
|
27717
|
-
function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, organisationId, sourceFile, mediaVault, customAssetUrl, itemReferenceSource, fileAccess) {
|
|
27733
|
+
function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, organisationId, sourceFile, mediaVault, customAssetUrl, itemReferenceSource, fileAccess, packageRoot) {
|
|
27718
27734
|
const metadata = extractItemMetadata(inputXml);
|
|
27719
27735
|
const { segments } = segmentItemBodyByInteractions(inputXml);
|
|
27720
27736
|
const stimuliByType = /* @__PURE__ */ new Map();
|
|
@@ -27931,7 +27947,7 @@ function convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, or
|
|
|
27931
27947
|
continue;
|
|
27932
27948
|
}
|
|
27933
27949
|
const converter = CONVERTER_MAP[group.type];
|
|
27934
|
-
if (converter) processResult(converter(inputXml, subDiagnostics, lomTags, organisationId, sourceFile, mediaVault, customAssetUrl, itemReferenceSource, group.stimuli), subDiagnostics);
|
|
27950
|
+
if (converter) processResult(converter(inputXml, subDiagnostics, lomTags, organisationId, sourceFile, mediaVault, customAssetUrl, itemReferenceSource, group.stimuli, fileAccess, packageRoot), subDiagnostics);
|
|
27935
27951
|
}
|
|
27936
27952
|
if (allQuestions.length === 0) {
|
|
27937
27953
|
diagnostics.push({
|
|
@@ -28568,7 +28584,7 @@ const SINGLE_INTERACTION_CONVERTERS = /* @__PURE__ */ new Map([
|
|
|
28568
28584
|
["matchInteraction", (xml, diag, lom, opts) => convertMatchToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
28569
28585
|
["gapMatchInteraction", (xml, diag, lom, opts) => convertGapMatchToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
28570
28586
|
["orderInteraction", (xml, diag, lom, opts) => convertOrderToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
28571
|
-
["hotspotInteraction", (xml, diag, lom, opts) => convertHotspotToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
28587
|
+
["hotspotInteraction", (xml, diag, lom, opts) => convertHotspotToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource, opts.fileAccess, opts.packageRoot)],
|
|
28572
28588
|
["hottextInteraction", (xml, diag, lom, opts) => convertHottextToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
28573
28589
|
["graphicGapMatchInteraction", (xml, diag, lom, opts) => convertGraphicGapMatchToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
28574
28590
|
["drawingInteraction", (xml, diag, lom, opts) => convertDrawingToLearnosity(xml, diag, lom, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource)],
|
|
@@ -28696,7 +28712,7 @@ function convertQtiAssessmentItemToLearnosity(inputXml, opts = {}) {
|
|
|
28696
28712
|
const { counts, allInteractions } = countAllInteractions(inputXml);
|
|
28697
28713
|
const presentTypes = INTERACTION_NAMES.filter((name) => counts[name] > 0);
|
|
28698
28714
|
if (presentTypes.reduce((sum, name) => sum + counts[name], 0) === 0) return handleNoInteractions(inputXml, diagnostics, allInteractions, lomTags, opts);
|
|
28699
|
-
if (presentTypes.length > 1) return convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource, opts.fileAccess);
|
|
28715
|
+
if (presentTypes.length > 1) return convertMixedInteractionsToLearnosity(inputXml, diagnostics, lomTags, opts.organisationId, opts.sourceFile, opts.mediaVault, opts.customAssetUrl, opts.itemReferenceSource, opts.fileAccess, opts.packageRoot);
|
|
28700
28716
|
return dispatchSingleInteractionConverter(presentTypes[0], inputXml, counts[presentTypes[0]], diagnostics, lomTags, opts);
|
|
28701
28717
|
} catch (error) {
|
|
28702
28718
|
diagnostics.push({
|
|
@@ -31667,4 +31683,4 @@ async function resolveOptions(cliOpts, config, isPackageCommand, configPath) {
|
|
|
31667
31683
|
//#endregion
|
|
31668
31684
|
export { parseJsonInput as a, convertQtiToLearnosity as c, writeOutput as i, ProgressTracker as n, readInput as o, showResolvedOptions as r, convertLearnosityToQti as s, resolveOptions as t };
|
|
31669
31685
|
|
|
31670
|
-
//# sourceMappingURL=resolveOptions-
|
|
31686
|
+
//# sourceMappingURL=resolveOptions-ehwJSkQy.js.map
|