@kodexa-ai/document-wasm-ts 2026.3.0-develop-22445149449 → 2026.3.0-develop-22507649787
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/dist/kodexa.wasm +0 -0
- package/dist/normalize.d.ts +1 -0
- package/dist/normalize.d.ts.map +1 -1
- package/dist/normalize.js +1 -0
- package/dist/normalize.js.map +1 -1
- package/package.json +1 -1
package/dist/kodexa.wasm
CHANGED
|
Binary file
|
package/dist/normalize.d.ts
CHANGED
package/dist/normalize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,CAqBlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
package/dist/normalize.js
CHANGED
package/dist/normalize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,UAAU,SAAS,CAAC,OAAuB;IAC/C,sCAAsC;IACtC,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAC;IACJ,CAAC;IAED,yCAAyC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAE7C,8BAA8B;IAC9B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAoB,CAAC;IACnD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,qCAAqC,CAAC,EAAE;SAChD,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,cAAc,KAAK,UAAU,CAAC;AAC9C,CAAC","sourcesContent":["/**\n * Value Normalization - Local WASM-based value normalization\n *\n * This module provides value normalization functionality using the Go WASM library.\n * It normalizes raw string values (extracted from documents) into typed values\n * based on taxon type (currency, number, date, boolean, etc.).\n *\n * Benefits over server-side normalization:\n * - No network latency - instant normalization\n * - Works offline - no server dependency\n * - Consistent logic - same Go code used by server and WASM\n *\n * @example\n * ```typescript\n * import { normalize } from '@kodexa-ai/document-wasm-ts';\n *\n * // Normalize a currency value\n * const result = normalize({ value: '$1,234.56', taxonType: 'currency' });\n * console.log(result.decimalValue); // 1234.56\n *\n * // Normalize with EU number format\n * const euResult = normalize({\n * value: '1.234,56',\n * taxonType: 'currency',\n * numberFormat: 'EU'\n * });\n * console.log(euResult.decimalValue); // 1234.56\n *\n * // Normalize a date\n * const dateResult = normalize({ value: '12/25/2024', taxonType: 'date' });\n * console.log(dateResult.dateValue); // \"2024-12-25T00:00:00Z\"\n * ```\n */\n\nimport type { NormalizeInput, NormalizeResult, NumberFormat } from './wasm/types';\n\n// Re-export types for convenience\nexport type { NormalizeInput, NormalizeResult, NumberFormat };\n\n/**\n * Normalizes a value based on its taxon type.\n *\n * Supports the following taxon types:\n * - **currency**: Extracts decimal value (supports negative via brackets, CR, trailing minus)\n * - **number**: Extracts decimal value with optional truncation\n * - **percentage**: Extracts decimal value (strips % sign)\n * - **date**: Parses various date formats to ISO format\n * - **datetime**: Parses date/time to ISO format\n * - **boolean**: Parses \"yes\"/\"no\"/\"true\"/\"false\" to boolean\n * - **phone**: Formats phone numbers (US format)\n * - **email**: Validates email format\n * - **url**: Validates and normalizes URLs\n * - **string**: Passes through as stringValue\n *\n * Negative number formats supported:\n * - Parentheses: (100), $(1,234.56)\n * - CR suffix: 100CR\n * - Angle brackets: <100>\n * - Trailing minus: 100-\n * - Leading minus: -100\n * - Unicode minus signs\n * - Delta/triangle characters: Δ ∆ ▲ ▼ △ ▽ ⏶ ⏷\n *\n * Number formats supported:\n * - US: 1,234,567.89\n * - EU: 1.234.567,89\n * - CH: 1'234'567.89\n * - IN: 12,34,567.89\n * - SPACE: 1 234 567,89\n *\n * @param options - The normalization options\n * @returns The normalization result with typed value fields\n * @throws Error if WASM normalize function is not available\n *\n * @example\n * ```typescript\n * // Basic currency normalization\n * const result = normalize({ value: '$1,234.56', taxonType: 'currency' });\n * if (result.success) {\n * console.log(result.decimalValue); // 1234.56\n * }\n *\n * // Negative value with parentheses (accounting format)\n * const negResult = normalize({ value: '$(500.00)', taxonType: 'currency' });\n * console.log(negResult.decimalValue); // -500\n *\n * // European number format\n * const euResult = normalize({\n * value: '1.234,56',\n * taxonType: 'number',\n * numberFormat: 'EU'\n * });\n *\n * // Number with decimal truncation\n * const truncResult = normalize({\n * value: '123.456789',\n * taxonType: 'number',\n * truncateDecimal: true,\n * decimalPlaces: 2\n * });\n * console.log(truncResult.decimalValue); // 123.45\n * ```\n */\nexport function normalize(options: NormalizeInput): NormalizeResult {\n // Check if WASM function is available\n if (typeof normalizeValue !== 'function') {\n throw new Error(\n 'WASM normalize function not available. Ensure WASM module is loaded before calling normalize().'\n );\n }\n\n // Call the WASM function with JSON input\n const inputJson = JSON.stringify(options);\n const resultJson = normalizeValue(inputJson);\n\n // Parse and return the result\n try {\n return JSON.parse(resultJson) as NormalizeResult;\n } catch (e) {\n return {\n success: false,\n error: `Failed to parse normalize result: ${e}`\n };\n }\n}\n\n/**\n * Checks if the normalize function is available.\n * Use this to verify WASM is loaded before calling normalize().\n *\n * @returns true if normalize function is available\n *\n * @example\n * ```typescript\n * if (isNormalizeAvailable()) {\n * const result = normalize({ value: '100', taxonType: 'number' });\n * } else {\n * // Fall back to server-side normalization\n * }\n * ```\n */\nexport function isNormalizeAvailable(): boolean {\n return typeof normalizeValue === 'function';\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodexa-ai/document-wasm-ts",
|
|
3
|
-
"version": "2026.3.0-develop-
|
|
3
|
+
"version": "2026.3.0-develop-22507649787",
|
|
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",
|