@pie-qti/transform-core 0.1.1

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 (49) hide show
  1. package/.turbo/turbo-build.log +1 -0
  2. package/CHANGELOG.md +10 -0
  3. package/VALIDATION.md +217 -0
  4. package/dist/engine/index.d.ts +2 -0
  5. package/dist/engine/index.d.ts.map +1 -0
  6. package/dist/engine/index.js +2 -0
  7. package/dist/engine/index.js.map +1 -0
  8. package/dist/engine/transform-engine.d.ts +58 -0
  9. package/dist/engine/transform-engine.d.ts.map +1 -0
  10. package/dist/engine/transform-engine.js +173 -0
  11. package/dist/engine/transform-engine.js.map +1 -0
  12. package/dist/index.d.ts +11 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +13 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/registry/index.d.ts +2 -0
  17. package/dist/registry/index.d.ts.map +1 -0
  18. package/dist/registry/index.js +2 -0
  19. package/dist/registry/index.js.map +1 -0
  20. package/dist/registry/plugin-registry.d.ts +54 -0
  21. package/dist/registry/plugin-registry.d.ts.map +1 -0
  22. package/dist/registry/plugin-registry.js +86 -0
  23. package/dist/registry/plugin-registry.js.map +1 -0
  24. package/dist/utils/index.d.ts +2 -0
  25. package/dist/utils/index.d.ts.map +1 -0
  26. package/dist/utils/index.js +2 -0
  27. package/dist/utils/index.js.map +1 -0
  28. package/dist/utils/logger.d.ts +40 -0
  29. package/dist/utils/logger.d.ts.map +1 -0
  30. package/dist/utils/logger.js +61 -0
  31. package/dist/utils/logger.js.map +1 -0
  32. package/dist/utils/validator.d.ts +60 -0
  33. package/dist/utils/validator.d.ts.map +1 -0
  34. package/dist/utils/validator.js +161 -0
  35. package/dist/utils/validator.js.map +1 -0
  36. package/package.json +38 -0
  37. package/src/engine/index.ts +1 -0
  38. package/src/engine/transform-engine.ts +257 -0
  39. package/src/index.ts +18 -0
  40. package/src/registry/index.ts +1 -0
  41. package/src/registry/plugin-registry.ts +116 -0
  42. package/src/utils/index.ts +1 -0
  43. package/src/utils/logger.ts +79 -0
  44. package/src/utils/validator.ts +193 -0
  45. package/tests/plugin-registry.test.ts +154 -0
  46. package/tests/transform-engine.test.ts +168 -0
  47. package/tests/validator.test.ts +234 -0
  48. package/tsconfig.json +13 -0
  49. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1 @@
