@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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Loader
|
|
3
|
+
* Loads transform configuration from files and environment variables
|
|
4
|
+
*/
|
|
5
|
+
import type { TransformConfig } from '@pie-qti/transform-types';
|
|
6
|
+
/**
|
|
7
|
+
* Load configuration from a JSON file
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadFromFile(configPath: string): Promise<TransformConfig>;
|
|
10
|
+
/**
|
|
11
|
+
* Load configuration from environment variables
|
|
12
|
+
*
|
|
13
|
+
* Supported environment variables:
|
|
14
|
+
* - PIE_QTI_STORAGE_BACKEND: Storage backend type (name-based, e.g., 'filesystem', 's3', 'database', or any custom name)
|
|
15
|
+
* - PIE_QTI_STORAGE_ROOT_DIR: Root directory for filesystem storage
|
|
16
|
+
* - PIE_QTI_LOG_LEVEL: Logging level (debug, info, warn, error)
|
|
17
|
+
* - PIE_QTI_CONFIG: Path to config file (takes precedence)
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadFromEnv(): TransformConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Merge multiple configuration objects
|
|
22
|
+
* Later configs override earlier ones
|
|
23
|
+
*/
|
|
24
|
+
export declare function merge(...configs: TransformConfig[]): TransformConfig;
|
|
25
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/config/config-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAW1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,eAAe,CA2C7C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,eAAe,EAAE,GAAG,eAAe,CAkFpE"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Loader
|
|
3
|
+
* Loads transform configuration from files and environment variables
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'node:fs/promises';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
/**
|
|
8
|
+
* Load configuration from a JSON file
|
|
9
|
+
*/
|
|
10
|
+
export async function loadFromFile(configPath) {
|
|
11
|
+
try {
|
|
12
|
+
const absolutePath = path.resolve(configPath);
|
|
13
|
+
const content = await fs.readFile(absolutePath, 'utf-8');
|
|
14
|
+
const config = JSON.parse(content);
|
|
15
|
+
return config;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throw new Error(`Failed to load config from ${configPath}: ${error.message}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Load configuration from environment variables
|
|
23
|
+
*
|
|
24
|
+
* Supported environment variables:
|
|
25
|
+
* - PIE_QTI_STORAGE_BACKEND: Storage backend type (name-based, e.g., 'filesystem', 's3', 'database', or any custom name)
|
|
26
|
+
* - PIE_QTI_STORAGE_ROOT_DIR: Root directory for filesystem storage
|
|
27
|
+
* - PIE_QTI_LOG_LEVEL: Logging level (debug, info, warn, error)
|
|
28
|
+
* - PIE_QTI_CONFIG: Path to config file (takes precedence)
|
|
29
|
+
*/
|
|
30
|
+
export function loadFromEnv() {
|
|
31
|
+
const config = {};
|
|
32
|
+
// Load from config file if specified
|
|
33
|
+
if (process.env.PIE_QTI_CONFIG) {
|
|
34
|
+
// Don't load synchronously here - caller should use loadFromFile
|
|
35
|
+
// Just return the path reference
|
|
36
|
+
return config;
|
|
37
|
+
}
|
|
38
|
+
// Storage configuration
|
|
39
|
+
if (process.env.PIE_QTI_STORAGE_BACKEND) {
|
|
40
|
+
config.storage = {
|
|
41
|
+
backend: process.env.PIE_QTI_STORAGE_BACKEND,
|
|
42
|
+
options: {},
|
|
43
|
+
};
|
|
44
|
+
// Filesystem-specific options
|
|
45
|
+
if (config.storage &&
|
|
46
|
+
process.env.PIE_QTI_STORAGE_BACKEND === 'filesystem' &&
|
|
47
|
+
process.env.PIE_QTI_STORAGE_ROOT_DIR) {
|
|
48
|
+
config.storage.options = {
|
|
49
|
+
rootDir: process.env.PIE_QTI_STORAGE_ROOT_DIR,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Backend-specific options are loaded by the backend implementation
|
|
53
|
+
}
|
|
54
|
+
// Logger configuration
|
|
55
|
+
if (process.env.PIE_QTI_LOG_LEVEL) {
|
|
56
|
+
config.logger = {
|
|
57
|
+
level: process.env.PIE_QTI_LOG_LEVEL,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Merge multiple configuration objects
|
|
64
|
+
* Later configs override earlier ones
|
|
65
|
+
*/
|
|
66
|
+
export function merge(...configs) {
|
|
67
|
+
const merged = {};
|
|
68
|
+
for (const config of configs) {
|
|
69
|
+
// Merge storage config
|
|
70
|
+
if (config.storage) {
|
|
71
|
+
// If backend changes, replace options completely
|
|
72
|
+
if (merged.storage &&
|
|
73
|
+
config.storage.backend !== merged.storage.backend) {
|
|
74
|
+
merged.storage = {
|
|
75
|
+
...config.storage,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Same backend or no previous storage, merge options
|
|
80
|
+
merged.storage = {
|
|
81
|
+
...merged.storage,
|
|
82
|
+
...config.storage,
|
|
83
|
+
options: {
|
|
84
|
+
...merged.storage?.options,
|
|
85
|
+
...config.storage.options,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Merge plugins
|
|
91
|
+
if (config.plugins) {
|
|
92
|
+
merged.plugins = merged.plugins || {};
|
|
93
|
+
for (const [sourceFormat, targets] of Object.entries(config.plugins)) {
|
|
94
|
+
merged.plugins[sourceFormat] = {
|
|
95
|
+
...merged.plugins[sourceFormat],
|
|
96
|
+
...targets,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Merge format detectors
|
|
101
|
+
if (config.formatDetectors) {
|
|
102
|
+
merged.formatDetectors = [
|
|
103
|
+
...(merged.formatDetectors || []),
|
|
104
|
+
...config.formatDetectors,
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
// Merge vendor extensions
|
|
108
|
+
if (config.vendorExtensions) {
|
|
109
|
+
merged.vendorExtensions = {
|
|
110
|
+
detectors: [
|
|
111
|
+
...(merged.vendorExtensions?.detectors || []),
|
|
112
|
+
...(config.vendorExtensions.detectors || []),
|
|
113
|
+
],
|
|
114
|
+
transformers: [
|
|
115
|
+
...(merged.vendorExtensions?.transformers || []),
|
|
116
|
+
...(config.vendorExtensions.transformers || []),
|
|
117
|
+
],
|
|
118
|
+
assetResolvers: [
|
|
119
|
+
...(merged.vendorExtensions?.assetResolvers || []),
|
|
120
|
+
...(config.vendorExtensions.assetResolvers || []),
|
|
121
|
+
],
|
|
122
|
+
cssClassExtractors: [
|
|
123
|
+
...(merged.vendorExtensions?.cssClassExtractors || []),
|
|
124
|
+
...(config.vendorExtensions.cssClassExtractors || []),
|
|
125
|
+
],
|
|
126
|
+
metadataExtractors: [
|
|
127
|
+
...(merged.vendorExtensions?.metadataExtractors || []),
|
|
128
|
+
...(config.vendorExtensions.metadataExtractors || []),
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
// Merge logger config
|
|
133
|
+
if (config.logger) {
|
|
134
|
+
merged.logger = {
|
|
135
|
+
...merged.logger,
|
|
136
|
+
...config.logger,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return merged;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=config-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/config/config-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,UAAkB;IAElB,IAAI,CAAC;QACJ,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,CAAC;QACtD,OAAO,MAAM,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACd,8BAA8B,UAAU,KAAM,KAAe,CAAC,OAAO,EAAE,CACvE,CAAC;IACH,CAAC;AACF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW;IAC1B,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC,qCAAqC;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;QAChC,iEAAiE;QACjE,iCAAiC;QACjC,OAAO,MAAM,CAAC;IACf,CAAC;IAED,wBAA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MAAM,CAAC,gBAAgB,CAAC,cAAc,IAAI,EAAE,CAAC;iBACjD;gBACD,kBAAkB,EAAE;oBACnB,GAAG,CAAC,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,IAAI,EAAE,CAAC;oBACtD,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,IAAI,EAAE,CAAC;iBACrD;gBACD,kBAAkB,EAAE;oBACnB,GAAG,CAAC,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,IAAI,EAAE,CAAC;oBACtD,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,IAAI,EAAE,CAAC;iBACrD;aACD,CAAC;QACH,CAAC;QAED,sBAAsB;QACtB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,CAAC,MAAM,GAAG;gBACf,GAAG,MAAM,CAAC,MAAM;gBAChB,GAAG,MAAM,CAAC,MAAM;aAChB,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Loader
|
|
3
|
+
* Dynamically loads and registers plugins and format detectors
|
|
4
|
+
*/
|
|
5
|
+
import type { TransformConfig, PluginConfig } from '@pie-qti/transform-types';
|
|
6
|
+
import type { TransformEngine } from '../engine/transform-engine.js';
|
|
7
|
+
/**
|
|
8
|
+
* Load a plugin or format detector from a module config
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadPlugin<T = unknown>(config: PluginConfig): Promise<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Load and register all plugins from configuration
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadAndRegisterPlugins(engine: TransformEngine, pluginConfig?: TransformConfig['plugins']): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Load and register format detectors from configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadFormatDetectors(engine: TransformEngine, detectorConfigs?: PluginConfig[]): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=plugin-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/config/plugin-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEX,eAAe,EACf,YAAY,EACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGrE;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAC3C,MAAM,EAAE,YAAY,GAClB,OAAO,CAAC,CAAC,CAAC,CAuBZ;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC3C,MAAM,EAAE,eAAe,EACvB,YAAY,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,MAAM,EAAE,eAAe,EACvB,eAAe,CAAC,EAAE,YAAY,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Loader
|
|
3
|
+
* Dynamically loads and registers plugins and format detectors
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Load a plugin or format detector from a module config
|
|
7
|
+
*/
|
|
8
|
+
export async function loadPlugin(config) {
|
|
9
|
+
try {
|
|
10
|
+
// Dynamic import of the module (Vite cannot statically analyze this)
|
|
11
|
+
const module = await import(/* @vite-ignore */ config.module);
|
|
12
|
+
// Get the export (default or named)
|
|
13
|
+
const exportName = config.export || 'default';
|
|
14
|
+
const PluginClass = module[exportName];
|
|
15
|
+
if (!PluginClass) {
|
|
16
|
+
throw new Error(`Export "${exportName}" not found in module ${config.module}`);
|
|
17
|
+
}
|
|
18
|
+
// Instantiate with options
|
|
19
|
+
const instance = new PluginClass(config.options || {});
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Failed to load plugin from ${config.module}: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Load and register all plugins from configuration
|
|
28
|
+
*/
|
|
29
|
+
export async function loadAndRegisterPlugins(engine, pluginConfig) {
|
|
30
|
+
if (!pluginConfig) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (const [sourceFormat, targets] of Object.entries(pluginConfig)) {
|
|
34
|
+
for (const [targetFormat, config] of Object.entries(targets)) {
|
|
35
|
+
try {
|
|
36
|
+
const plugin = await loadPlugin(config);
|
|
37
|
+
engine.use(plugin);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.warn(`Failed to load plugin ${sourceFormat}→${targetFormat}:`, error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Load and register format detectors from configuration
|
|
47
|
+
*/
|
|
48
|
+
export async function loadFormatDetectors(engine, detectorConfigs) {
|
|
49
|
+
if (!detectorConfigs) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
for (const config of detectorConfigs) {
|
|
53
|
+
try {
|
|
54
|
+
const detector = await loadPlugin(config);
|
|
55
|
+
engine.registerFormatDetector(detector);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.warn(`Failed to load format detector ${config.module}:`, error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=plugin-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/config/plugin-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC/B,MAAoB;IAEpB,IAAI,CAA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EACxD,KAAK,CACL,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,MAAuB,EACvB,eAAgC;IAEhC,IAAI,CAAC,eAAe,EAAE,CAAC;QACtB,OAAO;IACR,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACtC,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAiB,MAAM,CAAC,CAAC;YAC1D,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,kCAAkC,MAAM,CAAC,MAAM,GAAG,EAAE,KAAK,CAAC,CAAC;QACzE,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor Extension Registry
|
|
3
|
+
* Dynamically loads and registers vendor extensions from configuration
|
|
4
|
+
*/
|
|
5
|
+
import type { VendorExtensionConfig } from '@pie-qti/transform-types';
|
|
6
|
+
/**
|
|
7
|
+
* Plugin interface with vendor extension registration methods
|
|
8
|
+
* This is a generic interface to avoid circular dependencies with specific plugins
|
|
9
|
+
*/
|
|
10
|
+
export interface VendorExtensionPlugin {
|
|
11
|
+
registerVendorDetector?: (detector: any) => void;
|
|
12
|
+
registerVendorTransformer?: (transformer: any) => void;
|
|
13
|
+
registerAssetResolver?: (resolver: any) => void;
|
|
14
|
+
registerCssClassExtractor?: (extractor: any) => void;
|
|
15
|
+
registerMetadataExtractor?: (extractor: any) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Register vendor extensions on a plugin from configuration
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerExtensions(plugin: VendorExtensionPlugin, config: VendorExtensionConfig): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=vendor-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-registry.d.ts","sourceRoot":"","sources":["../../src/config/vendor-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,qBAAqB,EAErB,MAAM,0BAA0B,CAAC;AAElC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IACjD,yBAAyB,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,KAAK,IAAI,CAAC;IACvD,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAChD,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IACrD,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;CACrD;AAgCD;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA2Ef"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor Extension Registry
|
|
3
|
+
* Dynamically loads and registers vendor extensions from configuration
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Load a vendor extension module
|
|
7
|
+
*/
|
|
8
|
+
async function loadVendorModule(config) {
|
|
9
|
+
try {
|
|
10
|
+
// Dynamic import of the module (Vite cannot statically analyze this)
|
|
11
|
+
const module = await import(/* @vite-ignore */ config.module);
|
|
12
|
+
// Get the export (default or named)
|
|
13
|
+
const exportName = config.export || 'default';
|
|
14
|
+
const ExtensionClass = module[exportName];
|
|
15
|
+
if (!ExtensionClass) {
|
|
16
|
+
throw new Error(`Export "${exportName}" not found in module ${config.module}`);
|
|
17
|
+
}
|
|
18
|
+
// Instantiate with options
|
|
19
|
+
const instance = new ExtensionClass(config.options || {});
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Failed to load vendor extension from ${config.module}: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Register vendor extensions on a plugin from configuration
|
|
28
|
+
*/
|
|
29
|
+
export async function registerExtensions(plugin, config) {
|
|
30
|
+
// Register vendor detectors
|
|
31
|
+
if (config.detectors && plugin.registerVendorDetector) {
|
|
32
|
+
for (const detectorConfig of config.detectors) {
|
|
33
|
+
try {
|
|
34
|
+
const detector = await loadVendorModule(detectorConfig);
|
|
35
|
+
plugin.registerVendorDetector(detector);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.warn(`Failed to load vendor detector ${detectorConfig.module}:`, error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Register vendor transformers
|
|
43
|
+
if (config.transformers && plugin.registerVendorTransformer) {
|
|
44
|
+
for (const transformerConfig of config.transformers) {
|
|
45
|
+
try {
|
|
46
|
+
const transformer = await loadVendorModule(transformerConfig);
|
|
47
|
+
plugin.registerVendorTransformer(transformer);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.warn(`Failed to load vendor transformer ${transformerConfig.module}:`, error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Register asset resolvers
|
|
55
|
+
if (config.assetResolvers && plugin.registerAssetResolver) {
|
|
56
|
+
for (const resolverConfig of config.assetResolvers) {
|
|
57
|
+
try {
|
|
58
|
+
const resolver = await loadVendorModule(resolverConfig);
|
|
59
|
+
plugin.registerAssetResolver(resolver);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.warn(`Failed to load asset resolver ${resolverConfig.module}:`, error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Register CSS class extractors
|
|
67
|
+
if (config.cssClassExtractors && plugin.registerCssClassExtractor) {
|
|
68
|
+
for (const extractorConfig of config.cssClassExtractors) {
|
|
69
|
+
try {
|
|
70
|
+
const extractor = await loadVendorModule(extractorConfig);
|
|
71
|
+
plugin.registerCssClassExtractor(extractor);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.warn(`Failed to load CSS class extractor ${extractorConfig.module}:`, error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Register metadata extractors
|
|
79
|
+
if (config.metadataExtractors && plugin.registerMetadataExtractor) {
|
|
80
|
+
for (const extractorConfig of config.metadataExtractors) {
|
|
81
|
+
try {
|
|
82
|
+
const extractor = await loadVendorModule(extractorConfig);
|
|
83
|
+
plugin.registerMetadataExtractor(extractor);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.warn(`Failed to load metadata extractor ${extractorConfig.module}:`, error);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=vendor-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-registry.js","sourceRoot":"","sources":["../../src/config/vendor-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAC9B,MAAmC;IAEnC,IAAI,CAAC;QACJ,qEAAqE;QACrE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE9D,oCAAoC;QACpC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC;QAC9C,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QAE1C,IAAI,CAAC,cAAc,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACd,WAAW,UAAU,yBAAyB,MAAM,CAAC,MAAM,EA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AC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,CAAC,IAAI,CACX,qCAAqC,eAAe,CAAC,MAAM,GAAG,EAC9D,KAAK,CACL,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIE Format Detector
|
|
3
|
+
* Detects PIE JSON format
|
|
4
|
+
*/
|
|
5
|
+
import type { FormatDetector } from '../registry/format-detector-registry.js';
|
|
6
|
+
/**
|
|
7
|
+
* PIE format detector
|
|
8
|
+
* Detects JSON/object content with PIE structure
|
|
9
|
+
*/
|
|
10
|
+
export declare class PieDetector implements FormatDetector {
|
|
11
|
+
readonly id = "pie-detector";
|
|
12
|
+
readonly formatId = "pie";
|
|
13
|
+
readonly priority = 90;
|
|
14
|
+
/**
|
|
15
|
+
* Detect if input is PIE format
|
|
16
|
+
*/
|
|
17
|
+
detect(input: string | object): boolean;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=pie-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-detector.d.ts","sourceRoot":"","sources":["../../src/detectors/pie-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E;;;GAGG;AACH,qBAAa,WAAY,YAAW,cAAc;IACjD,QAAQ,CAAC,EAAE,kBAAkB;IAC7B,QAAQ,CAAC,QAAQ,SAAS;IAC1B,QAAQ,CAAC,QAAQ,MAAM;IAEvB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;CAkCvC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIE Format Detector
|
|
3
|
+
* Detects PIE JSON format
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* PIE format detector
|
|
7
|
+
* Detects JSON/object content with PIE structure
|
|
8
|
+
*/
|
|
9
|
+
export class PieDetector {
|
|
10
|
+
id = 'pie-detector';
|
|
11
|
+
formatId = 'pie';
|
|
12
|
+
priority = 90;
|
|
13
|
+
/**
|
|
14
|
+
* Detect if input is PIE format
|
|
15
|
+
*/
|
|
16
|
+
detect(input) {
|
|
17
|
+
// PIE can be an object or JSON string
|
|
18
|
+
if (typeof input === 'object') {
|
|
19
|
+
// Assume objects are PIE (or will be validated by the plugin)
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
// Try to parse as JSON
|
|
23
|
+
if (typeof input === 'string') {
|
|
24
|
+
const trimmed = input.trim();
|
|
25
|
+
// Must start with { or [
|
|
26
|
+
if (!trimmed.startsWith('{') && !trimmed.startsWith('[')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const parsed = JSON.parse(trimmed);
|
|
31
|
+
// Basic PIE shape detection
|
|
32
|
+
// PIE items typically have: id, element, or pieElement properties
|
|
33
|
+
if (parsed && typeof parsed === 'object') {
|
|
34
|
+
return !!(parsed.id || parsed.element || parsed.pieElement);
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Not valid JSON
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=pie-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-detector.js","sourceRoot":"","sources":["../../src/detectors/pie-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,EAAE,GAAG,cAAc,CAAC;IACpB,QAAQ,GAAG,KAAK,CAAC;IACjB,QAAQ,GAAG,EAAE,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,KAAsB;QAC5B,sCAAsC;QACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,8DAA8D;YAC9D,OAAO,IAAI,CAAC;QACb,CAAC;QAED,uBAAuB;QACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAE7B,yBAAyB;YACzB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1D,OAAO,KAAK,CAAC;YACd,CAAC;YAED,IAAI,CAAC;gBACJ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAEnC,4BAA4B;gBAC5B,kEAAkE;gBAClE,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;oBAC1C,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC7D,CAAC;gBAED,OAAO,KAAK,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACR,iBAAiB;gBACjB,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 2.x Format Detector
|
|
3
|
+
* Detects QTI 2.0, 2.1, and 2.2 XML formats
|
|
4
|
+
*/
|
|
5
|
+
import type { FormatDetector } from '../registry/format-detector-registry.js';
|
|
6
|
+
/**
|
|
7
|
+
* QTI 2.x format detector
|
|
8
|
+
* Detects XML content with QTI 2.0, 2.1, or 2.2 namespace
|
|
9
|
+
* Note: All versions are mapped to the same formatId for unified processing
|
|
10
|
+
*/
|
|
11
|
+
export declare class QtiDetector implements FormatDetector {
|
|
12
|
+
readonly id = "qti-detector";
|
|
13
|
+
readonly formatId = "qti22";
|
|
14
|
+
readonly priority = 100;
|
|
15
|
+
/**
|
|
16
|
+
* Detect if input is QTI 2.x XML (supports 2.0, 2.1, 2.2)
|
|
17
|
+
*/
|
|
18
|
+
detect(input: string | object): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=qti-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti-detector.d.ts","sourceRoot":"","sources":["../../src/detectors/qti-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,WAAY,YAAW,cAAc;IACjD,QAAQ,CAAC,EAAE,kBAAkB;IAC7B,QAAQ,CAAC,QAAQ,WAAW;IAC5B,QAAQ,CAAC,QAAQ,OAAO;IAExB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;CAqBvC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 2.x Format Detector
|
|
3
|
+
* Detects QTI 2.0, 2.1, and 2.2 XML formats
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* QTI 2.x format detector
|
|
7
|
+
* Detects XML content with QTI 2.0, 2.1, or 2.2 namespace
|
|
8
|
+
* Note: All versions are mapped to the same formatId for unified processing
|
|
9
|
+
*/
|
|
10
|
+
export class QtiDetector {
|
|
11
|
+
id = 'qti-detector';
|
|
12
|
+
formatId = 'qti22';
|
|
13
|
+
priority = 100;
|
|
14
|
+
/**
|
|
15
|
+
* Detect if input is QTI 2.x XML (supports 2.0, 2.1, 2.2)
|
|
16
|
+
*/
|
|
17
|
+
detect(input) {
|
|
18
|
+
// QTI is always a string (XML)
|
|
19
|
+
if (typeof input !== 'string') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const trimmed = input.trim();
|
|
23
|
+
// Must be XML-like
|
|
24
|
+
if (!trimmed.startsWith('<?xml') && !trimmed.startsWith('<')) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// Support QTI 2.0, 2.1, and 2.2 namespaces
|
|
28
|
+
return (trimmed.includes('imsqti_v2p0') ||
|
|
29
|
+
trimmed.includes('imsqti_v2p1') ||
|
|
30
|
+
trimmed.includes('imsqti_v2p2') ||
|
|
31
|
+
trimmed.includes('http://www.imsglobal.org/xsd/imsqti_v2p'));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=qti-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti-detector.js","sourceRoot":"","sources":["../../src/detectors/qti-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,OAAO,WAAW;IACd,EAAE,GAAG,cAAc,CAAC;IACpB,QAAQ,GAAG,OAAO,CAAC;IACnB,QAAQ,GAAG,GAAG,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,KAAsB;QAC5B,+BAA+B;QAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAE7B,mBAAmB;QACnB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACd,CAAC;QAED,2CAA2C;QAC3C,OAAO,CACN,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAC3D,CAAC;IACH,CAAC;CACD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 2.x Format Detector
|
|
3
|
+
* Detects QTI 2.0, 2.1, and 2.2 XML formats
|
|
4
|
+
*/
|
|
5
|
+
import type { FormatDetector } from '../registry/format-detector-registry.js';
|
|
6
|
+
/**
|
|
7
|
+
* QTI 2.x format detector
|
|
8
|
+
* Detects XML content with QTI 2.0, 2.1, or 2.2 namespace
|
|
9
|
+
* Note: All versions are mapped to the same formatId for unified processing
|
|
10
|
+
*/
|
|
11
|
+
export declare class Qti22Detector implements FormatDetector {
|
|
12
|
+
readonly id = "qti22-detector";
|
|
13
|
+
readonly formatId = "qti22";
|
|
14
|
+
readonly priority = 100;
|
|
15
|
+
/**
|
|
16
|
+
* Detect if input is QTI 2.x XML (supports 2.0, 2.1, 2.2)
|
|
17
|
+
*/
|
|
18
|
+
detect(input: string | object): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=qti22-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti22-detector.d.ts","sourceRoot":"","sources":["../../src/detectors/qti22-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E;;;;GAIG;AACH,qBAAa,aAAc,YAAW,cAAc;IACnD,QAAQ,CAAC,EAAE,oBAAoB;IAC/B,QAAQ,CAAC,QAAQ,WAAW;IAC5B,QAAQ,CAAC,QAAQ,OAAO;IAExB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;CAqBvC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QTI 2.x Format Detector
|
|
3
|
+
* Detects QTI 2.0, 2.1, and 2.2 XML formats
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* QTI 2.x format detector
|
|
7
|
+
* Detects XML content with QTI 2.0, 2.1, or 2.2 namespace
|
|
8
|
+
* Note: All versions are mapped to the same formatId for unified processing
|
|
9
|
+
*/
|
|
10
|
+
export class Qti22Detector {
|
|
11
|
+
id = 'qti22-detector';
|
|
12
|
+
formatId = 'qti22';
|
|
13
|
+
priority = 100;
|
|
14
|
+
/**
|
|
15
|
+
* Detect if input is QTI 2.x XML (supports 2.0, 2.1, 2.2)
|
|
16
|
+
*/
|
|
17
|
+
detect(input) {
|
|
18
|
+
// QTI is always a string (XML)
|
|
19
|
+
if (typeof input !== 'string') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const trimmed = input.trim();
|
|
23
|
+
// Must be XML-like
|
|
24
|
+
if (!trimmed.startsWith('<?xml') && !trimmed.startsWith('<')) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// Support QTI 2.0, 2.1, and 2.2 namespaces
|
|
28
|
+
return (trimmed.includes('imsqti_v2p0') ||
|
|
29
|
+
trimmed.includes('imsqti_v2p1') ||
|
|
30
|
+
trimmed.includes('imsqti_v2p2') ||
|
|
31
|
+
trimmed.includes('http://www.imsglobal.org/xsd/imsqti_v2p'));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=qti22-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti22-detector.js","sourceRoot":"","sources":["../../src/detectors/qti22-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,OAAO,aAAa;IAChB,EAAE,GAAG,gBAAgB,CAAC;IACtB,QAAQ,GAAG,OAAO,CAAC;IACnB,QAAQ,GAAG,GAAG,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,KAAsB;QAC5B,+BAA+B;QAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAE7B,mBAAmB;QACnB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACd,CAAC;QAED,2CAA2C;QAC3C,OAAO,CACN,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAC3D,CAAC;IACH,CAAC;CACD"}
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './transform-engine';
|
|
1
|
+
export * from './transform-engine.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/engine/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './transform-engine';
|
|
1
|
+
export * from './transform-engine.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/engine/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|