@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.
- package/README.md +28 -3
- package/docs/EXAMPLES.md +47 -21
- package/docs/FAQ.md +11 -1
- package/docs/GETTING_STARTED.md +34 -18
- package/package.json +1 -1
- package/packages/cli/dist/{batchProcessors-BfmvnTQ5.js → batchProcessors-C8k2v0o_.js} +4 -2
- package/packages/cli/dist/batchProcessors-C8k2v0o_.js.map +1 -0
- package/packages/cli/dist/batchWorker.js +1 -1
- package/packages/cli/dist/{learnosityToQti-B0PoimXr.js → learnosityToQti-D3Xxswaf.js} +5 -4
- package/packages/cli/dist/learnosityToQti-D3Xxswaf.js.map +1 -0
- package/packages/cli/dist/{learnosityToQtiPackage-RyClxvZj.js → learnosityToQtiPackage-D-hlZ9yI.js} +10 -5
- package/packages/cli/dist/learnosityToQtiPackage-D-hlZ9yI.js.map +1 -0
- package/packages/cli/dist/main.js +4 -4
- package/packages/cli/dist/{qtiPackageToLearnosity-0rkZKKOK.js → qtiPackageToLearnosity-CHDga9lI.js} +2 -2
- package/packages/cli/dist/{qtiPackageToLearnosity-0rkZKKOK.js.map → qtiPackageToLearnosity-CHDga9lI.js.map} +1 -1
- package/packages/cli/dist/{qtiToLearnosity-jiFTBiQU.js → qtiToLearnosity-BkYlsuH0.js} +2 -2
- package/packages/cli/dist/{qtiToLearnosity-jiFTBiQU.js.map → qtiToLearnosity-BkYlsuH0.js.map} +1 -1
- package/packages/cli/dist/{resolveOptions-gH_YAxxc.js → resolveOptions-CZ4dw2gp.js} +97 -5
- package/packages/cli/dist/resolveOptions-CZ4dw2gp.js.map +1 -0
- package/packages/core/dist/index.d.ts +14 -1
- package/packages/core/dist/index.js +115 -12
- package/packages/core/dist/node.d.ts +19 -1
- package/packages/core/dist/node.js +119 -14
- package/packages/cli/dist/batchProcessors-BfmvnTQ5.js.map +0 -1
- package/packages/cli/dist/learnosityToQti-B0PoimXr.js.map +0 -1
- package/packages/cli/dist/learnosityToQtiPackage-RyClxvZj.js.map +0 -1
- package/packages/cli/dist/resolveOptions-gH_YAxxc.js.map +0 -1
package/README.md
CHANGED
|
@@ -155,6 +155,31 @@ npm run validate:qti -- output/qti/item.xml
|
|
|
155
155
|
npm run validate:qti:debug -- output/qti/
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
By default the QTI version is **auto-detected per file** from each file's XML
|
|
159
|
+
namespace (`imsqti_v2p1` vs `imsqti_v2p2`), so a folder containing a mix of 2.1
|
|
160
|
+
and 2.2 files validates each against the correct schema. You do not need to pass
|
|
161
|
+
the schema path.
|
|
162
|
+
|
|
163
|
+
To force a specific version instead of auto-detecting, pass `--qti-version`:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Force QTI 2.1
|
|
167
|
+
npm run validate:qti -- output/qti/ --qti-version 2.1
|
|
168
|
+
|
|
169
|
+
# Force QTI 2.2
|
|
170
|
+
npm run validate:qti -- output/qti/ --qti-version 2.2
|
|
171
|
+
|
|
172
|
+
# Auto-detect with a custom parallel job count
|
|
173
|
+
npm run validate:qti -- output/qti/ 16
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Passing an explicit schema path (legacy form) still works and overrides
|
|
177
|
+
`--qti-version`:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm run validate:qti -- output/qti/ ./schemas/qti/v2p1/imsqti_v2p1.xsd
|
|
181
|
+
```
|
|
182
|
+
|
|
158
183
|
Note: the validation script requires Python and lxml library to be installed.
|
|
159
184
|
|
|
160
185
|
```bash
|
|
@@ -166,9 +191,9 @@ npm run validate:qti -- output/qti/
|
|
|
166
191
|
|
|
167
192
|
- Uses **local XSD schemas** (not remote) via XML catalog
|
|
168
193
|
- Automatically detects file types and uses appropriate schemas:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
194
|
+
- QTI items/tests → **QTI 2.1 or 2.2** schema, auto-detected per file from its XML namespace (override with `--qti-version`)
|
|
195
|
+
- Manifest files → **IMS Content Packaging v1.1.4** schema (`imscp_v1p1.xsd`)
|
|
196
|
+
- LOM metadata → **IMS Learning Resource Metadata v1.2.4** schema (`imsmd_v1p2p4.xsd`)
|
|
172
197
|
|
|
173
198
|
**Schema Versions:**
|
|
174
199
|
|
package/docs/EXAMPLES.md
CHANGED
|
@@ -136,6 +136,25 @@ lcon qti-package-to-learnosity \
|
|
|
136
136
|
|
|
137
137
|
All configuration options used during package conversion are automatically recorded in the `manifest.json` file under the `diagnostics` section. This provides traceability for how the bundle was created. See [Learnosity Bundle Format - Diagnostics Section](LEARNOSITY_BUNDLE_FORMAT.md#diagnostics-section) for details.
|
|
138
138
|
|
|
139
|
+
**Custom asset URL for Learnosity → QTI:**
|
|
140
|
+
|
|
141
|
+
The same `--custom-asset-url` flag works in the reverse direction (`learnosity-to-qti` and `learnosity-to-qti-package`). Here it rewrites the asset reference prefix in the generated QTI, preserving the filename. When omitted, the default prefix is `./assets`, so references resolve to `./assets/<filename>` (matching the packaged `assets/` folder):
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
lcon learnosity-to-qti-package \
|
|
145
|
+
--in ./bundle \
|
|
146
|
+
--out package.zip \
|
|
147
|
+
--custom-asset-url "https://my-cdn.example.com/media"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Given an input reference of `/vendor/learnosity/itembank/assets/abc123_photo.png`, this produces:
|
|
151
|
+
|
|
152
|
+
```html
|
|
153
|
+
<img src="https://my-cdn.example.com/media/abc123_photo.png" />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Without the flag, the same reference becomes `./assets/abc123_photo.png`. Note that in this direction `--custom-asset-url` rewrites only the reference strings — it does not move or rename the physical asset files copied into the package (they remain under `assets/`). Remote and `data:` URIs, plus converter-internal references such as the `lrn-normalize.css` stylesheet, are left untouched.
|
|
157
|
+
|
|
139
158
|
### 4. Instructor-Facing Content (rubricBlock)
|
|
140
159
|
|
|
141
160
|
When converting QTI to Learnosity, `<rubricBlock view="scorer">` elements are automatically mapped to the `instructor_stimulus` field in the question data. This content is visible only to instructors/scorers, not to students.
|
|
@@ -753,19 +772,19 @@ The package exports the following for library consumers:
|
|
|
753
772
|
|
|
754
773
|
`convertQtiToLearnosity` and `convertLearnosityToQti` accept a `ConversionOptions` object:
|
|
755
774
|
|
|
756
|
-
| Option | Type | Required | CLI Equivalent | Description
|
|
757
|
-
| --------------------- | ---------------------------------------------- | -------- | ------------------------- |
|
|
758
|
-
| `qtiVersion` | `'2.1'` \| `'2.2'` | Yes | `--qti-version` | QTI version to use for conversion
|
|
759
|
-
| `outputFormat` | `'dir'` \| `'zip'` \| `'stdout'` | No | `--output-format` | Output format
|
|
760
|
-
| `diagnostics` | `'stderr'` \| `'file'` \| `'both'` \| `'none'` | No | `--diagnostics` | Where to write diagnostic messages. Use `'none'` when using as a library
|
|
761
|
-
| `verbose` | `boolean` | No | `--verbose` | Include INFO-level diagnostics in the result
|
|
762
|
-
| `pretty` | `boolean` | No | `--pretty` | Pretty-print JSON/XML output
|
|
763
|
-
| `inputPath` | `string` | No | `--in` | Path to input file (used for LOM metadata lookup)
|
|
764
|
-
| `organisationId` | `number` | No | `--organisation_id` | Organisation ID for Learnosity CDN asset URLs
|
|
765
|
-
| `mediaVault` | `boolean` | No | `--mediavault` | Use `media-vault` subdomain instead of `assets` for CDN URLs
|
|
766
|
-
| `customAssetUrl` | `string` | No | `--custom-asset-url` | Custom base URL for assets
|
|
767
|
-
| `itemReferenceSource` | `'sourceFilename'` \| `'qti'` \| `'uuid'` | No | `--item-reference-source` | How to generate item references. Default: `'sourceFilename'`
|
|
768
|
-
| `truncateTags` | `boolean` | No | `--truncate-tags` | Truncate tag types and names to 255 characters instead of failing
|
|
775
|
+
| Option | Type | Required | CLI Equivalent | Description |
|
|
776
|
+
| --------------------- | ---------------------------------------------- | -------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
777
|
+
| `qtiVersion` | `'2.1'` \| `'2.2'` | Yes | `--qti-version` | QTI version to use for conversion |
|
|
778
|
+
| `outputFormat` | `'dir'` \| `'zip'` \| `'stdout'` | No | `--output-format` | Output format |
|
|
779
|
+
| `diagnostics` | `'stderr'` \| `'file'` \| `'both'` \| `'none'` | No | `--diagnostics` | Where to write diagnostic messages. Use `'none'` when using as a library |
|
|
780
|
+
| `verbose` | `boolean` | No | `--verbose` | Include INFO-level diagnostics in the result |
|
|
781
|
+
| `pretty` | `boolean` | No | `--pretty` | Pretty-print JSON/XML output |
|
|
782
|
+
| `inputPath` | `string` | No | `--in` | Path to input file (used for LOM metadata lookup) |
|
|
783
|
+
| `organisationId` | `number` | No | `--organisation_id` | Organisation ID for Learnosity CDN asset URLs |
|
|
784
|
+
| `mediaVault` | `boolean` | No | `--mediavault` | Use `media-vault` subdomain instead of `assets` for CDN URLs |
|
|
785
|
+
| `customAssetUrl` | `string` | No | `--custom-asset-url` | Custom base URL/prefix for assets. QTI → Learnosity: overrides default Learnosity CDN and `mediaVault`. Learnosity → QTI: replaces the asset prefix up to the filename (default `./assets`) |
|
|
786
|
+
| `itemReferenceSource` | `'sourceFilename'` \| `'qti'` \| `'uuid'` | No | `--item-reference-source` | How to generate item references. Default: `'sourceFilename'` |
|
|
787
|
+
| `truncateTags` | `boolean` | No | `--truncate-tags` | Truncate tag types and names to 255 characters instead of failing |
|
|
769
788
|
|
|
770
789
|
**Note:** Only `qtiVersion` is required; all other options are optional. `outputFormat`, `diagnostics`, and `verbose` are CLI-only — they are ignored by the library API (`convertQtiToLearnosity` / `convertLearnosityToQti`) and only take effect when running the `lcon` CLI.
|
|
771
790
|
|
|
@@ -791,13 +810,14 @@ The package exports the following for library consumers:
|
|
|
791
810
|
|
|
792
811
|
`convertLearnosityToQtiPackage` accepts a `ConvertLearnosityToQtiPackageOptions` object:
|
|
793
812
|
|
|
794
|
-
| Option
|
|
795
|
-
|
|
|
796
|
-
| `inputPath`
|
|
797
|
-
| `activityRefs`
|
|
798
|
-
| `outputPath`
|
|
799
|
-
| `qtiVersion`
|
|
800
|
-
| `pretty`
|
|
813
|
+
| Option | Type | Required | CLI Equivalent | Description |
|
|
814
|
+
| ---------------- | ------------------ | -------- | -------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
815
|
+
| `inputPath` | `string` | Yes | `--in` | Path to the Learnosity bundle directory |
|
|
816
|
+
| `activityRefs` | `string[]` | No | `--activity` | Activity reference(s) to convert. Omit to convert all activities |
|
|
817
|
+
| `outputPath` | `string` | No | `--out` | Output path (.zip or directory). Omit to skip writing to disk |
|
|
818
|
+
| `qtiVersion` | `'2.1'` \| `'2.2'` | No | `--qti-version` | QTI version (default: `'2.1'`) |
|
|
819
|
+
| `pretty` | `boolean` | No | `--pretty` | Pretty-print XML output |
|
|
820
|
+
| `customAssetUrl` | `string` | No | `--custom-asset-url` | Base URL/prefix for image/audio/video references, replacing everything up to the filename (default: `./assets`) |
|
|
801
821
|
|
|
802
822
|
## Validation Examples
|
|
803
823
|
|
|
@@ -885,7 +905,13 @@ With debug mode to see schema resolution details:
|
|
|
885
905
|
pnpm run validate:qti:debug ./output/qti-items
|
|
886
906
|
```
|
|
887
907
|
|
|
888
|
-
|
|
908
|
+
Force a specific QTI version (default is auto-detect per file):
|
|
909
|
+
|
|
910
|
+
```bash
|
|
911
|
+
pnpm run validate:qti ./output/qti-items --qti-version 2.1
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
With custom schema and parallel jobs (explicit schema overrides `--qti-version`):
|
|
889
915
|
|
|
890
916
|
```bash
|
|
891
917
|
pnpm run validate:qti ./output/qti-items ./schemas/qti/v2p1/imsqti_v2p1.xsd 16
|
package/docs/FAQ.md
CHANGED
|
@@ -269,9 +269,19 @@ Schema URLs are resolved to local files using the XML catalog (`schemas/catalog.
|
|
|
269
269
|
|
|
270
270
|
**A:** The converter may produce technically valid but schema-non-compliant XML in some edge cases. Check diagnostics for clues and report issues.
|
|
271
271
|
|
|
272
|
+
### Q: How do I choose the QTI version to validate against?
|
|
273
|
+
|
|
274
|
+
**A:** By default the version is auto-detected per file from its XML namespace,
|
|
275
|
+
so you usually don't need to do anything. To force a version:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
pnpm run validate:qti ./output/qti-items --qti-version 2.1
|
|
279
|
+
pnpm run validate:qti ./output/qti-items --qti-version 2.2
|
|
280
|
+
```
|
|
281
|
+
|
|
272
282
|
### Q: Can I use my own XSD schema?
|
|
273
283
|
|
|
274
|
-
**A:** Yes:
|
|
284
|
+
**A:** Yes, pass an explicit schema path (this overrides `--qti-version`):
|
|
275
285
|
|
|
276
286
|
```bash
|
|
277
287
|
pnpm run validate:qti ./output/qti-items ./path/to/custom.xsd
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -233,9 +233,11 @@ This produces URLs like:
|
|
|
233
233
|
|
|
234
234
|
### `--custom-asset-url`
|
|
235
235
|
|
|
236
|
-
_Available for: `qti-to-learnosity`, `qti-package-to-learnosity`_
|
|
236
|
+
_Available for: `qti-to-learnosity`, `qti-package-to-learnosity`, `learnosity-to-qti`, `learnosity-to-qti-package`_
|
|
237
|
+
|
|
238
|
+
Specify a custom base URL/prefix for asset references (images, audio, video). The value replaces the entire reference prefix up to the filename; the original filename (the last path segment) is always preserved.
|
|
237
239
|
|
|
238
|
-
|
|
240
|
+
**QTI → Learnosity** (`qti-to-learnosity`, `qti-package-to-learnosity`) — use a custom base instead of the default Learnosity CDN:
|
|
239
241
|
|
|
240
242
|
```bash
|
|
241
243
|
lcon qti-to-learnosity --in item.xml --out item.json --organisation_id 12345 --custom-asset-url "https://my-cdn.example.com/assets"
|
|
@@ -247,7 +249,21 @@ This produces URLs with your custom prefix:
|
|
|
247
249
|
<img src="https://my-cdn.example.com/assets/997a17a4-010b-4a95-9e70-1176f327d30b.png" />
|
|
248
250
|
```
|
|
249
251
|
|
|
250
|
-
**Note:**
|
|
252
|
+
**Note:** In this direction, when `--custom-asset-url` is provided it overrides both the default Learnosity CDN and the `--mediavault` flag.
|
|
253
|
+
|
|
254
|
+
**Learnosity → QTI** (`learnosity-to-qti`, `learnosity-to-qti-package`) — rewrite the asset prefix in the generated QTI. When omitted, the default prefix is `./assets`, so a reference resolves to `./assets/<filename>` (matching the packaged `assets/` folder):
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
lcon learnosity-to-qti-package --in ./bundle --out package.zip --custom-asset-url "https://my-cdn.example.com/media"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Given an input reference of `/vendor/learnosity/itembank/assets/abc123_photo.png`, this produces:
|
|
261
|
+
|
|
262
|
+
```html
|
|
263
|
+
<img src="https://my-cdn.example.com/media/abc123_photo.png" />
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Note:** In the Learnosity → QTI direction, `--custom-asset-url` only rewrites the reference strings in the generated XML — it does not relocate or rename the physical asset files copied into the package (those remain under `assets/`). Remote (`http(s)://`), protocol-relative (`//`) and `data:` URIs, and converter-internal references (such as the `lrn-normalize.css` stylesheet) are left untouched.
|
|
251
267
|
|
|
252
268
|
### `--item-reference-source`
|
|
253
269
|
|
|
@@ -488,7 +504,7 @@ Diagnostics are displayed after conversion:
|
|
|
488
504
|
|
|
489
505
|
Create `lrn-converter.config.json` in your working directory to set default options:
|
|
490
506
|
|
|
491
|
-
> **Note:** All four commands load `lrn-converter.config.json` (and honour `--config` / `--no-config`). Each command applies only the keys relevant to its conversion direction — e.g. `organisationId`, `mediaVault`, `
|
|
507
|
+
> **Note:** All four commands load `lrn-converter.config.json` (and honour `--config` / `--no-config`). Each command applies only the keys relevant to its conversion direction — e.g. `organisationId`, `mediaVault`, `itemReferenceSource` for QTI → Learnosity; `qtiVersion` for Learnosity → QTI; `customAssetUrl` for both directions — and ignores the rest.
|
|
492
508
|
|
|
493
509
|
```json
|
|
494
510
|
{
|
|
@@ -510,20 +526,20 @@ Create `lrn-converter.config.json` in your working directory to set default opti
|
|
|
510
526
|
|
|
511
527
|
All options are optional. CLI flags override config file values.
|
|
512
528
|
|
|
513
|
-
| Option | Type | Default | Description
|
|
514
|
-
| --------------------- | ---------------------------------------------- | ----------------------------- |
|
|
515
|
-
| `qtiVersion` | `"2.1"` \| `"2.2"` | `"2.2"` | QTI version to use for conversion
|
|
516
|
-
| `outputFormat` | `"dir"` \| `"zip"` \| `"stdout"` | `"dir"` | Output format (auto-detected based on output path)
|
|
517
|
-
| `diagnostics` | `"stderr"` \| `"file"` \| `"both"` \| `"none"` | `"file"` | Where to write diagnostic messages
|
|
518
|
-
| `pretty` | `boolean` | `false` | Pretty-print JSON/XML output
|
|
519
|
-
| `verbose` | `boolean` | `false` | Show detailed progress information
|
|
520
|
-
| `output` | `string` | `"-"` | Default output directory for interactive mode
|
|
521
|
-
| `organisationId` | `number` | - | Organisation ID for Learnosity CDN asset URLs
|
|
522
|
-
| `mediaVault` | `boolean` | `false` | Use `media-vault` subdomain instead of `assets` for CDN URLs
|
|
523
|
-
| `customAssetUrl` | `string` | - | Custom base URL for assets
|
|
524
|
-
| `truncateTags` | `boolean` | `false` | Truncate tag types and names to 255 characters instead of failing
|
|
525
|
-
| `itemReferenceSource` | `"sourceFilename"` \| `"qti"` \| `"uuid"` | `"sourceFilename"` | How to generate item references (QTI → Learnosity only)
|
|
526
|
-
| `itemFilenameSource` | `"sourceFilename"` \| `"qti"` | Same as `itemReferenceSource` | How to name output JSON files. Defaults to the resolved `itemReferenceSource` value if omitted
|
|
529
|
+
| Option | Type | Default | Description |
|
|
530
|
+
| --------------------- | ---------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
531
|
+
| `qtiVersion` | `"2.1"` \| `"2.2"` | `"2.2"` | QTI version to use for conversion |
|
|
532
|
+
| `outputFormat` | `"dir"` \| `"zip"` \| `"stdout"` | `"dir"` | Output format (auto-detected based on output path) |
|
|
533
|
+
| `diagnostics` | `"stderr"` \| `"file"` \| `"both"` \| `"none"` | `"file"` | Where to write diagnostic messages |
|
|
534
|
+
| `pretty` | `boolean` | `false` | Pretty-print JSON/XML output |
|
|
535
|
+
| `verbose` | `boolean` | `false` | Show detailed progress information |
|
|
536
|
+
| `output` | `string` | `"-"` | Default output directory for interactive mode |
|
|
537
|
+
| `organisationId` | `number` | - | Organisation ID for Learnosity CDN asset URLs |
|
|
538
|
+
| `mediaVault` | `boolean` | `false` | Use `media-vault` subdomain instead of `assets` for CDN URLs |
|
|
539
|
+
| `customAssetUrl` | `string` | - | Custom base URL/prefix for assets. QTI → Learnosity: overrides the default Learnosity CDN and `mediaVault`. Learnosity → QTI: replaces the asset prefix up to the filename (default `./assets`) |
|
|
540
|
+
| `truncateTags` | `boolean` | `false` | Truncate tag types and names to 255 characters instead of failing |
|
|
541
|
+
| `itemReferenceSource` | `"sourceFilename"` \| `"qti"` \| `"uuid"` | `"sourceFilename"` | How to generate item references (QTI → Learnosity only) |
|
|
542
|
+
| `itemFilenameSource` | `"sourceFilename"` \| `"qti"` | Same as `itemReferenceSource` | How to name output JSON files. Defaults to the resolved `itemReferenceSource` value if omitted |
|
|
527
543
|
|
|
528
544
|
### Config File Usage
|
|
529
545
|
|
package/package.json
CHANGED
|
@@ -116,7 +116,8 @@ async function processLearnosityToQtiPackage(pkg, packageOutputPath, options, qu
|
|
|
116
116
|
for (const activityRef of bundle.activityRefs) {
|
|
117
117
|
const convertResult = convertActivity(bundle, activityRef, {
|
|
118
118
|
pretty: options.pretty,
|
|
119
|
-
version: options.qtiVersion
|
|
119
|
+
version: options.qtiVersion,
|
|
120
|
+
customAssetUrl: options.customAssetUrl
|
|
120
121
|
});
|
|
121
122
|
allDiagnostics.push(...convertResult.diagnostics);
|
|
122
123
|
const itemRefs = bundle.activityItemRefs.get(activityRef) ?? [];
|
|
@@ -164,6 +165,7 @@ async function processLearnosityToQtiPackage(pkg, packageOutputPath, options, qu
|
|
|
164
165
|
}
|
|
165
166
|
const pkgData = {
|
|
166
167
|
zipPath: "",
|
|
168
|
+
version: options.qtiVersion,
|
|
167
169
|
resources: [],
|
|
168
170
|
entries: /* @__PURE__ */ new Map(),
|
|
169
171
|
items: [],
|
|
@@ -212,4 +214,4 @@ function itemRefsToFilenames(bundle, itemRefs) {
|
|
|
212
214
|
//#endregion
|
|
213
215
|
export { processQtiPackageToLearnosity as n, runBatchTask as r, processLearnosityToQtiPackage as t };
|
|
214
216
|
|
|
215
|
-
//# sourceMappingURL=batchProcessors-
|
|
217
|
+
//# sourceMappingURL=batchProcessors-C8k2v0o_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batchProcessors-C8k2v0o_.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 customAssetUrl: options.customAssetUrl,\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 version: options.qtiVersion,\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,8BAClB,KACA,mBACA,SACA,OACs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K,OAAO;AAC1F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as loadConfig, r as showBanner } from "./pathUtils-CwZnJ55s.js";
|
|
2
2
|
import { r as formatDiagnosticsTable, s as writeDiagnostics, t as countErrors } from "./table-DYcNeyJ_.js";
|
|
3
|
-
import { a as parseJsonInput, i as writeOutput, n as ProgressTracker, o as readInput, r as showResolvedOptions, s as convertLearnosityToQti, t as resolveOptions } from "./resolveOptions-
|
|
3
|
+
import { a as parseJsonInput, i as writeOutput, n as ProgressTracker, o as readInput, r as showResolvedOptions, s as convertLearnosityToQti, t as resolveOptions } from "./resolveOptions-CZ4dw2gp.js";
|
|
4
4
|
import { copyFile, mkdir } from "fs/promises";
|
|
5
5
|
import { basename, dirname, join } from "path";
|
|
6
6
|
//#region src/commands/learnosityToQti.ts
|
|
@@ -8,7 +8,7 @@ import { basename, dirname, join } from "path";
|
|
|
8
8
|
* Register learnosity-to-qti command
|
|
9
9
|
*/
|
|
10
10
|
function registerLearnosityToQtiCommand(program, version) {
|
|
11
|
-
program.command("learnosity-to-qti").description("Convert a single Learnosity item to QTI").option("--in <path>", "Input file path or \"-\" for stdin").option("--out <path>", "Output file path or \"-\" for stdout").option("--qti-version <version>", "QTI version (2.1 or 2.2, default: 2.2)").option("--output-format <format>", "Output format (dir|zip|stdout, default: auto-detect from output path)").option("--diagnostics <mode>", "Diagnostics output (stderr|file|both|none, default: file for file output, stderr for stdout)").option("--fail-on-warn", "Exit with error code 1 if warnings exist (default: false)").option("--config <path>", "Path to config file").option("--no-config", "Disable config file loading").option("-i, --interactive", "Enable interactive prompts (default: false)").option("--verbose", "Verbose output (default: false)").option("--pretty", "Pretty-print JSON output (default: false)").option("-q, --quiet", "Suppress non-essential output (default: false)").option("--include-learnosity-source", "Copy input file to source/ folder alongside output (default: false)").action(async (opts) => {
|
|
11
|
+
program.command("learnosity-to-qti").description("Convert a single Learnosity item to QTI").option("--in <path>", "Input file path or \"-\" for stdin").option("--out <path>", "Output file path or \"-\" for stdout").option("--qti-version <version>", "QTI version (2.1 or 2.2, default: 2.2)").option("--custom-asset-url <url>", "Base URL/prefix for image/audio/video asset references, replacing everything up to the filename (default: ./assets)").option("--output-format <format>", "Output format (dir|zip|stdout, default: auto-detect from output path)").option("--diagnostics <mode>", "Diagnostics output (stderr|file|both|none, default: file for file output, stderr for stdout)").option("--fail-on-warn", "Exit with error code 1 if warnings exist (default: false)").option("--config <path>", "Path to config file").option("--no-config", "Disable config file loading").option("-i, --interactive", "Enable interactive prompts (default: false)").option("--verbose", "Verbose output (default: false)").option("--pretty", "Pretty-print JSON output (default: false)").option("-q, --quiet", "Suppress non-essential output (default: false)").option("--include-learnosity-source", "Copy input file to source/ folder alongside output (default: false)").action(async (opts) => {
|
|
12
12
|
await executeLearnosityToQti(opts, version);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -46,7 +46,8 @@ async function executeLearnosityToQti(cliOpts, version) {
|
|
|
46
46
|
outputFormat: resolved.outputFormat,
|
|
47
47
|
diagnostics: resolved.diagnostics,
|
|
48
48
|
verbose: resolved.verbose,
|
|
49
|
-
pretty: resolved.pretty
|
|
49
|
+
pretty: resolved.pretty,
|
|
50
|
+
customAssetUrl: resolved.customAssetUrl
|
|
50
51
|
};
|
|
51
52
|
const result = await convertLearnosityToQti(input, conversionOpts);
|
|
52
53
|
const inputFilename = resolved.inputPath.split("/").pop() ?? resolved.inputPath;
|
|
@@ -99,4 +100,4 @@ async function executeLearnosityToQti(cliOpts, version) {
|
|
|
99
100
|
//#endregion
|
|
100
101
|
export { registerLearnosityToQtiCommand };
|
|
101
102
|
|
|
102
|
-
//# sourceMappingURL=learnosityToQti-
|
|
103
|
+
//# sourceMappingURL=learnosityToQti-D3Xxswaf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learnosityToQti-D3Xxswaf.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 '--custom-asset-url <url>',\n 'Base URL/prefix for image/audio/video asset references, replacing everything up to the filename (default: ./assets)'\n )\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 customAssetUrl: resolved.customAssetUrl,\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,qHACJ,CAAC,CACA,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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1C;EAGA,IACI,QAAQ,2BACR,SAAS,cAAc,OACvB,SAAS,eAAe,KAC1B;GACE,SAAS,WAAW,wBAAwB;GAC5C,MAAM,eAAe,SAAS,WAAW,SAAS,UAAU;GAC5D,SAAS,aAAa,oBAAoB;EAC9C;EAGA,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;EAI7D,MAAM,eAAe,eAAe,QAAQ,MAAM,EAAE,UAAU,SAAS,CAAC,CAAC;EAEzE,IAAI,eAAe,KAAK,QAAQ,YAAY;GACxC,QAAQ,OAAO,MACX,KAAK,aAAa,0DACtB;GACA,QAAQ,KAAK,CAAC;EAClB;EAEA,QAAQ,KAAK,CAAC;CAClB,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"}
|
package/packages/cli/dist/{learnosityToQtiPackage-RyClxvZj.js → learnosityToQtiPackage-D-hlZ9yI.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { _ as isEnterKey, c as usePrefix, f as useState, g as isDownKey, l as ma
|
|
|
2
2
|
import { i as useMemo, n as Separator, r as usePagination, t as dist_default$1 } from "./dist-DjpU2mIj.js";
|
|
3
3
|
import { l as dist_default$2, n as loadConfig, r as showBanner, t as expandTilde } from "./pathUtils-CwZnJ55s.js";
|
|
4
4
|
import { n as formatDiagnosticsSummaryTable, r as formatDiagnosticsTable, s as writeDiagnostics } from "./table-DYcNeyJ_.js";
|
|
5
|
-
import { t as processLearnosityToQtiPackage } from "./batchProcessors-
|
|
5
|
+
import { t as processLearnosityToQtiPackage } from "./batchProcessors-C8k2v0o_.js";
|
|
6
6
|
import { i as processBatchParallel, n as displayConfiguration, r as processBatch, t as configField } from "./configOutput-FwkFyQmk.js";
|
|
7
7
|
import { styleText } from "node:util";
|
|
8
8
|
import { join } from "path";
|
|
@@ -197,7 +197,7 @@ var dist_default = createPrompt((config, done) => {
|
|
|
197
197
|
* Register learnosity-to-qti-package command
|
|
198
198
|
*/
|
|
199
199
|
function registerLearnosityToQtiPackageCommand(program, version) {
|
|
200
|
-
program.command("learnosity-to-qti-package").description("Convert a Learnosity bundle to a QTI Content Package").option("--in <path>", "Input bundle directory path").option("--activity <id...>", "Activity reference(s) to convert (space-separated). Omit to convert all activities.").option("--out <path>", "Output package path (.zip or directory)").option("--format <type>", "Output format: zip or dir (default: auto-detect from --out path)").option("--qti-version <version>", "QTI version: 2.1 or 2.2 (default: 2.2)").option("--recursive", "Process all subdirectories in the input path (default: false)").option("--concurrency <number>", "Worker threads for --recursive batch conversion (default: 1 = serial)", parseInt).option("--diagnostics <mode>", "Diagnostics output (stderr|file|both|none, default: file)").option("--fail-on-warn", "Exit with error code 1 if warnings exist (default: false)").option("--config <path>", "Path to config file").option("--no-config", "Disable config file loading").option("-i, --interactive", "Enable interactive prompts (default: false)").option("--pretty", "Pretty-print XML output (default: false)").option("-q, --quiet", "Suppress non-essential output (default: false)").option("-v, --verbose", "Show INFO level diagnostics (default: false)").option("--include-learnosity-source", "Copy input bundle to source/ folder in output package (default: false)").action(async (opts) => {
|
|
200
|
+
program.command("learnosity-to-qti-package").description("Convert a Learnosity bundle to a QTI Content Package").option("--in <path>", "Input bundle directory path").option("--activity <id...>", "Activity reference(s) to convert (space-separated). Omit to convert all activities.").option("--out <path>", "Output package path (.zip or directory)").option("--format <type>", "Output format: zip or dir (default: auto-detect from --out path)").option("--qti-version <version>", "QTI version: 2.1 or 2.2 (default: 2.2)").option("--custom-asset-url <url>", "Base URL/prefix for image/audio/video asset references, replacing everything up to the filename (default: ./assets)").option("--recursive", "Process all subdirectories in the input path (default: false)").option("--concurrency <number>", "Worker threads for --recursive batch conversion (default: 1 = serial)", parseInt).option("--diagnostics <mode>", "Diagnostics output (stderr|file|both|none, default: file)").option("--fail-on-warn", "Exit with error code 1 if warnings exist (default: false)").option("--config <path>", "Path to config file").option("--no-config", "Disable config file loading").option("-i, --interactive", "Enable interactive prompts (default: false)").option("--pretty", "Pretty-print XML output (default: false)").option("-q, --quiet", "Suppress non-essential output (default: false)").option("-v, --verbose", "Show INFO level diagnostics (default: false)").option("--include-learnosity-source", "Copy input bundle to source/ folder in output package (default: false)").action(async (opts) => {
|
|
201
201
|
await executeLearnosityToQtiPackage(opts, version);
|
|
202
202
|
});
|
|
203
203
|
}
|
|
@@ -342,6 +342,7 @@ async function executeLearnosityToQtiPackage(cliOpts, version) {
|
|
|
342
342
|
const outputPath = await resolveOutputPath(cliOpts.out, interactive);
|
|
343
343
|
const qtiVersion = await resolveQtiVersion(cliOpts.qtiVersion, interactive, config?.qtiVersion);
|
|
344
344
|
const pretty = cliOpts.pretty ?? config?.pretty ?? false;
|
|
345
|
+
const customAssetUrl = cliOpts.customAssetUrl ?? config?.customAssetUrl;
|
|
345
346
|
const failOnWarn = cliOpts.failOnWarn ?? false;
|
|
346
347
|
const includeLearnositySource = cliOpts.includeLearnositySource ?? false;
|
|
347
348
|
if (qtiVersion !== "2.1" && qtiVersion !== "2.2") {
|
|
@@ -360,6 +361,7 @@ async function executeLearnosityToQtiPackage(cliOpts, version) {
|
|
|
360
361
|
outputPath,
|
|
361
362
|
qtiVersion,
|
|
362
363
|
pretty,
|
|
364
|
+
customAssetUrl,
|
|
363
365
|
failOnWarn,
|
|
364
366
|
includeLearnositySource,
|
|
365
367
|
diagnosticsMode,
|
|
@@ -428,7 +430,8 @@ Configuration:`);
|
|
|
428
430
|
process.stderr.write("Loading complete ✓\n");
|
|
429
431
|
const { convertedActivities: allConvertedActivities, totalItemsConverted, totalItemsFailed } = convertActivities(activityRefs, bundle, {
|
|
430
432
|
pretty,
|
|
431
|
-
version: qtiVersion
|
|
433
|
+
version: qtiVersion,
|
|
434
|
+
customAssetUrl
|
|
432
435
|
}, allDiagnostics);
|
|
433
436
|
if (allConvertedActivities.length === 0) {
|
|
434
437
|
process.stderr.write("\nConversion FAILED - no activities could be converted\n\n");
|
|
@@ -450,6 +453,7 @@ Configuration:`);
|
|
|
450
453
|
process.stderr.write("Building package... ");
|
|
451
454
|
const pkg = {
|
|
452
455
|
zipPath: "",
|
|
456
|
+
version: qtiVersion,
|
|
453
457
|
resources: [],
|
|
454
458
|
entries: /* @__PURE__ */ new Map(),
|
|
455
459
|
items: [],
|
|
@@ -592,7 +596,8 @@ async function executeBatchLearnosityToQtiPackage(opts) {
|
|
|
592
596
|
direction: "learnosity-to-qti",
|
|
593
597
|
options: {
|
|
594
598
|
qtiVersion: opts.qtiVersion,
|
|
595
|
-
pretty: opts.pretty
|
|
599
|
+
pretty: opts.pretty,
|
|
600
|
+
customAssetUrl: opts.customAssetUrl
|
|
596
601
|
},
|
|
597
602
|
concurrency: opts.concurrency,
|
|
598
603
|
quiet: opts.quiet
|
|
@@ -629,4 +634,4 @@ async function executeBatchLearnosityToQtiPackage(opts) {
|
|
|
629
634
|
//#endregion
|
|
630
635
|
export { registerLearnosityToQtiPackageCommand };
|
|
631
636
|
|
|
632
|
-
//# sourceMappingURL=learnosityToQtiPackage-
|
|
637
|
+
//# sourceMappingURL=learnosityToQtiPackage-D-hlZ9yI.js.map
|