@kodexa-ai/document-wasm-ts 8.0.0-20484695702
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/README.md +563 -0
- package/dist/ContentNode.d.ts +207 -0
- package/dist/ContentNode.d.ts.map +1 -0
- package/dist/ContentNode.js +633 -0
- package/dist/ContentNode.js.map +1 -0
- package/dist/ExtractionEngine.d.ts +65 -0
- package/dist/ExtractionEngine.d.ts.map +1 -0
- package/dist/ExtractionEngine.js +115 -0
- package/dist/ExtractionEngine.js.map +1 -0
- package/dist/KddbDocument.d.ts +193 -0
- package/dist/KddbDocument.d.ts.map +1 -0
- package/dist/KddbDocument.js +575 -0
- package/dist/KddbDocument.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96 -0
- package/dist/index.js.map +1 -0
- package/dist/sqljs-bridge.bundle.js +330 -0
- package/dist/wasm/browser-bridge.d.ts +44 -0
- package/dist/wasm/browser-bridge.d.ts.map +1 -0
- package/dist/wasm/browser-bridge.js +104 -0
- package/dist/wasm/browser-bridge.js.map +1 -0
- package/dist/wasm/loader.d.ts +57 -0
- package/dist/wasm/loader.d.ts.map +1 -0
- package/dist/wasm/loader.js +193 -0
- package/dist/wasm/loader.js.map +1 -0
- package/dist/wasm/sqljs-bridge.d.ts +40 -0
- package/dist/wasm/sqljs-bridge.d.ts.map +1 -0
- package/dist/wasm/sqljs-bridge.js +98 -0
- package/dist/wasm/sqljs-bridge.js.map +1 -0
- package/dist/wasm/sqljs-core.d.ts +92 -0
- package/dist/wasm/sqljs-core.d.ts.map +1 -0
- package/dist/wasm/sqljs-core.js +372 -0
- package/dist/wasm/sqljs-core.js.map +1 -0
- package/dist/wasm/types.d.ts +179 -0
- package/dist/wasm/types.d.ts.map +1 -0
- package/dist/wasm/types.js +9 -0
- package/dist/wasm/types.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core sql.js bridge operations - shared between environments
|
|
3
|
+
*
|
|
4
|
+
* This module contains all the database operations that are common between
|
|
5
|
+
* the npm package (sqljs-bridge.ts) and browser CDN (browser-bridge.ts) implementations.
|
|
6
|
+
*
|
|
7
|
+
* The SQL instance is passed in from the wrapper modules, allowing them to
|
|
8
|
+
* load sql.js in different ways (npm import vs CDN global).
|
|
9
|
+
*/
|
|
10
|
+
// Database handle management
|
|
11
|
+
const databases = new Map();
|
|
12
|
+
let nextHandle = 1;
|
|
13
|
+
// Store SQL instance reference for operations that need it
|
|
14
|
+
let sqlInstance = null;
|
|
15
|
+
/**
|
|
16
|
+
* Convert Uint8Array to base64 string efficiently.
|
|
17
|
+
* Uses chunked processing to handle large arrays without stack overflow.
|
|
18
|
+
* @param bytes Uint8Array to convert
|
|
19
|
+
* @returns Base64 encoded string
|
|
20
|
+
*/
|
|
21
|
+
function uint8ArrayToBase64(bytes) {
|
|
22
|
+
// For small arrays, use the simple method
|
|
23
|
+
if (bytes.length < 32768) {
|
|
24
|
+
let binary = '';
|
|
25
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
26
|
+
binary += String.fromCharCode(bytes[i]);
|
|
27
|
+
}
|
|
28
|
+
return btoa(binary);
|
|
29
|
+
}
|
|
30
|
+
// For large arrays, process in chunks to avoid stack overflow
|
|
31
|
+
const chunkSize = 32768;
|
|
32
|
+
let binary = '';
|
|
33
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
34
|
+
const chunk = bytes.subarray(i, Math.min(i + chunkSize, bytes.length));
|
|
35
|
+
binary += String.fromCharCode.apply(null, Array.from(chunk));
|
|
36
|
+
}
|
|
37
|
+
return btoa(binary);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Convert a row object for JSON serialization.
|
|
41
|
+
* Converts Uint8Array (BLOB) to base64-encoded string with "base64:" prefix.
|
|
42
|
+
* @param obj Row object from sql.js
|
|
43
|
+
* @returns Object safe for JSON.stringify
|
|
44
|
+
*/
|
|
45
|
+
function processRowForJson(obj) {
|
|
46
|
+
const result = {};
|
|
47
|
+
for (const key in obj) {
|
|
48
|
+
const value = obj[key];
|
|
49
|
+
if (value instanceof Uint8Array) {
|
|
50
|
+
// Convert BLOB to base64 with prefix for Go to recognize
|
|
51
|
+
try {
|
|
52
|
+
const base64 = uint8ArrayToBase64(value);
|
|
53
|
+
result[key] = 'base64:' + base64;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
console.error(`[sql.js] Failed to convert BLOB column '${key}' (${value.length} bytes):`, err);
|
|
57
|
+
result[key] = null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
result[key] = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// Database Operations
|
|
68
|
+
// ============================================================================
|
|
69
|
+
/**
|
|
70
|
+
* Create a new in-memory database
|
|
71
|
+
* @returns Database handle (positive integer) or 0 on error
|
|
72
|
+
*/
|
|
73
|
+
export function createDatabaseOp() {
|
|
74
|
+
if (!sqlInstance) {
|
|
75
|
+
console.error('[sql.js] Not initialized');
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const db = new sqlInstance.Database();
|
|
80
|
+
const handle = nextHandle++;
|
|
81
|
+
databases.set(handle, db);
|
|
82
|
+
console.log(`[sql.js] Created database with handle ${handle}`);
|
|
83
|
+
return handle;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error('[sql.js] Failed to create database:', error);
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Execute SQL statement without returning results
|
|
92
|
+
* @param handle Database handle
|
|
93
|
+
* @param sql SQL statement
|
|
94
|
+
* @returns 1 on success, 0 on error
|
|
95
|
+
*/
|
|
96
|
+
export function execOp(handle, sql) {
|
|
97
|
+
const db = databases.get(handle);
|
|
98
|
+
if (!db) {
|
|
99
|
+
console.error(`[sql.js] Invalid database handle: ${handle}`);
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
db.run(sql);
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error('[sql.js] Exec failed:', error);
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Execute SQL query with parameters and return results as JSON
|
|
113
|
+
* @param handle Database handle
|
|
114
|
+
* @param sql SQL query with ? placeholders
|
|
115
|
+
* @param paramsJson JSON array of parameters
|
|
116
|
+
* @returns JSON string of results (array of objects) or empty string on error
|
|
117
|
+
*/
|
|
118
|
+
export function queryOp(handle, sql, paramsJson) {
|
|
119
|
+
const db = databases.get(handle);
|
|
120
|
+
if (!db) {
|
|
121
|
+
console.error(`[sql.js] Invalid database handle: ${handle}`);
|
|
122
|
+
return '[]';
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
// Parse parameters
|
|
126
|
+
let params = [];
|
|
127
|
+
if (paramsJson && paramsJson !== '[]' && paramsJson !== 'null') {
|
|
128
|
+
params = JSON.parse(paramsJson);
|
|
129
|
+
}
|
|
130
|
+
// Execute query
|
|
131
|
+
const stmt = db.prepare(sql);
|
|
132
|
+
if (params.length > 0) {
|
|
133
|
+
stmt.bind(params);
|
|
134
|
+
}
|
|
135
|
+
// Collect results - convert Uint8Array to base64 for Go
|
|
136
|
+
const results = [];
|
|
137
|
+
while (stmt.step()) {
|
|
138
|
+
results.push(processRowForJson(stmt.getAsObject()));
|
|
139
|
+
}
|
|
140
|
+
stmt.free();
|
|
141
|
+
return JSON.stringify(results);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
console.error('[sql.js] Query failed:', sql, error);
|
|
145
|
+
return '[]';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Execute INSERT statement and return the last inserted row ID
|
|
150
|
+
* @param handle Database handle
|
|
151
|
+
* @param sql INSERT statement with ? placeholders
|
|
152
|
+
* @param paramsJson JSON array of parameters
|
|
153
|
+
* @returns Last insert row ID or 0 on error
|
|
154
|
+
*/
|
|
155
|
+
export function insertOp(handle, sql, paramsJson) {
|
|
156
|
+
const db = databases.get(handle);
|
|
157
|
+
if (!db) {
|
|
158
|
+
console.error(`[sql.js] Invalid database handle: ${handle}`);
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
// Parse parameters
|
|
163
|
+
let params = [];
|
|
164
|
+
if (paramsJson && paramsJson !== '[]' && paramsJson !== 'null') {
|
|
165
|
+
params = JSON.parse(paramsJson);
|
|
166
|
+
}
|
|
167
|
+
// Execute insert
|
|
168
|
+
if (params.length > 0) {
|
|
169
|
+
db.run(sql, params);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
db.run(sql);
|
|
173
|
+
}
|
|
174
|
+
// Get last insert row ID
|
|
175
|
+
const result = db.exec('SELECT last_insert_rowid() as id');
|
|
176
|
+
if (result.length > 0 && result[0].values.length > 0) {
|
|
177
|
+
return result[0].values[0][0];
|
|
178
|
+
}
|
|
179
|
+
return 0;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
console.error('[sql.js] Insert failed:', sql, error);
|
|
183
|
+
return 0;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Execute UPDATE/DELETE statement and return rows affected
|
|
188
|
+
* @param handle Database handle
|
|
189
|
+
* @param sql UPDATE or DELETE statement with ? placeholders
|
|
190
|
+
* @param paramsJson JSON array of parameters
|
|
191
|
+
* @returns Number of rows affected or -1 on error
|
|
192
|
+
*/
|
|
193
|
+
export function execParamsOp(handle, sql, paramsJson) {
|
|
194
|
+
const db = databases.get(handle);
|
|
195
|
+
if (!db) {
|
|
196
|
+
console.error(`[sql.js] Invalid database handle: ${handle}`);
|
|
197
|
+
return -1;
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
// Parse parameters
|
|
201
|
+
let params = [];
|
|
202
|
+
if (paramsJson && paramsJson !== '[]' && paramsJson !== 'null') {
|
|
203
|
+
params = JSON.parse(paramsJson);
|
|
204
|
+
}
|
|
205
|
+
// Execute statement
|
|
206
|
+
if (params.length > 0) {
|
|
207
|
+
db.run(sql, params);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
db.run(sql);
|
|
211
|
+
}
|
|
212
|
+
// Get rows affected
|
|
213
|
+
const result = db.exec('SELECT changes() as count');
|
|
214
|
+
if (result.length > 0 && result[0].values.length > 0) {
|
|
215
|
+
return result[0].values[0][0];
|
|
216
|
+
}
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
console.error('[sql.js] ExecParams failed:', sql, error);
|
|
221
|
+
return -1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Export database to binary format
|
|
226
|
+
* @param handle Database handle
|
|
227
|
+
* @returns Base64-encoded database bytes or empty string on error
|
|
228
|
+
*/
|
|
229
|
+
export function exportOp(handle) {
|
|
230
|
+
const db = databases.get(handle);
|
|
231
|
+
if (!db) {
|
|
232
|
+
console.error(`[sql.js] Invalid database handle: ${handle}`);
|
|
233
|
+
return '';
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
const data = db.export();
|
|
237
|
+
// Use chunked base64 conversion for potentially large databases
|
|
238
|
+
return uint8ArrayToBase64(data);
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
console.error('[sql.js] Export failed:', error);
|
|
242
|
+
return '';
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Import database from binary format
|
|
247
|
+
* @param base64Data Base64-encoded database bytes
|
|
248
|
+
* @returns Database handle or 0 on error
|
|
249
|
+
*/
|
|
250
|
+
export function importOp(base64Data) {
|
|
251
|
+
if (!sqlInstance) {
|
|
252
|
+
console.error('[sql.js] Not initialized');
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
// Decode base64 to Uint8Array
|
|
257
|
+
const binary = atob(base64Data);
|
|
258
|
+
const data = new Uint8Array(binary.length);
|
|
259
|
+
for (let i = 0; i < binary.length; i++) {
|
|
260
|
+
data[i] = binary.charCodeAt(i);
|
|
261
|
+
}
|
|
262
|
+
const db = new sqlInstance.Database(data);
|
|
263
|
+
const handle = nextHandle++;
|
|
264
|
+
databases.set(handle, db);
|
|
265
|
+
console.log(`[sql.js] Imported database with handle ${handle}`);
|
|
266
|
+
return handle;
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
console.error('[sql.js] Import failed:', error);
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Load database directly from bytes
|
|
275
|
+
* @param bytes Raw database bytes
|
|
276
|
+
* @returns Database handle or 0 on error
|
|
277
|
+
*/
|
|
278
|
+
export function loadDirectOp(bytes) {
|
|
279
|
+
if (!sqlInstance) {
|
|
280
|
+
console.error('[sql.js] Not initialized');
|
|
281
|
+
return 0;
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
const db = new sqlInstance.Database(bytes);
|
|
285
|
+
const handle = nextHandle++;
|
|
286
|
+
databases.set(handle, db);
|
|
287
|
+
return handle;
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
console.error('[sql.js] Failed to load database directly:', error);
|
|
291
|
+
return 0;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Close a database
|
|
296
|
+
* @param handle Database handle
|
|
297
|
+
*/
|
|
298
|
+
export function closeOp(handle) {
|
|
299
|
+
const db = databases.get(handle);
|
|
300
|
+
if (db) {
|
|
301
|
+
try {
|
|
302
|
+
db.close();
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
console.error('[sql.js] Close failed:', error);
|
|
306
|
+
}
|
|
307
|
+
databases.delete(handle);
|
|
308
|
+
console.log(`[sql.js] Closed database with handle ${handle}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Get last error message (for debugging)
|
|
313
|
+
* @param _handle Database handle
|
|
314
|
+
* @returns Error message or empty string
|
|
315
|
+
*/
|
|
316
|
+
export function getErrorOp(_handle) {
|
|
317
|
+
// sql.js throws exceptions rather than storing error messages
|
|
318
|
+
// This is a placeholder for API compatibility
|
|
319
|
+
return '';
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Cleanup all databases and reset state
|
|
323
|
+
*/
|
|
324
|
+
export function cleanupOp() {
|
|
325
|
+
for (const [_handle, db] of databases) {
|
|
326
|
+
try {
|
|
327
|
+
db.close();
|
|
328
|
+
}
|
|
329
|
+
catch (_e) {
|
|
330
|
+
// Ignore close errors during cleanup
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
databases.clear();
|
|
334
|
+
nextHandle = 1;
|
|
335
|
+
console.log('[sql.js] Cleaned up all databases');
|
|
336
|
+
}
|
|
337
|
+
// ============================================================================
|
|
338
|
+
// Bridge Exposure
|
|
339
|
+
// ============================================================================
|
|
340
|
+
/**
|
|
341
|
+
* Set the SQL instance for database operations
|
|
342
|
+
* Must be called before any database operations
|
|
343
|
+
*/
|
|
344
|
+
export function setSqlInstance(SQL) {
|
|
345
|
+
sqlInstance = SQL;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Expose sql.js bridge functions to globalThis for Go WASM access
|
|
349
|
+
*/
|
|
350
|
+
export function exposeBridgeFunctions() {
|
|
351
|
+
const g = globalThis;
|
|
352
|
+
g.sqljsCreateDatabase = createDatabaseOp;
|
|
353
|
+
g.sqljsExec = execOp;
|
|
354
|
+
g.sqljsQuery = queryOp;
|
|
355
|
+
g.sqljsInsert = insertOp;
|
|
356
|
+
g.sqljsExecParams = execParamsOp;
|
|
357
|
+
g.sqljsExport = exportOp;
|
|
358
|
+
g.sqljsImport = importOp;
|
|
359
|
+
g.sqljsClose = closeOp;
|
|
360
|
+
g.sqljsGetError = getErrorOp;
|
|
361
|
+
g.sqljsLoadDirect = loadDirectOp;
|
|
362
|
+
// Also expose database map for debugging
|
|
363
|
+
g.sqljsDatabases = databases;
|
|
364
|
+
console.log('[sql.js] Bridge functions exposed to globalThis');
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Get a database by handle (for debugging from console)
|
|
368
|
+
*/
|
|
369
|
+
export function getDatabase(handle) {
|
|
370
|
+
return databases.get(handle);
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=sqljs-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqljs-core.js","sourceRoot":"","sources":["../../src/wasm/sqljs-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6BAA6B;AAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAC;AACzC,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,2DAA2D;AAC3D,IAAI,WAAW,GAAQ,IAAI,CAAC;AAE5B;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,KAAiB;IAC3C,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;QACzB,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAED,8DAA8D;IAC9D,MAAM,SAAS,GAAG,KAAK,CAA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;YACZ,qCAAqC;QACvC,CAAC;IACH,CAAC;IACD,SAAS,CAAC,KAAK,EAAE,CAAC;IAClB,UAAU,GAAG,CAAC,CAAC;IACf,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;AACnD,CAAC;AAED,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,WAAW,GAAG,GAAG,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,CAAC,GAAG,UAAiB,CAAC;IAE5B,CAAC,CAAC,mBAAmB,GAAG,gBAAgB,CAAC;IACzC,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC;IACrB,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC;IACvB,CAAC,CAAC,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC,CAAC,eAAe,GAAG,YAAY,CAAC;IACjC,CAAC,CAAC,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC,CAAC,WAAW,GAAG,QAAQ,CAAC;IACzB,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC;IACvB,CAAC,CAAC,aAAa,GAAG,UAAU,CAAC;IAC7B,CAAC,CAAC,eAAe,GAAG,YAAY,CAAC;IAEjC,yCAAyC;IACzC,CAAC,CAAC,cAAc,GAAG,SAAS,CAAC;IAE7B,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for Kodexa Go WASM library
|
|
3
|
+
*
|
|
4
|
+
* NOTE: Go WASM with syscall/js uses direct value passing.
|
|
5
|
+
* Functions accept and return JS values directly (strings, numbers, booleans),
|
|
6
|
+
* NOT memory pointers like traditional WASM.
|
|
7
|
+
*/
|
|
8
|
+
export interface GoWasmInstance {
|
|
9
|
+
exports: {
|
|
10
|
+
memory: WebAssembly.Memory;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
function createDocument(): number;
|
|
15
|
+
function createDocumentFromText(text: string): number;
|
|
16
|
+
function createDocumentFromJson(json: string): number;
|
|
17
|
+
function documentToJson(docRef: number): string;
|
|
18
|
+
function documentToKddbBytes(docRef: number): Uint8Array;
|
|
19
|
+
function documentGetRoot(docRef: number): number;
|
|
20
|
+
function freeDocument(docRef: number): void;
|
|
21
|
+
function documentGetMetadata(docRef: number): string;
|
|
22
|
+
function documentSetMetadata(docRef: number, metadataJson: string): void;
|
|
23
|
+
function documentGetUUID(docRef: number): string;
|
|
24
|
+
function documentGetDbHandle(docRef: number): number;
|
|
25
|
+
function documentGetLines(docRef: number): string;
|
|
26
|
+
function documentGetNodeCountByType(docRef: number, nodeType: string): number;
|
|
27
|
+
function documentGetNodeByUUID(docRef: number, uuid: string): number;
|
|
28
|
+
function documentGetNodesByType(docRef: number, nodeType: string): string;
|
|
29
|
+
function documentGetAllTaggedNodes(docRef: number): string;
|
|
30
|
+
function documentGetTagsByName(docRef: number, tagName: string): string;
|
|
31
|
+
function documentGetTagsByPrefix(docRef: number, prefix: string): string;
|
|
32
|
+
function documentGetStatistics(docRef: number): string;
|
|
33
|
+
function documentGetValidations(docRef: number): string;
|
|
34
|
+
function documentSetValidations(docRef: number, validationsJson: string): void;
|
|
35
|
+
function documentGetExternalData(docRef: number, key: string): string;
|
|
36
|
+
function documentSetExternalData(docRef: number, key: string, dataJson: string): void;
|
|
37
|
+
function documentGetExternalDataKeys(docRef: number): string;
|
|
38
|
+
function documentGetExceptions(docRef: number): string;
|
|
39
|
+
function documentGetOpenExceptions(docRef: number): string;
|
|
40
|
+
function documentAddException(docRef: number, exceptionJson: string): void;
|
|
41
|
+
function documentCloseException(docRef: number, exceptionUuid: string): void;
|
|
42
|
+
function nodeGetContent(nodeRef: number): string;
|
|
43
|
+
function nodeSetContent(nodeRef: number, content: string): void;
|
|
44
|
+
function nodeGetChildren(nodeRef: number): string;
|
|
45
|
+
function nodeTag(nodeRef: number, tagName: string): void;
|
|
46
|
+
function nodeHasTag(nodeRef: number, tagName: string): boolean;
|
|
47
|
+
function nodeRemoveTag(nodeRef: number, tagName: string): void;
|
|
48
|
+
function nodeGetTags(nodeRef: number): string;
|
|
49
|
+
function freeNode(nodeRef: number): void;
|
|
50
|
+
function cleanup(): void;
|
|
51
|
+
function createExtractionEngine(docRef: number, taxonomiesJSON: string): number;
|
|
52
|
+
function processExtraction(engineRef: number): string;
|
|
53
|
+
function processAndSaveExtraction(engineRef: number): string;
|
|
54
|
+
function getExtractionContentExceptions(engineRef: number): string;
|
|
55
|
+
function getExtractionValidations(engineRef: number): string;
|
|
56
|
+
function freeExtractionEngine(engineRef: number): void;
|
|
57
|
+
}
|
|
58
|
+
export interface BoundingBox {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
}
|
|
64
|
+
export interface ContentFeature {
|
|
65
|
+
featureType: string;
|
|
66
|
+
name: string;
|
|
67
|
+
value: any[];
|
|
68
|
+
single: boolean;
|
|
69
|
+
start?: number;
|
|
70
|
+
end?: number;
|
|
71
|
+
uuid?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface ContentException {
|
|
74
|
+
exceptionType: string;
|
|
75
|
+
exceptionTypeId?: string;
|
|
76
|
+
message: string;
|
|
77
|
+
stack?: string;
|
|
78
|
+
timestamp?: Date;
|
|
79
|
+
source?: string;
|
|
80
|
+
severity?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ProcessingStep {
|
|
83
|
+
name: string;
|
|
84
|
+
type: string;
|
|
85
|
+
version?: string;
|
|
86
|
+
timestamp?: Date;
|
|
87
|
+
configuration?: Record<string, any>;
|
|
88
|
+
metrics?: Record<string, any>;
|
|
89
|
+
}
|
|
90
|
+
export interface DocumentMetadata {
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
}
|
|
93
|
+
export interface TagOptions {
|
|
94
|
+
start?: number;
|
|
95
|
+
end?: number;
|
|
96
|
+
uuid?: string;
|
|
97
|
+
confidence?: number;
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}
|
|
100
|
+
export interface Taxonomy {
|
|
101
|
+
ref: string;
|
|
102
|
+
name: string;
|
|
103
|
+
version?: string;
|
|
104
|
+
type?: string;
|
|
105
|
+
enabled?: boolean;
|
|
106
|
+
taxons?: Taxon[];
|
|
107
|
+
}
|
|
108
|
+
export interface Taxon {
|
|
109
|
+
name: string;
|
|
110
|
+
label?: string;
|
|
111
|
+
externalName?: string;
|
|
112
|
+
taxonType?: string;
|
|
113
|
+
valuePath?: string;
|
|
114
|
+
expression?: string;
|
|
115
|
+
semanticDefinition?: string;
|
|
116
|
+
path?: string;
|
|
117
|
+
group?: boolean;
|
|
118
|
+
enabled?: boolean;
|
|
119
|
+
usePostExpression?: boolean;
|
|
120
|
+
postExpression?: string;
|
|
121
|
+
enableFallbackExpression?: boolean;
|
|
122
|
+
fallbackExpression?: string;
|
|
123
|
+
metadataValue?: string;
|
|
124
|
+
children?: Taxon[];
|
|
125
|
+
validationRules?: TaxonValidation[];
|
|
126
|
+
}
|
|
127
|
+
export interface TaxonValidation {
|
|
128
|
+
ruleFormula: string;
|
|
129
|
+
messageFormula?: string;
|
|
130
|
+
detailFormula?: string;
|
|
131
|
+
exceptionId?: string;
|
|
132
|
+
conditionalFormula?: string;
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
conditional?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface DataObject {
|
|
137
|
+
id: number;
|
|
138
|
+
uuid?: string;
|
|
139
|
+
groupUuid?: string;
|
|
140
|
+
parentGroupUuid?: string;
|
|
141
|
+
taxonomyRef?: string;
|
|
142
|
+
path?: string;
|
|
143
|
+
attributes?: DataAttribute[];
|
|
144
|
+
dataExceptions?: DataException[];
|
|
145
|
+
children?: DataObject[];
|
|
146
|
+
}
|
|
147
|
+
export interface DataAttribute {
|
|
148
|
+
id: number;
|
|
149
|
+
tag?: string;
|
|
150
|
+
tagUuid?: string;
|
|
151
|
+
value?: any;
|
|
152
|
+
stringValue?: string;
|
|
153
|
+
decimalValue?: number;
|
|
154
|
+
dateValue?: string;
|
|
155
|
+
booleanValue?: boolean;
|
|
156
|
+
confidence?: number;
|
|
157
|
+
typeAtCreation?: string;
|
|
158
|
+
path?: string;
|
|
159
|
+
ownerUri?: string;
|
|
160
|
+
dataFeatures?: Record<string, any>;
|
|
161
|
+
dataExceptions?: DataException[];
|
|
162
|
+
}
|
|
163
|
+
export interface DataException {
|
|
164
|
+
uuid: string;
|
|
165
|
+
message: string;
|
|
166
|
+
severity: string;
|
|
167
|
+
exceptionType: string;
|
|
168
|
+
open: boolean;
|
|
169
|
+
exceptionDetails?: string;
|
|
170
|
+
path?: string;
|
|
171
|
+
dataObjectId?: number;
|
|
172
|
+
dataAttributeId?: number;
|
|
173
|
+
}
|
|
174
|
+
export interface DocumentTaxonValidation {
|
|
175
|
+
taxonomyRef: string;
|
|
176
|
+
taxonPath: string;
|
|
177
|
+
validation?: TaxonValidation;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/wasm/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE;QACP,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;KAC5B,CAAC;CACH;AAID,OAAO,CAAC,MAAM,CAAC;IAEb,SAAS,cAAc,IAAI,MAAM,CAAC;IAClC,SAAS,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtD,SAAS,sBAAsB,CAAC,IAAI,EAAE,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AAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for Kodexa Go WASM library
|
|
3
|
+
*
|
|
4
|
+
* NOTE: Go WASM with syscall/js uses direct value passing.
|
|
5
|
+
* Functions accept and return JS values directly (strings, numbers, booleans),
|
|
6
|
+
* NOT memory pointers like traditional WASM.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/wasm/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kodexa-ai/document-wasm-ts",
|
|
3
|
+
"version": "8.0.0-20484695702",
|
|
4
|
+
"description": "TypeScript WASM wrapper for high-performance Kodexa Document processing using Go backend",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/kodexa/platform.git",
|
|
10
|
+
"directory": "kodexa-document/lib/typescript"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"clean": "rimraf ./dist",
|
|
18
|
+
"build:ts": "tsc && npm run build:browser-bridge",
|
|
19
|
+
"build": "npm run clean && npm run build:ts",
|
|
20
|
+
"build:browser-bridge": "esbuild src/wasm/browser-bridge.ts --bundle --format=iife --global-name=KodexaBridge --outfile=dist/sqljs-bridge.bundle.js",
|
|
21
|
+
"build:wasm": "cd ../go && make wasm wasm-support",
|
|
22
|
+
"build:all": "npm run clean && npm run build:wasm && npm run build:ts",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"kodexa",
|
|
31
|
+
"document",
|
|
32
|
+
"wasm",
|
|
33
|
+
"webassembly",
|
|
34
|
+
"go",
|
|
35
|
+
"typescript",
|
|
36
|
+
"high-performance"
|
|
37
|
+
],
|
|
38
|
+
"author": "",
|
|
39
|
+
"license": "ISC",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/jest": "^29.5.14",
|
|
42
|
+
"@types/node": "^22.15.17",
|
|
43
|
+
"@types/uuid": "^10.0.0",
|
|
44
|
+
"esbuild": "^0.24.0",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"jest-junit": "^16.0.0",
|
|
47
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
48
|
+
"rimraf": "^5.0.10",
|
|
49
|
+
"ts-jest": "^29.1.2",
|
|
50
|
+
"typescript": "^5.8.3"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"antlr4": "^4.13.2",
|
|
54
|
+
"antlr4ts": "^0.5.0-alpha.4",
|
|
55
|
+
"sql.js": "^1.11.0",
|
|
56
|
+
"tslib": "^2.8.1"
|
|
57
|
+
},
|
|
58
|
+
"browser": {
|
|
59
|
+
"fs": false,
|
|
60
|
+
"path": false
|
|
61
|
+
}
|
|
62
|
+
}
|