@learnosity/lib-qti-converter 0.16.0 → 0.16.2
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 +10 -10
- package/packages/cli/dist/{batchProcessors-C7czhqX0.js → batchProcessors-BGdELwug.js} +75 -102
- package/packages/cli/dist/batchProcessors-BGdELwug.js.map +1 -0
- package/packages/cli/dist/batchWorker.js +2 -3
- package/packages/cli/dist/{configOutput-FwkFyQmk.js → configOutput-DYPwNQf7.js} +5 -9
- package/packages/cli/dist/{configOutput-FwkFyQmk.js.map → configOutput-DYPwNQf7.js.map} +1 -1
- package/packages/cli/dist/{create-prompt-dWckcotJ.js → create-prompt-C3XKo-s3.js} +95 -71
- package/packages/cli/dist/create-prompt-C3XKo-s3.js.map +1 -0
- package/packages/cli/dist/{dist-DXDR2peT.js → dist-D7b9-VIt.js} +8 -11
- package/packages/cli/dist/dist-D7b9-VIt.js.map +1 -0
- package/packages/cli/dist/{learnosityToQti-D4ddrXaz.js → learnosityToQti-CN6KKSmF.js} +5 -6
- package/packages/cli/dist/{learnosityToQti-D4ddrXaz.js.map → learnosityToQti-CN6KKSmF.js.map} +1 -1
- package/packages/cli/dist/{learnosityToQtiPackage-Bwzm-uLX.js → learnosityToQtiPackage-CMOQRiCV.js} +29 -21
- package/packages/cli/dist/learnosityToQtiPackage-CMOQRiCV.js.map +1 -0
- package/packages/cli/dist/main.js +22 -29
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/{nodeFileAccess-BhCoGDOi.js → nodeFileAccess-_jRCd340.js} +6 -10
- package/packages/cli/dist/{nodeFileAccess-BhCoGDOi.js.map → nodeFileAccess-_jRCd340.js.map} +1 -1
- package/packages/cli/dist/pathUtils-I2bRHUwu.js +2922 -0
- package/packages/cli/dist/pathUtils-I2bRHUwu.js.map +1 -0
- package/packages/cli/dist/{qtiPackageToLearnosity-CX9htPId.js → qtiPackageToLearnosity-JRb3TTyC.js} +7 -8
- package/packages/cli/dist/{qtiPackageToLearnosity-CX9htPId.js.map → qtiPackageToLearnosity-JRb3TTyC.js.map} +1 -1
- package/packages/cli/dist/{qtiToLearnosity-JQYOkNbM.js → qtiToLearnosity-C-jQYKqR.js} +6 -7
- package/packages/cli/dist/{qtiToLearnosity-JQYOkNbM.js.map → qtiToLearnosity-C-jQYKqR.js.map} +1 -1
- package/packages/cli/dist/{resolveOptions-BuNN2KMA.js → resolveOptions-ikupjaRQ.js} +322 -359
- package/packages/cli/dist/resolveOptions-ikupjaRQ.js.map +1 -0
- package/packages/cli/dist/{rolldown-runtime-DktXgydw.js → rolldown-runtime-BuRBZLzk.js} +13 -12
- package/packages/cli/dist/{table-DsKq-B4-.js → table-6SiZD7aK.js} +9944 -2294
- package/packages/cli/dist/table-6SiZD7aK.js.map +1 -0
- package/packages/core/dist/index.d.ts +8 -58
- package/packages/core/dist/index.js +9923 -2267
- package/packages/core/dist/node.d.ts +10 -80
- package/packages/core/dist/node.js +9951 -2311
- package/packages/cli/dist/batchProcessors-C7czhqX0.js.map +0 -1
- package/packages/cli/dist/create-prompt-dWckcotJ.js.map +0 -1
- package/packages/cli/dist/dist-DXDR2peT.js.map +0 -1
- package/packages/cli/dist/learnosityToQtiPackage-Bwzm-uLX.js.map +0 -1
- package/packages/cli/dist/pathUtils-D_VsVde8.js +0 -2272
- package/packages/cli/dist/pathUtils-D_VsVde8.js.map +0 -1
- package/packages/cli/dist/resolveOptions-BuNN2KMA.js.map +0 -1
- package/packages/cli/dist/table-DsKq-B4-.js.map +0 -1
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe public API for @learnosity/converter-core.
|
|
3
|
+
*
|
|
4
|
+
* This entry point contains only in-memory, filesystem-free code so it can be
|
|
5
|
+
* bundled for the browser without Node polyfills. Filesystem- and ZIP-based
|
|
6
|
+
* helpers (package/bundle load & save, disk-based package conversion) live in
|
|
7
|
+
* the `@learnosity/converter-core/node` entry point.
|
|
8
|
+
*/
|
|
2
9
|
/**
|
|
3
10
|
* Abstraction over the filesystem lookups the QTI → Learnosity converters may
|
|
4
11
|
* perform.
|
|
@@ -44,8 +51,6 @@ interface FileAccess {
|
|
|
44
51
|
height: number;
|
|
45
52
|
} | undefined;
|
|
46
53
|
}
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/types.d.ts
|
|
49
54
|
/**
|
|
50
55
|
* Diagnostic levels
|
|
51
56
|
*/
|
|
@@ -297,8 +302,6 @@ interface ConversionResult<T> {
|
|
|
297
302
|
output: T;
|
|
298
303
|
diagnostics: Diagnostic[];
|
|
299
304
|
}
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region src/diagnostics/formatDiagnosticsReport.d.ts
|
|
302
305
|
/**
|
|
303
306
|
* Options for formatting diagnostics report
|
|
304
307
|
*/
|
|
@@ -324,8 +327,6 @@ interface FormatDiagnosticsReportOptions {
|
|
|
324
327
|
* Format diagnostics array into structured report with metadata
|
|
325
328
|
*/
|
|
326
329
|
export declare function formatDiagnosticsReport(diagnostics: Diagnostic[], options: FormatDiagnosticsReportOptions): DiagnosticsReport;
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region src/utils/diagnosticHelpers.d.ts
|
|
329
330
|
/**
|
|
330
331
|
* Add file context to diagnostics
|
|
331
332
|
* Maps diagnostics to include a specific source file path
|
|
@@ -429,8 +430,6 @@ export declare function createDiagnostic(level: 'error' | 'warning' | 'info', co
|
|
|
429
430
|
* const allDiagnostics = mergeDiagnostics(parseResult.diagnostics, mapResult.diagnostics, serializeResult.diagnostics);
|
|
430
431
|
*/
|
|
431
432
|
export declare function mergeDiagnostics(...diagnosticArrays: Diagnostic[][]): Diagnostic[];
|
|
432
|
-
//#endregion
|
|
433
|
-
//#region src/learnosity-model/types.d.ts
|
|
434
433
|
/**
|
|
435
434
|
* Learnosity Item Model types
|
|
436
435
|
*
|
|
@@ -1179,8 +1178,6 @@ export interface LearnosityItemModel {
|
|
|
1179
1178
|
questionsByRef: Map<string, LearnosityQuestion>;
|
|
1180
1179
|
featuresByRef: Map<string, LearnosityFeature>;
|
|
1181
1180
|
}
|
|
1182
|
-
//#endregion
|
|
1183
|
-
//#region src/qti-to-learnosity/types.d.ts
|
|
1184
1181
|
/**
|
|
1185
1182
|
* Learnosity Item JSON types for output (QTI → Learnosity conversion)
|
|
1186
1183
|
* TASK 011 / Updated for new format
|
|
@@ -1445,8 +1442,6 @@ interface LearnosityImageclozeassociationV2QuestionJson {
|
|
|
1445
1442
|
type: 'imageclozeassociationV2';
|
|
1446
1443
|
data: Record<string, unknown>;
|
|
1447
1444
|
}
|
|
1448
|
-
//#endregion
|
|
1449
|
-
//#region src/conversions.d.ts
|
|
1450
1445
|
/**
|
|
1451
1446
|
* Convert QTI XML to Learnosity JSON.
|
|
1452
1447
|
*
|
|
@@ -1466,8 +1461,6 @@ export declare function convertQtiToLearnosity(input: string, opts: ConversionOp
|
|
|
1466
1461
|
* @returns QTI XML string and diagnostics
|
|
1467
1462
|
*/
|
|
1468
1463
|
export declare function convertLearnosityToQti(input: unknown, opts: ConversionOptions): Promise<ConversionResult<string>>;
|
|
1469
|
-
//#endregion
|
|
1470
|
-
//#region src/qti-package/types.d.ts
|
|
1471
1464
|
/**
|
|
1472
1465
|
* QTI Content Package types for IMS Content Packaging
|
|
1473
1466
|
*/
|
|
@@ -1538,8 +1531,6 @@ export interface QtiContentPackage {
|
|
|
1538
1531
|
/** Assets extracted from manifest */
|
|
1539
1532
|
assets: AssetRef[];
|
|
1540
1533
|
}
|
|
1541
|
-
//#endregion
|
|
1542
|
-
//#region src/qti-package/pathSafety.d.ts
|
|
1543
1534
|
/**
|
|
1544
1535
|
* ZIP entry path safety validation (zip-slip protection)
|
|
1545
1536
|
*/
|
|
@@ -1562,8 +1553,6 @@ export declare function validateZipEntryPath(entryPath: string): string | null;
|
|
|
1562
1553
|
* @returns true if safe, false if unsafe
|
|
1563
1554
|
*/
|
|
1564
1555
|
export declare function isPathSafe(entryPath: string): boolean;
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region src/qti-package/parseManifest.d.ts
|
|
1567
1556
|
/**
|
|
1568
1557
|
* Result of parsing a manifest
|
|
1569
1558
|
*/
|
|
@@ -1586,8 +1575,6 @@ export interface ParseManifestResult {
|
|
|
1586
1575
|
* @returns Parsed resources and diagnostics
|
|
1587
1576
|
*/
|
|
1588
1577
|
export declare function parseManifest(manifestXml: string, zipPath: string): ParseManifestResult;
|
|
1589
|
-
//#endregion
|
|
1590
|
-
//#region src/qti-package/buildManifest.d.ts
|
|
1591
1578
|
/**
|
|
1592
1579
|
* Generates a minimal valid imsmanifest.xml from resources
|
|
1593
1580
|
*
|
|
@@ -1605,8 +1592,6 @@ export declare function parseManifest(manifestXml: string, zipPath: string): Par
|
|
|
1605
1592
|
* @returns XML string for imsmanifest.xml
|
|
1606
1593
|
*/
|
|
1607
1594
|
export declare function buildManifest(resources: ManifestResource[], version?: '2.1' | '2.2'): string;
|
|
1608
|
-
//#endregion
|
|
1609
|
-
//#region src/qti-package/testDependencies.d.ts
|
|
1610
1595
|
/**
|
|
1611
1596
|
* Extract item and stimulus dependencies from QTI assessmentTest XML,
|
|
1612
1597
|
* and map hrefs to manifest resource identifiers.
|
|
@@ -1627,8 +1612,6 @@ export declare function extractTestDependencies(testXml: string): {
|
|
|
1627
1612
|
* - "../../items/abc123.xml" -> "item_abc123"
|
|
1628
1613
|
*/
|
|
1629
1614
|
export declare function mapHrefToResourceId(href: string): string | null;
|
|
1630
|
-
//#endregion
|
|
1631
|
-
//#region src/learnosity-model/parseLearnosityItem.d.ts
|
|
1632
1615
|
/**
|
|
1633
1616
|
* Result of parsing a Learnosity item
|
|
1634
1617
|
*/
|
|
@@ -1643,8 +1626,6 @@ export interface ParseLearnosityItemResult {
|
|
|
1643
1626
|
* @returns Validated model if successful, diagnostics in all cases
|
|
1644
1627
|
*/
|
|
1645
1628
|
export declare function parseLearnosityItem(input: unknown): ParseLearnosityItemResult;
|
|
1646
|
-
//#endregion
|
|
1647
|
-
//#region src/learnosity-bundle/types.d.ts
|
|
1648
1629
|
/**
|
|
1649
1630
|
* Types for Learnosity export bundle model (manifest + activities + items + assets)
|
|
1650
1631
|
* Part of TASK 004D
|
|
@@ -1694,8 +1675,6 @@ export interface LearnosityBundleModel {
|
|
|
1694
1675
|
/** Map: itemRef → actual filename on disk (e.g., "items/hash.json") */
|
|
1695
1676
|
itemRefToFilename: Map<string, string>;
|
|
1696
1677
|
}
|
|
1697
|
-
//#endregion
|
|
1698
|
-
//#region src/qti-ast/types.d.ts
|
|
1699
1678
|
/**
|
|
1700
1679
|
* Internal QTI AST types
|
|
1701
1680
|
* Neutral representation independent of source (Learnosity) or target (QTI XML)
|
|
@@ -2239,8 +2218,6 @@ export interface QtiAssessmentStimulus {
|
|
|
2239
2218
|
instructorStimulus?: string;
|
|
2240
2219
|
stimulusBody: string;
|
|
2241
2220
|
}
|
|
2242
|
-
//#endregion
|
|
2243
|
-
//#region src/qti-ast/assessmentTestTypes.d.ts
|
|
2244
2221
|
/**
|
|
2245
2222
|
* QTI 2.2 assessmentTest AST types (TASK 005)
|
|
2246
2223
|
*
|
|
@@ -2321,8 +2298,6 @@ export interface QtiAssessmentTest {
|
|
|
2321
2298
|
/** Test parts */
|
|
2322
2299
|
testParts: QtiTestPart[];
|
|
2323
2300
|
}
|
|
2324
|
-
//#endregion
|
|
2325
|
-
//#region src/qti-ast/downgradeToQti21.d.ts
|
|
2326
2301
|
export interface DowngradeResult<T> {
|
|
2327
2302
|
/** Downgraded AST (modified in place or cloned) */
|
|
2328
2303
|
ast: T;
|
|
@@ -2348,8 +2323,6 @@ export declare function downgradeAssessmentItemToQti21(item: QtiAssessmentItem):
|
|
|
2348
2323
|
* @returns { downgraded test, diagnostics }
|
|
2349
2324
|
*/
|
|
2350
2325
|
export declare function downgradeAssessmentTestToQti21(test: QtiAssessmentTest): DowngradeResult<QtiAssessmentTest>;
|
|
2351
|
-
//#endregion
|
|
2352
|
-
//#region src/learnosity-mapper/mapLearnosityToAst.d.ts
|
|
2353
2326
|
/**
|
|
2354
2327
|
* Map a validated Learnosity Item Model to a QTI AST
|
|
2355
2328
|
*
|
|
@@ -2360,8 +2333,6 @@ export declare function mapLearnosityToAst(model: LearnosityItemModel | null | u
|
|
|
2360
2333
|
ast?: QtiAssessmentItem;
|
|
2361
2334
|
diagnostics: Diagnostic[];
|
|
2362
2335
|
};
|
|
2363
|
-
//#endregion
|
|
2364
|
-
//#region src/learnosity-mapper/mapActivityToTest.d.ts
|
|
2365
2336
|
export interface MapActivityToTestResult {
|
|
2366
2337
|
test?: QtiAssessmentTest;
|
|
2367
2338
|
diagnostics: Diagnostic[];
|
|
@@ -2431,8 +2402,6 @@ export interface ActivityData {
|
|
|
2431
2402
|
* @returns { test?, diagnostics[] }
|
|
2432
2403
|
*/
|
|
2433
2404
|
export declare function mapActivityToTest(activity: ActivityData): MapActivityToTestResult;
|
|
2434
|
-
//#endregion
|
|
2435
|
-
//#region src/learnosity-mapper/convertActivity.d.ts
|
|
2436
2405
|
export interface ConvertedItem {
|
|
2437
2406
|
/** Item reference from Learnosity */
|
|
2438
2407
|
reference: string;
|
|
@@ -2479,8 +2448,6 @@ export interface ConvertActivityOptions {
|
|
|
2479
2448
|
* @returns { testXml?, test?, items[], diagnostics[] }
|
|
2480
2449
|
*/
|
|
2481
2450
|
export declare function convertActivity(bundle: LearnosityBundleModel, activityRef: string, options?: ConvertActivityOptions): ConvertActivityResult;
|
|
2482
|
-
//#endregion
|
|
2483
|
-
//#region src/learnosity-mapper/sanitizeFolderName.d.ts
|
|
2484
2451
|
/**
|
|
2485
2452
|
* Sanitize activity reference for use as folder name
|
|
2486
2453
|
*/
|
|
@@ -2507,14 +2474,10 @@ export declare function sanitizeFolderName(input: string, fallback?: string): st
|
|
|
2507
2474
|
* @returns Unique folder name (may have suffix like _2, _3)
|
|
2508
2475
|
*/
|
|
2509
2476
|
export declare function ensureUniqueFolderName(desiredName: string, usedNames: Set<string>): string;
|
|
2510
|
-
//#endregion
|
|
2511
|
-
//#region src/learnosity-mapper/buildPackageFromActivityTypes.d.ts
|
|
2512
2477
|
interface BuildPackageFromActivityResult {
|
|
2513
2478
|
package?: QtiContentPackage;
|
|
2514
2479
|
diagnostics: Diagnostic[];
|
|
2515
2480
|
}
|
|
2516
|
-
//#endregion
|
|
2517
|
-
//#region src/learnosity-mapper/mergeActivityPackage.d.ts
|
|
2518
2481
|
/**
|
|
2519
2482
|
* Rewrite item/stimulus/asset hrefs inside an assessmentTest that has been moved
|
|
2520
2483
|
* into tests/<folderName>/ (two levels deep) so they resolve against the package root.
|
|
@@ -2529,8 +2492,6 @@ export declare function rewriteTestHrefs(testXml: string): string;
|
|
|
2529
2492
|
* dependency on the normalize CSS. Duplicate resources (by identifier) are skipped.
|
|
2530
2493
|
*/
|
|
2531
2494
|
export declare function mergeActivityPackage(pkg: QtiContentPackage, folderName: string, packageResult: BuildPackageFromActivityResult, addedResourceIds: Set<string>): void;
|
|
2532
|
-
//#endregion
|
|
2533
|
-
//#region src/qti-serializer/serializeAssessmentItem.d.ts
|
|
2534
2495
|
/**
|
|
2535
2496
|
* Serialize a QTI AST to QTI 2.2 or 2.1 XML
|
|
2536
2497
|
*
|
|
@@ -2559,8 +2520,6 @@ export declare function fixElementIds(xml: string): {
|
|
|
2559
2520
|
xml: string;
|
|
2560
2521
|
changes: number;
|
|
2561
2522
|
};
|
|
2562
|
-
//#endregion
|
|
2563
|
-
//#region src/qti-serializer/serializeAssessmentTest.d.ts
|
|
2564
2523
|
export interface SerializeTestOptions {
|
|
2565
2524
|
/** Format with newlines and indentation */
|
|
2566
2525
|
pretty?: boolean;
|
|
@@ -2579,8 +2538,6 @@ export interface SerializeTestResult {
|
|
|
2579
2538
|
* @returns { xml?, diagnostics[] }
|
|
2580
2539
|
*/
|
|
2581
2540
|
export declare function serializeAssessmentTest(test: QtiAssessmentTest, options?: SerializeTestOptions): SerializeTestResult;
|
|
2582
|
-
//#endregion
|
|
2583
|
-
//#region src/qti-to-learnosity/convertShared.d.ts
|
|
2584
2541
|
/**
|
|
2585
2542
|
* Result of converting a single QTI assessmentItem to a Learnosity item.
|
|
2586
2543
|
*/
|
|
@@ -2588,8 +2545,6 @@ interface ConvertResult$1 {
|
|
|
2588
2545
|
item?: LearnosityItemJson;
|
|
2589
2546
|
diagnostics: Diagnostic[];
|
|
2590
2547
|
}
|
|
2591
|
-
//#endregion
|
|
2592
|
-
//#region src/qti-to-learnosity/convertQtiToLearnosity.d.ts
|
|
2593
2548
|
interface ConvertOptions {
|
|
2594
2549
|
qtiVersion?: QtiVersion;
|
|
2595
2550
|
inputPath?: string;
|
|
@@ -2614,8 +2569,6 @@ interface ConvertOptions {
|
|
|
2614
2569
|
* Supports choiceInteraction (MCQ), textEntryInteraction (clozetext), extendedTextInteraction (longtextV2), matchInteraction (choicematrix), gapMatchInteraction (clozeassociation), inlineChoiceInteraction (clozedropdown), orderInteraction (orderlist), hotspotInteraction (hotspot), hottextInteraction (tokenhighlight), associateInteraction (classification)
|
|
2615
2570
|
*/
|
|
2616
2571
|
export declare function convertQtiAssessmentItemToLearnosity(inputXml: string, opts?: ConvertOptions): ConvertResult$1;
|
|
2617
|
-
//#endregion
|
|
2618
|
-
//#region src/qti-to-learnosity/convertAssessmentTestToActivity.d.ts
|
|
2619
2572
|
type LearnosityActivityJson = {
|
|
2620
2573
|
rendering_type: 'assess';
|
|
2621
2574
|
items: Array<{
|
|
@@ -2639,8 +2592,6 @@ interface ConvertResult {
|
|
|
2639
2592
|
* Supports simple linear tests only (v1)
|
|
2640
2593
|
*/
|
|
2641
2594
|
export declare function convertAssessmentTestToLearnosityActivity(inputXml: string): ConvertResult;
|
|
2642
|
-
//#endregion
|
|
2643
|
-
//#region src/qti-to-learnosity/convertQtiPackageToLearnosityBundle.d.ts
|
|
2644
2595
|
/** A package entry (ZIP or directory) with raw bytes. Buffer satisfies this too. */
|
|
2645
2596
|
interface PackageEntry {
|
|
2646
2597
|
file: string;
|
|
@@ -2687,6 +2638,5 @@ export declare function convertQtiPackageToLearnosityBundle(input: {
|
|
|
2687
2638
|
} | {
|
|
2688
2639
|
entries: ReadonlyMap<string, PackageEntry>;
|
|
2689
2640
|
}, opts?: ConvertQtiPackageToLearnosityBundleOptions): ConvertQtiPackageToLearnosityBundleResult;
|
|
2690
|
-
//#endregion
|
|
2691
2641
|
export type { ConversionOptions, ConversionResult, ConvertQtiPackageToLearnosityBundleOptions, ConvertQtiPackageToLearnosityBundleResult, Diagnostic, DiagnosticIssue, DiagnosticLevel, DiagnosticsOutput, DiagnosticsReport, FileAccess, FormatDiagnosticsReportOptions, ItemFilenameSource, ItemReferenceSource, LearnosityActivityJson, LearnosityItemJson, LearnosityQuestionJson, OutputFormat, PackageEntry, QtiVersion };
|
|
2692
2642
|
//# sourceMappingURL=index.d.ts.map
|