@codenkay/questionbankextractor-processing-contracts 0.0.0-stage → 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0
4
+
5
+ - Initial public package under `@codenkay/questionbankextractor-*`
6
+ - Renamed from private `@cwte/*` workspace scope
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # `@codenkay/questionbankextractor-processing-contracts`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Reader / parser / pipeline stage TypeScript contracts for the Question Extraction Studio engine.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @codenkay/questionbankextractor-processing-contracts \
9
+ @codenkay/questionbankextractor-document-ir \
10
+ @codenkay/questionbankextractor-question-schema
11
+ ```
12
+
13
+ Most portals and websites do **not** need this package — use it when extending the extraction engine, not when rendering Question JSON.
package/dist/index.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/index.ts
17
+ var index_exports = {};
18
+ module.exports = __toCommonJS(index_exports);
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { DocumentIr } from '@codenkay/questionbankextractor-document-ir';\nimport type { ChartItem, MediaItem, QuestionDocument } from '@codenkay/questionbankextractor-question-schema';\n\nexport type SourceFormat = 'docx' | 'pdf';\n\nexport interface ReadContext {\n jobId: string;\n filePath: string;\n fileName: string;\n buffer: Buffer;\n language?: 'en' | 'hi' | 'auto';\n profile?: string;\n signal?: AbortSignal;\n}\n\nexport interface IDocumentReader {\n readonly id: string;\n supports(input: { mimeType?: string; fileName: string; buffer: Buffer }): boolean;\n read(ctx: ReadContext): Promise<DocumentIr>;\n}\n\nexport interface IDocumentNormalizer {\n normalize(ir: DocumentIr): Promise<DocumentIr>;\n}\n\nexport interface IOcrProvider {\n readonly id: string;\n recognizePage(input: {\n image: Buffer;\n languages: Array<'en' | 'hi'>;\n }): Promise<{ text: string; confidence: number; blocks?: unknown[] }>;\n}\n\nexport interface IQuestionParser {\n readonly profileId: string;\n parse(ir: DocumentIr, opts?: { language?: 'en' | 'hi' }): Promise<QuestionDocument>;\n}\n\nexport interface IMathProcessor {\n process(ir: DocumentIr): Promise<DocumentIr>;\n}\n\nexport interface IChartProcessor {\n process(ir: DocumentIr): Promise<{ ir: DocumentIr; charts: ChartItem[] }>;\n}\n\nexport interface ITableProcessor {\n process(ir: DocumentIr): Promise<DocumentIr>;\n}\n\nexport interface StoredMedia {\n id: string;\n mimeType: string;\n byteSize: number;\n sha256: string;\n storage: 'base64' | 'local' | 's3';\n ref: string;\n width?: number;\n height?: number;\n category?: MediaItem['category'];\n originalName?: string;\n}\n\nexport interface IMediaStorage {\n readonly driver: 'base64' | 'local' | 's3';\n store(input: {\n jobId: string;\n buffer: Buffer;\n mimeType: string;\n originalName?: string;\n category?: MediaItem['category'];\n }): Promise<StoredMedia>;\n resolve(jobId: string, mediaId: string): Promise<{ buffer: Buffer; mimeType: string }>;\n}\n\nexport interface IMediaProcessor {\n extract(ir: DocumentIr, storage: IMediaStorage, jobId: string): Promise<{\n ir: DocumentIr;\n media: MediaItem[];\n }>;\n}\n\nexport interface ValidationIssue {\n code: string;\n message: string;\n path?: string;\n questionNo?: number;\n}\n\nexport interface IContentValidator {\n validate(doc: QuestionDocument): ValidationIssue[];\n}\n\nexport type ExportMode = 'question' | 'complete' | 'zip' | 'validation';\n\nexport interface IJsonExporter {\n export(\n doc: QuestionDocument,\n mode: ExportMode,\n opts?: { ir?: DocumentIr; mediaDir?: string },\n ): Promise<{ contentType: string; body: Buffer | string; fileName: string }>;\n}\n\nexport interface PipelineProgress {\n jobId: string;\n stage: string;\n percent: number;\n pagesProcessed?: number;\n questionsDetected?: number;\n questionsExtracted?: number;\n warnings?: number;\n errors?: number;\n mediaCount?: number;\n durationMs?: number;\n message?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,121 @@
1
+ import { DocumentIr } from '@codenkay/questionbankextractor-document-ir';
2
+ import { ChartItem, QuestionDocument, MediaItem } from '@codenkay/questionbankextractor-question-schema';
3
+
4
+ type SourceFormat = 'docx' | 'pdf';
5
+ interface ReadContext {
6
+ jobId: string;
7
+ filePath: string;
8
+ fileName: string;
9
+ buffer: Buffer;
10
+ language?: 'en' | 'hi' | 'auto';
11
+ profile?: string;
12
+ signal?: AbortSignal;
13
+ }
14
+ interface IDocumentReader {
15
+ readonly id: string;
16
+ supports(input: {
17
+ mimeType?: string;
18
+ fileName: string;
19
+ buffer: Buffer;
20
+ }): boolean;
21
+ read(ctx: ReadContext): Promise<DocumentIr>;
22
+ }
23
+ interface IDocumentNormalizer {
24
+ normalize(ir: DocumentIr): Promise<DocumentIr>;
25
+ }
26
+ interface IOcrProvider {
27
+ readonly id: string;
28
+ recognizePage(input: {
29
+ image: Buffer;
30
+ languages: Array<'en' | 'hi'>;
31
+ }): Promise<{
32
+ text: string;
33
+ confidence: number;
34
+ blocks?: unknown[];
35
+ }>;
36
+ }
37
+ interface IQuestionParser {
38
+ readonly profileId: string;
39
+ parse(ir: DocumentIr, opts?: {
40
+ language?: 'en' | 'hi';
41
+ }): Promise<QuestionDocument>;
42
+ }
43
+ interface IMathProcessor {
44
+ process(ir: DocumentIr): Promise<DocumentIr>;
45
+ }
46
+ interface IChartProcessor {
47
+ process(ir: DocumentIr): Promise<{
48
+ ir: DocumentIr;
49
+ charts: ChartItem[];
50
+ }>;
51
+ }
52
+ interface ITableProcessor {
53
+ process(ir: DocumentIr): Promise<DocumentIr>;
54
+ }
55
+ interface StoredMedia {
56
+ id: string;
57
+ mimeType: string;
58
+ byteSize: number;
59
+ sha256: string;
60
+ storage: 'base64' | 'local' | 's3';
61
+ ref: string;
62
+ width?: number;
63
+ height?: number;
64
+ category?: MediaItem['category'];
65
+ originalName?: string;
66
+ }
67
+ interface IMediaStorage {
68
+ readonly driver: 'base64' | 'local' | 's3';
69
+ store(input: {
70
+ jobId: string;
71
+ buffer: Buffer;
72
+ mimeType: string;
73
+ originalName?: string;
74
+ category?: MediaItem['category'];
75
+ }): Promise<StoredMedia>;
76
+ resolve(jobId: string, mediaId: string): Promise<{
77
+ buffer: Buffer;
78
+ mimeType: string;
79
+ }>;
80
+ }
81
+ interface IMediaProcessor {
82
+ extract(ir: DocumentIr, storage: IMediaStorage, jobId: string): Promise<{
83
+ ir: DocumentIr;
84
+ media: MediaItem[];
85
+ }>;
86
+ }
87
+ interface ValidationIssue {
88
+ code: string;
89
+ message: string;
90
+ path?: string;
91
+ questionNo?: number;
92
+ }
93
+ interface IContentValidator {
94
+ validate(doc: QuestionDocument): ValidationIssue[];
95
+ }
96
+ type ExportMode = 'question' | 'complete' | 'zip' | 'validation';
97
+ interface IJsonExporter {
98
+ export(doc: QuestionDocument, mode: ExportMode, opts?: {
99
+ ir?: DocumentIr;
100
+ mediaDir?: string;
101
+ }): Promise<{
102
+ contentType: string;
103
+ body: Buffer | string;
104
+ fileName: string;
105
+ }>;
106
+ }
107
+ interface PipelineProgress {
108
+ jobId: string;
109
+ stage: string;
110
+ percent: number;
111
+ pagesProcessed?: number;
112
+ questionsDetected?: number;
113
+ questionsExtracted?: number;
114
+ warnings?: number;
115
+ errors?: number;
116
+ mediaCount?: number;
117
+ durationMs?: number;
118
+ message?: string;
119
+ }
120
+
121
+ export type { ExportMode, IChartProcessor, IContentValidator, IDocumentNormalizer, IDocumentReader, IJsonExporter, IMathProcessor, IMediaProcessor, IMediaStorage, IOcrProvider, IQuestionParser, ITableProcessor, PipelineProgress, ReadContext, SourceFormat, StoredMedia, ValidationIssue };
@@ -0,0 +1,121 @@
1
+ import { DocumentIr } from '@codenkay/questionbankextractor-document-ir';
2
+ import { ChartItem, QuestionDocument, MediaItem } from '@codenkay/questionbankextractor-question-schema';
3
+
4
+ type SourceFormat = 'docx' | 'pdf';
5
+ interface ReadContext {
6
+ jobId: string;
7
+ filePath: string;
8
+ fileName: string;
9
+ buffer: Buffer;
10
+ language?: 'en' | 'hi' | 'auto';
11
+ profile?: string;
12
+ signal?: AbortSignal;
13
+ }
14
+ interface IDocumentReader {
15
+ readonly id: string;
16
+ supports(input: {
17
+ mimeType?: string;
18
+ fileName: string;
19
+ buffer: Buffer;
20
+ }): boolean;
21
+ read(ctx: ReadContext): Promise<DocumentIr>;
22
+ }
23
+ interface IDocumentNormalizer {
24
+ normalize(ir: DocumentIr): Promise<DocumentIr>;
25
+ }
26
+ interface IOcrProvider {
27
+ readonly id: string;
28
+ recognizePage(input: {
29
+ image: Buffer;
30
+ languages: Array<'en' | 'hi'>;
31
+ }): Promise<{
32
+ text: string;
33
+ confidence: number;
34
+ blocks?: unknown[];
35
+ }>;
36
+ }
37
+ interface IQuestionParser {
38
+ readonly profileId: string;
39
+ parse(ir: DocumentIr, opts?: {
40
+ language?: 'en' | 'hi';
41
+ }): Promise<QuestionDocument>;
42
+ }
43
+ interface IMathProcessor {
44
+ process(ir: DocumentIr): Promise<DocumentIr>;
45
+ }
46
+ interface IChartProcessor {
47
+ process(ir: DocumentIr): Promise<{
48
+ ir: DocumentIr;
49
+ charts: ChartItem[];
50
+ }>;
51
+ }
52
+ interface ITableProcessor {
53
+ process(ir: DocumentIr): Promise<DocumentIr>;
54
+ }
55
+ interface StoredMedia {
56
+ id: string;
57
+ mimeType: string;
58
+ byteSize: number;
59
+ sha256: string;
60
+ storage: 'base64' | 'local' | 's3';
61
+ ref: string;
62
+ width?: number;
63
+ height?: number;
64
+ category?: MediaItem['category'];
65
+ originalName?: string;
66
+ }
67
+ interface IMediaStorage {
68
+ readonly driver: 'base64' | 'local' | 's3';
69
+ store(input: {
70
+ jobId: string;
71
+ buffer: Buffer;
72
+ mimeType: string;
73
+ originalName?: string;
74
+ category?: MediaItem['category'];
75
+ }): Promise<StoredMedia>;
76
+ resolve(jobId: string, mediaId: string): Promise<{
77
+ buffer: Buffer;
78
+ mimeType: string;
79
+ }>;
80
+ }
81
+ interface IMediaProcessor {
82
+ extract(ir: DocumentIr, storage: IMediaStorage, jobId: string): Promise<{
83
+ ir: DocumentIr;
84
+ media: MediaItem[];
85
+ }>;
86
+ }
87
+ interface ValidationIssue {
88
+ code: string;
89
+ message: string;
90
+ path?: string;
91
+ questionNo?: number;
92
+ }
93
+ interface IContentValidator {
94
+ validate(doc: QuestionDocument): ValidationIssue[];
95
+ }
96
+ type ExportMode = 'question' | 'complete' | 'zip' | 'validation';
97
+ interface IJsonExporter {
98
+ export(doc: QuestionDocument, mode: ExportMode, opts?: {
99
+ ir?: DocumentIr;
100
+ mediaDir?: string;
101
+ }): Promise<{
102
+ contentType: string;
103
+ body: Buffer | string;
104
+ fileName: string;
105
+ }>;
106
+ }
107
+ interface PipelineProgress {
108
+ jobId: string;
109
+ stage: string;
110
+ percent: number;
111
+ pagesProcessed?: number;
112
+ questionsDetected?: number;
113
+ questionsExtracted?: number;
114
+ warnings?: number;
115
+ errors?: number;
116
+ mediaCount?: number;
117
+ durationMs?: number;
118
+ message?: string;
119
+ }
120
+
121
+ export type { ExportMode, IChartProcessor, IContentValidator, IDocumentNormalizer, IDocumentReader, IJsonExporter, IMathProcessor, IMediaProcessor, IMediaStorage, IOcrProvider, IQuestionParser, ITableProcessor, PipelineProgress, ReadContext, SourceFormat, StoredMedia, ValidationIssue };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@codenkay/questionbankextractor-processing-contracts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Careerwill Question Extraction Studio — reader, parser, and pipeline stage contracts",
5
+ "license": "UNLICENSED",
6
+ "author": "Careerwill",
7
+ "homepage": "https://github.com/codenannu/question-bank-extractor#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/codenannu/question-bank-extractor.git",
11
+ "directory": "packages/processing-contracts"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/codenannu/question-bank-extractor/issues"
15
+ },
16
+ "keywords": [
17
+ "careerwill",
18
+ "extraction",
19
+ "contracts"
20
+ ],
21
+ "main": "./dist/index.cjs",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.cjs"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "CHANGELOG.md"
34
+ ],
35
+ "sideEffects": false,
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "scripts": {
40
+ "build": "tsup",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit"
42
+ },
43
+ "peerDependencies": {
44
+ "@codenkay/questionbankextractor-document-ir": "^1.0.0",
45
+ "@codenkay/questionbankextractor-question-schema": "^1.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@codenkay/questionbankextractor-document-ir": "*",
49
+ "@codenkay/questionbankextractor-question-schema": "*",
50
+ "tsup": "^8.5.1",
51
+ "typescript": "^5.7.3"
52
+ },
53
+ "type": "module",
54
+ "module": "./dist/index.js"
55
+ }