@juspay/neurolink 9.56.1 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/browser/neurolink.min.js +306 -306
- package/dist/files/fileReferenceRegistry.js +25 -10
- package/dist/lib/files/fileReferenceRegistry.js +25 -10
- package/dist/lib/types/file.d.ts +10 -0
- package/dist/lib/types/fileReference.d.ts +9 -0
- package/dist/lib/utils/fileDetector.d.ts +7 -0
- package/dist/lib/utils/fileDetector.js +47 -0
- package/dist/lib/utils/messageBuilder.js +15 -1
- package/dist/lib/utils/mimeTypeHints.d.ts +40 -0
- package/dist/lib/utils/mimeTypeHints.js +122 -0
- package/dist/types/file.d.ts +10 -0
- package/dist/types/fileReference.d.ts +9 -0
- package/dist/utils/fileDetector.d.ts +7 -0
- package/dist/utils/fileDetector.js +47 -0
- package/dist/utils/messageBuilder.js +15 -1
- package/dist/utils/mimeTypeHints.d.ts +40 -0
- package/dist/utils/mimeTypeHints.js +121 -0
- package/package.json +1 -1
|
@@ -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.
|
|
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": {
|