@juspay/neurolink 9.56.0 → 9.56.2

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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Shared helpers for caller-provided MIME type hints.
3
+ *
4
+ * A "MIME hint" is a mimetype string the SDK receives alongside a raw Buffer
5
+ * whose original filename is missing (e.g. Slack/Curator file-uploads that
6
+ * arrive as { buffer, filename: "Untitled", mimetype: "text/plain" }). When
7
+ * the filename has no extension and magic-byte detection cannot identify the
8
+ * content, the hint is the only signal we have.
9
+ *
10
+ * Both FileReferenceRegistry.register() and FileDetector.detect() consume
11
+ * these helpers so the trust/normalization rules stay in one place:
12
+ *
13
+ * - `application/octet-stream` is never trusted — it is the opaque
14
+ * "I don't know" sentinel and would let a caller hide real content
15
+ * behind a generic label (a PNG hinted as octet-stream would otherwise
16
+ * record mimeType="application/octet-stream" instead of "image/png").
17
+ * - Empty/undefined hints pass through as `undefined`.
18
+ * - A hint that cannot be classified maps to `null` so the caller falls
19
+ * back to magic-byte / extension detection instead of synthesising a
20
+ * wrong type.
21
+ */
22
+ import type { FileType } from "../types/index.js";
23
+ /**
24
+ * Normalize a caller-provided mimetype hint: strip any `;charset=...`
25
+ * parameter, lowercase, trim. Returns undefined for empty strings or for
26
+ * the opaque `application/octet-stream` sentinel so downstream code can
27
+ * treat the hint as absent instead of trusting it verbatim.
28
+ */
29
+ export declare function normalizeMimeHint(raw?: string): string | undefined;
30
+ /**
31
+ * Map a normalized mimetype hint to a NeuroLink FileType. Returns null when
32
+ * the mimetype is unknown or too generic to classify confidently.
33
+ */
34
+ export declare function mimeHintToFileType(mimetype: string): FileType | null;
35
+ /**
36
+ * Map a normalized mimetype hint to the canonical file extension (without
37
+ * leading dot). Returns "" when the mimetype is unknown — caller should
38
+ * then fall back to magic-byte detection.
39
+ */
40
+ export declare function mimeHintToExtension(mimetype: string): string;
@@ -0,0 +1,121 @@
1
+ const OPAQUE_MIMETYPE = "application/octet-stream";
2
+ /**
3
+ * Normalize a caller-provided mimetype hint: strip any `;charset=...`
4
+ * parameter, lowercase, trim. Returns undefined for empty strings or for
5
+ * the opaque `application/octet-stream` sentinel so downstream code can
6
+ * treat the hint as absent instead of trusting it verbatim.
7
+ */
8
+ export function normalizeMimeHint(raw) {
9
+ if (!raw) {
10
+ return undefined;
11
+ }
12
+ const cleaned = raw.split(";")[0].trim().toLowerCase();
13
+ if (!cleaned || cleaned === OPAQUE_MIMETYPE) {
14
+ return undefined;
15
+ }
16
+ return cleaned;
17
+ }
18
+ /**
19
+ * Map a normalized mimetype hint to a NeuroLink FileType. Returns null when
20
+ * the mimetype is unknown or too generic to classify confidently.
21
+ */
22
+ export function mimeHintToFileType(mimetype) {
23
+ const exact = {
24
+ "text/csv": "csv",
25
+ "application/csv": "csv",
26
+ "image/svg+xml": "svg",
27
+ "application/pdf": "pdf",
28
+ "application/json": "text",
29
+ "application/xml": "text",
30
+ "text/xml": "text",
31
+ "application/yaml": "text",
32
+ "application/x-yaml": "text",
33
+ "text/yaml": "text",
34
+ "application/javascript": "text",
35
+ "application/typescript": "text",
36
+ "application/zip": "archive",
37
+ "application/x-tar": "archive",
38
+ "application/gzip": "archive",
39
+ "application/x-gzip": "archive",
40
+ "application/x-7z-compressed": "archive",
41
+ "application/vnd.rar": "archive",
42
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
43
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
44
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
45
+ };
46
+ if (exact[mimetype]) {
47
+ return exact[mimetype];
48
+ }
49
+ if (mimetype.startsWith("text/")) {
50
+ return "text";
51
+ }
52
+ if (mimetype.startsWith("image/")) {
53
+ return "image";
54
+ }
55
+ if (mimetype.startsWith("audio/")) {
56
+ return "audio";
57
+ }
58
+ if (mimetype.startsWith("video/")) {
59
+ return "video";
60
+ }
61
+ return null;
62
+ }
63
+ /**
64
+ * Map a normalized mimetype hint to the canonical file extension (without
65
+ * leading dot). Returns "" when the mimetype is unknown — caller should
66
+ * then fall back to magic-byte detection.
67
+ */
68
+ export function mimeHintToExtension(mimetype) {
69
+ const table = {
70
+ // Text
71
+ "text/plain": "txt",
72
+ "text/html": "html",
73
+ "text/css": "css",
74
+ "text/javascript": "js",
75
+ "application/javascript": "js",
76
+ "application/typescript": "ts",
77
+ "text/markdown": "md",
78
+ "text/csv": "csv",
79
+ "application/csv": "csv",
80
+ "application/json": "json",
81
+ "application/xml": "xml",
82
+ "text/xml": "xml",
83
+ "application/yaml": "yaml",
84
+ "application/x-yaml": "yaml",
85
+ "text/yaml": "yaml",
86
+ // Documents
87
+ "application/pdf": "pdf",
88
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
89
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
90
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
91
+ // Images
92
+ "image/png": "png",
93
+ "image/jpeg": "jpg",
94
+ "image/gif": "gif",
95
+ "image/webp": "webp",
96
+ "image/bmp": "bmp",
97
+ "image/tiff": "tiff",
98
+ "image/svg+xml": "svg",
99
+ // Video
100
+ "video/mp4": "mp4",
101
+ "video/webm": "webm",
102
+ "video/quicktime": "mov",
103
+ "video/x-matroska": "mkv",
104
+ "video/x-msvideo": "avi",
105
+ // Audio
106
+ "audio/mpeg": "mp3",
107
+ "audio/wav": "wav",
108
+ "audio/ogg": "ogg",
109
+ "audio/flac": "flac",
110
+ "audio/mp4": "m4a",
111
+ "audio/aac": "aac",
112
+ // Archives
113
+ "application/zip": "zip",
114
+ "application/x-tar": "tar",
115
+ "application/gzip": "gz",
116
+ "application/x-gzip": "gz",
117
+ "application/x-7z-compressed": "7z",
118
+ "application/vnd.rar": "rar",
119
+ };
120
+ return table[mimetype] || "";
121
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.56.0",
3
+ "version": "9.56.2",
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": {