@juspay/neurolink 11.21.3 → 11.21.4
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 +3 -2
- package/dist/browser/neurolink.min.js +182 -182
- package/dist/utils/redirectDispatcher.d.ts +24 -13
- package/dist/utils/redirectDispatcher.js +29 -19
- package/package.json +5 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatcher } from "undici";
|
|
2
2
|
/**
|
|
3
|
-
* A dispatcher that follows redirects
|
|
3
|
+
* A dispatcher that follows redirects.
|
|
4
4
|
*
|
|
5
5
|
* `getGlobalDispatcher()` returns Node's **built-in** undici dispatcher, whose
|
|
6
6
|
* major tracks the runtime rather than this package's dependency. The composed
|
|
@@ -10,19 +10,30 @@ import type { Dispatcher } from "undici";
|
|
|
10
10
|
* node 24 built-in 7.24.4 + npm 7.28.0 request() succeeds
|
|
11
11
|
* node 22 built-in 6.28.0 + npm 7.28.0 throws "invalid onError method"
|
|
12
12
|
*
|
|
13
|
-
* Node 22 is this package's declared minimum, so the broken combination is
|
|
14
|
-
*
|
|
15
|
-
* compose(), which is why it surfaces as an opaque runtime error instead of
|
|
16
|
-
* something recognisably about versions.
|
|
13
|
+
* Node 22 is this package's declared minimum, so the broken combination is the
|
|
14
|
+
* floor, not an edge case.
|
|
17
15
|
*
|
|
18
|
-
* When the majors
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* streaming size guard on the GET, so the size protection is unchanged and the
|
|
22
|
-
* cost is one extra round trip.
|
|
16
|
+
* When the majors match, compose onto the global dispatcher — that preserves
|
|
17
|
+
* whatever the host application configured globally, such as a corporate
|
|
18
|
+
* ProxyAgent.
|
|
23
19
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
20
|
+
* When they do not, compose onto a fresh `Agent` that npm undici owns, so the
|
|
21
|
+
* handler contract is self-consistent. Redirects still get followed.
|
|
22
|
+
*
|
|
23
|
+
* The earlier version of this function returned the global dispatcher
|
|
24
|
+
* *uncomposed* in the mismatch case, on the stated grounds that it "drops
|
|
25
|
+
* redirect-following from the pre-flight HEAD only". That was wrong: the same
|
|
26
|
+
* dispatcher feeds the real GET in fileDetector.ts and messageBuilder.ts, and
|
|
27
|
+
* that path treats any non-200 as fatal — so on Node 22 a redirecting URL threw
|
|
28
|
+
* `HTTP 302 fetching …` instead of downloading. Verified against a local
|
|
29
|
+
* redirecting server: node 24 -> 200 (followed), node 22 -> 302 (not followed).
|
|
30
|
+
*
|
|
31
|
+
* The cost of the fresh Agent is narrow and worth naming: on a runtime whose
|
|
32
|
+
* built-in undici major differs from ours, a globally-configured dispatcher
|
|
33
|
+
* (e.g. a ProxyAgent set via setGlobalDispatcher) is not inherited for these
|
|
34
|
+
* requests. Losing a proxy on one Node version is recoverable; silently failing
|
|
35
|
+
* every redirecting download is not.
|
|
36
|
+
*
|
|
37
|
+
* @param maxRedirections How many redirects to follow before giving up.
|
|
27
38
|
*/
|
|
28
39
|
export declare function redirectFollowingDispatcher(maxRedirections: number): Dispatcher;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getGlobalDispatcher, interceptors } from "undici";
|
|
1
|
+
import { Agent, getGlobalDispatcher, interceptors } from "undici";
|
|
2
2
|
/**
|
|
3
3
|
* The major of the `undici` this package depends on.
|
|
4
4
|
*
|
|
@@ -8,7 +8,7 @@ import { getGlobalDispatcher, interceptors } from "undici";
|
|
|
8
8
|
*/
|
|
9
9
|
const NPM_UNDICI_MAJOR = 7;
|
|
10
10
|
/**
|
|
11
|
-
* A dispatcher that follows redirects
|
|
11
|
+
* A dispatcher that follows redirects.
|
|
12
12
|
*
|
|
13
13
|
* `getGlobalDispatcher()` returns Node's **built-in** undici dispatcher, whose
|
|
14
14
|
* major tracks the runtime rather than this package's dependency. The composed
|
|
@@ -18,26 +18,36 @@ const NPM_UNDICI_MAJOR = 7;
|
|
|
18
18
|
* node 24 built-in 7.24.4 + npm 7.28.0 request() succeeds
|
|
19
19
|
* node 22 built-in 6.28.0 + npm 7.28.0 throws "invalid onError method"
|
|
20
20
|
*
|
|
21
|
-
* Node 22 is this package's declared minimum, so the broken combination is
|
|
22
|
-
*
|
|
23
|
-
* compose(), which is why it surfaces as an opaque runtime error instead of
|
|
24
|
-
* something recognisably about versions.
|
|
21
|
+
* Node 22 is this package's declared minimum, so the broken combination is the
|
|
22
|
+
* floor, not an edge case.
|
|
25
23
|
*
|
|
26
|
-
* When the majors
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* streaming size guard on the GET, so the size protection is unchanged and the
|
|
30
|
-
* cost is one extra round trip.
|
|
24
|
+
* When the majors match, compose onto the global dispatcher — that preserves
|
|
25
|
+
* whatever the host application configured globally, such as a corporate
|
|
26
|
+
* ProxyAgent.
|
|
31
27
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
28
|
+
* When they do not, compose onto a fresh `Agent` that npm undici owns, so the
|
|
29
|
+
* handler contract is self-consistent. Redirects still get followed.
|
|
30
|
+
*
|
|
31
|
+
* The earlier version of this function returned the global dispatcher
|
|
32
|
+
* *uncomposed* in the mismatch case, on the stated grounds that it "drops
|
|
33
|
+
* redirect-following from the pre-flight HEAD only". That was wrong: the same
|
|
34
|
+
* dispatcher feeds the real GET in fileDetector.ts and messageBuilder.ts, and
|
|
35
|
+
* that path treats any non-200 as fatal — so on Node 22 a redirecting URL threw
|
|
36
|
+
* `HTTP 302 fetching …` instead of downloading. Verified against a local
|
|
37
|
+
* redirecting server: node 24 -> 200 (followed), node 22 -> 302 (not followed).
|
|
38
|
+
*
|
|
39
|
+
* The cost of the fresh Agent is narrow and worth naming: on a runtime whose
|
|
40
|
+
* built-in undici major differs from ours, a globally-configured dispatcher
|
|
41
|
+
* (e.g. a ProxyAgent set via setGlobalDispatcher) is not inherited for these
|
|
42
|
+
* requests. Losing a proxy on one Node version is recoverable; silently failing
|
|
43
|
+
* every redirecting download is not.
|
|
44
|
+
*
|
|
45
|
+
* @param maxRedirections How many redirects to follow before giving up.
|
|
35
46
|
*/
|
|
36
47
|
export function redirectFollowingDispatcher(maxRedirections) {
|
|
37
|
-
const globalDispatcher = getGlobalDispatcher();
|
|
38
48
|
const builtinMajor = Number.parseInt(process.versions.undici?.split(".")[0] ?? "", 10);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return
|
|
49
|
+
const base = Number.isFinite(builtinMajor) && builtinMajor === NPM_UNDICI_MAJOR
|
|
50
|
+
? getGlobalDispatcher()
|
|
51
|
+
: new Agent();
|
|
52
|
+
return base.compose(interceptors.redirect({ maxRedirections }));
|
|
43
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "11.21.
|
|
3
|
+
"version": "11.21.4",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && tsc --noEmit --strict",
|
|
43
43
|
"check:ci-scripts": "svelte-kit sync && tsc -p tsconfig.ci-scripts.json",
|
|
44
44
|
"check:test-parse": "node scripts/parse-check-tests.mjs",
|
|
45
|
+
"check:tools-tests": "svelte-kit sync && tsc -p tsconfig.tools-tests.json",
|
|
45
46
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
46
47
|
"typecheck": "tsc --noEmit",
|
|
47
48
|
"modelServer": "tsx scripts/modelServer.ts",
|
|
@@ -475,6 +476,7 @@
|
|
|
475
476
|
"@sveltejs/package": "^2.5.7",
|
|
476
477
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
477
478
|
"@types/cors": "^2.8.19",
|
|
479
|
+
"@types/diff": "^8.0.0",
|
|
478
480
|
"@types/express": "^5.0.6",
|
|
479
481
|
"@types/fluent-ffmpeg": "^2.1.28",
|
|
480
482
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -491,8 +493,10 @@
|
|
|
491
493
|
"@vercel/ncc": "^0.38.4",
|
|
492
494
|
"concurrently": "^9.2.1",
|
|
493
495
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
496
|
+
"diff": "^9.0.0",
|
|
494
497
|
"esbuild": "^0.28.1",
|
|
495
498
|
"eslint": "^10.0.2",
|
|
499
|
+
"glob": "^13.0.6",
|
|
496
500
|
"husky": "^9.1.7",
|
|
497
501
|
"playwright": "^1.58.2",
|
|
498
502
|
"prettier": "^3.8.1",
|