@pie-qti/transform-core 0.1.1 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/config/config-loader.d.ts +25 -0
  2. package/dist/config/config-loader.d.ts.map +1 -0
  3. package/dist/config/config-loader.js +142 -0
  4. package/dist/config/config-loader.js.map +1 -0
  5. package/dist/config/plugin-loader.d.ts +19 -0
  6. package/dist/config/plugin-loader.d.ts.map +1 -0
  7. package/dist/config/plugin-loader.js +62 -0
  8. package/dist/config/plugin-loader.js.map +1 -0
  9. package/dist/config/vendor-registry.d.ts +21 -0
  10. package/dist/config/vendor-registry.d.ts.map +1 -0
  11. package/dist/config/vendor-registry.js +91 -0
  12. package/dist/config/vendor-registry.js.map +1 -0
  13. package/dist/detectors/pie-detector.d.ts +19 -0
  14. package/dist/detectors/pie-detector.d.ts.map +1 -0
  15. package/dist/detectors/pie-detector.js +46 -0
  16. package/dist/detectors/pie-detector.js.map +1 -0
  17. package/dist/detectors/qti-detector.d.ts +20 -0
  18. package/dist/detectors/qti-detector.d.ts.map +1 -0
  19. package/dist/detectors/qti-detector.js +34 -0
  20. package/dist/detectors/qti-detector.js.map +1 -0
  21. package/dist/detectors/qti22-detector.d.ts +20 -0
  22. package/dist/detectors/qti22-detector.d.ts.map +1 -0
  23. package/dist/detectors/qti22-detector.js +34 -0
  24. package/dist/detectors/qti22-detector.js.map +1 -0
  25. package/dist/engine/index.d.ts +1 -1
  26. package/dist/engine/index.d.ts.map +1 -1
  27. package/dist/engine/index.js +1 -1
  28. package/dist/engine/index.js.map +1 -1
  29. package/dist/engine/transform-engine.d.ts +27 -10
  30. package/dist/engine/transform-engine.d.ts.map +1 -1
  31. package/dist/engine/transform-engine.js +96 -85
  32. package/dist/engine/transform-engine.js.map +1 -1
  33. package/dist/index.d.ts +8 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +11 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/orchestration/activities/detect-format-activity.d.ts +18 -0
  38. package/dist/orchestration/activities/detect-format-activity.d.ts.map +1 -0
  39. package/dist/orchestration/activities/detect-format-activity.js +51 -0
  40. package/dist/orchestration/activities/detect-format-activity.js.map +1 -0
  41. package/dist/orchestration/activities/detect-vendor-activity.d.ts +25 -0
  42. package/dist/orchestration/activities/detect-vendor-activity.d.ts.map +1 -0
  43. package/dist/orchestration/activities/detect-vendor-activity.js +27 -0
  44. package/dist/orchestration/activities/detect-vendor-activity.js.map +1 -0
  45. package/dist/orchestration/activities/index.d.ts +18 -0
  46. package/dist/orchestration/activities/index.d.ts.map +1 -0
  47. package/dist/orchestration/activities/index.js +11 -0
  48. package/dist/orchestration/activities/index.js.map +1 -0
  49. package/dist/orchestration/activities/parse-xml-activity.d.ts +18 -0
  50. package/dist/orchestration/activities/parse-xml-activity.d.ts.map +1 -0
  51. package/dist/orchestration/activities/parse-xml-activity.js +37 -0
  52. package/dist/orchestration/activities/parse-xml-activity.js.map +1 -0
  53. package/dist/orchestration/activities/read-content-activity.d.ts +24 -0
  54. package/dist/orchestration/activities/read-content-activity.d.ts.map +1 -0
  55. package/dist/orchestration/activities/read-content-activity.js +49 -0
  56. package/dist/orchestration/activities/read-content-activity.js.map +1 -0
  57. package/dist/orchestration/activities/transform-qti-to-pie-activity.d.ts +23 -0
  58. package/dist/orchestration/activities/transform-qti-to-pie-activity.d.ts.map +1 -0
  59. package/dist/orchestration/activities/transform-qti-to-pie-activity.js +48 -0
  60. package/dist/orchestration/activities/transform-qti-to-pie-activity.js.map +1 -0
  61. package/dist/orchestration/activities/validate-qti-activity.d.ts +19 -0
  62. package/dist/orchestration/activities/validate-qti-activity.d.ts.map +1 -0
  63. package/dist/orchestration/activities/validate-qti-activity.js +47 -0
  64. package/dist/orchestration/activities/validate-qti-activity.js.map +1 -0
  65. package/dist/orchestration/activities/write-content-activity.d.ts +22 -0
  66. package/dist/orchestration/activities/write-content-activity.d.ts.map +1 -0
  67. package/dist/orchestration/activities/write-content-activity.js +36 -0
  68. package/dist/orchestration/activities/write-content-activity.js.map +1 -0
  69. package/dist/orchestration/in-memory-orchestrator.d.ts +44 -0
  70. package/dist/orchestration/in-memory-orchestrator.d.ts.map +1 -0
  71. package/dist/orchestration/in-memory-orchestrator.js +375 -0
  72. package/dist/orchestration/in-memory-orchestrator.js.map +1 -0
  73. package/dist/orchestration/index.d.ts +7 -0
  74. package/dist/orchestration/index.d.ts.map +1 -0
  75. package/dist/orchestration/index.js +10 -0
  76. package/dist/orchestration/index.js.map +1 -0
  77. package/dist/orchestration/workflows/batch-transform-workflow.d.ts +58 -0
  78. package/dist/orchestration/workflows/batch-transform-workflow.d.ts.map +1 -0
  79. package/dist/orchestration/workflows/batch-transform-workflow.js +100 -0
  80. package/dist/orchestration/workflows/batch-transform-workflow.js.map +1 -0
  81. package/dist/orchestration/workflows/index.d.ts +8 -0
  82. package/dist/orchestration/workflows/index.d.ts.map +1 -0
  83. package/dist/orchestration/workflows/index.js +6 -0
  84. package/dist/orchestration/workflows/index.js.map +1 -0
  85. package/dist/orchestration/workflows/transform-item-workflow.d.ts +57 -0
  86. package/dist/orchestration/workflows/transform-item-workflow.d.ts.map +1 -0
  87. package/dist/orchestration/workflows/transform-item-workflow.js +148 -0
  88. package/dist/orchestration/workflows/transform-item-workflow.js.map +1 -0
  89. package/dist/registry/format-detector-registry.d.ts +55 -0
  90. package/dist/registry/format-detector-registry.d.ts.map +1 -0
  91. package/dist/registry/format-detector-registry.js +55 -0
  92. package/dist/registry/format-detector-registry.js.map +1 -0
  93. package/dist/registry/index.d.ts +1 -1
  94. package/dist/registry/index.d.ts.map +1 -1
  95. package/dist/registry/index.js +1 -1
  96. package/dist/registry/index.js.map +1 -1
  97. package/dist/registry/plugin-registry.d.ts +1 -0
  98. package/dist/registry/plugin-registry.d.ts.map +1 -1
  99. package/dist/registry/plugin-registry.js +6 -2
  100. package/dist/registry/plugin-registry.js.map +1 -1
  101. package/dist/utils/errors.d.ts +79 -0
  102. package/dist/utils/errors.d.ts.map +1 -0
  103. package/dist/utils/errors.js +159 -0
  104. package/dist/utils/errors.js.map +1 -0
  105. package/dist/utils/index.d.ts +1 -1
  106. package/dist/utils/index.d.ts.map +1 -1
  107. package/dist/utils/index.js +1 -1
  108. package/dist/utils/index.js.map +1 -1
  109. package/dist/utils/logger.d.ts +9 -37
  110. package/dist/utils/logger.d.ts.map +1 -1
  111. package/dist/utils/logger.js +10 -58
  112. package/dist/utils/logger.js.map +1 -1
  113. package/package.json +69 -36
  114. package/.turbo/turbo-build.log +0 -1
  115. package/CHANGELOG.md +0 -10
  116. package/VALIDATION.md +0 -217
  117. package/src/engine/index.ts +0 -1
  118. package/src/engine/transform-engine.ts +0 -257
  119. package/src/index.ts +0 -18
  120. package/src/registry/index.ts +0 -1
  121. package/src/registry/plugin-registry.ts +0 -116
  122. package/src/utils/index.ts +0 -1
  123. package/src/utils/logger.ts +0 -79
  124. package/src/utils/validator.ts +0 -193
  125. package/tests/plugin-registry.test.ts +0 -154
  126. package/tests/transform-engine.test.ts +0 -168
  127. package/tests/validator.test.ts +0 -234
  128. package/tsconfig.json +0 -13
  129. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Parse XML Activity
