@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.
@@ -543,6 +543,37 @@ export type ProcessedYaml = ProcessedFileBase & {
543
543
  /** YAML content converted to JSON string for AI consumption */
544
544
  asJson: string | null;
545
545
  };
546
+ /**
547
+ * Structural types for exceljs objects.
548
+ * Defined here so the optional exceljs package is not required at typecheck time.
549
+ */
550
+ export type ExcelJSCell = {
551
+ value: CellValue;
552
+ };
553
+ export type ExcelJSRow = {
554
+ values: (CellValue | undefined)[];
555
+ eachCell: (opts: {
556
+ includeEmpty: boolean;
557
+ }, callback: (cell: ExcelJSCell, colNumber: number) => void) => void;
558
+ };
559
+ export type ExcelJSWorksheet = {
560
+ name: string;
561
+ rowCount: number;
562
+ eachRow: {
563
+ (callback: (row: ExcelJSRow, rowNumber: number) => void): void;
564
+ (opts: {
565
+ includeEmpty: boolean;
566
+ }, callback: (row: ExcelJSRow, rowNumber: number) => void): void;
567
+ };
568
+ getRow: (rowNumber: number) => ExcelJSRow;
569
+ };
570
+ export type ExcelJSWorkbook = {
571
+ worksheets: ExcelJSWorksheet[];
572
+ getWorksheet: (name: string) => ExcelJSWorksheet | undefined;
573
+ xlsx: {
574
+ load: (buffer: ArrayBuffer) => Promise<void>;
575
+ };
576
+ };
546
577
  /**
547
578
  * Single worksheet extracted from an Excel file.
548
579
  */
@@ -1109,3 +1109,13 @@ export type SonioxMessage = {
1109
1109
  export type ClientControlMessage = {
1110
1110
  type?: string;
1111
1111
  };
1112
+ /**
1113
+ * Structural type for Picovoice Cobra VAD instance.
1114
+ * Defined here so the optional `@picovoice/cobra-node` package
1115
+ * is not required at typecheck time.
1116
+ */
1117
+ export type CobraInstance = {
1118
+ frameLength: number;
1119
+ process: (pcm: Int16Array) => number;
1120
+ release: () => void;
1121
+ };
@@ -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 workbook = new Workbook();
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.map((ws) => ws.name).join(", ");
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