1
+ $ tsc
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
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 ADDED
@@ -0,0 +1,217 @@
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
@@ -0,0 +1,2 @@
1
+ export * from './transform-engine';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './transform-engine';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Transform Engine
3
+ *
4
+ * Core transformation engine that orchestrates plugins
5
+ */
6
+ import type { TransformFormat, TransformLogger, TransformOutput, TransformPlugin } from '@pie-qti/transform-types';
7
+ export interface TransformOptions {
8
+ /** Source format (will be auto-detected if not provided) */
9
+ sourceFormat?: TransformFormat;
10
+ /** Target format */
11
+ targetFormat: TransformFormat;
12
+ /** Vendor-specific options */
13
+ vendor?: string;
14
+ /** Logger instance */
15
+ logger?: TransformLogger;
16
+ /** Additional options */
17
+ [key: string]: any;
18
+ }
19
+ export declare class TransformEngine {
20
+ private registry;
21
+ private defaultLogger;
22
+ constructor();
23
+ /**
24
+ * Register a plugin
25
+ */
26
+ use(plugin: TransformPlugin): this;
27
+ /**
28
+ * Transform input to target format
29
+ */
30
+ transform(input: string | object, options: TransformOptions): Promise<TransformOutput>;
31
+ /**
32
+ * Transform multiple inputs in batch
33
+ */
34
+ transformBatch(inputs: Array<string | object>, options: TransformOptions & {
35
+ parallel?: number;
36
+ }): Promise<TransformOutput[]>;
37
+ /**
38
+ * Transform stream of inputs
39
+ */
40
+ transformStream(inputs: AsyncIterable<string | object>, options: TransformOptions): AsyncGenerator<TransformOutput>;
41
+ /**
42
+ * Auto-detect input format
43
+ */
44
+ private detectFormat;
45
+ /**
46
+ * Get all registered plugins
47
+ */
48
+ getPlugins(): TransformPlugin[];
49
+ /**
50
+ * Get plugin by ID
51
+ */
52
+ getPlugin(id: string): TransformPlugin | undefined;
53
+ /**
54
+ * Cleanup resources
55
+ */
56
+ dispose(): Promise<void>;
57
+ }
58
+ //# sourceMappingURL=transform-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-engine.d.ts","sourceRoot":"","sources":["../../src/engine/transform-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAEV,eAAe,EAEf,eAAe,EACf,eAAe,EACf,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,YAAY,CAAC,EAAE,eAAe,CAAC;IAE/B,oBAAoB;IACpB,YAAY,EAAE,eAAe,CAAC;IAE9B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,sBAAsB;IACtB,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB,yBAAyB;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,aAAa,CAAkB;;IAOvC;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAKlC;;OAEG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC;IA6E3B;;OAEG;IACG,cAAc,CAClB,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC9B,OAAO,EAAE,gBAAgB,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAChD,OAAO,CAAC,eAAe,EAAE,CAAC;IA8B7B;;OAEG;IACI,eAAe,CACpB,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,EACtC,OAAO,EAAE,gBAAgB,GACxB,cAAc,CAAC,eAAe,CAAC;IAgBlC;;OAEG;YACW,YAAY;IAiC1B;;OAEG;IACH,UAAU,IAAI,eAAe,EAAE;IAI/B;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIlD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAW/B"}
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Transform Engine
3
+ *
4
+ * Core transformation engine that orchestrates plugins
5
+ */
6
+ import { PluginRegistry } from '../registry/plugin-registry.js';
7
+ import { ConsoleLogger } from '../utils/logger.js';
8
+ export class TransformEngine {
9
+ registry;
10
+ defaultLogger;
11
+ constructor() {
12
+ this.registry = new PluginRegistry();
13
+ this.defaultLogger = new ConsoleLogger();
14
+ }
15
+ /**
16
+ * Register a plugin
17
+ */
18
+ use(plugin) {
19
+ this.registry.register(plugin);
20
+ return this;
21
+ }
22
+ /**
23
+ * Transform input to target format
24
+ */
25
+ async transform(input, options) {
26
+ const startTime = Date.now();
27
+ const logger = options.logger || this.defaultLogger;
28
+ // Prepare input
29
+ const transformInput = {
30
+ content: input,
31
+ format: options.sourceFormat,
32
+ };
33
+ // Detect format if not provided
34
+ const sourceFormat = options.sourceFormat || (await this.detectFormat(transformInput));
35
+ logger.info(`Transforming from ${sourceFormat} to ${options.targetFormat}`);
36
+ // Find appropriate plugin
37
+ const plugin = this.registry.findPlugin(sourceFormat, options.targetFormat);
38
+ if (!plugin) {
39
+ throw new Error(`No plugin found for transformation: ${sourceFormat} → ${options.targetFormat}`);
40
+ }
41
+ logger.debug(`Using plugin: ${plugin.name} (${plugin.id})`);
42
+ // Create context
43
+ const context = {
44
+ logger,
45
+ vendor: options.vendor,
46
+ options,
47
+ };
48
+ // Initialize plugin if needed
49
+ if (plugin.initialize) {
50
+ logger.debug('Initializing plugin...');
51
+ await plugin.initialize(options);
52
+ }
53
+ // Transform
54
+ logger.info('Starting transformation...');
55
+ const output = await plugin.transform(transformInput, context);
56
+ // Validate output if plugin supports it
57
+ if (plugin.validate) {
58
+ logger.debug('Validating output...');
59
+ const validation = await plugin.validate(output);
60
+ if (!validation.valid) {
61
+ logger.warn('Validation warnings/errors detected');
62
+ if (validation.errors && validation.errors.length > 0) {
63
+ validation.errors.forEach((error) => logger.error(error));
64
+ }
65
+ if (validation.warnings && validation.warnings.length > 0) {
66
+ validation.warnings.forEach((warning) => logger.warn(warning));
67
+ }
68
+ }
69
+ }
70
+ // Update metadata
71
+ const processingTime = Date.now() - startTime;
72
+ output.metadata = {
73
+ ...output.metadata,
74
+ sourceFormat,
75
+ targetFormat: options.targetFormat,
76
+ pluginId: plugin.id,
77
+ timestamp: new Date(),
78
+ itemCount: output.items.length,
79
+ processingTime,
80
+ };
81
+ logger.info(`Transformation complete: ${output.items.length} items in ${processingTime}ms`);
82
+ return output;
83
+ }
84
+ /**
85
+ * Transform multiple inputs in batch
86
+ */
87
+ async transformBatch(inputs, options) {
88
+ const parallelism = options.parallel || 5;
89
+ const logger = options.logger || this.defaultLogger;
90
+ logger.info(`Batch transforming ${inputs.length} items with parallelism=${parallelism}`);
91
+ const results = [];
92
+ const chunks = [];
93
+ // Split into chunks
94
+ for (let i = 0; i < inputs.length; i += parallelism) {
95
+ chunks.push(inputs.slice(i, i + parallelism));
96
+ }
97
+ // Process chunks
98
+ for (let i = 0; i < chunks.length; i++) {
99
+ const chunk = chunks[i];
100
+ logger.debug(`Processing chunk ${i + 1}/${chunks.length} (${chunk.length} items)`);
101
+ const chunkResults = await Promise.all(chunk.map((input) => this.transform(input, options)));
102
+ results.push(...chunkResults);
103
+ }
104
+ logger.info(`Batch transformation complete: ${results.length} outputs`);
105
+ return results;
106
+ }
107
+ /**
108
+ * Transform stream of inputs
109
+ */
110
+ async *transformStream(inputs, options) {
111
+ const logger = options.logger || this.defaultLogger;
112
+ logger.info('Starting streaming transformation...');
113
+ let count = 0;
114
+ for await (const input of inputs) {
115
+ const output = await this.transform(input, options);
116
+ count++;
117
+ logger.debug(`Streamed ${count} items`);
118
+ yield output;
119
+ }
120
+ logger.info(`Streaming transformation complete: ${count} items`);
121
+ }
122
+ /**
123
+ * Auto-detect input format
124
+ */
125
+ async detectFormat(input) {
126
+ // If content is string, try to detect XML (QTI) vs JSON (PIE)
127
+ if (typeof input.content === 'string') {
128
+ const trimmed = input.content.trim();
129
+ if (trimmed.startsWith('<?xml') || trimmed.startsWith('<')) {
130
+ // It's XML - this repo only supports QTI 2.2.x at transform time.
131
+ if (trimmed.includes('imsqti_v2p2') ||
132
+ trimmed.includes('http://www.imsglobal.org/xsd/imsqti_v2p2')) {
133
+ return 'qti22';
134
+ }
135
+ throw new Error('Unsupported QTI namespace. Expected QTI 2.2 (imsqti_v2p2).');
136
+ }
137
+ if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
138
+ // It's JSON - assume PIE
139
+ return 'pie';
140
+ }
141
+ }
142
+ // If object, assume PIE
143
+ if (typeof input.content === 'object') {
144
+ return 'pie';
145
+ }
146
+ throw new Error('Could not detect input format');
147
+ }
148
+ /**
149
+ * Get all registered plugins
150
+ */
151
+ getPlugins() {
152
+ return this.registry.getAll();
153
+ }
154
+ /**
155
+ * Get plugin by ID
156
+ */
157
+ getPlugin(id) {
158
+ return this.registry.get(id);
159
+ }
160
+ /**
161
+ * Cleanup resources
162
+ */
163
+ async dispose() {
164
+ const plugins = this.registry.getAll();
165
+ for (const plugin of plugins) {
166
+ if (plugin.dispose) {
167
+ await plugin.dispose();
168
+ }
169
+ }
170
+ this.registry.clear();
171
+ }
172
+ }
173
+ //# sourceMappingURL=transform-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-engine.js","sourceRoot":"","sources":["../../src/engine/transform-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAmBnD,MAAM,OAAO,eAAe;IAClB,QAAQ,CAAiB;IACzB,aAAa,CAAkB;IAEvC;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,MAAuB;QACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,KAAsB,EACtB,OAAyB;QAEzB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC;QAEpD,gBAAgB;QAChB,MAAM,cAAc,GAAmB;YACrC,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,OAAO,CAAC,YAAY;SAC7B,CAAC;QAEF,gCAAgC;QAChC,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC;QAEvF,MAAM,CAAC,IAAI,CAAC,qBAAqB,YAAY,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;QAE5E,0BAA0B;QAC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G,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QAEvC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @pie-qti/transform-core
3
+ *
4
+ * Core transformation engine and plugin system
5
+ */
6
+ export type * from '@pie-qti/transform-types';
7
+ export * from './engine/transform-engine.js';
8
+ export * from './registry/plugin-registry.js';
9
+ export * from './utils/logger.js';
10
+ export * from './utils/validator.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,mBAAmB,0BAA0B,CAAC;AAG9C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @pie-qti/transform-core
3
+ *
4
+ * Core transformation engine and plugin system
5
+ */
6
+ // Engine
7
+ export * from './engine/transform-engine.js';
8
+ // Registry
9
+ export * from './registry/plugin-registry.js';
10
+ // Utilities
11
+ export * from './utils/logger.js';
12
+ export * from './utils/validator.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,SAAS;AACT,cAAc,8BAA8B,CAAC;AAE7C,WAAW;AACX,cAAc,+BAA+B,CAAC;AAE9C,YAAY;AACZ,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './plugin-registry';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './plugin-registry';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Plugin Registry
3
+ *
4
+ * Central registry for managing transformation plugins
5
+ */
6
+ import type { TransformFormat, TransformInput, TransformPlugin } from '@pie-qti/transform-types';
7
+ export declare class PluginRegistry {
8
+ private plugins;
9
+ /**
10
+ * Register a plugin
11
+ */
12
+ register(plugin: TransformPlugin): void;
13
+ /**
14
+ * Unregister a plugin
15
+ */
16
+ unregister(pluginId: string): boolean;
17
+ /**
18
+ * Get a plugin by ID
19
+ */
20
+ get(pluginId: string): TransformPlugin | undefined;
21
+ /**
22
+ * Check if a plugin is registered
23
+ */
24
+ has(pluginId: string): boolean;
25
+ /**
26
+ * Get all registered plugins
27
+ */
28
+ getAll(): TransformPlugin[];
29
+ /**
30
+ * Find plugin that can handle transformation from source to target format
31
+ */
32
+ findPlugin(sourceFormat: TransformFormat, targetFormat: TransformFormat): TransformPlugin | undefined;
33
+ /**
34
+ * Find plugins that can handle the given input
35
+ */
36
+ findCompatiblePlugins(input: TransformInput): Promise<TransformPlugin[]>;
37
+ /**
38
+ * Get plugins by source format
39
+ */
40
+ getBySourceFormat(format: TransformFormat): TransformPlugin[];
41
+ /**
42
+ * Get plugins by target format
43
+ */
44
+ getByTargetFormat(format: TransformFormat): TransformPlugin[];
45
+ /**
46
+ * Clear all registered plugins
47
+ */
48
+ clear(): void;
49
+ /**
50
+ * Get count of registered plugins
51
+ */
52
+ get size(): number;
53
+ }
54
+ //# sourceMappingURL=plugin-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/registry/plugin-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAsC;IAErD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAQvC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrC;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIlD;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,MAAM,IAAI,eAAe,EAAE;IAI3B;;OAEG;IACH,UAAU,CACR,YAAY,EAAE,eAAe,EAC7B,YAAY,EAAE,eAAe,GAC5B,eAAe,GAAG,SAAS;IAQ9B;;OAEG;IACG,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAa9E;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,EAAE;IAM7D;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,EAAE;IAM7D;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}