@pie-qti/qti-common 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +16 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -276,15 +276,21 @@ console.log(`Playing ${version} content`);
276
276
  ### Transform Integration
277
277
 
278
278
  ```typescript
279
- import { transformQtiToPie } from '@pie-qti/to-pie';
279
+ import { TransformEngine } from '@pie-qti/transform-core';
280
+ import { QtiToPiePlugin } from '@pie-qti/to-pie';
280
281
  import { createQtiParser } from '@pie-qti/qti-common';
281
282
 
282
283
  const xml = `...(QTI 2.x or 3.0)...`;
283
- const { mapper, version } = createQtiParser(xml);
284
+ const { version } = createQtiParser(xml);
285
+
286
+ const engine = new TransformEngine();
287
+ engine.use(new QtiToPiePlugin());
284
288
 
285
- const pieItem = await transformQtiToPie(xml, {
286
- elementNameMapper: mapper
289
+ const handle = await engine.transform(xml, {
290
+ sourceFormat: version.startsWith('3') ? 'qti30' : 'qti22',
291
+ targetFormat: 'pie'
287
292
  });
293
+ const result = await handle.result();
288
294
  ```
289
295
 
290
296
  ## Migration Guide
@@ -292,11 +298,13 @@ const pieItem = await transformQtiToPie(xml, {
292
298
  ### From QTI 2.x-only Code
293
299
 
294
300
  **Before** (QTI 2.x only):
301
+
295
302
  ```typescript
296
303
  const elements = doc.getElementsByTagName('choiceInteraction');
297
304
  ```
298
305
 
299
306
  **After** (QTI 2.x + 3.0):
307
+
300
308
  ```typescript
301
309
  import { createQtiParser } from '@pie-qti/qti-common';
302
310
 
@@ -306,6 +314,7 @@ const elements = doc.getElementsByTagName(tagName);
306
314
  ```
307
315
 
308
316
  **Even Better** (using existing extraction layer):
317
+
309
318
  ```typescript
310
319
  // No changes needed! Extraction layer already uses mappers internally
311
320
  const player = new Player(xml); // Works with both QTI 2.x and 3.0
@@ -314,11 +323,13 @@ const player = new Player(xml); // Works with both QTI 2.x and 3.0
314
323
  ### Attribute Handling Migration
315
324
 
316
325
  **Before** (QTI 2.x only):
326
+
317
327
  ```typescript
318
328
  const baseType = element.getAttribute('baseType');
319
329
  ```
320
330
 
321
331
  **After** (QTI 2.x + 3.0):
332
+
322
333
  ```typescript
323
334
  import { getAttribute } from '@pie-qti/qti-common';
324
335
 
@@ -336,6 +347,7 @@ bun test --coverage
336
347
  ```
337
348
 
338
349
  Test fixtures are available in `src/__tests__/fixtures/`:
350
+
339
351
  - `qti3-choice-single.xml` — Single-selection choice
340
352
  - `qti3-choice-multiple.xml` — Multiple-selection choice
341
353
  - `qti3-match-interaction.xml` — Match interaction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-qti/qti-common",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "main": "./dist/index.js",
5
5
  "devDependencies": {
6
6
  "@types/bun": "^1.3.11",