@kodexa-ai/document-wasm-ts 2026.2.0-develop-21765561544 → 2026.2.0-develop-21888294639

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.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * Message protocol types for Kodexa Web Worker communication.\n *\n * The worker owns the WASM instance and exposes an RPC-style API via postMessage.\n * All Go WASM functions are called by name with arguments serialized as JSON.\n */\n\n/**\n * Request message sent from main thread to worker.\n */\nexport interface WorkerRequest {\n /** Unique request ID for response matching */\n id: string;\n /** Request type */\n type: 'call';\n /** Go WASM function name to call (e.g., 'documentGetRoot', 'nodeGetChildren') */\n method: string;\n /** Arguments to pass to the function (must be JSON-serializable) */\n args: unknown[];\n}\n\n/**\n * Response message sent from worker to main thread.\n */\nexport interface WorkerResponse {\n /** Matches the request ID */\n id: string;\n /** Whether the call succeeded */\n success: boolean;\n /** Return value from the Go function (typically JSON string or number) */\n result?: unknown;\n /** Error message if the call failed */\n error?: string;\n}\n\n/**\n * Message sent when worker has finished initializing WASM.\n */\nexport interface WorkerReadyMessage {\n type: 'ready';\n}\n\n/**\n * Message sent if worker initialization fails.\n */\nexport interface WorkerErrorMessage {\n type: 'error';\n error: string;\n}\n\n/**\n * WASM event forwarded from worker to main thread.\n * These events originate from the Go WASM runtime (e.g., kodexaDataChange events).\n */\nexport interface WorkerWasmEventMessage {\n type: 'wasmEvent';\n /** The original event type (e.g., 'kodexaDataChange') */\n eventType: string;\n /** The event detail/payload (typically JSON string) */\n detail: unknown;\n /** Document reference this event is associated with */\n documentRef?: number;\n}\n\n/**\n * All possible messages from worker to main thread.\n */\nexport type WorkerOutboundMessage = WorkerResponse | WorkerReadyMessage | WorkerErrorMessage | WorkerWasmEventMessage;\n\n/**\n * Configuration for initializing the worker.\n */\nexport interface WorkerConfig {\n /** Base URL for WASM files (kodexa.wasm, wasm_exec.js). Defaults to same origin. */\n wasmBaseUrl?: string;\n /** Log level for the Go WASM module */\n logLevel?: 'debug' | 'info' | 'warn' | 'error';\n /** Optional version string for cache-busting WASM files */\n wasmVersion?: string;\n}\n\n/**\n * Pending request tracker for the main thread proxy.\n */\nexport interface PendingRequest {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n}\n\n/**\n * Content node data returned from Go WASM.\n * This mirrors the ContentNodeData interface from the main library.\n */\nexport interface WorkerNodeData {\n nodeRef: number;\n id: number;\n parentId?: number;\n type: string;\n content: string;\n index?: number;\n virtual?: boolean;\n confidence?: number;\n}\n\n// ============================================================================\n// SharedWorker Types\n// ============================================================================\n\n/**\n * Request message for SharedWorker (includes port identification).\n */\nexport interface SharedWorkerRequest extends WorkerRequest {\n /** Identifies which port sent the request */\n portId: string;\n}\n\n/**\n * Response message for SharedWorker (includes port identification).\n */\nexport interface SharedWorkerResponse extends WorkerResponse {\n /** Identifies which port should receive the response */\n portId: string;\n}\n\n/**\n * Message sent when a port connects to the SharedWorker.\n */\nexport interface PortConnectedMessage {\n type: 'connected';\n /** Unique identifier for this port/tab */\n portId: string;\n}\n\n/**\n * Message sent when worker is ready (SharedWorker variant with portId).\n */\nexport interface SharedWorkerReadyMessage {\n type: 'ready';\n /** The assigned port ID for this connection */\n portId: string;\n}\n\n/**\n * Init message for SharedWorker.\n */\nexport interface SharedWorkerInitMessage {\n type: 'init';\n config?: WorkerConfig;\n}\n\n/**\n * Subscribe to document changes (SharedWorker).\n */\nexport interface SharedWorkerSubscribeMessage {\n type: 'subscribe';\n portId: string;\n docRef: number;\n pattern: string;\n}\n\n/**\n * Unsubscribe from document changes (SharedWorker).\n */\nexport interface SharedWorkerUnsubscribeMessage {\n type: 'unsubscribe';\n portId: string;\n docRef: number;\n}\n\n// ============================================================================\n// Shared Document Messages (for document sharing across tabs)\n// ============================================================================\n\n/**\n * Load or join a shared document by documentFamilyId.\n */\nexport interface SharedDocumentLoadMessage {\n type: 'loadSharedDocument';\n documentFamilyId: string;\n /** KDDB bytes - required if document not already loaded by another tab */\n kddbBytes?: Uint8Array;\n}\n\n/**\n * Release this tab's reference to a shared document.\n */\nexport interface SharedDocumentReleaseMessage {\n type: 'releaseSharedDocument';\n documentFamilyId: string;\n}\n\n/**\n * Check if a document is already loaded as shared.\n */\nexport interface SharedDocumentCheckMessage {\n type: 'isDocumentShared';\n documentFamilyId: string;\n}\n\n/**\n * Invalidate a shared document and notify other tabs.\n */\nexport interface SharedDocumentInvalidateMessage {\n type: 'invalidateSharedDocument';\n documentFamilyId: string;\n reason?: string;\n}\n\n/**\n * Response to shared document operations.\n */\nexport interface SharedDocumentResponse {\n type: 'sharedDocumentResponse';\n success: boolean;\n requestType: 'loadSharedDocument' | 'releaseSharedDocument' | 'isDocumentShared' | 'invalidateSharedDocument';\n error?: string;\n /** For loadSharedDocument: the document reference */\n docRef?: number;\n /** For loadSharedDocument: whether the document was already loaded by another tab */\n shared?: boolean;\n /** For loadSharedDocument/releaseSharedDocument: number of tabs using the document */\n userCount?: number;\n /** For releaseSharedDocument: whether the document was freed (last user) */\n freed?: boolean;\n /** For releaseSharedDocument: remaining users if not freed */\n remainingUsers?: number;\n /** For releaseSharedDocument: document was not found */\n notFound?: boolean;\n}\n\n/**\n * Notification sent to other tabs when a document is invalidated.\n */\nexport interface SharedDocumentInvalidatedEvent {\n type: 'documentInvalidated';\n documentFamilyId: string;\n reason: string;\n initiatorPortId: string;\n}\n\n/**\n * All possible messages from SharedWorker to main thread.\n */\nexport type SharedWorkerOutboundMessage =\n | SharedWorkerResponse\n | SharedWorkerReadyMessage\n | WorkerErrorMessage\n | WorkerWasmEventMessage\n | PortConnectedMessage\n | SharedDocumentResponse\n | SharedDocumentInvalidatedEvent;\n\n/**\n * All possible messages from main thread to SharedWorker.\n */\nexport type SharedWorkerInboundMessage =\n | SharedWorkerRequest\n | SharedWorkerInitMessage\n | SharedWorkerSubscribeMessage\n | SharedWorkerUnsubscribeMessage\n | SharedDocumentLoadMessage\n | SharedDocumentReleaseMessage\n | SharedDocumentCheckMessage\n | SharedDocumentInvalidateMessage;\n\n// ============================================================================\n// Transaction Types\n// ============================================================================\n\n/**\n * Reference to an object created earlier in the same transaction.\n * Used when creating attributes on newly-created data objects.\n */\nexport interface TempRef {\n $tempId: number;\n}\n\n/**\n * Individual operation within a transaction.\n */\nexport type TransactionOperation =\n | { type: 'createDataObject'; input: Record<string, unknown>; tempId: number }\n | { type: 'updateDataObject'; id: number; updates: Record<string, unknown> }\n | { type: 'deleteDataObject'; id: number }\n | { type: 'createDataAttribute'; dataObjectId: number | TempRef; input: Record<string, unknown>; tempId: number }\n | { type: 'updateDataAttribute'; id: number; updates: Record<string, unknown> }\n | { type: 'deleteDataAttribute'; id: number };\n\n/**\n * Request to execute a transaction (batched operations).\n */\nexport interface TransactionRequest {\n type: 'transaction';\n id: string;\n documentRef: number;\n operations: TransactionOperation[];\n}\n\n/**\n * Response from a successful transaction.\n */\nexport interface TransactionSuccessResponse {\n id: string;\n success: true;\n /** Maps tempId (negative) to real database ID */\n idMappings: Record<number, number>;\n}\n\n/**\n * Response from a failed transaction (all operations rolled back).\n */\nexport interface TransactionErrorResponse {\n id: string;\n success: false;\n error: string;\n}\n\nexport type TransactionResponse = TransactionSuccessResponse | TransactionErrorResponse;"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * Message protocol types for Kodexa Web Worker communication.\n *\n * The worker owns the WASM instance and exposes an RPC-style API via postMessage.\n * All Go WASM functions are called by name with arguments serialized as JSON.\n */\n\n/**\n * Request message sent from main thread to worker.\n */\nexport interface WorkerRequest {\n /** Unique request ID for response matching */\n id: string;\n /** Request type */\n type: 'call';\n /** Go WASM function name to call (e.g., 'documentGetRoot', 'nodeGetChildren') */\n method: string;\n /** Arguments to pass to the function (must be JSON-serializable) */\n args: unknown[];\n}\n\n/**\n * Response message sent from worker to main thread.\n */\nexport interface WorkerResponse {\n /** Matches the request ID */\n id: string;\n /** Whether the call succeeded */\n success: boolean;\n /** Return value from the Go function (typically JSON string or number) */\n result?: unknown;\n /** Error message if the call failed */\n error?: string;\n}\n\n/**\n * Message sent when worker has finished initializing WASM.\n */\nexport interface WorkerReadyMessage {\n type: 'ready';\n}\n\n/**\n * Message sent if worker initialization fails.\n */\nexport interface WorkerErrorMessage {\n type: 'error';\n error: string;\n}\n\n/**\n * WASM event forwarded from worker to main thread.\n * These events originate from the Go WASM runtime (e.g., kodexaDataChange events).\n */\nexport interface WorkerWasmEventMessage {\n type: 'wasmEvent';\n /** The original event type (e.g., 'kodexaDataChange') */\n eventType: string;\n /** The event detail/payload (typically JSON string) */\n detail: unknown;\n /** Document reference this event is associated with */\n documentRef?: number;\n}\n\n/**\n * All possible messages from worker to main thread.\n */\nexport type WorkerOutboundMessage = WorkerResponse | WorkerReadyMessage | WorkerErrorMessage | WorkerWasmEventMessage;\n\n/**\n * Configuration for initializing the worker.\n */\nexport interface WorkerConfig {\n /** Base URL for WASM files (kodexa.wasm, wasm_exec.js). Defaults to same origin. */\n wasmBaseUrl?: string;\n /** Log level for the Go WASM module */\n logLevel?: 'debug' | 'info' | 'warn' | 'error';\n /** Optional version string for cache-busting WASM files */\n wasmVersion?: string;\n}\n\n/**\n * Pending request tracker for the main thread proxy.\n */\nexport interface PendingRequest {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n}\n\n/**\n * Content node data returned from Go WASM.\n * This mirrors the ContentNodeData interface from the main library.\n */\nexport interface WorkerNodeData {\n nodeRef: number;\n id: number;\n parentId?: number;\n type: string;\n content: string;\n index?: number;\n virtual?: boolean;\n confidence?: number;\n}\n\n// ============================================================================\n// SharedWorker Types\n// ============================================================================\n\n/**\n * Request message for SharedWorker (includes port identification).\n */\nexport interface SharedWorkerRequest extends WorkerRequest {\n /** Identifies which port sent the request */\n portId: string;\n}\n\n/**\n * Response message for SharedWorker (includes port identification).\n */\nexport interface SharedWorkerResponse extends WorkerResponse {\n /** Identifies which port should receive the response */\n portId: string;\n}\n\n/**\n * Message sent when a port connects to the SharedWorker.\n */\nexport interface PortConnectedMessage {\n type: 'connected';\n /** Unique identifier for this port/tab */\n portId: string;\n}\n\n/**\n * Message sent when worker is ready (SharedWorker variant with portId).\n */\nexport interface SharedWorkerReadyMessage {\n type: 'ready';\n /** The assigned port ID for this connection */\n portId: string;\n}\n\n/**\n * Init message for SharedWorker.\n */\nexport interface SharedWorkerInitMessage {\n type: 'init';\n config?: WorkerConfig;\n}\n\n/**\n * Subscribe to document changes (SharedWorker).\n */\nexport interface SharedWorkerSubscribeMessage {\n type: 'subscribe';\n portId: string;\n docRef: number;\n pattern: string;\n}\n\n/**\n * Unsubscribe from document changes (SharedWorker).\n */\nexport interface SharedWorkerUnsubscribeMessage {\n type: 'unsubscribe';\n portId: string;\n docRef: number;\n}\n\n// ============================================================================\n// Shared Document Messages (for document sharing across tabs)\n// ============================================================================\n\n/**\n * Load or join a shared document by documentFamilyId.\n */\nexport interface SharedDocumentLoadMessage {\n type: 'loadSharedDocument';\n documentFamilyId: string;\n /** KDDB bytes - required if document not already loaded by another tab */\n kddbBytes?: Uint8Array;\n /** Request ID for correlating responses */\n requestId?: string;\n}\n\n/**\n * Release this tab's reference to a shared document.\n */\nexport interface SharedDocumentReleaseMessage {\n type: 'releaseSharedDocument';\n documentFamilyId: string;\n /** Request ID for correlating responses */\n requestId?: string;\n}\n\n/**\n * Check if a document is already loaded as shared.\n */\nexport interface SharedDocumentCheckMessage {\n type: 'isDocumentShared';\n documentFamilyId: string;\n /** Request ID for correlating responses */\n requestId?: string;\n}\n\n/**\n * Invalidate a shared document and notify other tabs.\n */\nexport interface SharedDocumentInvalidateMessage {\n type: 'invalidateSharedDocument';\n documentFamilyId: string;\n reason?: string;\n /** Request ID for correlating responses */\n requestId?: string;\n}\n\n/**\n * Heartbeat message sent periodically by each port to indicate it's still alive.\n */\nexport interface HeartbeatMessage {\n type: 'heartbeat';\n}\n\n/**\n * Disconnect message sent by a port before it closes (e.g., tab close/reload).\n */\nexport interface DisconnectMessage {\n type: 'disconnect';\n}\n\n/**\n * Response to shared document operations.\n */\nexport interface SharedDocumentResponse {\n type: 'sharedDocumentResponse';\n success: boolean;\n requestType: 'loadSharedDocument' | 'releaseSharedDocument' | 'isDocumentShared' | 'invalidateSharedDocument';\n /** Echoed request ID for correlating responses to requests */\n requestId?: string;\n error?: string;\n /** For loadSharedDocument: the document reference */\n docRef?: number;\n /** For loadSharedDocument: whether the document was already loaded by another tab */\n shared?: boolean;\n /** For loadSharedDocument/releaseSharedDocument: number of tabs using the document */\n userCount?: number;\n /** For releaseSharedDocument: whether the document was freed (last user) */\n freed?: boolean;\n /** For releaseSharedDocument: remaining users if not freed */\n remainingUsers?: number;\n /** For releaseSharedDocument: document was not found */\n notFound?: boolean;\n}\n\n/**\n * Notification sent to other tabs when a document is invalidated.\n */\nexport interface SharedDocumentInvalidatedEvent {\n type: 'documentInvalidated';\n documentFamilyId: string;\n reason: string;\n initiatorPortId: string;\n}\n\n/**\n * All possible messages from SharedWorker to main thread.\n */\nexport type SharedWorkerOutboundMessage =\n | SharedWorkerResponse\n | SharedWorkerReadyMessage\n | WorkerErrorMessage\n | WorkerWasmEventMessage\n | PortConnectedMessage\n | SharedDocumentResponse\n | SharedDocumentInvalidatedEvent;\n\n/**\n * All possible messages from main thread to SharedWorker.\n */\nexport type SharedWorkerInboundMessage =\n | SharedWorkerRequest\n | SharedWorkerInitMessage\n | SharedWorkerSubscribeMessage\n | SharedWorkerUnsubscribeMessage\n | SharedDocumentLoadMessage\n | SharedDocumentReleaseMessage\n | SharedDocumentCheckMessage\n | SharedDocumentInvalidateMessage\n | HeartbeatMessage\n | DisconnectMessage;\n\n// ============================================================================\n// Transaction Types\n// ============================================================================\n\n/**\n * Reference to an object created earlier in the same transaction.\n * Used when creating attributes on newly-created data objects.\n */\nexport interface TempRef {\n $tempId: number;\n}\n\n/**\n * Individual operation within a transaction.\n */\nexport type TransactionOperation =\n | { type: 'createDataObject'; input: Record<string, unknown>; tempId: number }\n | { type: 'updateDataObject'; id: number; updates: Record<string, unknown> }\n | { type: 'deleteDataObject'; id: number }\n | { type: 'createDataAttribute'; dataObjectId: number | TempRef; input: Record<string, unknown>; tempId: number }\n | { type: 'updateDataAttribute'; id: number; updates: Record<string, unknown> }\n | { type: 'deleteDataAttribute'; id: number };\n\n/**\n * Request to execute a transaction (batched operations).\n */\nexport interface TransactionRequest {\n type: 'transaction';\n id: string;\n documentRef: number;\n operations: TransactionOperation[];\n}\n\n/**\n * Response from a successful transaction.\n */\nexport interface TransactionSuccessResponse {\n id: string;\n success: true;\n /** Maps tempId (negative) to real database ID */\n idMappings: Record<number, number>;\n}\n\n/**\n * Response from a failed transaction (all operations rolled back).\n */\nexport interface TransactionErrorResponse {\n id: string;\n success: false;\n error: string;\n}\n\nexport type TransactionResponse = TransactionSuccessResponse | TransactionErrorResponse;"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodexa-ai/document-wasm-ts",
3
- "version": "2026.2.0-develop-21765561544",
3
+ "version": "2026.2.0-develop-21888294639",
4
4
  "description": "TypeScript WASM wrapper for high-performance Kodexa Document processing using Go backend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",