3
+ *
4
+ * Parses QTI XML content into a DOM structure
5
+ */
6
+ import { parse } from 'node-html-parser';
7
+ /**
8
+ * Activity that parses XML content
9
+ */
10
+ export const ParseXmlActivity = {
11
+ type: 'parse-xml',
12
+ name: 'Parse XML',
13
+ async execute(context, input) {
14
+ context.log('debug', 'Parsing XML content', { xmlLength: input.xml.length });
15
+ try {
16
+ const doc = parse(input.xml, {
17
+ lowerCaseTagName: false,
18
+ comment: false,
19
+ });
20
+ context.log('debug', 'XML parsed successfully');
21
+ return { doc };
22
+ }
23
+ catch (error) {
24
+ const errorMsg = error instanceof Error ? error.message : String(error);
25
+ context.log('error', 'Failed to parse XML', { error: errorMsg });
26
+ throw new Error(`XML parsing failed: ${errorMsg}`);
27
+ }
28
+ },
29
+ timeout: 30000, // 30 seconds
30
+ retryPolicy: {
31
+ maxAttempts: 1, // XML parsing shouldn't be retried
32
+ initialInterval: 1000,
33
+ maxInterval: 1000,
34
+ backoffCoefficient: 1,
35
+ },
36
+ };
37
+ //# sourceMappingURL=parse-xml-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-xml-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/parse-xml-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAUtD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA4C;IACvE,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IAEjB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK;QAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE;gBAC3B,gBAAgB,EAAE,KAAK;gBACvB,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;YAChD,OAAO,EAAE,GAAG,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACjE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,aAAa;IAC7B,WAAW,EAAE;QACX,WAAW,EAAE,CAAC,EAAE,mCAAmC;QACnD,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,IAAI;QACjB,kBAAkB,EAAE,CAAC;KACtB;CACF,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Read Content Activity
3
+ *
4
+ * Reads content from storage backend using framework abstraction
5
+ */
6
+ import type { Activity } from '@pie-qti/transform-types';
7
+ import type { StorageBackend } from '@pie-qti/transform-types';
8
+ export interface ReadContentInput {
9
+ uri: string;
10
+ storage: StorageBackend;
11
+ }
12
+ export interface ReadContentOutput {
13
+ content: string;
14
+ metadata?: {
15
+ size: number;
16
+ mimeType?: string;
17
+ lastModified?: Date;
18
+ };
19
+ }
20
+ /**
21
+ * Activity that reads content from storage
22
+ */
23
+ export declare const ReadContentActivity: Activity<ReadContentInput, ReadContentOutput>;
24
+ //# sourceMappingURL=read-content-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-content-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/read-content-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,IAAI,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,iBAAiB,CA2C7E,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Read Content Activity
3
+ *
4
+ * Reads content from storage backend using framework abstraction
5
+ */
6
+ /**
7
+ * Activity that reads content from storage
8
+ */
9
+ export const ReadContentActivity = {
10
+ type: 'read-content',
11
+ name: 'Read Content',
12
+ async execute(context, input) {
13
+ context.log('debug', `Reading content from: ${input.uri}`);
14
+ try {
15
+ const content = await input.storage.readText(input.uri);
16
+ // Get metadata if supported
17
+ let metadata;
18
+ if (input.storage.getMetadata) {
19
+ try {
20
+ const meta = await input.storage.getMetadata(input.uri);
21
+ metadata = {
22
+ size: meta.size,
23
+ mimeType: meta.mimeType,
24
+ lastModified: meta.lastModified,
25
+ };
26
+ }
27
+ catch {
28
+ // Metadata not available
29
+ }
30
+ }
31
+ context.log('info', `Content read successfully: ${content.length} bytes`);
32
+ return { content, metadata };
33
+ }
34
+ catch (error) {
35
+ const errorMsg = error instanceof Error ? error.message : String(error);
36
+ context.log('error', `Failed to read content: ${errorMsg}`);
37
+ throw new Error(`Failed to read ${input.uri}: ${errorMsg}`);
38
+ }
39
+ },
40
+ timeout: 60000, // 1 minute
41
+ retryPolicy: {
42
+ maxAttempts: 3,
43
+ initialInterval: 1000,
44
+ maxInterval: 10000,
45
+ backoffCoefficient: 2,
46
+ nonRetryableErrors: ['NotFoundError'],
47
+ },
48
+ };
49
+ //# sourceMappingURL=read-content-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-content-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/read-content-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAkD;IAChF,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IAEpB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK;QAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,yBAAyB,KAAK,CAAC,GAAG,EAAE,CAA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AAC;KACtC;CACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Transform QTI to PIE Activity
3
+ *
4
+ * Core transformation activity that converts QTI content to PIE format
5
+ */
6
+ import type { Activity, TransformPlugin, TransformContext } from '@pie-qti/transform-types';
7
+ import type { VendorInfo } from './detect-vendor-activity.js';
8
+ export interface TransformQtiToPieInput {
9
+ xml: string;
10
+ itemId: string;
11
+ vendorInfo: VendorInfo | null;
12
+ plugin: TransformPlugin;
13
+ context: TransformContext;
14
+ }
15
+ export interface TransformQtiToPieOutput {
16
+ pieConfig: unknown;
17
+ warnings: unknown[];
18
+ }
19
+ /**
20
+ * Activity that performs the core QTI to PIE transformation
21
+ */
22
+ export declare const TransformQtiToPieActivity: Activity<TransformQtiToPieInput, TransformQtiToPieOutput>;
23
+ //# sourceMappingURL=transform-qti-to-pie-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-qti-to-pie-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/transform-qti-to-pie-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAkB,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB,CA2C/F,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Transform QTI to PIE Activity
3
+ *
4
+ * Core transformation activity that converts QTI content to PIE format
5
+ */
6
+ /**
7
+ * Activity that performs the core QTI to PIE transformation
8
+ */
9
+ export const TransformQtiToPieActivity = {
10
+ type: 'transform-qti-to-pie',
11
+ name: 'Transform QTI to PIE',
12
+ async execute(context, input) {
13
+ context.log('info', `Transforming item: ${input.itemId}`);
14
+ // Send heartbeat for long-running transformations
15
+ const heartbeatInterval = setInterval(() => {
16
+ context.heartbeat({ itemId: input.itemId });
17
+ }, 5000);
18
+ try {
19
+ const transformInput = {
20
+ content: input.xml,
21
+ format: 'qti22',
22
+ };
23
+ const result = await input.plugin.transform(transformInput, input.context);
24
+ context.log('info', `Transformation complete: ${result.items.length} items produced`);
25
+ return {
26
+ pieConfig: result.items.length === 1 ? result.items[0] : result.items,
27
+ warnings: result.warnings || [],
28
+ };
29
+ }
30
+ catch (error) {
31
+ const errorMsg = error instanceof Error ? error.message : String(error);
32
+ context.log('error', `Transformation failed: ${errorMsg}`);
33
+ throw error;
34
+ }
35
+ finally {
36
+ clearInterval(heartbeatInterval);
37
+ }
38
+ },
39
+ timeout: 120000, // 2 minutes
40
+ retryPolicy: {
41
+ maxAttempts: 3,
42
+ initialInterval: 2000,
43
+ maxInterval: 30000,
44
+ backoffCoefficient: 2,
45
+ nonRetryableErrors: ['ValidationError', 'ParseError'],
46
+ },
47
+ };
48
+ //# sourceMappingURL=transform-qti-to-pie-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-qti-to-pie-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/transform-qti-to-pie-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA8D;IAClG,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,sBAAsB;IAE5B,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK;QAC1B,OAAO,CAAC,GAAG,CAAC,M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eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,CAAC;QACrB,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,YAAY,CAAC;KACtD;CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Validate QTI Activity
3
+ *
4
+ * Validates QTI XML content against schema
5
+ */
6
+ import type { Activity } from '@pie-qti/transform-types';
7
+ export interface ValidateQtiInput {
8
+ xml: string;
9
+ }
10
+ export interface ValidateQtiOutput {
11
+ valid: boolean;
12
+ errors: string[];
13
+ warnings: string[];
14
+ }
15
+ /**
16
+ * Activity that validates QTI content
17
+ */
18
+ export declare const ValidateQtiActivity: Activity<ValidateQtiInput, ValidateQtiOutput>;
19
+ //# sourceMappingURL=validate-qti-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-qti-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/validate-qti-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,iBAAiB,CA8C7E,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Validate QTI Activity
3
+ *
4
+ * Validates QTI XML content against schema
5
+ */
6
+ /**
7
+ * Activity that validates QTI content
8
+ */
9
+ export const ValidateQtiActivity = {
10
+ type: 'validate-qti',
11
+ name: 'Validate QTI',
12
+ async execute(context, input) {
13
+ context.log('debug', 'Validating QTI content');
14
+ const errors = [];
15
+ const warnings = [];
16
+ // Basic validation checks
17
+ if (!input.xml.includes('<assessmentItem') && !input.xml.includes('<assessmentTest')) {
18
+ errors.push('No assessmentItem or assessmentTest element found');
19
+ }
20
+ // Check for required attributes
21
+ if (!input.xml.match(/identifier\s*=/)) {
22
+ errors.push('Missing identifier attribute');
23
+ }
24
+ // Check for well-formed XML
25
+ const openTags = input.xml.match(/<[^/!][^>]*>/g) || [];
26
+ const closeTags = input.xml.match(/<\/[^>]+>/g) || [];
27
+ if (openTags.length !== closeTags.length) {
28
+ warnings.push('Potential XML structure issue: tag count mismatch');
29
+ }
30
+ const valid = errors.length === 0;
31
+ if (valid) {
32
+ context.log('info', 'QTI validation passed', { warnings: warnings.length });
33
+ }
34
+ else {
35
+ context.log('error', 'QTI validation failed', { errors: errors.length });
36
+ }
37
+ return { valid, errors, warnings };
38
+ },
39
+ timeout: 30000, // 30 seconds
40
+ retryPolicy: {
41
+ maxAttempts: 1, // Validation shouldn't be retried
42
+ initialInterval: 1000,
43
+ maxInterval: 1000,
44
+ backoffCoefficient: 1,
45
+ },
46
+ };
47
+ //# sourceMappingURL=validate-qti-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-qti-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/validate-qti-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAkD;IAChF,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IAEpB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK;QAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,0BAA0B;QAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,iBA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 * Writes content to storage backend using framework abstraction
5
+ */
6
+ import type { Activity } from '@pie-qti/transform-types';
7
+ import type { StorageBackend, WriteOptions } from '@pie-qti/transform-types';
8
+ export interface WriteContentInput {
9
+ uri: string;
10
+ content: string | Buffer;
11
+ storage: StorageBackend;
12
+ options?: WriteOptions;
13
+ }
14
+ export interface WriteContentOutput {
15
+ uri: string;
16
+ size: number;
17
+ }
18
+ /**
19
+ * Activity that writes content to storage
20
+ */
21
+ export declare const WriteContentActivity: Activity<WriteContentInput, WriteContentOutput>;
22
+ //# sourceMappingURL=write-content-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-content-activity.d.ts","sourceRoot":"","sources":["../../../src/orchestration/activities/write-content-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7E,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,kBAAkB,CA+BhF,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Write Content Activity
3
+ *
4
+ * Writes content to storage backend using framework abstraction
5
+ */
6
+ /**
7
+ * Activity that writes content to storage
8
+ */
9
+ export const WriteContentActivity = {
10
+ type: 'write-content',
11
+ name: 'Write Content',
12
+ async execute(context, input) {
13
+ context.log('debug', `Writing content to: ${input.uri}`);
14
+ try {
15
+ await input.storage.write(input.uri, input.content, input.options);
16
+ const size = typeof input.content === 'string'
17
+ ? Buffer.byteLength(input.content, 'utf-8')
18
+ : input.content.length;
19
+ context.log('info', `Content written successfully: ${size} bytes`);
20
+ return { uri: input.uri, size };
21
+ }
22
+ catch (error) {
23
+ const errorMsg = error instanceof Error ? error.message : String(error);
24
+ context.log('error', `Failed to write content: ${errorMsg}`);
25
+ throw new Error(`Failed to write ${input.uri}: ${errorMsg}`);
26
+ }
27
+ },
28
+ timeout: 60000, // 1 minute
29
+ retryPolicy: {
30
+ maxAttempts: 3,
31
+ initialInterval: 1000,
32
+ maxInterval: 10000,
33
+ backoffCoefficient: 2,
34
+ },
35
+ };
36
+ //# sourceMappingURL=write-content-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-content-activity.js","sourceRoot":"","sources":["../../../src/orchestration/activities/write-content-activity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH;;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,uBAAuB,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;QAEzD,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAEnE,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;gBAC5C,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC;gBAC3C,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAEzB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iCAAiC,IAAI,QAAQ,CAAC,CAAC;YAEnE,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,4BAA4B,QAAQ,EAAE,CAAC,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,WAAW;IAC3B,WAAW,EAAE;QACX,WAAW,EAAE,CAAC;QACd,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,CAAC;KACtB;CACF,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * In-memory workflow orchestrator
3
+ *
4
+ * Simple orchestrator for development and CLI usage.
5
+ * No external dependencies, all execution happens in-process.
6
+ */
7
+ import type { OrchestratorConfig, WorkflowDefinition, WorkflowEvent, WorkflowFilter, WorkflowHandle, WorkflowInfo, WorkflowOptions, WorkflowOrchestrator } from '@pie-qti/transform-types';
8
+ /**
9
+ * In-memory implementation of workflow orchestrator
10
+ */
11
+ export declare class InMemoryOrchestrator implements WorkflowOrchestrator {
12
+ readonly name = "in-memory";
13
+ private config?;
14
+ private executions;
15
+ private eventListeners;
16
+ initialize(config: OrchestratorConfig): Promise<void>;
17
+ startWorkflow<TInput, TOutput>(definition: WorkflowDefinition<TInput, TOutput>, input: TInput, options?: WorkflowOptions): Promise<WorkflowHandle<TOutput>>;
18
+ getWorkflow<TOutput>(workflowId: string): Promise<WorkflowHandle<TOutput>>;
19
+ listWorkflows(filter?: WorkflowFilter): Promise<WorkflowInfo[]>;
20
+ on(_event: 'workflow-event', listener: (event: WorkflowEvent) => void): void;
21
+ off(_event: 'workflow-event', listener: (event: WorkflowEvent) => void): void;
22
+ shutdown(): Promise<void>;
23
+ /**
24
+ * Create workflow context for execution
25
+ */
26
+ private createWorkflowContext;
27
+ /**
28
+ * Execute workflow with timeout handling
29
+ */
30
+ private executeWorkflow;
31
+ /**
32
+ * Execute activity with retry logic
33
+ */
34
+ private executeActivityWithRetry;
35
+ /**
36
+ * Create workflow handle
37
+ */
38
+ private createWorkflowHandle;
39
+ /**
40
+ * Emit workflow event to listeners
41
+ */
42
+ private emitEvent;
43
+ }
44
+ //# sourceMappingURL=in-memory-orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory-orchestrator.d.ts","sourceRoot":"","sources":["../../src/orchestration/in-memory-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAGV,kBAAkB,EAGlB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,oBAAoB,EAGrB,MAAM,0BAA0B,CAAC;AA4BlC;;GAEG;AACH,qBAAa,oBAAqB,YAAW,oBAAoB;IAC/D,QAAQ,CAAC,IAAI,eAAe;IAE5B,OAAO,CAAC,MAAM,CAAC,CAAqB;IACpC,OAAO,CAAC,UAAU,CAAsC;IACxD,OAAO,CAAC,cAAc,CAA6C;IAE7D,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,aAAa,CAAC,MAAM,EAAE,OAAO,EACjC,UAAU,EAAE,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/C,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IA+D7B,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAQ1E,aAAa,CAAC,MAAM,CAAC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