@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
41 lines (40 loc) • 2.01 kB
TypeScript
/**
* Shared helpers for caller-provided MIME type hints.
*
* A "MIME hint" is a mimetype string the SDK receives alongside a raw Buffer
* whose original filename is missing (e.g. Slack/Curator file-uploads that
* arrive as { buffer, filename: "Untitled", mimetype: "text/plain" }). When
* the filename has no extension and magic-byte detection cannot identify the
* content, the hint is the only signal we have.
*
* Both FileReferenceRegistry.register() and FileDetector.detect() consume
* these helpers so the trust/normalization rules stay in one place:
*
* - `application/octet-stream` is never trusted — it is the opaque
* "I don't know" sentinel and would let a caller hide real content
* behind a generic label (a PNG hinted as octet-stream would otherwise
* record mimeType="application/octet-stream" instead of "image/png").
* - Empty/undefined hints pass through as `undefined`.
* - A hint that cannot be classified maps to `null` so the caller falls
* back to magic-byte / extension detection instead of synthesising a
* wrong type.
*/
import type { FileType } from "../types/index.js";
/**
* Normalize a caller-provided mimetype hint: strip any `;charset=...`
* parameter, lowercase, trim. Returns undefined for empty strings or for
* the opaque `application/octet-stream` sentinel so downstream code can
* treat the hint as absent instead of trusting it verbatim.
*/
export declare function normalizeMimeHint(raw?: string): string | undefined;
/**
* Map a normalized mimetype hint to a NeuroLink FileType. Returns null when
* the mimetype is unknown or too generic to classify confidently.
*/
export declare function mimeHintToFileType(mimetype: string): FileType | null;
/**
* Map a normalized mimetype hint to the canonical file extension (without
* leading dot). Returns "" when the mimetype is unknown — caller should
* then fall back to magic-byte detection.
*/
export declare function mimeHintToExtension(mimetype: string): string;