@pie-qti/transform-core 0.1.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/config/config-loader.d.ts +25 -0
  2. package/dist/config/config-loader.d.ts.map +1 -0
  3. package/dist/config/config-loader.js +142 -0
  4. package/dist/config/config-loader.js.map +1 -0
  5. package/dist/config/plugin-loader.d.ts +19 -0
  6. package/dist/config/plugin-loader.d.ts.map +1 -0
  7. package/dist/config/plugin-loader.js +62 -0
  8. package/dist/config/plugin-loader.js.map +1 -0
  9. package/dist/config/vendor-registry.d.ts +21 -0
  10. package/dist/config/vendor-registry.d.ts.map +1 -0
  11. package/dist/config/vendor-registry.js +91 -0
  12. package/dist/config/vendor-registry.js.map +1 -0
  13. package/dist/detectors/pie-detector.d.ts +19 -0
  14. package/dist/detectors/pie-detector.d.ts.map +1 -0
  15. package/dist/detectors/pie-detector.js +46 -0
  16. package/dist/detectors/pie-detector.js.map +1 -0
  17. package/dist/detectors/qti-detector.d.ts +20 -0
  18. package/dist/detectors/qti-detector.d.ts.map +1 -0
  19. package/dist/detectors/qti-detector.js +34 -0
  20. package/dist/detectors/qti-detector.js.map +1 -0
  21. package/dist/detectors/qti22-detector.d.ts +20 -0
  22. package/dist/detectors/qti22-detector.d.ts.map +1 -0
  23. package/dist/detectors/qti22-detector.js +34 -0
  24. package/dist/detectors/qti22-detector.js.map +1 -0
  25. package/dist/engine/index.d.ts +1 -1
  26. package/dist/engine/index.d.ts.map +1 -1
  27. package/dist/engine/index.js +1 -1
  28. package/dist/engine/index.js.map +1 -1
  29. package/dist/engine/transform-engine.d.ts +27 -10
  30. package/dist/engine/transform-engine.d.ts.map +1 -1
  31. package/dist/engine/transform-engine.js +96 -85
  32. package/dist/engine/transform-engine.js.map +1 -1
  33. package/dist/index.d.ts +8 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +11 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/orchestration/activities/detect-format-activity.d.ts +18 -0
  38. package/dist/orchestration/activities/detect-format-activity.d.ts.map +1 -0
  39. package/dist/orchestration/activities/detect-format-activity.js +51 -0
  40. package/dist/orchestration/activities/detect-format-activity.js.map +1 -0
  41. package/dist/orchestration/activities/detect-vendor-activity.d.ts +25 -0
  42. package/dist/orchestration/activities/detect-vendor-activity.d.ts.map +1 -0
  43. package/dist/orchestration/activities/detect-vendor-activity.js +27 -0
  44. package/dist/orchestration/activities/detect-vendor-activity.js.map +1 -0
  45. package/dist/orchestration/activities/index.d.ts +18 -0
  46. package/dist/orchestration/activities/index.d.ts.map +1 -0
  47. package/dist/orchestration/activities/index.js +11 -0
  48. package/dist/orchestration/activities/index.js.map +1 -0
  49. package/dist/orchestration/activities/parse-xml-activity.d.ts +18 -0
  50. package/dist/orchestration/activities/parse-xml-activity.d.ts.map +1 -0
  51. package/dist/orchestration/activities/parse-xml-activity.js +37 -0
  52. package/dist/orchestration/activities/parse-xml-activity.js.map +1 -0
  53. package/dist/orchestration/activities/read-content-activity.d.ts +24 -0
  54. package/dist/orchestration/activities/read-content-activity.d.ts.map +1 -0
  55. package/dist/orchestration/activities/read-content-activity.js +49 -0
  56. package/dist/orchestration/activities/read-content-activity.js.map +1 -0
  57. package/dist/orchestration/activities/transform-qti-to-pie-activity.d.ts +23 -0
  58. package/dist/orchestration/activities/transform-qti-to-pie-activity.d.ts.map +1 -0
  59. package/dist/orchestration/activities/transform-qti-to-pie-activity.js +48 -0
  60. package/dist/orchestration/activities/transform-qti-to-pie-activity.js.map +1 -0
  61. package/dist/orchestration/activities/validate-qti-activity.d.ts +19 -0
  62. package/dist/orchestration/activities/validate-qti-activity.d.ts.map +1 -0
  63. package/dist/orchestration/activities/validate-qti-activity.js +47 -0
  64. package/dist/orchestration/activities/validate-qti-activity.js.map +1 -0
  65. package/dist/orchestration/activities/write-content-activity.d.ts +22 -0
  66. package/dist/orchestration/activities/write-content-activity.d.ts.map +1 -0
  67. package/dist/orchestration/activities/write-content-activity.js +36 -0
  68. package/dist/orchestration/activities/write-content-activity.js.map +1 -0
  69. package/dist/orchestration/in-memory-orchestrator.d.ts +44 -0
  70. package/dist/orchestration/in-memory-orchestrator.d.ts.map +1 -0
  71. package/dist/orchestration/in-memory-orchestrator.js +375 -0
  72. package/dist/orchestration/in-memory-orchestrator.js.map +1 -0
  73. package/dist/orchestration/index.d.ts +7 -0
  74. package/dist/orchestration/index.d.ts.map +1 -0
  75. package/dist/orchestration/index.js +10 -0
  76. package/dist/orchestration/index.js.map +1 -0
  77. package/dist/orchestration/workflows/batch-transform-workflow.d.ts +58 -0
  78. package/dist/orchestration/workflows/batch-transform-workflow.d.ts.map +1 -0
  79. package/dist/orchestration/workflows/batch-transform-workflow.js +100 -0
  80. package/dist/orchestration/workflows/batch-transform-workflow.js.map +1 -0
  81. package/dist/orchestration/workflows/index.d.ts +8 -0
  82. package/dist/orchestration/workflows/index.d.ts.map +1 -0
  83. package/dist/orchestration/workflows/index.js +6 -0
  84. package/dist/orchestration/workflows/index.js.map +1 -0
  85. package/dist/orchestration/workflows/transform-item-workflow.d.ts +57 -0
  86. package/dist/orchestration/workflows/transform-item-workflow.d.ts.map +1 -0
  87. package/dist/orchestration/workflows/transform-item-workflow.js +148 -0
  88. package/dist/orchestration/workflows/transform-item-workflow.js.map +1 -0
  89. package/dist/registry/format-detector-registry.d.ts +55 -0
  90. package/dist/registry/format-detector-registry.d.ts.map +1 -0
  91. package/dist/registry/format-detector-registry.js +55 -0
  92. package/dist/registry/format-detector-registry.js.map +1 -0
  93. package/dist/registry/index.d.ts +1 -1
  94. package/dist/registry/index.d.ts.map +1 -1
  95. package/dist/registry/index.js +1 -1
  96. package/dist/registry/index.js.map +1 -1
  97. package/dist/registry/plugin-registry.d.ts +1 -0
  98. package/dist/registry/plugin-registry.d.ts.map +1 -1
  99. package/dist/registry/plugin-registry.js +6 -2
  100. package/dist/registry/plugin-registry.js.map +1 -1
  101. package/dist/utils/errors.d.ts +79 -0
  102. package/dist/utils/errors.d.ts.map +1 -0
  103. package/dist/utils/errors.js +159 -0
  104. package/dist/utils/errors.js.map +1 -0
  105. package/dist/utils/index.d.ts +1 -1
  106. package/dist/utils/index.d.ts.map +1 -1
  107. package/dist/utils/index.js +1 -1
  108. package/dist/utils/index.js.map +1 -1
  109. package/dist/utils/logger.d.ts +9 -37
  110. package/dist/utils/logger.d.ts.map +1 -1
  111. package/dist/utils/logger.js +10 -58
  112. package/dist/utils/logger.js.map +1 -1
  113. package/package.json +69 -36
  114. package/.turbo/turbo-build.log +0 -1
  115. package/CHANGELOG.md +0 -10
  116. package/VALIDATION.md +0 -217
  117. package/src/engine/index.ts +0 -1
  118. package/src/engine/transform-engine.ts +0 -257
  119. package/src/index.ts +0 -18
  120. package/src/registry/index.ts +0 -1
  121. package/src/registry/plugin-registry.ts +0 -116
  122. package/src/utils/index.ts +0 -1
  123. package/src/utils/logger.ts +0 -79
  124. package/src/utils/validator.ts +0 -193
  125. package/tests/plugin-registry.test.ts +0 -154
  126. package/tests/transform-engine.test.ts +0 -168
  127. package/tests/validator.test.ts +0 -234
  128. package/tsconfig.json +0 -13
  129. package/tsconfig.tsbuildinfo +0 -1
