@kodexa-ai/document-wasm-ts 8.0.0-develop-20663153063 → 8.0.0-develop-20664344428

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.
@@ -0,0 +1,252 @@
1
+ /**
2
+ * KodexaWorker - Main Thread Proxy for Web Worker WASM
3
+ *
4
+ * This class manages a web worker that runs the Go WASM module.
5
+ * All document operations are performed in the worker, keeping
6
+ * the main thread responsive.
7
+ *
8
+ * Usage:
9
+ * ```typescript
10
+ * const kodexa = new KodexaWorker();
11
+ * await kodexa.init();
12
+ *
13
+ * const doc = await kodexa.createDocument();
14
+ * const root = await doc.getRoot();
15
+ *
16
+ * await doc.dispose();
17
+ * kodexa.terminate();
18
+ * ```
19
+ */
20
+ import { KodexaWorkerDocument } from './KodexaWorkerDocument';
21
+ /**
22
+ * Main thread proxy for Kodexa Web Worker.
23
+ *
24
+ * Creates and manages a web worker that runs the Go WASM module.
25
+ * Provides promise-based API that mirrors the regular Kodexa API.
26
+ */
27
+ export class KodexaWorker {
28
+ /**
29
+ * Create a new KodexaWorker instance.
30
+ *
31
+ * @param options Configuration options
32
+ */
33
+ constructor(options = {}) {
34
+ this.pending = new Map();
35
+ this.nextId = 0;
36
+ this.terminated = false;
37
+ this.config = {
38
+ wasmBaseUrl: options.wasmBaseUrl,
39
+ logLevel: options.logLevel,
40
+ };
41
+ // Determine worker URL
42
+ let workerUrl;
43
+ if (options.workerUrl) {
44
+ workerUrl = options.workerUrl;
45
+ }
46
+ else {
47
+ // Default: use worker from same directory as this module
48
+ // This works when the package is properly built with worker bundle
49
+ workerUrl = new URL('./kodexa-worker.js', import.meta.url);
50
+ }
51
+ this.worker = new Worker(workerUrl, { type: 'module' });
52
+ // Set up ready promise
53
+ this.ready = new Promise((resolve, reject) => {
54
+ this.readyResolve = resolve;
55
+ this.readyReject = reject;
56
+ });
57
+ // Handle messages from worker
58
+ this.worker.onmessage = this.handleMessage.bind(this);
59
+ this.worker.onerror = this.handleError.bind(this);
60
+ }
61
+ /**
62
+ * Handle messages from the worker.
63
+ */
64
+ handleMessage(event) {
65
+ const data = event.data;
66
+ // Handle ready message
67
+ if ('type' in data && data.type === 'ready') {
68
+ this.readyResolve();
69
+ return;
70
+ }
71
+ // Handle error message during initialization
72
+ if ('type' in data && data.type === 'error') {
73
+ this.readyReject(new Error(data.error));
74
+ return;
75
+ }
76
+ // Handle RPC response
77
+ if ('id' in data) {
78
+ const response = data;
79
+ const handler = this.pending.get(response.id);
80
+ if (handler) {
81
+ this.pending.delete(response.id);
82
+ if (response.success) {
83
+ handler.resolve(response.result);
84
+ }
85
+ else {
86
+ handler.reject(new Error(response.error || 'Unknown worker error'));
87
+ }
88
+ }
89
+ }
90
+ }
91
+ /**
92
+ * Handle worker errors.
93
+ */
94
+ handleError(event) {
95
+ console.error('[KodexaWorker] Worker error:', event.message);
96
+ this.readyReject(new Error(`Worker error: ${event.message}`));
97
+ // Reject all pending requests
98
+ for (const [id, handler] of this.pending) {
99
+ handler.reject(new Error('Worker terminated unexpectedly'));
100
+ this.pending.delete(id);
101
+ }
102
+ }
103
+ /**
104
+ * Initialize the worker and load WASM.
105
+ * Must be called before any other methods.
106
+ */
107
+ async init() {
108
+ if (this.terminated) {
109
+ throw new Error('Worker has been terminated');
110
+ }
111
+ // Send init message to worker
112
+ this.worker.postMessage({
113
+ type: 'init',
114
+ config: this.config,
115
+ });
116
+ // Wait for ready signal
117
+ await this.ready;
118
+ }
119
+ /**
120
+ * Call a Go WASM function in the worker.
121
+ *
122
+ * @param method Function name (e.g., 'createDocument', 'documentGetRoot')
123
+ * @param args Arguments to pass to the function
124
+ * @returns Promise that resolves with the function result
125
+ */
126
+ async call(method, ...args) {
127
+ if (this.terminated) {
128
+ throw new Error('Worker has been terminated');
129
+ }
130
+ // Wait for initialization
131
+ await this.ready;
132
+ // Generate unique request ID
133
+ const id = String(++this.nextId);
134
+ // Create promise for response
135
+ return new Promise((resolve, reject) => {
136
+ this.pending.set(id, {
137
+ resolve: resolve,
138
+ reject,
139
+ });
140
+ // Send request to worker
141
+ const request = {
142
+ id,
143
+ type: 'call',
144
+ method,
145
+ args,
146
+ };
147
+ this.worker.postMessage(request);
148
+ });
149
+ }
150
+ /**
151
+ * Create a new empty document.
152
+ */
153
+ async createDocument() {
154
+ const docRef = await this.call('createDocument');
155
+ return new KodexaWorkerDocument(this, docRef);
156
+ }
157
+ /**
158
+ * Create a document from text content.
159
+ *
160
+ * @param text Text content for the document
161
+ */
162
+ async fromText(text) {
163
+ const docRef = await this.call('createDocumentFromText', text);
164
+ return new KodexaWorkerDocument(this, docRef);
165
+ }
166
+ /**
167
+ * Create a document from JSON.
168
+ *
169
+ * @param json JSON string representing the document
170
+ */
171
+ async fromJson(json) {
172
+ const docRef = await this.call('createDocumentFromJson', json);
173
+ return new KodexaWorkerDocument(this, docRef);
174
+ }
175
+ /**
176
+ * Create a document from KDDB bytes.
177
+ *
178
+ * @param bytes KDDB file contents as Uint8Array
179
+ */
180
+ async fromKddb(bytes) {
181
+ // Use the loadDocument function which handles migration
182
+ const docRef = await this.call('loadDocument', bytes);
183
+ if (docRef === 0) {
184
+ throw new Error('Failed to load KDDB document');
185
+ }
186
+ return new KodexaWorkerDocument(this, docRef);
187
+ }
188
+ /**
189
+ * Create a document from KDDB bytes (raw, no migration).
190
+ *
191
+ * @param bytes KDDB file contents as Uint8Array
192
+ */
193
+ async fromKddbBytes(bytes) {
194
+ const docRef = await this.call('createDocumentFromKddbBytes', bytes);
195
+ return new KodexaWorkerDocument(this, docRef);
196
+ }
197
+ /**
198
+ * Get library version information.
199
+ */
200
+ async getLibraryVersion() {
201
+ return this.call('getLibraryVersion');
202
+ }
203
+ /**
204
+ * Get build information.
205
+ */
206
+ async getBuildInfo() {
207
+ return this.call('getBuildInfo');
208
+ }
209
+ /**
210
+ * Cleanup all resources in the worker.
211
+ */
212
+ async cleanup() {
213
+ await this.call('cleanup');
214
+ }
215
+ /**
216
+ * Get active handle count (for debugging).
217
+ */
218
+ async getActiveHandles() {
219
+ return this.call('getActiveHandles');
220
+ }
221
+ /**
222
+ * Set the log level for Go WASM logging.
223
+ *
224
+ * @param level Log level ('debug', 'info', 'warn', 'error')
225
+ */
226
+ async setLogLevel(level) {
227
+ return this.call('kodexa_setLogLevel', level);
228
+ }
229
+ /**
230
+ * Terminate the worker.
231
+ * After calling this, the worker cannot be used.
232
+ */
233
+ terminate() {
234
+ if (this.terminated) {
235
+ return;
236
+ }
237
+ this.terminated = true;
238
+ this.worker.terminate();
239
+ // Reject all pending requests
240
+ for (const [id, handler] of this.pending) {
241
+ handler.reject(new Error('Worker terminated'));
242
+ this.pending.delete(id);
243
+ }
244
+ }
245
+ /**
246
+ * Check if the worker has been terminated.
247
+ */
248
+ isTerminated() {
249
+ return this.terminated;
250
+ }
251
+ }
252
+ //# sourceMappingURL=KodexaWorker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KodexaWorker.js","sourceRoot":"","sources":["../../src/worker/KodexaWorker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAa9D;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAUvB;;;;OAIG;IACH,YAAY,UAA+B,EAAE;QAVrC,YAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;QAC5C,WAAM,GAAG,CAAC,CAAC;QACX,eAAU,GAAG,KAAK,CAAC;QASzB,IAAI,CAAC,MAAM,GAAG;YACZ,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;QAEF,uBAAuB;QACvB,IAAI,SAAuB,CAAC;QAC5B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,yDAAyD;YACzD,mEAAmE;YACnE,SAAS,GAAG,IAAI,GAAG,CAAC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ED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAExB,8BAA8B;QAC9B,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACzC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * KodexaWorkerDocument - Document Proxy for Web Worker WASM
3
+ *
4
+ * This class provides a document API that mirrors KddbDocument but
5
+ * routes all operations through the web worker via RPC.
6
+ */
7
+ import type { KodexaWorker } from './KodexaWorker';
8
+ import { KodexaWorkerNode } from './KodexaWorkerNode';
9
+ /**
10
+ * Metadata interface for document metadata.
11
+ */
12
+ export interface DocumentMetadata {
13
+ [key: string]: unknown;
14
+ }
15
+ /**
16
+ * Exception interface for document exceptions.
17
+ */
18
+ export interface ContentException {
19
+ exceptionType: string;
20
+ exceptionTypeId?: string;
21
+ message: string;
22
+ stack?: string;
23
+ timestamp?: Date;
24
+ source?: string;
25
+ severity?: string;
26
+ }
27
+ /**
28
+ * Document proxy that routes operations to the web worker.
29
+ */
30
+ export declare class KodexaWorkerDocument {
31
+ private worker;
32
+ private docRef;
33
+ private disposed;
34
+ /**
35
+ * Create a new document proxy.
36
+ * This should not be called directly - use KodexaWorker.createDocument() instead.
37
+ *
38
+ * @param worker The worker instance to route calls through
39
+ * @param docRef The document reference from the worker
40
+ */
41
+ constructor(worker: KodexaWorker, docRef: number);
42
+ /**
43
+ * Get the document reference (for internal use).
44
+ */
45
+ getDocumentRef(): number;
46
+ /**
47
+ * Check if the document has been disposed.
48
+ */
49
+ private checkDisposed;
50
+ /**
51
+ * Parse JSON result, handling null and error cases.
52
+ */
53
+ private parseJson;
54
+ /**
55
+ * Get the root content node.
56
+ */
57
+ getRoot(): Promise<KodexaWorkerNode | null>;
58
+ /**
59
+ * Get the root content node (alias for getRoot).
60
+ */
61
+ getRootNode(): Promise<KodexaWorkerNode | null>;
62
+ /**
63
+ * Convert document to JSON string.
64
+ */
65
+ toJson(): Promise<string>;
66
+ /**
67
+ * Convert document to KDDB bytes.
68
+ */
69
+ toKddbBytes(): Promise<Uint8Array>;
70
+ /**
71
+ * Get the document UUID.
72
+ */
73
+ getUUID(): Promise<string>;
74
+ /**
75
+ * Create a new node.
76
+ *
77
+ * @param nodeType The type of node to create (e.g., 'page', 'paragraph')
78
+ */
79
+ createNode(nodeType: string): Promise<KodexaWorkerNode>;
80
+ /**
81
+ * Find a node by its UUID.
82
+ */
83
+ findNodeByUUID(uuid: string): Promise<KodexaWorkerNode | null>;
84
+ /**
85
+ * Get node by ID (alias for findNodeByUUID).
86
+ */
87
+ getNodeById(nodeId: string): Promise<KodexaWorkerNode | null>;
88
+ /**
89
+ * Select nodes using a selector expression.
90
+ *
91
+ * @param selector Kodexa selector expression (e.g., '//paragraph', '//page[1]')
92
+ */
93
+ select(selector: string): Promise<KodexaWorkerNode[]>;
94
+ /**
95
+ * Select the first node matching a selector.
96
+ *
97
+ * @param selector Kodexa selector expression
98
+ */
99
+ selectFirst(selector: string): Promise<KodexaWorkerNode | null>;
100
+ /**
101
+ * Get all metadata.
102
+ */
103
+ getMetadata(): Promise<DocumentMetadata>;
104
+ /**
105
+ * Set metadata from object.
106
+ */
107
+ setMetadata(metadata: DocumentMetadata): Promise<void>;
108
+ /**
109
+ * Get all exceptions.
110
+ */
111
+ getExceptions(): Promise<ContentException[]>;
112
+ /**
113
+ * Add an exception.
114
+ */
115
+ addException(exception: ContentException): Promise<void>;
116
+ /**
117
+ * Get all tags in the document.
118
+ */
119
+ getAllTags(): Promise<unknown[]>;
120
+ /**
121
+ * Get tags by prefix.
122
+ */
123
+ getTagsByPrefix(prefix: string): Promise<unknown[]>;
124
+ /**
125
+ * Find nodes by tag UUID.
126
+ */
127
+ findNodesByTagUuid(tagUuid: string): Promise<KodexaWorkerNode[]>;
128
+ /**
129
+ * Get document statistics.
130
+ */
131
+ getStatistics(): Promise<unknown>;
132
+ /**
133
+ * Get the number of pages.
134
+ */
135
+ getNumPages(): Promise<number>;
136
+ /**
137
+ * Get document lines.
138
+ */
139
+ getLines(): Promise<Array<{
140
+ content: string;
141
+ uuid: string;
142
+ }>>;
143
+ /**
144
+ * Get document source.
145
+ */
146
+ getSource(): Promise<string>;
147
+ /**
148
+ * Set document source.
149
+ */
150
+ setSource(source: string): Promise<void>;
151
+ /**
152
+ * Get document labels.
153
+ */
154
+ getLabels(): Promise<string[]>;
155
+ /**
156
+ * Add a label.
157
+ */
158
+ addLabel(label: string): Promise<void>;
159
+ /**
160
+ * Remove a label.
161
+ */
162
+ removeLabel(label: string): Promise<void>;
163
+ /**
164
+ * Get external data by key.
165
+ */
166
+ getExternalData(key: string): Promise<unknown>;
167
+ /**
168
+ * Set external data.
169
+ */
170
+ setExternalData(key: string, data: unknown): Promise<void>;
171
+ /**
172
+ * Get external data keys.
173
+ */
174
+ getExternalDataKeys(): Promise<string[]>;
175
+ /**
176
+ * Get processing steps.
177
+ */
178
+ getSteps(): Promise<unknown[]>;
179
+ /**
180
+ * Set processing steps.
181
+ */
182
+ setSteps(steps: unknown[]): Promise<void>;
183
+ /**
184
+ * Dispose of the document and free resources.
185
+ */
186
+ dispose(): Promise<void>;
187
+ /**
188
+ * Alias for dispose() for compatibility.
189
+ */
190
+ destroy(): Promise<void>;
191
+ }
192
+ //# sourceMappingURL=KodexaWorkerDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KodexaWorkerDocument.d.ts","sourceRoot":"","sources":["../../src/worker/KodexaWorkerDocument.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EA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