@juspay/neurolink 9.88.5 → 9.88.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.
@@ -121,6 +121,7 @@ export declare const CLI_LIMITS: {
121
121
  export declare const PDF_LIMITS: {
122
122
  MAX_SIZE_MB: number;
123
123
  DEFAULT_MAX_PAGES: number;
124
+ MAX_SCALE: number;
124
125
  };
125
126
  export declare const SYSTEM_LIMITS: {
126
127
  MAX_PROMPT_LENGTH: number;
@@ -217,6 +217,9 @@ export const PDF_LIMITS = {
217
217
  MAX_SIZE_MB: 20,
218
218
  // Default maximum pages for image conversion
219
219
  DEFAULT_MAX_PAGES: 20,
220
+ // Upper bound for the render scale factor. Above this, a single page can
221
+ // allocate hundreds of MB; scale <= 0 produces a degenerate viewport.
222
+ MAX_SCALE: 10,
220
223
  };
221
224
  // Performance and System Limits
222
225
  export const SYSTEM_LIMITS = {
@@ -121,6 +121,7 @@ export declare const CLI_LIMITS: {
121
121
  export declare const PDF_LIMITS: {
122
122
  MAX_SIZE_MB: number;
123
123
  DEFAULT_MAX_PAGES: number;
124
+ MAX_SCALE: number;
124
125
  };
125
126
  export declare const SYSTEM_LIMITS: {
126
127
  MAX_PROMPT_LENGTH: number;
@@ -217,6 +217,9 @@ export const PDF_LIMITS = {
217
217
  MAX_SIZE_MB: 20,
218
218
  // Default maximum pages for image conversion
219
219
  DEFAULT_MAX_PAGES: 20,
220
+ // Upper bound for the render scale factor. Above this, a single page can
221
+ // allocate hundreds of MB; scale <= 0 produces a degenerate viewport.
222
+ MAX_SCALE: 10,
220
223
  };
221
224
  // Performance and System Limits
222
225
  export const SYSTEM_LIMITS = {
@@ -267,6 +267,12 @@ export class PDFProcessor {
267
267
  if (format !== "png") {
268
268
  throw new Error(`Invalid format: "${format}". Only "png" format is currently supported.`);
269
269
  }
270
+ // 0b. Validate the render scale. A non-finite or non-positive scale yields a
271
+ // degenerate viewport (blank/zero-dimension render), and an excessive scale
272
+ // can allocate hundreds of MB per page — reject both with a clear message.
273
+ if (!Number.isFinite(scale) || scale <= 0 || scale > PDF_LIMITS.MAX_SCALE) {
274
+ throw new Error(`Invalid scale: ${scale}. Scale must be a finite number greater than 0 and at most ${PDF_LIMITS.MAX_SCALE}.`);
275
+ }
270
276
  // 1. Validate buffer is not empty or too small
271
277
  if (!pdfBuffer || pdfBuffer.length < 5) {
272
278
  throw new Error("Invalid PDF: Buffer is too small or empty. " +
@@ -267,6 +267,12 @@ export class PDFProcessor {
267
267
  if (format !== "png") {
268
268
  throw new Error(`Invalid format: "${format}". Only "png" format is currently supported.`);
269
269
  }
270
+ // 0b. Validate the render scale. A non-finite or non-positive scale yields a
271
+ // degenerate viewport (blank/zero-dimension render), and an excessive scale
272
+ // can allocate hundreds of MB per page — reject both with a clear message.
273
+ if (!Number.isFinite(scale) || scale <= 0 || scale > PDF_LIMITS.MAX_SCALE) {
274
+ throw new Error(`Invalid scale: ${scale}. Scale must be a finite number greater than 0 and at most ${PDF_LIMITS.MAX_SCALE}.`);
275
+ }
270
276
  // 1. Validate buffer is not empty or too small
271
277
  if (!pdfBuffer || pdfBuffer.length < 5) {
272
278
  throw new Error("Invalid PDF: Buffer is too small or empty. " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.88.5",
3
+ "version": "9.88.6",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (58+ servers), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
6
6
  "author": {