@pie-qti/transform-core 0.1.1 → 0.1.4
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/dist/config/config-loader.d.ts +25 -0
- package/dist/config/config-loader.d.ts.map +1 -0
- package/dist/config/config-loader.js +142 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/config/plugin-loader.d.ts +19 -0
- package/dist/config/plugin-loader.d.ts.map +1 -0
- package/dist/config/plugin-loader.js +62 -0
- package/dist/config/plugin-loader.js.map +1 -0
- package/dist/config/vendor-registry.d.ts +21 -0
- package/dist/config/vendor-registry.d.ts.map +1 -0
- package/dist/config/vendor-registry.js +91 -0
- package/dist/config/vendor-registry.js.map +1 -0
- package/dist/detectors/pie-detector.d.ts +19 -0
- package/dist/detectors/pie-detector.d.ts.map +1 -0
- package/dist/detectors/pie-detector.js +46 -0
- package/dist/detectors/pie-detector.js.map +1 -0
- package/dist/detectors/qti-detector.d.ts +20 -0
- package/dist/detectors/qti-detector.d.ts.map +1 -0
- package/dist/detectors/qti-detector.js +34 -0
- package/dist/detectors/qti-detector.js.map +1 -0
- package/dist/detectors/qti22-detector.d.ts +20 -0
- package/dist/detectors/qti22-detector.d.ts.map +1 -0
- package/dist/detectors/qti22-detector.js +34 -0
- package/dist/detectors/qti22-detector.js.map +1 -0
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/transform-engine.d.ts +27 -10
- package/dist/engine/transform-engine.d.ts.map +1 -1
- package/dist/engine/transform-engine.js +96 -85
- package/dist/engine/transform-engine.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestration/activities/detect-format-activity.d.ts +18 -0
- package/dist/orchestration/activities/detect-format-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/detect-format-activity.js +51 -0
- package/dist/orchestration/activities/detect-format-activity.js.map +1 -0
- package/dist/orchestration/activities/detect-vendor-activity.d.ts +25 -0
- package/dist/orchestration/activities/detect-vendor-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/detect-vendor-activity.js +27 -0
- package/dist/orchestration/activities/detect-vendor-activity.js.map +1 -0
- package/dist/orchestration/activities/index.d.ts +18 -0
- package/dist/orchestration/activities/index.d.ts.map +1 -0
- package/dist/orchestration/activities/index.js +11 -0
- package/dist/orchestration/activities/index.js.map +1 -0
- package/dist/orchestration/activities/parse-xml-activity.d.ts +18 -0
- package/dist/orchestration/activities/parse-xml-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/parse-xml-activity.js +37 -0
- package/dist/orchestration/activities/parse-xml-activity.js.map +1 -0
- package/dist/orchestration/activities/read-content-activity.d.ts +24 -0
- package/dist/orchestration/activities/read-content-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/read-content-activity.js +49 -0
- package/dist/orchestration/activities/read-content-activity.js.map +1 -0
- package/dist/orchestration/activities/transform-qti-to-pie-activity.d.ts +23 -0
- package/dist/orchestration/activities/transform-qti-to-pie-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/transform-qti-to-pie-activity.js +48 -0
- package/dist/orchestration/activities/transform-qti-to-pie-activity.js.map +1 -0
- package/dist/orchestration/activities/validate-qti-activity.d.ts +19 -0
- package/dist/orchestration/activities/validate-qti-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/validate-qti-activity.js +47 -0
- package/dist/orchestration/activities/validate-qti-activity.js.map +1 -0
- package/dist/orchestration/activities/write-content-activity.d.ts +22 -0
- package/dist/orchestration/activities/write-content-activity.d.ts.map +1 -0
- package/dist/orchestration/activities/write-content-activity.js +36 -0
- package/dist/orchestration/activities/write-content-activity.js.map +1 -0
- package/dist/orchestration/in-memory-orchestrator.d.ts +44 -0
- package/dist/orchestration/in-memory-orchestrator.d.ts.map +1 -0
- package/dist/orchestration/in-memory-orchestrator.js +375 -0
- package/dist/orchestration/in-memory-orchestrator.js.map +1 -0
- package/dist/orchestration/index.d.ts +7 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +10 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/workflows/batch-transform-workflow.d.ts +58 -0
- package/dist/orchestration/workflows/batch-transform-workflow.d.ts.map +1 -0
- package/dist/orchestration/workflows/batch-transform-workflow.js +100 -0
- package/dist/orchestration/workflows/batch-transform-workflow.js.map +1 -0
- package/dist/orchestration/workflows/index.d.ts +8 -0
- package/dist/orchestration/workflows/index.d.ts.map +1 -0
- package/dist/orchestration/workflows/index.js +6 -0
- package/dist/orchestration/workflows/index.js.map +1 -0
- package/dist/orchestration/workflows/transform-item-workflow.d.ts +57 -0
- package/dist/orchestration/workflows/transform-item-workflow.d.ts.map +1 -0
- package/dist/orchestration/workflows/transform-item-workflow.js +148 -0
- package/dist/orchestration/workflows/transform-item-workflow.js.map +1 -0
- package/dist/registry/format-detector-registry.d.ts +55 -0
- package/dist/registry/format-detector-registry.d.ts.map +1 -0
- package/dist/registry/format-detector-registry.js +55 -0
- package/dist/registry/format-detector-registry.js.map +1 -0
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/plugin-registry.d.ts +1 -0
- package/dist/registry/plugin-registry.d.ts.map +1 -1
- package/dist/registry/plugin-registry.js +6 -2
- package/dist/registry/plugin-registry.js.map +1 -1
- package/dist/utils/errors.d.ts +79 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +159 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.d.ts +9 -37
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +10 -58
- package/dist/utils/logger.js.map +1 -1
- package/package.json +69 -36
- package/.turbo/turbo-build.log +0 -1
- package/CHANGELOG.md +0 -10
- package/VALIDATION.md +0 -217
- package/src/engine/index.ts +0 -1
- package/src/engine/transform-engine.ts +0 -257
- package/src/index.ts +0 -18
- package/src/registry/index.ts +0 -1
- package/src/registry/plugin-registry.ts +0 -116
- package/src/utils/index.ts +0 -1
- package/src/utils/logger.ts +0 -79
- package/src/utils/validator.ts +0 -193
- package/tests/plugin-registry.test.ts +0 -154
- package/tests/transform-engine.test.ts +0 -168
- package/tests/validator.test.ts +0 -234
- package/tsconfig.json +0 -13
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Core transformation engine that orchestrates plugins
|
|
5
5
|
*/
|
|
6
|
-
import type { TransformFormat,
|
|
6
|
+
import type { TransformFormat, TransformPlugin, WorkflowOrchestrator, WorkflowHandle, StorageBackend } from '@pie-qti/transform-types';
|
|
7
|
+
import type { ServerLogger } from '@pie-qti/logger/server';
|
|
8
|
+
import type { FormatDetector } from '../registry/format-detector-registry.js';
|
|
9
|
+
import { type TransformItemOutput } from '../orchestration/workflows/transform-item-workflow.js';
|
|
10
|
+
import { type BatchTransformOutput } from '../orchestration/workflows/batch-transform-workflow.js';
|
|
7
11
|
export interface TransformOptions {
|
|
8
12
|
/** Source format (will be auto-detected if not provided) */
|
|
9
13
|
sourceFormat?: TransformFormat;
|
|
@@ -12,34 +16,39 @@ export interface TransformOptions {
|
|
|
12
16
|
/** Vendor-specific options */
|
|
13
17
|
vendor?: string;
|
|
14
18
|
/** Logger instance */
|
|
15
|
-
logger?:
|
|
19
|
+
logger?: ServerLogger;
|
|
16
20
|
/** Additional options */
|
|
17
21
|
[key: string]: any;
|
|
18
22
|
}
|
|
19
23
|
export declare class TransformEngine {
|
|
20
24
|
private registry;
|
|
25
|
+
private formatDetectorRegistry;
|
|
21
26
|
private defaultLogger;
|
|
22
|
-
|
|
27
|
+
private orchestrator;
|
|
28
|
+
private storage?;
|
|
29
|
+
constructor(orchestrator?: WorkflowOrchestrator, storage?: StorageBackend);
|
|
23
30
|
/**
|
|
24
31
|
* Register a plugin
|
|
25
32
|
*/
|
|
26
33
|
use(plugin: TransformPlugin): this;
|
|
34
|
+
/**
|
|
35
|
+
* Register a custom format detector
|
|
36
|
+
*/
|
|
37
|
+
registerFormatDetector(detector: FormatDetector): this;
|
|
27
38
|
/**
|
|
28
39
|
* Transform input to target format
|
|
40
|
+
* Returns a workflow handle for monitoring progress and getting results
|
|
29
41
|
*/
|
|
30
|
-
transform(input: string | object, options: TransformOptions): Promise<
|
|
42
|
+
transform(input: string | object, options: TransformOptions): Promise<WorkflowHandle<TransformItemOutput>>;
|
|
31
43
|
/**
|
|
32
44
|
* Transform multiple inputs in batch
|
|
45
|
+
* Returns a workflow handle for monitoring progress and getting results
|
|
33
46
|
*/
|
|
34
47
|
transformBatch(inputs: Array<string | object>, options: TransformOptions & {
|
|
35
48
|
parallel?: number;
|
|
36
|
-
}): Promise<
|
|
37
|
-
/**
|
|
38
|
-
* Transform stream of inputs
|
|
39
|
-
*/
|
|
40
|
-
transformStream(inputs: AsyncIterable<string | object>, options: TransformOptions): AsyncGenerator<TransformOutput>;
|
|
49
|
+
}): Promise<WorkflowHandle<BatchTransformOutput>>;
|
|
41
50
|
/**
|
|
42
|
-
* Auto-detect input format
|
|
51
|
+
* Auto-detect input format using registered format detectors
|
|
43
52
|
*/
|
|
44
53
|
private detectFormat;
|
|
45
54
|
/**
|
|
@@ -54,5 +63,13 @@ export declare class TransformEngine {
|
|
|
54
63
|
* Cleanup resources
|
|
55
64
|
*/
|
|
56
65
|
dispose(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the workflow orchestrator
|
|
68
|
+
*/
|
|
69
|
+
getOrchestrator(): WorkflowOrchestrator;
|
|
70
|
+
/**
|
|
71
|
+
* Set storage backend
|
|
72
|
+
*/
|
|
73
|
+
setStorage(storage: StorageBackend): void;
|
|
57
74
|
}
|
|
58
75
|
//# sourceMappingURL=transform-engine.d.ts.map
|
|
@@ -1 +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,
|
|
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,oBAAoB,EACpB,cAAc,EACd,cAAc,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAK9E,OAAO,EAAkD,KAAK,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AACjJ,OAAO,EAAoD,KAAK,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAErJ,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,YAAY,CAAC;IAEtB,yBAAyB;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,sBAAsB,CAAyB;IACvD,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAiB;gBAErB,YAAY,CAAC,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc;IAYzE;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAKlC;;OAEG;IACH,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKtD;;;OAGG;IACG,SAAS,CACb,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAqD/C;;;OAGG;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,cAAc,CAAC,oBAAoB,CAAC,CAAC;IAuDhD;;OAEG;YACW,YAAY;IAY1B;;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;IAe9B;;OAEG;IACH,eAAe,IAAI,oBAAoB;IAIvC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;CAG1C"}
|
|
@@ -3,14 +3,29 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Core transformation engine that orchestrates plugins
|
|
5
5
|
*/
|
|
6
|
+
import { ConsoleLogger } from '@pie-qti/logger/server';
|
|
6
7
|
import { PluginRegistry } from '../registry/plugin-registry.js';
|
|
7
|
-
import {
|
|
8
|
+
import { FormatDetectorRegistry } from '../registry/format-detector-registry.js';
|
|
9
|
+
import { QtiDetector } from '../detectors/qti-detector.js';
|
|
10
|
+
import { PieDetector } from '../detectors/pie-detector.js';
|
|
11
|
+
import { InMemoryOrchestrator } from '../orchestration/in-memory-orchestrator.js';
|
|
12
|
+
import { TransformItemWorkflow } from '../orchestration/workflows/transform-item-workflow.js';
|
|
13
|
+
import { BatchTransformWorkflow } from '../orchestration/workflows/batch-transform-workflow.js';
|
|
8
14
|
export class TransformEngine {
|
|
9
15
|
registry;
|
|
16
|
+
formatDetectorRegistry;
|
|
10
17
|
defaultLogger;
|
|
11
|
-
|
|
18
|
+
orchestrator;
|
|
19
|
+
storage;
|
|
20
|
+
constructor(orchestrator, storage) {
|
|
12
21
|
this.registry = new PluginRegistry();
|
|
22
|
+
this.formatDetectorRegistry = new FormatDetectorRegistry();
|
|
13
23
|
this.defaultLogger = new ConsoleLogger();
|
|
24
|
+
this.orchestrator = orchestrator || new InMemoryOrchestrator();
|
|
25
|
+
this.storage = storage;
|
|
26
|
+
// Register built-in format detectors
|
|
27
|
+
this.formatDetectorRegistry.register(new QtiDetector());
|
|
28
|
+
this.formatDetectorRegistry.register(new PieDetector());
|
|
14
29
|
}
|
|
15
30
|
/**
|
|
16
31
|
* Register a plugin
|
|
@@ -19,11 +34,18 @@ export class TransformEngine {
|
|
|
19
34
|
this.registry.register(plugin);
|
|
20
35
|
return this;
|
|
21
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Register a custom format detector
|
|
39
|
+
*/
|
|
40
|
+
registerFormatDetector(detector) {
|
|
41
|
+
this.formatDetectorRegistry.register(detector);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
22
44
|
/**
|
|
23
45
|
* Transform input to target format
|
|
46
|
+
* Returns a workflow handle for monitoring progress and getting results
|
|
24
47
|
*/
|
|
25
48
|
async transform(input, options) {
|
|
26
|
-
const startTime = Date.now();
|
|
27
49
|
const logger = options.logger || this.defaultLogger;
|
|
28
50
|
// Prepare input
|
|
29
51
|
const transformInput = {
|
|
@@ -39,111 +61,86 @@ export class TransformEngine {
|
|
|
39
61
|
throw new Error(`No plugin found for transformation: ${sourceFormat} → ${options.targetFormat}`);
|
|
40
62
|
}
|
|
41
63
|
logger.debug(`Using plugin: ${plugin.name} (${plugin.id})`);
|
|
64
|
+
// Initialize plugin if needed
|
|
65
|
+
if (plugin.initialize) {
|
|
66
|
+
logger.debug('Initializing plugin...');
|
|
67
|
+
await plugin.initialize(options);
|
|
68
|
+
}
|
|
42
69
|
// Create context
|
|
43
70
|
const context = {
|
|
44
71
|
logger,
|
|
45
72
|
vendor: options.vendor,
|
|
46
73
|
options,
|
|
47
74
|
};
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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,
|
|
75
|
+
// Prepare workflow input
|
|
76
|
+
const workflowInput = {
|
|
77
|
+
content: typeof input === 'string' ? input : JSON.stringify(input),
|
|
78
|
+
itemId: 'item-' + Date.now(),
|
|
74
79
|
sourceFormat,
|
|
75
80
|
targetFormat: options.targetFormat,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
processingTime,
|
|
81
|
+
plugin,
|
|
82
|
+
context,
|
|
83
|
+
storage: this.storage,
|
|
80
84
|
};
|
|
81
|
-
|
|
82
|
-
return
|
|
85
|
+
// Start workflow
|
|
86
|
+
return this.orchestrator.startWorkflow(TransformItemWorkflow, workflowInput);
|
|
83
87
|
}
|
|
84
88
|
/**
|
|
85
89
|
* Transform multiple inputs in batch
|
|
90
|
+
* Returns a workflow handle for monitoring progress and getting results
|
|
86
91
|
*/
|
|
87
92
|
async transformBatch(inputs, options) {
|
|
88
|
-
const parallelism = options.parallel || 5;
|
|
89
93
|
const logger = options.logger || this.defaultLogger;
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
// Detect format if not provided
|
|
95
|
+
const sourceFormat = options.sourceFormat || (await this.detectFormat({
|
|
96
|
+
content: inputs[0],
|
|
97
|
+
format: options.sourceFormat,
|
|
98
|
+
}));
|
|
99
|
+
logger.info(`Batch transforming ${inputs.length} items`);
|
|
100
|
+
// Find appropriate plugin
|
|
101
|
+
const plugin = this.registry.findPlugin(sourceFormat, options.targetFormat);
|
|
102
|
+
if (!plugin) {
|
|
103
|
+
throw new Error(`No plugin found for transformation: ${sourceFormat} → ${options.targetFormat}`);
|
|
96
104
|
}
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const chunkResults = await Promise.all(chunk.map((input) => this.transform(input, options)));
|
|
102
|
-
results.push(...chunkResults);
|
|
105
|
+
// Initialize plugin if needed
|
|
106
|
+
if (plugin.initialize) {
|
|
107
|
+
logger.debug('Initializing plugin...');
|
|
108
|
+
await plugin.initialize(options);
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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;
|
|
110
|
+
// Create context
|
|
111
|
+
const context = {
|
|
112
|
+
logger,
|
|
113
|
+
vendor: options.vendor,
|
|
114
|
+
options,
|
|
115
|
+
};
|
|
116
|
+
if (!this.storage) {
|
|
117
|
+
throw new Error('Storage backend required for batch transformation');
|
|
119
118
|
}
|
|
120
|
-
|
|
119
|
+
// Prepare workflow input
|
|
120
|
+
const workflowInput = {
|
|
121
|
+
items: inputs.map((input, index) => ({
|
|
122
|
+
itemId: `item-${Date.now()}-${index}`,
|
|
123
|
+
contentUri: typeof input === 'string' ? input : `memory://item-${index}`,
|
|
124
|
+
})),
|
|
125
|
+
sourceFormat,
|
|
126
|
+
targetFormat: options.targetFormat,
|
|
127
|
+
plugin,
|
|
128
|
+
context,
|
|
129
|
+
storage: this.storage,
|
|
130
|
+
maxConcurrent: options.parallel || 5,
|
|
131
|
+
};
|
|
132
|
+
// Start workflow
|
|
133
|
+
return this.orchestrator.startWorkflow(BatchTransformWorkflow, workflowInput);
|
|
121
134
|
}
|
|
122
135
|
/**
|
|
123
|
-
* Auto-detect input format
|
|
136
|
+
* Auto-detect input format using registered format detectors
|
|
124
137
|
*/
|
|
125
138
|
async detectFormat(input) {
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
|
|
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';
|
|
139
|
+
const detected = await this.formatDetectorRegistry.detectFormat(input.content);
|
|
140
|
+
if (!detected) {
|
|
141
|
+
throw new Error('Could not detect input format. Please specify sourceFormat explicitly.');
|
|
145
142
|
}
|
|
146
|
-
|
|
143
|
+
return detected;
|
|
147
144
|
}
|
|
148
145
|
/**
|
|
149
146
|
* Get all registered plugins
|
|
@@ -168,6 +165,20 @@ export class TransformEngine {
|
|
|
168
165
|
}
|
|
169
166
|
}
|
|
170
167
|
this.registry.clear();
|
|
168
|
+
// Shutdown orchestrator
|
|
169
|
+
await this.orchestrator.shutdown();
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get the workflow orchestrator
|
|
173
|
+
*/
|
|
174
|
+
getOrchestrator() {
|
|
175
|
+
return this.orchestrator;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Set storage backend
|
|
179
|
+
*/
|
|
180
|
+
setStorage(storage) {
|
|
181
|
+
this.storage = storage;
|
|
171
182
|
}
|
|
172
183
|
}
|
|
173
184
|
//# sourceMappingURL=transform-engine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-engine.js","sourceRoot":"","sources":["../../src/engine/transform-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"transform-engine.js","sourceRoot":"","sources":["../../src/engine/transform-engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAqD,MAAM,uDAAuD,CAAC;AACjJ,OAAO,EAAE,sBAAs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tB,wBAAwB;QACxB,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAuB;QAChC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,13 @@
|
|
|
6
6
|
export type * from '@pie-qti/transform-types';
|
|
7
7
|
export * from './engine/transform-engine.js';
|
|
8
8
|
export * from './registry/plugin-registry.js';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './registry/format-detector-registry.js';
|
|
10
|
+
export * from './detectors/qti-detector.js';
|
|
11
|
+
export * from './detectors/pie-detector.js';
|
|
12
|
+
export * from './config/config-loader.js';
|
|
13
|
+
export * from './config/plugin-loader.js';
|
|
14
|
+
export * from './config/vendor-registry.js';
|
|
10
15
|
export * from './utils/validator.js';
|
|
16
|
+
export * from './utils/errors.js';
|
|
17
|
+
export * from './orchestration/index.js';
|
|
11
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;AAC9C,cAAc,wCAAwC,CAAC;AAGvD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,17 @@
|
|
|
7
7
|
export * from './engine/transform-engine.js';
|
|
8
8
|
// Registry
|
|
9
9
|
export * from './registry/plugin-registry.js';
|
|
10
|
+
export * from './registry/format-detector-registry.js';
|
|
11
|
+
// Detectors
|
|
12
|
+
export * from './detectors/qti-detector.js';
|
|
13
|
+
export * from './detectors/pie-detector.js';
|
|
14
|
+
// Configuration
|
|
15
|
+
export * from './config/config-loader.js';
|
|
16
|
+
export * from './config/plugin-loader.js';
|
|
17
|
+
export * from './config/vendor-registry.js';
|
|
10
18
|
// Utilities
|
|
11
|
-
export * from './utils/logger.js';
|
|
12
19
|
export * from './utils/validator.js';
|
|
20
|
+
export * from './utils/errors.js';
|
|
21
|
+
// Orchestration
|
|
22
|
+
export * from './orchestration/index.js';
|
|
13
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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;
|
|
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;AAC9C,cAAc,wCAAwC,CAAC;AAEvD,YAAY;AACZ,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAE5C,gBAAgB;AAChB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAE5C,YAAY;AACZ,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAElC,gBAAgB;AAChB,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect Format Activity
|
|
3
|
+
*
|
|
4
|
+
* Detects the format of content (QTI 2.2, PIE, etc.)
|
|
5
|
+
*/
|
|
6
|
+
import type { Activity, TransformFormat } from '@pie-qti/transform-types';
|
|
7
|
+
export interface DetectFormatInput {
|
|
8
|
+
content: string | object;
|
|
9
|
+
}
|
|
10
|
+
export interface DetectFormatOutput {
|
|
11
|
+
format: TransformFormat;
|
|
12
|
+
confidence: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Activity that detects content format
|
|
16
|
+
*/
|
|
17
|
+
export declare const DetectFormatActivity: Activity<DetectFormatInput, DetectFormatOutput>;
|
|
18
|
+
//# sourceMappingURL=detect-format-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-format-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/detect-format-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE1E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,kBAAkB,CAiDhF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect Format Activity
|
|
3
|
+
*
|
|
4
|
+
* Detects the format of content (QTI 2.2, PIE, etc.)
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Activity that detects content format
|
|
8
|
+
*/
|
|
9
|
+
export const DetectFormatActivity = {
|
|
10
|
+
type: 'detect-format',
|
|
11
|
+
name: 'Detect Format',
|
|
12
|
+
async execute(context, input) {
|
|
13
|
+
context.log('debug', 'Detecting content format');
|
|
14
|
+
const content = typeof input.content === 'string' ? input.content : JSON.stringify(input.content);
|
|
15
|
+
// Check for PIE format (JSON-based)
|
|
16
|
+
if (typeof input.content === 'object' || content.trim().startsWith('{')) {
|
|
17
|
+
try {
|
|
18
|
+
const obj = typeof input.content === 'object' ? input.content : JSON.parse(content);
|
|
19
|
+
if (obj &&
|
|
20
|
+
typeof obj === 'object' &&
|
|
21
|
+
'id' in obj &&
|
|
22
|
+
'element' in obj) {
|
|
23
|
+
context.log('info', 'Detected PIE format');
|
|
24
|
+
return { format: 'pie', confidence: 0.9 };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// Not valid JSON, continue
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Check for QTI 2.2 format (XML-based)
|
|
32
|
+
if (content.includes('<assessmentItem') || content.includes('<assessmentTest')) {
|
|
33
|
+
context.log('info', 'Detected QTI 2.2 format');
|
|
34
|
+
return { format: 'qti22', confidence: 0.9 };
|
|
35
|
+
}
|
|
36
|
+
// Check for QTI 3.0 format
|
|
37
|
+
if (content.includes('xmlns="http://www.imsglobal.org/xsd/imsqtiasi_v3p0"')) {
|
|
38
|
+
context.log('info', 'Detected QTI 3.0 format');
|
|
39
|
+
return { format: 'qti30', confidence: 0.9 };
|
|
40
|
+
}
|
|
41
|
+
throw new Error('Unable to detect content format');
|
|
42
|
+
},
|
|
43
|
+
timeout: 10000, // 10 seconds
|
|
44
|
+
retryPolicy: {
|
|
45
|
+
maxAttempts: 1, // Format detection shouldn't be retried
|
|
46
|
+
initialInterval: 1000,
|
|
47
|
+
maxInterval: 1000,
|
|
48
|
+
backoffCoefficient: 1,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=detect-format-activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-format-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/detect-format-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAoD;IACnF,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IAErB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK;QAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAElG,oCAAoC;QACpC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxE,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACpF,IACE,GAAG;oBACH,OAAO,GAAG,KAAK,QAAQ;oBACvB,IAAI,IAAI,GAAG;oBACX,SAAS,IAAI,GAAG,EAChB,CAAC;oBACD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;oBAC3C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;gBAC5C,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,2BAA2B;YAC7B,CAAC;QACH,CAAC;QAED,uCAAuC;QACvC,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC/E,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;YAC/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;QAC9C,CAAC;QAED,2BAA2B;QAC3B,IAAI,OAAO,CAAC,QAAQ,CAAC,qDAAqD,CAAC,EAAE,CAAC;YAC5E,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;YAC/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;QAC9C,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,aAAa;IAC7B,WAAW,EAAE;QACX,WAAW,EAAE,CAAC,EAAE,wCAAwC;QACxD,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;QACjB,kBAAkB,EAAE,CAAC;KACtB;CACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect Vendor Activity
|
|
3
|
+
*
|
|
4
|
+
* Detects vendor-specific patterns in QTI content
|
|
5
|
+
*/
|
|
6
|
+
import type { Activity } from '@pie-qti/transform-types';
|
|
7
|
+
import type { HTMLElement } from 'node-html-parser';
|
|
8
|
+
export interface VendorInfo {
|
|
9
|
+
vendor: string;
|
|
10
|
+
confidence: number;
|
|
11
|
+
features?: string[];
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface DetectVendorInput {
|
|
15
|
+
xml: string;
|
|
16
|
+
doc: HTMLElement;
|
|
17
|
+
}
|
|
18
|
+
export interface DetectVendorOutput {
|
|
19
|
+
vendorInfo: VendorInfo | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Activity that detects vendor-specific patterns
|
|
23
|
+
*/
|
|
24
|
+
export declare const DetectVendorActivity: Activity<DetectVendorInput, DetectVendorOutput>;
|
|
25
|
+
//# sourceMappingURL=detect-vendor-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-vendor-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/detect-vendor-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,WAAW,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,kBAAkB,CAoBhF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect Vendor Activity
|
|
3
|
+
*
|
|
4
|
+
* Detects vendor-specific patterns in QTI content
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Activity that detects vendor-specific patterns
|
|
8
|
+
*/
|
|
9
|
+
export const DetectVendorActivity = {
|
|
10
|
+
type: 'detect-vendor',
|
|
11
|
+
name: 'Detect Vendor',
|
|
12
|
+
async execute(context, _input) {
|
|
13
|
+
context.log('debug', 'Detecting vendor-specific patterns');
|
|
14
|
+
// Vendor detection relies on pluggable vendor detectors configured at runtime
|
|
15
|
+
// No built-in patterns are included to avoid speculation
|
|
16
|
+
context.log('debug', 'No vendor-specific patterns detected');
|
|
17
|
+
return { vendorInfo: null };
|
|
18
|
+
},
|
|
19
|
+
timeout: 15000, // 15 seconds
|
|
20
|
+
retryPolicy: {
|
|
21
|
+
maxAttempts: 1, // Vendor detection shouldn't be retried
|
|
22
|
+
initialInterval: 1000,
|
|
23
|
+
maxInterval: 1000,
|
|
24
|
+
backoffCoefficient: 1,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=detect-vendor-activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-vendor-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/detect-vendor-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAoD;IACnF,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IAErB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM;QAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,oCAAoC,CAAC,CAAC;QAE3D,8EAA8E;QAC9E,yDAAyD;QACzD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,sCAAsC,CAAC,CAAC;QAC7D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,aAAa;IAC7B,WAAW,EAAE;QACX,WAAW,EAAE,CAAC,EAAE,wCAAwC;QACxD,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;QACjB,kBAAkB,EAAE,CAAC;KACtB;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity definitions for transformation pipeline
|
|
3
|
+
*/
|
|
4
|
+
export { DetectFormatActivity } from './detect-format-activity.js';
|
|
5
|
+
export type { DetectFormatInput, DetectFormatOutput } from './detect-format-activity.js';
|
|
6
|
+
export { DetectVendorActivity } from './detect-vendor-activity.js';
|
|
7
|
+
export type { DetectVendorInput, DetectVendorOutput, VendorInfo } from './detect-vendor-activity.js';
|
|
8
|
+
export { ParseXmlActivity } from './parse-xml-activity.js';
|
|
9
|
+
export type { ParseXmlInput, ParseXmlOutput } from './parse-xml-activity.js';
|
|
10
|
+
export { ReadContentActivity } from './read-content-activity.js';
|
|
11
|
+
export type { ReadContentInput, ReadContentOutput } from './read-content-activity.js';
|
|
12
|
+
export { TransformQtiToPieActivity } from './transform-qti-to-pie-activity.js';
|
|
13
|
+
export type { TransformQtiToPieInput, TransformQtiToPieOutput } from './transform-qti-to-pie-activity.js';
|
|
14
|
+
export { ValidateQtiActivity } from './validate-qti-activity.js';
|
|
15
|
+
export type { ValidateQtiInput, ValidateQtiOutput } from './validate-qti-activity.js';
|
|
16
|
+
export { WriteContentActivity } from './write-content-activity.js';
|
|
17
|
+
export type { WriteContentInput, WriteContentOutput } from './write-content-activity.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAErG,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity definitions for transformation pipeline
|
|
3
|
+
*/
|
|
4
|
+
export { DetectFormatActivity } from './detect-format-activity.js';
|
|
5
|
+
export { DetectVendorActivity } from './detect-vendor-activity.js';
|
|
6
|
+
export { ParseXmlActivity } from './parse-xml-activity.js';
|
|
7
|
+
export { ReadContentActivity } from './read-content-activity.js';
|
|
8
|
+
export { TransformQtiToPieActivity } from './transform-qti-to-pie-activity.js';
|
|
9
|
+
export { ValidateQtiActivity } from './validate-qti-activity.js';
|
|
10
|
+
export { WriteContentActivity } from './write-content-activity.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/orchestration/activities/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAG/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse XML Activity
|
|
3
|
+
*
|
|
4
|
+
* Parses QTI XML content into a DOM structure
|
|
5
|
+
*/
|
|
6
|
+
import type { Activity } from '@pie-qti/transform-types';
|
|
7
|
+
import { HTMLElement } from 'node-html-parser';
|
|
8
|
+
export interface ParseXmlInput {
|
|
9
|
+
xml: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ParseXmlOutput {
|
|
12
|
+
doc: HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Activity that parses XML content
|
|
16
|
+
*/
|
|
17
|
+
export declare const ParseXmlActivity: Activity<ParseXmlInput, ParseXmlOutput>;
|
|
18
|
+
//# sourceMappingURL=parse-xml-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-xml-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/parse-xml-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAS,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,WAAW,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,aAAa,EAAE,cAAc,CA6BpE,CAAC"}
|