@@ -1,2 +1,2 @@
1
- export * from './logger';
1
+ export * from './logger.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,2 +1,2 @@
1
- export * from './logger';
1
+ export * from './logger.js';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -1,40 +1,12 @@
1
1
  /**
2
2
  * Logger Utilities
3
- */
4
- import type { TransformLogger } from '@pie-qti/transform-types';
5
- /**
6
- * Simple console logger
7
- */
8
- export declare class ConsoleLogger implements TransformLogger {
9
- debug(message: string, itemId?: string): void;
10
- info(message: string, itemId?: string): void;
11
- warn(message: string, itemId?: string): void;
12
- error(message: string, itemId?: string): void;
13
- }
14
- /**
15
- * Silent logger (no output)
16
- */
17
- export declare class SilentLogger implements TransformLogger {
18
- debug(): void;
19
- info(): void;
20
- warn(): void;
21
- error(): void;
22
- }
23
- /**
24
- * Memory logger (stores messages in memory)
25
- */
26
- export declare class MemoryLogger implements TransformLogger {
27
- messages: Array<{
28
- level: 'debug' | 'info' | 'warn' | 'error';
29
- message: string;
30
- itemId?: string;
31
- timestamp: Date;
32
- }>;
33
- debug(message: string, itemId?: string): void;
34
- info(message: string, itemId?: string): void;
35
- warn(message: string, itemId?: string): void;
36
- error(message: string, itemId?: string): void;
37
- clear(): void;
38
- getMessages(level?: 'debug' | 'info' | 'warn' | 'error'): typeof this.messages;
39
- }
3
+ *
4
+ * @deprecated Import from @pie-qti/logger/server instead
5
+ * This module re-exports from @pie-qti/logger for backward compatibility
6
+ */
7
+ import { ConsoleLogger as ServerConsoleLogger, JsonLogger as ServerJsonLogger, SilentLogger as ServerSilentLogger, MemoryLogger as ServerMemoryLogger } from '@pie-qti/logger/server';
8
+ export declare const ConsoleLogger: typeof ServerConsoleLogger;
9
+ export declare const JsonLogger: typeof ServerJsonLogger;
10
+ export declare const SilentLogger: typeof ServerSilentLogger;
11
+ export declare const MemoryLogger: typeof ServerMemoryLogger;
40
12
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,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AI,CAAC,QAAQ;CAM/E"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,aAAa,IAAI,mBAAmB,EACpC,UAAU,IAAI,gBAAgB,EAC9B,YAAY,IAAI,kBAAkB,EAClC,YAAY,IAAI,kBAAkB,EAClC,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,aAAa,4BAAsB,CAAC;AACjD,eAAO,MAAM,UAAU,yBAAmB,CAAC;AAC3C,eAAO,MAAM,YAAY,2BAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,2BAAqB,CAAC"}
@@ -1,61 +1,13 @@
1
1
  /**
2
2
  * Logger Utilities
3
- */
4
- /**
5
- * Simple console logger
6
- */
7
- export class ConsoleLogger {
8
- debug(message, itemId) {
9
- const prefix = itemId ? `[${itemId}]` : '';
10
- console.debug(`[DEBUG] ${prefix} ${message}`);
11
- }
12
- info(message, itemId) {
13
- const prefix = itemId ? `[${itemId}]` : '';
14
- console.info(`[INFO] ${prefix} ${message}`);
15
- }
16
- warn(message, itemId) {
17
- const prefix = itemId ? `[${itemId}]` : '';
18
- console.warn(`[WARN] ${prefix} ${message}`);
19
- }
20
- error(message, itemId) {
21
- const prefix = itemId ? `[${itemId}]` : '';
22
- console.error(`[ERROR] ${prefix} ${message}`);
23
- }
24
- }
25
- /**
26
- * Silent logger (no output)
27
- */
28
- export class SilentLogger {
29
- debug() { }
30
- info() { }
31
- warn() { }
32
- error() { }
33
- }
34
- /**
35
- * Memory logger (stores messages in memory)
36
- */
37
- export class MemoryLogger {
38
- messages = [];
39
- debug(message, itemId) {
40
- this.messages.push({ level: 'debug', message, itemId, timestamp: new Date() });
41
- }
42
- info(message, itemId) {
43
- this.messages.push({ level: 'info', message, itemId, timestamp: new Date() });
44
- }
45
- warn(message, itemId) {
46
- this.messages.push({ level: 'warn', message, itemId, timestamp: new Date() });
47
- }
48
- error(message, itemId) {
49
- this.messages.push({ level: 'error', message, itemId, timestamp: new Date() });
50
- }
51
- clear() {
52
- this.messages = [];
53
- }
54
- getMessages(level) {
55
- if (level) {
56
- return this.messages.filter((msg) => msg.level === level);
57
- }
58
- return this.messages;
59
- }
60
- }
3
+ *
4
+ * @deprecated Import from @pie-qti/logger/server instead
5
+ * This module re-exports from @pie-qti/logger for backward compatibility
6
+ */
7
+ import { ConsoleLogger as ServerConsoleLogger, JsonLogger as ServerJsonLogger, SilentLogger as ServerSilentLogger, MemoryLogger as ServerMemoryLogger, } from '@pie-qti/logger/server';
8
+ // Re-export logger classes (types are now exported from @pie-qti/transform-types)
9
+ export const ConsoleLogger = ServerConsoleLogger;
10
+ export const JsonLogger = ServerJsonLogger;
11
+ export const SilentLogger = ServerSilentLogger;
12
+ export const MemoryLogger = ServerMemoryLogger;
61
13
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,KAAK,CAAC,OAAe,EAAE,MAAe;QACpC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,MAAe;QACnC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,UAAU,MAAM,IAAI,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,MAAe;QACnC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,E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AS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,WAAW,CAAC,KAA2C;QACrD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,aAAa,IAAI,mBAAmB,EACpC,UAAU,IAAI,gBAAgB,EAC9B,YAAY,IAAI,kBAAkB,EAClC,YAAY,IAAI,kBAAkB,GAClC,MAAM,wBAAwB,CAAC;AAEhC,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,38 +1,71 @@
1
1
  {
2
- "name": "@pie-qti/transform-core",
3
- "version": "0.1.1",
4
- "description": "Core transformation engine and plugin system for PIE Transform",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- }
14
- },
15
- "scripts": {
16
- "build": "tsc",
17
- "clean": "rm -rf dist",
18
- "test": "bun test tests",
19
- "typecheck": "tsc --noEmit"
20
- },
21
- "keywords": [
22
- "pie",
23
- "qti",
24
- "assessment",
25
- "transformation",
26
- "plugin"
27
- ],
28
- "author": "Renaissance Learning",
29
- "license": "ISC",
30
- "dependencies": {
31
- "@pie-qti/element-schemas": "workspace:*",
32
- "@pie-qti/transform-types": "workspace:*",
33
- "ajv": "^8.17.1"
34
- },
35
- "devDependencies": {
36
- "typescript": "^5.9.3"
37
- }
2
+ "name": "@pie-qti/transform-core",
3
+ "version": "0.1.5",
4
+ "description": "Core transformation engine and plugin system for PIE Transform",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./config/config-loader.js": {
15
+ "types": "./dist/config/config-loader.d.ts",
16
+ "import": "./dist/config/config-loader.js"
17
+ },
18
+ "./config/plugin-loader.js": {
19
+ "types": "./dist/config/plugin-loader.d.ts",
20
+ "import": "./dist/config/plugin-loader.js"
21
+ },
22
+ "./config/vendor-registry.js": {
23
+ "types": "./dist/config/vendor-registry.d.ts",
24
+ "import": "./dist/config/vendor-registry.js"
25
+ }
26
+ },
27
+ "scripts": {
28
+ "build": "tsc",
29
+ "clean": "rm -rf dist",
30
+ "test": "bun test tests",
31
+ "typecheck": "tsc --noEmit"
32
+ },
33
+ "keywords": [
34
+ "pie",
35
+ "qti",
36
+ "assessment",
37
+ "transformation",
38
+ "plugin"
39
+ ],
40
+ "license": "MIT",
41
+ "dependencies": {
42
+ "@pie-qti/element-schemas": "0.1.5",
43
+ "@pie-qti/logger": "0.1.5",
44
+ "@pie-qti/transform-types": "0.1.5",
45
+ "ajv": "^8.17.1",
46
+ "node-html-parser": "^6.1.13"
47
+ },
48
+ "devDependencies": {
49
+ "typescript": "^5.9.3",
50
+ "vitest": "^3.0.0"
51
+ },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/pie-framework/pie-qti.git",
55
+ "directory": "packages/core"
56
+ },
57
+ "homepage": "https://github.com/pie-framework/pie-qti/tree/master/packages/core",
58
+ "bugs": {
59
+ "url": "https://github.com/pie-framework/pie-qti/issues"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ },
64
+ "sideEffects": false,
65
+ "engines": {
66
+ "node": ">=20.19.0"
67
+ },
68
+ "files": [
69
+ "dist"
70
+ ]
38
71
  }
