@juspay/neurolink 9.55.4 → 9.55.6
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 +284 -282
- package/dist/lib/processors/document/ExcelProcessor.js +22 -4
- package/dist/lib/processors/document/WordProcessor.js +18 -1
- package/dist/lib/types/processor.d.ts +31 -0
- package/dist/processors/document/ExcelProcessor.js +22 -4
- package/dist/processors/document/WordProcessor.js +18 -1
- package/dist/types/processor.d.ts +31 -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
|
|
@@ -31,10 +31,26 @@
|
|
|
31
31
|
* }
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
import * as mammoth from "mammoth";
|
|
35
34
|
import { BaseFileProcessor } from "../base/BaseFileProcessor.js";
|
|
36
35
|
import { SIZE_LIMITS } from "../config/index.js";
|
|
37
36
|
import { FileErrorCode } from "../errors/index.js";
|
|
37
|
+
let _mammoth = null;
|
|
38
|
+
async function loadMammoth() {
|
|
39
|
+
if (_mammoth) {
|
|
40
|
+
return _mammoth;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
_mammoth = await import(/* @vite-ignore */ "mammoth");
|
|
44
|
+
return _mammoth;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const e = err instanceof Error ? err : null;
|
|
48
|
+
if (e?.code === "ERR_MODULE_NOT_FOUND" && e.message.includes("mammoth")) {
|
|
49
|
+
throw new Error('Word document processing requires the "mammoth" package. Install it with:\n pnpm add mammoth', { cause: err });
|
|
50
|
+
}
|
|
51
|
+
throw err;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
38
54
|
// Re-export for consumers who import from this module
|
|
39
55
|
// Import for local use
|
|
40
56
|
// =============================================================================
|
|
@@ -223,6 +239,7 @@ export class WordProcessor extends BaseFileProcessor {
|
|
|
223
239
|
let htmlContent = "";
|
|
224
240
|
const warnings = [];
|
|
225
241
|
try {
|
|
242
|
+
const mammoth = await loadMammoth();
|
|
226
243
|
// Extract plain text
|
|
227
244
|
const textResult = await mammoth.extractRawText({ buffer });
|
|
228
245
|
textContent = textResult.value;
|
|
@@ -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
|
*/
|
|
@@ -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
|
|
@@ -31,10 +31,26 @@
|
|
|
31
31
|
* }
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
import * as mammoth from "mammoth";
|
|
35
34
|
import { BaseFileProcessor } from "../base/BaseFileProcessor.js";
|
|
36
35
|
import { SIZE_LIMITS } from "../config/index.js";
|
|
37
36
|
import { FileErrorCode } from "../errors/index.js";
|
|
37
|
+
let _mammoth = null;
|
|
38
|
+
async function loadMammoth() {
|
|
39
|
+
if (_mammoth) {
|
|
40
|
+
return _mammoth;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
_mammoth = await import(/* @vite-ignore */ "mammoth");
|
|
44
|
+
return _mammoth;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const e = err instanceof Error ? err : null;
|
|
48
|
+
if (e?.code === "ERR_MODULE_NOT_FOUND" && e.message.includes("mammoth")) {
|
|
49
|
+
throw new Error('Word document processing requires the "mammoth" package. Install it with:\n pnpm add mammoth', { cause: err });
|
|
50
|
+
}
|
|
51
|
+
throw err;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
38
54
|
// Re-export for consumers who import from this module
|
|
39
55
|
// Import for local use
|
|
40
56
|
// =============================================================================
|
|
@@ -223,6 +239,7 @@ export class WordProcessor extends BaseFileProcessor {
|
|
|
223
239
|
let htmlContent = "";
|
|
224
240
|
const warnings = [];
|
|
225
241
|
try {
|
|
242
|
+
const mammoth = await loadMammoth();
|
|
226
243
|
// Extract plain text
|
|
227
244
|
const textResult = await mammoth.extractRawText({ buffer });
|
|
228
245
|
textContent = textResult.value;
|
|
@@ -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
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.55.
|
|
3
|
+
"version": "9.55.6",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
6
6
|
"author": {
|
|
@@ -230,14 +230,12 @@
|
|
|
230
230
|
"croner": "^9.1.0",
|
|
231
231
|
"csv-parser": "^3.2.0",
|
|
232
232
|
"dotenv": "^17.3.1",
|
|
233
|
-
"exceljs": "^4.4.0",
|
|
234
233
|
"fluent-ffmpeg": "^2.1.3",
|
|
235
234
|
"google-auth-library": "^10.6.1",
|
|
236
235
|
"hono": "^4.12.3",
|
|
237
236
|
"inquirer": "^13.3.0",
|
|
238
237
|
"jose": "^6.1.3",
|
|
239
238
|
"json-schema-to-zod": "^2.7.0",
|
|
240
|
-
"mammoth": "^1.11.0",
|
|
241
239
|
"mediabunny": "^1.40.1",
|
|
242
240
|
"music-metadata": "^11.11.2",
|
|
243
241
|
"nanoid": "^5.1.5",
|
|
@@ -273,6 +271,8 @@
|
|
|
273
271
|
"@langfuse/otel": "^5.0.1",
|
|
274
272
|
"@picovoice/cobra-node": "^3.0.2",
|
|
275
273
|
"bullmq": "^5.52.2",
|
|
274
|
+
"exceljs": "^4.4.0",
|
|
275
|
+
"mammoth": "^1.11.0",
|
|
276
276
|
"pdf-parse": "^2.4.5",
|
|
277
277
|
"pdf-to-img": "^5.0.0",
|
|
278
278
|
"@fastify/cors": "^11.2.0",
|