@juspay/neurolink 9.55.3 → 9.55.5
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 +4 -0
- package/dist/browser/neurolink.min.js +280 -279
- package/dist/lib/processors/document/ExcelProcessor.js +22 -4
- package/dist/lib/server/voice/voiceWebSocketHandler.js +389 -367
- package/dist/lib/types/processor.d.ts +31 -0
- package/dist/lib/types/server.d.ts +10 -0
- package/dist/processors/document/ExcelProcessor.js +22 -4
- package/dist/server/voice/voiceWebSocketHandler.js +389 -367
- package/dist/types/processor.d.ts +31 -0
- package/dist/types/server.d.ts +10 -0
- package/package.json +3 -3
|
@@ -35,11 +35,26 @@
|
|
|
35
35
|
* }
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
import ExcelJS from "exceljs";
|
|
39
|
-
const { Workbook } = ExcelJS;
|
|
40
38
|
import { BaseFileProcessor } from "../base/BaseFileProcessor.js";
|
|
41
39
|
import { SIZE_LIMITS } from "../config/index.js";
|
|
42
40
|
import { FileErrorCode } from "../errors/index.js";
|
|
41
|
+
let _exceljs = null;
|
|
42
|
+
async function loadExcelJS() {
|
|
43
|
+
if (_exceljs) {
|
|
44
|
+
return _exceljs;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
_exceljs = await import(/* @vite-ignore */ "exceljs");
|
|
48
|
+
return _exceljs;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
const e = err instanceof Error ? err : null;
|
|
52
|
+
if (e?.code === "ERR_MODULE_NOT_FOUND" && e.message.includes("exceljs")) {
|
|
53
|
+
throw new Error('Excel file processing requires the "exceljs" package. Install it with:\n pnpm add exceljs', { cause: err });
|
|
54
|
+
}
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
43
58
|
// Re-export for consumers who import from this module
|
|
44
59
|
// Import for local use
|
|
45
60
|
// =============================================================================
|
|
@@ -247,7 +262,8 @@ export class ExcelProcessor extends BaseFileProcessor {
|
|
|
247
262
|
* @returns Parsed ExcelJS Workbook
|
|
248
263
|
*/
|
|
249
264
|
async parseWorkbook(buffer) {
|
|
250
|
-
const
|
|
265
|
+
const ExcelJS = await loadExcelJS();
|
|
266
|
+
const workbook = new ExcelJS.Workbook();
|
|
251
267
|
// ExcelJS load() types expect Buffer but Node 22+ Buffer<ArrayBufferLike>
|
|
252
268
|
// is not directly assignable. Extract a clean ArrayBuffer for the exact
|
|
253
269
|
// byte range via slice, then cast for type compatibility.
|
|
@@ -419,7 +435,9 @@ export class ExcelProcessor extends BaseFileProcessor {
|
|
|
419
435
|
worksheet = workbook.worksheets[0];
|
|
420
436
|
}
|
|
421
437
|
if (!worksheet) {
|
|
422
|
-
const sheetNames = workbook.worksheets
|
|
438
|
+
const sheetNames = workbook.worksheets
|
|
439
|
+
.map((ws) => ws.name)
|
|
440
|
+
.join(", ");
|
|
423
441
|
return `Sheet not found. Available sheets: ${sheetNames}`;
|
|
424
442
|
}
|
|
425
443
|
// Convert column letters to 1-based column indices if specified
|