@@ -1 +0,0 @@
1
- $ tsc
package/CHANGELOG.md DELETED
@@ -1,10 +0,0 @@
1
- # @pie-qti/transform-core
2
-
3
- ## 0.1.1
4
-
5
- ### Patch Changes
6
-
7
- - 2243643: Publish the initial public release of all publishable PIE-QTI packages.
8
- - Updated dependencies [2243643]
9
- - @pie-qti/element-schemas@0.1.1
10
- - @pie-qti/transform-types@0.1.1
package/VALIDATION.md DELETED
@@ -1,217 +0,0 @@
1
- # PIE Item Validation
2
-
3
- This package provides validation utilities for PIE items using JSON Schema validation.
4
-
5
- ## Overview
6
-
7
- The validation system validates PIE items against:
8
- 1. **Basic structure** - Required fields like `id`, `uuid`, `config`
9
- 2. **Element-specific schemas** - JSON schemas from PIE element packages
10
-
11
- ## Usage
12
-
13
- ### Basic Structural Validation
14
-
15
- For quick validation without schemas:
16
-
17
- ```typescript
18
- import { validatePieItemStructure } from '@pie-qti/transform-core';
19
-
20
- const item = {
21
- id: 'item-001',
22
- uuid: '123e4567-e89b-12d3-a456-426614174000',
23
- config: {
24
- id: '123e4567-e89b-12d3-a456-426614174000',
25
- models: [],
26
- elements: {},
27
- },
28
- };
29
-
30
- const result = validatePieItemStructure(item);
31
-
32
- if (!result.valid) {
33
- console.error('Validation errors:', result.errors);
34
- }
35
- ```
36
-
37
- ### Schema-Based Validation
38
-
39
- For validating against PIE element schemas:
40
-
41
- ```typescript
42
- import { PieItemValidator } from '@pie-qti/transform-core';
43
-
44
- const validator = new PieItemValidator();
45
-
46
- // Load schema from schemas package (recommended)
47
- await validator.loadSchemaForElement('@pie-element/multiple-choice');
48
-
49
- // Or register schema directly
50
- import { loadSchema } from '@pie-qti/element-schemas';
51
- const schema = await loadSchema('multiple-choice');
52
- validator.registerSchema('@pie-element/multiple-choice', schema);
53
-
54
- // Validate an item
55
- const result = validator.validate(pieItem);
56
-
57
- if (!result.valid) {
58
- for (const error of result.errors!) {
59
- console.error(`${error.path}: ${error.message}`);
60
- }
61
- }
62
- ```
63
-
64
- ### Validation in Plugins
65
-
66
- Plugins can implement the optional `validate()` method:
67
-
68
- ```typescript
69
- export class Qti22ToPiePlugin implements TransformPlugin {
70
- private validator: PieItemValidator;
71
-
72
- constructor() {
73
- this.validator = new PieItemValidator();
74
- // Load schemas during initialization
75
- }
76
-
77
- async validate(output: TransformOutput): Promise<ValidationResult> {
78
- const results = this.validator.validateMany(output.items);
79
-
80
- const errors: ValidationError[] = [];
81
- for (let i = 0; i < results.length; i++) {
82
- if (!results[i].valid && results[i].errors) {
83
- for (const error of results[i].errors) {
84
- errors.push({
85
- ...error,
86
- path: `items[${i}].${error.path}`,
87
- });
88
- }
89
- }
90
- }
91
-
92
- return {
93
- valid: errors.length === 0,
94
- errors: errors.length > 0 ? errors : undefined,
95
- };
96
- }
97
- }
98
- ```
99
-
100
- ## PIE Element Schemas
101
-
102
- Schemas are provided by the `@pie-qti/element-schemas` package, which contains JSON schemas synced from PIE element packages:
103
-
104
- - **pie-schema.json** - Schema for the PIE item model
105
- - **config-schema.json** - Schema for authoring configuration (future)
106
-
107
- Available schemas:
108
-
109
- - `multiple-choice` - Multiple choice questions (from @pie-element/multiple-choice v11.4.3)
110
- - `extended-text-entry` - Extended text entry questions (from @pie-element/extended-text-entry v13.4.0)
111
-
112
- See the [schemas package README](../schemas/README.md) for information on keeping schemas up-to-date.
113
-
114
- ## QTI Input Validation
115
-
116
- For validating QTI input:
117
-
118
- ```typescript
119
- import { QtiValidator } from '@pie-qti/qti2-to-pie';
120
-
121
- const validator = new QtiValidator();
122
-
123
- // Validate QTI XML
124
- const result = await validator.validate(qtiXml);
125
-
126
- if (!result.valid) {
127
- console.error('QTI validation errors:', result.errors);
128
- }
129
- ```
130
-
131
- Notes:
132
- - The current validator performs **well-formedness + structural checks** and warns on missing QTI 2.2 namespace.
133
- - Full XSD validation is intentionally out of scope for now (it requires resolving/importing the full schema graph).
134
-
135
- ## Validation Results
136
-
137
- All validation functions return a `ValidationResult`:
138
-
139
- ```typescript
140
- interface ValidationResult {
141
- valid: boolean;
142
- errors?: ValidationError[];
143
- }
144
-
145
- interface ValidationError {
146
- path: string; // JSON path to the error (e.g., "config.models[0].choices")
147
- message: string; // Human-readable error message
148
- value?: any; // The invalid value (optional)
149
- }
150
- ```
151
-
152
- ## CLI Validation
153
-
154
- The CLI tool can optionally validate transformations:
155
-
156
- ```bash
157
- pie-transform transform input.xml -o output.json --validate
158
- ```
159
-
160
- This will:
161
- 1. Transform the QTI to PIE
162
- 2. Validate the output against PIE schemas
163
- 3. Report any validation errors
164
- 4. Exit with error code if validation fails
165
-
166
- ## Integration Testing
167
-
168
- For testing transformations with validation:
169
-
170
- ```typescript
171
- import { describe, test, expect } from 'bun:test';
172
- import { Qti22ToPiePlugin } from '@pie-qti/qti2-to-pie';
173
- import { PieItemValidator } from '@pie-qti/transform-core';
174
-
175
- describe('QTI to PIE transformation', () => {
176
- test('should produce valid PIE output', async () => {
177
- const plugin = new Qti22ToPiePlugin();
178
- const validator = new PieItemValidator();
179
-
180
- // Load schemas for elements you're testing
181
- await validator.loadSchema(
182
- '@pie-element/multiple-choice',
183
- './schemas/multiple-choice/pie-schema.json'
184
- );
185
-
186
- const output = await plugin.transform(
187
- { content: qtiXml },
188
- { logger: new SilentLogger() }
189
- );
190
-
191
- // Validate all items
192
- const results = validator.validateMany(output.items);
193
-
194
- for (let i = 0; i < results.length; i++) {
195
- expect(results[i].valid).toBe(true);
196
- if (!results[i].valid) {
197
- console.log(`Item ${i} validation errors:`, results[i].errors);
198
- }
199
- }
200
- });
201
- });
202
- ```
203
-
204
- ## Best Practices
205
-
206
- 1. **Load schemas once** - Create validator instances during initialization
207
- 2. **Cache schemas** - Don't reload schemas for every validation
208
- 3. **Validate in tests** - Always validate transformer output in tests
209
- 4. **Report clear errors** - Use validation errors to improve transformations
210
- 5. **Version schemas** - Pin to specific PIE element versions
211
-
212
- ## Performance
213
-
214
- - Schema compilation is done once per element type
215
- - Validation is fast (~1ms per item for typical items)
216
- - Use `validateMany()` for batch validation
217
- - Consider async validation for large batches
@@ -1 +0,0 @@
1
- export * from './transform-engine';