@openclaw/discord 2026.6.33 → 2026.6.35
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/dist/action-runtime-api.js +1 -1
- package/dist/{api-CjnGBhM3.js → api-1GXlSrYP.js} +42 -21
- package/dist/api.js +14 -14
- package/dist/{approval-handler.runtime-BWPQrzpP.js → approval-handler.runtime-Dv4p7REU.js} +3 -3
- package/dist/{audit-BwJ_2OjL.js → audit-DEVi9nIs.js} +3 -3
- package/dist/{channel-Ddnonoy4.js → channel-CQIRiosn.js} +15 -15
- package/dist/{channel-actions-CwmIqnYN.js → channel-actions-JziPEcBU.js} +2 -2
- package/dist/{channel-actions.runtime-DvpTfaJ4.js → channel-actions.runtime-D7L47LY3.js} +5 -5
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-glZ5Y98a.js → channel.setup-oMeR19Cc.js} +2 -2
- package/dist/{components-j6lTZBsT.js → components-_s5UPJqU.js} +1 -1
- package/dist/{conversation-identity-36FFBwm5.js → conversation-identity-B0k94-bz.js} +2 -2
- package/dist/{directory-config-BYMFzL29.js → directory-config-CD1svkyN.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-9JtJCiu8.js → directory-live-DBTsSRxl.js} +5 -5
- package/dist/{handle-action.guild-admin-xxGYrp-I.js → handle-action.guild-admin-CYIFMxh-.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{manager.runtime-BK6cf2Zu.js → manager.runtime-BZVdGX2d.js} +17 -9
- package/dist/{message-handler-BqpJIavO.js → message-handler-DZd9Bpq8.js} +7 -6
- package/dist/{message-handler.preflight-C90MxCcv.js → message-handler.preflight-Axv9J9EO.js} +12 -11
- package/dist/{message-handler.process-CeQ7Bd_3.js → message-handler.process-CG0zFS-Z.js} +10 -10
- package/dist/{message-utils-CJeAoISH.js → message-utils-Dbuw27gd.js} +1 -1
- package/dist/{outbound-adapter-Dxs6iKEq.js → outbound-adapter-CKC_kmUN.js} +6 -6
- package/dist/pluralkit-CfTReLl3.js +40 -0
- package/dist/{probe-esE_Oqdm.js → probe-DcgZIpyF.js} +3 -2
- package/dist/{probe.runtime-C3Atgpvr.js → probe.runtime-CVwM9L5E.js} +1 -1
- package/dist/{provider-C7376XFH.js → provider-CwwSXIIj.js} +102 -37
- package/dist/{provider-session.runtime-CCdqogGf.js → provider-session.runtime-reBWkqHZ.js} +3 -3
- package/dist/provider.runtime-BsmTLYS_.js +2 -0
- package/dist/{resolve-allowlist-common-3gB2Gpmm.js → resolve-allowlist-common-D7bZqAw3.js} +3 -3
- package/dist/{resolve-channels-B3gQf8QL.js → resolve-channels--oE-RnO6.js} +6 -6
- package/dist/{resolve-users-BO10y5fJ.js → resolve-users-QXo8CXBU.js} +5 -5
- package/dist/{runtime-CFlR3L9X.js → runtime-CF7ramAs.js} +7 -7
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +19 -19
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-CzF8MUl_.js +6 -0
- package/dist/runtime-api.monitor.js +5 -5
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +3 -3
- package/dist/{send-JHxfT4Pk.js → send-Bb295iHT.js} +5 -5
- package/dist/{send.components-CN35E2Ck.js → send.components-COkDUO3B.js} +4 -4
- package/dist/{send.outbound-B-cA1Esv.js → send.outbound-B_sk0hNe.js} +3 -3
- package/dist/{send.receipt-CGecJDin.js → send.receipt-Cli6_9Sn.js} +19 -7
- package/dist/{send.shared-vcbfThdy.js → send.shared-BCG7MWnP.js} +2 -2
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{subagent-hooks-20wXhVzZ.js → subagent-hooks-CtqoWK4x.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DR27TE7p.js → system-events-BxGNk_wE.js} +1 -1
- package/dist/{target-resolver-CDi1gI90.js → target-resolver-BcoK6b0g.js} +2 -2
- package/dist/targets-Q-ZoP7K4.js +3 -0
- package/dist/{thread-bindings-DU4T6nDo.js → thread-bindings-DJ_HT6GJ.js} +4 -4
- package/dist/{thread-bindings.discord-api-CYkr-3Gj.js → thread-bindings.discord-api-OPyjvgyz.js} +4 -4
- package/dist/{thread-bindings.manager-BqWs1UE2.js → thread-bindings.manager-Cd2HAVw_.js} +3 -3
- package/dist/{transcripts-source-D-lBI5ZD.js → transcripts-source-CPf5gURy.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-xr05bL-r.js → typing-DY0cwLdg.js} +1 -1
- package/node_modules/undici/README.md +8 -2
- package/node_modules/undici/docs/docs/api/Agent.md +248 -44
- package/node_modules/undici/docs/docs/api/BalancedPool.md +246 -48
- package/node_modules/undici/docs/docs/api/CacheStorage.md +171 -13
- package/node_modules/undici/docs/docs/api/CacheStore.md +294 -98
- package/node_modules/undici/docs/docs/api/Client.md +386 -179
- package/node_modules/undici/docs/docs/api/ClientStats.md +80 -14
- package/node_modules/undici/docs/docs/api/Connector.md +118 -36
- package/node_modules/undici/docs/docs/api/ContentType.md +65 -25
- package/node_modules/undici/docs/docs/api/Cookies.md +122 -71
- package/node_modules/undici/docs/docs/api/Debug.md +34 -18
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +364 -164
- package/node_modules/undici/docs/docs/api/Dispatcher.md +485 -1102
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +102 -87
- package/node_modules/undici/docs/docs/api/Errors.md +503 -40
- package/node_modules/undici/docs/docs/api/EventSource.md +298 -32
- package/node_modules/undici/docs/docs/api/Fetch.md +680 -31
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +78 -98
- package/node_modules/undici/docs/docs/api/H2CClient.md +298 -176
- package/node_modules/undici/docs/docs/api/Interceptors.md +418 -0
- package/node_modules/undici/docs/docs/api/MockAgent.md +333 -314
- package/node_modules/undici/docs/docs/api/MockCallHistory.md +272 -98
- package/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +189 -26
- package/node_modules/undici/docs/docs/api/MockClient.md +151 -33
- package/node_modules/undici/docs/docs/api/MockErrors.md +56 -5
- package/node_modules/undici/docs/docs/api/MockPool.md +321 -258
- package/node_modules/undici/docs/docs/api/Pool.md +235 -43
- package/node_modules/undici/docs/docs/api/PoolStats.md +119 -13
- package/node_modules/undici/docs/docs/api/ProxyAgent.md +179 -160
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +238 -63
- package/node_modules/undici/docs/docs/api/RetryAgent.md +113 -26
- package/node_modules/undici/docs/docs/api/RetryHandler.md +161 -77
- package/node_modules/undici/docs/docs/api/RoundRobinPool.md +166 -72
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +264 -542
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +177 -196
- package/node_modules/undici/docs/docs/api/Util.md +68 -11
- package/node_modules/undici/docs/docs/api/WebSocket.md +475 -80
- package/node_modules/undici/docs/docs/api/api-lifecycle.md +100 -32
- package/node_modules/undici/docs/docs/best-practices/client-certificate.md +2 -0
- package/node_modules/undici/docs/docs/best-practices/crawling.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +6 -4
- package/node_modules/undici/docs/docs/best-practices/mocking-request.md +9 -7
- package/node_modules/undici/docs/docs/best-practices/proxy.md +3 -1
- package/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +10 -8
- package/node_modules/undici/docs/docs/best-practices/writing-tests.md +2 -0
- package/node_modules/undici/docs/docs/{GettingStarted.md → getting-started.md} +22 -19
- package/node_modules/undici/docs/docs/index.md +784 -0
- package/node_modules/undici/docs/docs/site.json +125 -0
- package/node_modules/undici/docs/docs/type-map.json +79 -0
- package/node_modules/undici/lib/api/api-request.js +7 -1
- package/node_modules/undici/lib/api/readable.js +42 -7
- package/node_modules/undici/lib/cache/memory-cache-store.js +56 -11
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +7 -1
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/errors.js +20 -0
- package/node_modules/undici/lib/core/request.js +14 -3
- package/node_modules/undici/lib/core/symbols.js +3 -0
- package/node_modules/undici/lib/core/util.js +30 -2
- package/node_modules/undici/lib/dispatcher/agent.js +10 -5
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
- package/node_modules/undici/lib/dispatcher/client-h1.js +74 -9
- package/node_modules/undici/lib/dispatcher/client-h2.js +483 -151
- package/node_modules/undici/lib/dispatcher/client.js +76 -30
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
- package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +37 -8
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +58 -7
- package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +106 -22
- package/node_modules/undici/lib/global.js +36 -16
- package/node_modules/undici/lib/handler/cache-handler.js +297 -65
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +13 -3
- package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
- package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/undici/lib/handler/redirect-handler.js +26 -5
- package/node_modules/undici/lib/handler/retry-handler.js +238 -51
- package/node_modules/undici/lib/interceptor/cache.js +221 -58
- package/node_modules/undici/lib/interceptor/decompress.js +124 -15
- package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/undici/lib/interceptor/dns.js +7 -0
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/mock/mock-agent.js +13 -1
- package/node_modules/undici/lib/mock/mock-interceptor.js +25 -7
- package/node_modules/undici/lib/mock/mock-utils.js +246 -27
- package/node_modules/undici/lib/util/cache.js +415 -71
- package/node_modules/undici/lib/util/date.js +23 -6
- package/node_modules/undici/lib/web/cookies/parse.js +150 -146
- package/node_modules/undici/lib/web/cookies/util.js +79 -9
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
- package/node_modules/undici/lib/web/eventsource/util.js +1 -1
- package/node_modules/undici/lib/web/fetch/body.js +2 -1
- package/node_modules/undici/lib/web/fetch/constants.js +1 -1
- package/node_modules/undici/lib/web/fetch/index.js +17 -2
- package/node_modules/undici/lib/web/fetch/request.js +2 -3
- package/node_modules/undici/lib/web/fetch/response.js +1 -3
- package/node_modules/undici/lib/web/fetch/util.js +10 -2
- package/node_modules/undici/lib/web/webidl/index.js +3 -3
- package/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +4 -4
- package/node_modules/undici/types/client.d.ts +53 -3
- package/node_modules/undici/types/cookies.d.ts +1 -1
- package/node_modules/undici/types/dispatcher.d.ts +3 -3
- package/node_modules/undici/types/errors.d.ts +10 -0
- package/node_modules/undici/types/handlers.d.ts +2 -0
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/node_modules/undici/types/mock-agent.d.ts +11 -10
- package/node_modules/undici/types/mock-interceptor.d.ts +5 -1
- package/node_modules/undici/types/proxy-agent.d.ts +7 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
- package/npm-shrinkwrap.json +7 -7
- package/package.json +6 -5
- package/dist/pluralkit-DI6RYaVj.js +0 -24
- package/dist/provider.runtime-D1m66kDS.js +0 -2
- package/dist/runtime-api.monitor-4oc58TSk.js +0 -6
- package/dist/targets-C6yd3y8R.js +0 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sidebar": [
|
|
3
|
+
{
|
|
4
|
+
"groupName": "Documentation",
|
|
5
|
+
"items": [
|
|
6
|
+
{ "link": "/", "label": "Home" },
|
|
7
|
+
{ "link": "/getting-started", "label": "Getting Started" }
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"groupName": "API",
|
|
12
|
+
"items": [
|
|
13
|
+
{
|
|
14
|
+
"label": "Core",
|
|
15
|
+
"items": [
|
|
16
|
+
{ "link": "/api/Dispatcher", "label": "Dispatcher" },
|
|
17
|
+
{ "link": "/api/Client", "label": "Client" },
|
|
18
|
+
{ "link": "/api/H2CClient", "label": "H2CClient" },
|
|
19
|
+
{ "link": "/api/Pool", "label": "Pool" },
|
|
20
|
+
{ "link": "/api/BalancedPool", "label": "BalancedPool" },
|
|
21
|
+
{ "link": "/api/RoundRobinPool", "label": "RoundRobinPool" },
|
|
22
|
+
{ "link": "/api/Agent", "label": "Agent" },
|
|
23
|
+
{ "link": "/api/PoolStats", "label": "PoolStats" },
|
|
24
|
+
{ "link": "/api/Connector", "label": "Connector" }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"label": "Proxy & Agents",
|
|
29
|
+
"items": [
|
|
30
|
+
{ "link": "/api/ProxyAgent", "label": "ProxyAgent" },
|
|
31
|
+
{
|
|
32
|
+
"link": "/api/EnvHttpProxyAgent",
|
|
33
|
+
"label": "EnvHttpProxyAgent"
|
|
34
|
+
},
|
|
35
|
+
{ "link": "/api/Socks5ProxyAgent", "label": "Socks5ProxyAgent" },
|
|
36
|
+
{ "link": "/api/RetryAgent", "label": "RetryAgent" }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"label": "Web Standards",
|
|
41
|
+
"items": [
|
|
42
|
+
{ "link": "/api/Fetch", "label": "Fetch" },
|
|
43
|
+
{ "link": "/api/EventSource", "label": "EventSource" },
|
|
44
|
+
{ "link": "/api/WebSocket", "label": "WebSocket" },
|
|
45
|
+
{ "link": "/api/Cookies", "label": "Cookies" },
|
|
46
|
+
{ "link": "/api/CacheStorage", "label": "CacheStorage" },
|
|
47
|
+
{ "link": "/api/ContentType", "label": "MIME Type Parsing" }
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"label": "Mocking",
|
|
52
|
+
"items": [
|
|
53
|
+
{ "link": "/api/MockClient", "label": "MockClient" },
|
|
54
|
+
{ "link": "/api/MockPool", "label": "MockPool" },
|
|
55
|
+
{ "link": "/api/MockAgent", "label": "MockAgent" },
|
|
56
|
+
{ "link": "/api/SnapshotAgent", "label": "SnapshotAgent" },
|
|
57
|
+
{ "link": "/api/MockCallHistory", "label": "MockCallHistory" },
|
|
58
|
+
{
|
|
59
|
+
"link": "/api/MockCallHistoryLog",
|
|
60
|
+
"label": "MockCallHistoryLog"
|
|
61
|
+
},
|
|
62
|
+
{ "link": "/api/MockErrors", "label": "MockErrors" }
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"label": "Interceptors",
|
|
67
|
+
"items": [
|
|
68
|
+
{ "link": "/api/Interceptors", "label": "Interceptors" }
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"label": "Handlers",
|
|
73
|
+
"items": [
|
|
74
|
+
{ "link": "/api/RedirectHandler", "label": "RedirectHandler" },
|
|
75
|
+
{ "link": "/api/RetryHandler", "label": "RetryHandler" }
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"label": "Diagnostics & Utilities",
|
|
80
|
+
"items": [
|
|
81
|
+
{ "link": "/api/Errors", "label": "Errors" },
|
|
82
|
+
{
|
|
83
|
+
"link": "/api/DiagnosticsChannel",
|
|
84
|
+
"label": "Diagnostics Channel Support"
|
|
85
|
+
},
|
|
86
|
+
{ "link": "/api/Debug", "label": "Debug" },
|
|
87
|
+
{ "link": "/api/Util", "label": "Util" },
|
|
88
|
+
{
|
|
89
|
+
"link": "/api/GlobalInstallation",
|
|
90
|
+
"label": "Global Installation"
|
|
91
|
+
},
|
|
92
|
+
{ "link": "/api/api-lifecycle", "label": "API Lifecycle" }
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"groupName": "Best Practices",
|
|
99
|
+
"items": [
|
|
100
|
+
{
|
|
101
|
+
"link": "/best-practices/undici-vs-builtin-fetch",
|
|
102
|
+
"label": "Undici vs. Built-in Fetch"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"link": "/best-practices/migrating-from-v7-to-v8",
|
|
106
|
+
"label": "Migrating from Undici 7 to 8"
|
|
107
|
+
},
|
|
108
|
+
{ "link": "/best-practices/proxy", "label": "Proxy" },
|
|
109
|
+
{
|
|
110
|
+
"link": "/best-practices/client-certificate",
|
|
111
|
+
"label": "Client Certificate"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"link": "/best-practices/writing-tests",
|
|
115
|
+
"label": "Writing Tests"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"link": "/best-practices/mocking-request",
|
|
119
|
+
"label": "Mocking Request"
|
|
120
|
+
},
|
|
121
|
+
{ "link": "/best-practices/crawling", "label": "Crawling" }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AbortError": "/api/Errors.md#class-aborterror",
|
|
3
|
+
"Agent": "/api/Agent.md#class-agent",
|
|
4
|
+
"AgentDispatchOptions": "/api/Agent.md#agentdispatchoptions-handler",
|
|
5
|
+
"AgentOptions": "/api/Agent.md#new-agentoptions",
|
|
6
|
+
"BalancedPool": "/api/BalancedPool.md#class-balancedpool",
|
|
7
|
+
"BalancedPoolOptions": "/api/BalancedPool.md#parameter-balancedpooloptions",
|
|
8
|
+
"BodyMixin": "/api/Fetch.md#new-formdata",
|
|
9
|
+
"Buffer": "https://nodejs.org/api/buffer.html#class-buffer",
|
|
10
|
+
"BuildOptions": "/api/Connector.md#buildconnectoroptions",
|
|
11
|
+
"CacheKey": "/api/CacheStore.md#cachekey",
|
|
12
|
+
"CacheStore": "/api/CacheStore.md#new-memorycachestoreoptions",
|
|
13
|
+
"CacheValue": "/api/CacheStore.md#cachevalue",
|
|
14
|
+
"ClientDestroyedError": "/api/Errors.md#class-clientdestroyederror",
|
|
15
|
+
"ClientOptions": "/api/Client.md#new-clienturl-options",
|
|
16
|
+
"ClientStats": "/api/ClientStats.md#class-clientstats",
|
|
17
|
+
"ConnectOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
18
|
+
"Cookie": "/api/Cookies.md#cookie",
|
|
19
|
+
"DispatchController": "/api/Dispatcher.md#class-dispatcher",
|
|
20
|
+
"DispatchHandler": "/api/Dispatcher.md#class-dispatcher",
|
|
21
|
+
"DispatchOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
22
|
+
"Dispatcher": "/api/Dispatcher.md#class-dispatcher",
|
|
23
|
+
"Duplex": "https://nodejs.org/api/stream.html#class-streamduplex",
|
|
24
|
+
"EnvHttpProxyAgent": "/api/EnvHttpProxyAgent.md#class-envhttpproxyagent",
|
|
25
|
+
"EnvHttpProxyAgentOptions": "/api/EnvHttpProxyAgent.md#new-envhttpproxyagentoptions",
|
|
26
|
+
"EventEmitter": "https://nodejs.org/api/events.html#class-eventemitter",
|
|
27
|
+
"GetResult": "/api/CacheStore.md#getresult",
|
|
28
|
+
"H2CClientOptions": "/api/H2CClient.md#new-h2cclienturl-options",
|
|
29
|
+
"HeadersInit": "https://developer.mozilla.org/docs/Web/API/Headers/Headers",
|
|
30
|
+
"InvalidArgumentError": "/api/Errors.md#class-invalidargumenterror",
|
|
31
|
+
"Iterable": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols",
|
|
32
|
+
"MaxOriginsReachedError": "/api/Errors.md#class-maxoriginsreachederror",
|
|
33
|
+
"MockAgent": "/api/MockAgent.md#class-mockagent",
|
|
34
|
+
"MockAgentOptions": "/api/MockAgent.md#parameter-mockagentoptions",
|
|
35
|
+
"MockCallHistory": "/api/MockCallHistory.md#class-mockcallhistory",
|
|
36
|
+
"MockCallHistoryLog": "/api/MockCallHistoryLog.md#class-mockcallhistorylog",
|
|
37
|
+
"MockClient": "/api/MockClient.md#class-mockclient",
|
|
38
|
+
"MockClientOptions": "/api/MockClient.md#parameter-mockclientoptions",
|
|
39
|
+
"MockInterceptor": "/api/MockPool.md#return-mockinterceptor",
|
|
40
|
+
"MockInterceptor.Options": "/api/MockPool.md#parameter-mockpoolinterceptoptions",
|
|
41
|
+
"MockPool": "/api/MockPool.md#class-mockpool",
|
|
42
|
+
"MockPoolInterceptOptions": "/api/MockPool.md#parameter-mockpoolinterceptoptions",
|
|
43
|
+
"MockPoolOptions": "/api/MockPool.md#parameter-mockpooloptions",
|
|
44
|
+
"MockResponseOptions": "/api/MockPool.md#parameter-mockresponseoptions",
|
|
45
|
+
"MockScope": "/api/MockPool.md#return-mockscope",
|
|
46
|
+
"PendingInterceptor": "/api/MockAgent.md#new-mockagentoptions",
|
|
47
|
+
"PipelineOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
48
|
+
"Pool": "/api/Pool.md#class-pool",
|
|
49
|
+
"PoolOptions": "/api/Pool.md#new-poolurl-options",
|
|
50
|
+
"PoolStats": "/api/PoolStats.md#class-poolstats",
|
|
51
|
+
"ProxyAgent": "/api/ProxyAgent.md#class-proxyagent",
|
|
52
|
+
"ProxyAgentOptions": "/api/ProxyAgent.md#new-proxyagentoptions",
|
|
53
|
+
"Readable": "https://nodejs.org/api/stream.html#class-streamreadable",
|
|
54
|
+
"Record": "https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type",
|
|
55
|
+
"RequestInit": "/api/Fetch.md#new-formdata",
|
|
56
|
+
"RequestOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
57
|
+
"ResponseInit": "/api/Fetch.md#new-formdata",
|
|
58
|
+
"RetryContext": "/api/RetryHandler.md#retrycontext",
|
|
59
|
+
"RetryHandler": "/api/RetryHandler.md#class-retryhandler",
|
|
60
|
+
"RetryHandlers": "/api/RetryHandler.md#parameter-retryhandlers",
|
|
61
|
+
"RetryOptions": "/api/RetryHandler.md#retryoptions",
|
|
62
|
+
"RetryState": "/api/RetryHandler.md#retrystate",
|
|
63
|
+
"RoundRobinPoolOptions": "/api/RoundRobinPool.md#parameter-roundrobinpooloptions",
|
|
64
|
+
"SnapshotRecorder": "/api/SnapshotAgent.md#new-snapshotagentoptions",
|
|
65
|
+
"Socket": "https://nodejs.org/api/net.html#class-netsocket",
|
|
66
|
+
"SocketInfo": "/api/Errors.md#new-requestretryerrormessage-code-options",
|
|
67
|
+
"StreamOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
68
|
+
"TLSSocket": "https://nodejs.org/api/tls.html#class-tlstlssocket",
|
|
69
|
+
"UndiciError": "/api/Errors.md#class-undicierror",
|
|
70
|
+
"UndiciHeaders": "/api/Dispatcher.md#class-dispatcher",
|
|
71
|
+
"UpgradeOptions": "/api/Dispatcher.md#class-dispatcher",
|
|
72
|
+
"UrlObject": "/index.md#urlobject",
|
|
73
|
+
"WebSocketInit": "/api/WebSocket.md#new-websocketurl-protocols",
|
|
74
|
+
"WebSocketStreamOptions": "/api/WebSocket.md#new-websocketurl-protocols",
|
|
75
|
+
"Writable": "https://nodejs.org/api/stream.html#class-streamwritable",
|
|
76
|
+
"buildConnector.BuildOptions": "/api/Connector.md#buildconnectoroptions",
|
|
77
|
+
"net.Socket": "https://nodejs.org/api/net.html#class-netsocket",
|
|
78
|
+
"stream.Readable": "https://nodejs.org/api/stream.html#class-streamreadable"
|
|
79
|
+
}
|
|
@@ -66,7 +66,13 @@ class RequestHandler extends AsyncResource {
|
|
|
66
66
|
this.removeAbortListener = util.addAbortListener(signal, () => {
|
|
67
67
|
this.reason = signal.reason ?? new RequestAbortedError()
|
|
68
68
|
if (this.res) {
|
|
69
|
-
|
|
69
|
+
// Null the reference before destroying, mirroring onResponseError, so
|
|
70
|
+
// that chunks flushed after the abort (e.g. an async decompressor
|
|
71
|
+
// flush) are dropped by the `!this.res` guard in onResponseData
|
|
72
|
+
// instead of being pushed into the torn-down stream.
|
|
73
|
+
const res = this.res
|
|
74
|
+
this.res = null
|
|
75
|
+
util.destroy(res.on('error', noop), this.reason)
|
|
70
76
|
} else if (this.abort) {
|
|
71
77
|
this.abort(this.reason)
|
|
72
78
|
}
|
|
@@ -325,7 +325,15 @@ class BodyReadable extends Readable {
|
|
|
325
325
|
*/
|
|
326
326
|
setEncoding (encoding) {
|
|
327
327
|
if (Buffer.isEncoding(encoding)) {
|
|
328
|
-
|
|
328
|
+
// Delegate to Node.js Readable.setEncoding() which initializes a
|
|
329
|
+
// StringDecoder and re-encodes already-buffered chunks. This properly
|
|
330
|
+
// handles multi-byte sequences split at chunk boundaries for the
|
|
331
|
+
// for-await / on('data') paths. Without this, Node.js uses
|
|
332
|
+
// buf.toString(encoding) on each chunk, producing U+FFFD for split chars.
|
|
333
|
+
//
|
|
334
|
+
// The consume path (body.text(), body.json(), ...) copes with the
|
|
335
|
+
// decoded strings this leaves in state.buffer, see consumeStart().
|
|
336
|
+
super.setEncoding(encoding)
|
|
329
337
|
}
|
|
330
338
|
return this
|
|
331
339
|
}
|
|
@@ -445,14 +453,29 @@ function consumeStart (consume) {
|
|
|
445
453
|
}
|
|
446
454
|
}
|
|
447
455
|
|
|
456
|
+
// If setEncoding() was called, state.buffer holds decoded strings, which
|
|
457
|
+
// consumePush() turns back into bytes. The trailing bytes of a multi-byte
|
|
458
|
+
// sequence split across a chunk boundary are not part of any of those
|
|
459
|
+
// strings, they are held inside the decoder until the rest arrives, so
|
|
460
|
+
// take them from there.
|
|
461
|
+
const decoder = state.decoder
|
|
462
|
+
if (decoder != null && decoder.lastNeed > 0) {
|
|
463
|
+
consumePush(consume, Buffer.from(decoder.lastChar.subarray(0, decoder.lastTotal - decoder.lastNeed)))
|
|
464
|
+
}
|
|
465
|
+
|
|
448
466
|
if (state.endEmitted) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
467
|
+
// No `this` to read the consume off here: consumeStart is a free function, called from
|
|
468
|
+
// the queueMicrotask above. The callback below does have one, because the emitter passes
|
|
469
|
+
// the stream as its receiver. Returning matters too - consumeEnd() clears consume.stream,
|
|
470
|
+
// which the resume() below would then dereference.
|
|
471
|
+
consumeEnd(consume, state.encoding)
|
|
472
|
+
return
|
|
454
473
|
}
|
|
455
474
|
|
|
475
|
+
consume.stream.on('end', function () {
|
|
476
|
+
consumeEnd(this[kConsume], this._readableState.encoding)
|
|
477
|
+
})
|
|
478
|
+
|
|
456
479
|
consume.stream.resume()
|
|
457
480
|
|
|
458
481
|
while (consume.stream.read() != null) {
|
|
@@ -542,10 +565,22 @@ function consumeEnd (consume, encoding) {
|
|
|
542
565
|
|
|
543
566
|
/**
|
|
544
567
|
* @param {Consume} consume
|
|
545
|
-
* @param {Buffer} chunk
|
|
568
|
+
* @param {Buffer|string} chunk
|
|
546
569
|
* @returns {void}
|
|
547
570
|
*/
|
|
548
571
|
function consumePush (consume, chunk) {
|
|
572
|
+
if (consume.body === null) {
|
|
573
|
+
return
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (typeof chunk === 'string') {
|
|
577
|
+
// Buffered before the consume started, while an encoding was set.
|
|
578
|
+
// consume.length has to stay a byte count and chunksDecode()/chunksConcat()
|
|
579
|
+
// only work on bytes, so re-encode. A string's own length is in UTF-16 code
|
|
580
|
+
// units and Uint8Array.prototype.set() ignores a string argument entirely.
|
|
581
|
+
chunk = Buffer.from(chunk, consume.stream._readableState.encoding)
|
|
582
|
+
}
|
|
583
|
+
|
|
549
584
|
consume.length += chunk.length
|
|
550
585
|
consume.body.push(chunk)
|
|
551
586
|
}
|
|
@@ -87,7 +87,7 @@ class MemoryCacheStore extends EventEmitter {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey}
|
|
90
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} key
|
|
91
91
|
* @returns {import('../../types/cache-interceptor.d.ts').default.GetResult | undefined}
|
|
92
92
|
*/
|
|
93
93
|
get (key) {
|
|
@@ -179,7 +179,7 @@ class MemoryCacheStore extends EventEmitter {
|
|
|
179
179
|
|
|
180
180
|
// Perform eviction
|
|
181
181
|
for (const [key, entries] of store.#entries) {
|
|
182
|
-
for (const entry of entries.splice(0, entries.length / 2)) {
|
|
182
|
+
for (const entry of entries.splice(0, Math.ceil(entries.length / 2))) {
|
|
183
183
|
store.#size -= entry.size
|
|
184
184
|
store.#count -= 1
|
|
185
185
|
}
|
|
@@ -218,17 +218,62 @@ class MemoryCacheStore extends EventEmitter {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
function findEntry (key, entries, now) {
|
|
221
|
-
|
|
222
|
-
entry
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
for (let i = 0; i < entries.length; i++) {
|
|
222
|
+
const entry = entries[i]
|
|
223
|
+
if (
|
|
224
|
+
entry.deleteAt > now &&
|
|
225
|
+
entry.method === key.method &&
|
|
226
|
+
varyMatches(key, entry)
|
|
227
|
+
) {
|
|
228
|
+
return entry
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function varyMatches (key, entry) {
|
|
234
|
+
if (entry.vary == null) {
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
for (const headerName in entry.vary) {
|
|
239
|
+
if (Object.hasOwn(entry.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry.vary[headerName])) {
|
|
240
|
+
return false
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return true
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @param {string|string[]|null|undefined} lhs
|
|
249
|
+
* @param {string|string[]|null|undefined} rhs
|
|
250
|
+
* @returns {boolean}
|
|
251
|
+
*/
|
|
252
|
+
function headerValueEquals (lhs, rhs) {
|
|
253
|
+
if (lhs == null && rhs == null) {
|
|
254
|
+
return true
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if ((lhs == null && rhs != null) ||
|
|
258
|
+
(lhs != null && rhs == null)) {
|
|
259
|
+
return false
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
263
|
+
if (lhs.length !== rhs.length) {
|
|
264
|
+
return false
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
268
|
+
if (lhs[i] !== rhs[i]) {
|
|
269
|
+
return false
|
|
227
270
|
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return true
|
|
274
|
+
}
|
|
228
275
|
|
|
229
|
-
|
|
230
|
-
}))
|
|
231
|
-
))
|
|
276
|
+
return lhs === rhs
|
|
232
277
|
}
|
|
233
278
|
|
|
234
279
|
module.exports = MemoryCacheStore
|
|
@@ -456,7 +456,13 @@ function headerValueEquals (lhs, rhs) {
|
|
|
456
456
|
return false
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
460
|
+
if (lhs[i] !== rhs[i]) {
|
|
461
|
+
return false
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
return true
|
|
460
466
|
}
|
|
461
467
|
|
|
462
468
|
return lhs === rhs
|
|
@@ -105,13 +105,27 @@ function buildConnector ({ allowH2, preferH2, useH2c, maxCachedSessions, socketP
|
|
|
105
105
|
|
|
106
106
|
port = port || 80
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
const connectOptions = {
|
|
109
109
|
highWaterMark: 64 * 1024, // Same as nodejs fs streams.
|
|
110
110
|
...options,
|
|
111
111
|
localAddress,
|
|
112
112
|
port,
|
|
113
113
|
host: hostname
|
|
114
|
-
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const family = net.isIP(hostname)
|
|
117
|
+
if (family !== 0 && servername && servername !== hostname) {
|
|
118
|
+
connectOptions.host = servername
|
|
119
|
+
connectOptions.lookup = (_hostname, lookupOptions, cb) => {
|
|
120
|
+
if (lookupOptions.all) {
|
|
121
|
+
cb(null, [{ address: hostname, family }])
|
|
122
|
+
} else {
|
|
123
|
+
cb(null, hostname, family)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
socket = net.connect(connectOptions)
|
|
115
129
|
if (useH2c === true) {
|
|
116
130
|
socket.alpnProtocol = 'h2'
|
|
117
131
|
}
|
|
@@ -403,6 +403,25 @@ class SecureProxyConnectionError extends UndiciError {
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
const kProxyConnectionError = Symbol.for('undici.error.UND_ERR_PRX_CONN')
|
|
407
|
+
class ProxyConnectionError extends UndiciError {
|
|
408
|
+
constructor (cause, message, options = {}) {
|
|
409
|
+
super(message, { cause, ...options })
|
|
410
|
+
this.name = 'ProxyConnectionError'
|
|
411
|
+
this.message = message || 'Proxy Connection failed'
|
|
412
|
+
this.code = 'UND_ERR_PRX_CONN'
|
|
413
|
+
this.cause = cause
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
static [Symbol.hasInstance] (instance) {
|
|
417
|
+
return instance && instance[kProxyConnectionError] === true
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
get [kProxyConnectionError] () {
|
|
421
|
+
return true
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
406
425
|
const kMaxOriginsReachedError = Symbol.for('undici.error.UND_ERR_MAX_ORIGINS_REACHED')
|
|
407
426
|
class MaxOriginsReachedError extends UndiciError {
|
|
408
427
|
constructor (message) {
|
|
@@ -471,6 +490,7 @@ module.exports = {
|
|
|
471
490
|
RequestRetryError,
|
|
472
491
|
ResponseError,
|
|
473
492
|
SecureProxyConnectionError,
|
|
493
|
+
ProxyConnectionError,
|
|
474
494
|
MaxOriginsReachedError,
|
|
475
495
|
Socks5ProxyError,
|
|
476
496
|
MessageSizeExceededError
|
|
@@ -173,7 +173,7 @@ class Request {
|
|
|
173
173
|
|
|
174
174
|
this.method = method
|
|
175
175
|
|
|
176
|
-
this.typeOfService = typeOfService
|
|
176
|
+
this.typeOfService = typeOfService
|
|
177
177
|
|
|
178
178
|
this.abort = null
|
|
179
179
|
|
|
@@ -225,7 +225,7 @@ class Request {
|
|
|
225
225
|
this.protocol = getProtocolFromUrlString(origin)
|
|
226
226
|
|
|
227
227
|
this.idempotent = idempotent == null
|
|
228
|
-
? method === 'HEAD' || method === 'GET'
|
|
228
|
+
? method === 'HEAD' || method === 'GET' || method === 'QUERY'
|
|
229
229
|
: idempotent
|
|
230
230
|
|
|
231
231
|
this.blocking = blocking ?? this.method !== 'HEAD'
|
|
@@ -472,7 +472,13 @@ function processHeader (request, key, val) {
|
|
|
472
472
|
} else if (typeof val[i] === 'object') {
|
|
473
473
|
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
474
474
|
} else {
|
|
475
|
-
|
|
475
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
476
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
477
|
+
const str = `${val[i]}`
|
|
478
|
+
if (!isValidHeaderValue(str)) {
|
|
479
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
480
|
+
}
|
|
481
|
+
arr.push(str)
|
|
476
482
|
}
|
|
477
483
|
}
|
|
478
484
|
val = arr
|
|
@@ -483,7 +489,12 @@ function processHeader (request, key, val) {
|
|
|
483
489
|
} else if (val === null) {
|
|
484
490
|
val = ''
|
|
485
491
|
} else {
|
|
492
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
493
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
486
494
|
val = `${val}`
|
|
495
|
+
if (!isValidHeaderValue(val)) {
|
|
496
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
497
|
+
}
|
|
487
498
|
}
|
|
488
499
|
|
|
489
500
|
if (headerName === 'host') {
|
|
@@ -5,6 +5,8 @@ module.exports = {
|
|
|
5
5
|
kDestroy: Symbol('destroy'),
|
|
6
6
|
kDispatch: Symbol('dispatch'),
|
|
7
7
|
kUrl: Symbol('url'),
|
|
8
|
+
kRequestOrigin: Symbol('request origin'),
|
|
9
|
+
kOriginless: Symbol('originless'),
|
|
8
10
|
kWriting: Symbol('writing'),
|
|
9
11
|
kResuming: Symbol('resuming'),
|
|
10
12
|
kQueue: Symbol('queue'),
|
|
@@ -56,6 +58,7 @@ module.exports = {
|
|
|
56
58
|
kCounter: Symbol('socket request counter'),
|
|
57
59
|
kMaxResponseSize: Symbol('max response size'),
|
|
58
60
|
kHTTP2Session: Symbol('http2Session'),
|
|
61
|
+
kHTTP2Options: Symbol('http2 options'),
|
|
59
62
|
kHTTP2SessionState: Symbol('http2Session state'),
|
|
60
63
|
kRetryHandlerDefaultRetry: Symbol('retry agent default retry'),
|
|
61
64
|
kConstruct: Symbol('constructable'),
|
|
@@ -370,7 +370,12 @@ function destroy (stream, err) {
|
|
|
370
370
|
stream.socket = null
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
try {
|
|
374
|
+
stream.destroy(err)
|
|
375
|
+
} catch {
|
|
376
|
+
// stream.destroy may throw on managed sockets (e.g., http2).
|
|
377
|
+
// Silently ignore — the socket lifecycle is handled by the subsystem.
|
|
378
|
+
}
|
|
374
379
|
} else if (err) {
|
|
375
380
|
queueMicrotask(() => {
|
|
376
381
|
stream.emit('error', err)
|
|
@@ -919,11 +924,32 @@ function onConnectTimeout (socket, opts) {
|
|
|
919
924
|
destroy(socket, new ConnectTimeoutError(message))
|
|
920
925
|
}
|
|
921
926
|
|
|
927
|
+
let lastUrlString = null
|
|
928
|
+
let lastProtocol = null
|
|
929
|
+
|
|
922
930
|
/**
|
|
923
931
|
* @param {string} urlString
|
|
924
932
|
* @returns {string}
|
|
925
933
|
*/
|
|
926
934
|
function getProtocolFromUrlString (urlString) {
|
|
935
|
+
// Requests are typically dispatched against the same origin over and over,
|
|
936
|
+
// so cache the last (urlString, protocol) pair to skip re-parsing.
|
|
937
|
+
if (urlString === lastUrlString) {
|
|
938
|
+
return lastProtocol
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
const protocol = getProtocolFromUrlStringSlow(urlString)
|
|
942
|
+
lastUrlString = urlString
|
|
943
|
+
lastProtocol = protocol
|
|
944
|
+
|
|
945
|
+
return protocol
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* @param {string} urlString
|
|
950
|
+
* @returns {string}
|
|
951
|
+
*/
|
|
952
|
+
function getProtocolFromUrlStringSlow (urlString) {
|
|
927
953
|
if (
|
|
928
954
|
urlString[0] === 'h' &&
|
|
929
955
|
urlString[1] === 't' &&
|
|
@@ -960,7 +986,9 @@ const normalizedMethodRecordsBase = {
|
|
|
960
986
|
post: 'POST',
|
|
961
987
|
POST: 'POST',
|
|
962
988
|
put: 'PUT',
|
|
963
|
-
PUT: 'PUT'
|
|
989
|
+
PUT: 'PUT',
|
|
990
|
+
query: 'QUERY',
|
|
991
|
+
QUERY: 'QUERY'
|
|
964
992
|
}
|
|
965
993
|
|
|
966
994
|
const normalizedMethodRecords = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { InvalidArgumentError, MaxOriginsReachedError } = require('../core/errors')
|
|
4
|
-
const { kBusy, kClients, kConnected, kRunning, kClose, kDestroy, kDispatch, kUrl } = require('../core/symbols')
|
|
4
|
+
const { kBusy, kClients, kConnected, kRunning, kPending, kClose, kDestroy, kDispatch, kUrl } = require('../core/symbols')
|
|
5
5
|
const DispatcherBase = require('./dispatcher-base')
|
|
6
6
|
const Pool = require('./pool')
|
|
7
7
|
const Client = require('./client')
|
|
@@ -97,7 +97,12 @@ class Agent extends DispatcherBase {
|
|
|
97
97
|
return
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
// A GOAWAY detaches the HTTP/2 session before requeued requests are
|
|
101
|
+
// dispatched on a replacement connection. At that point the pool has
|
|
102
|
+
// no connected clients and is not busy, but it still has pending work.
|
|
103
|
+
// Closing it here lets the replacement Client finish those requests
|
|
104
|
+
// and then destroys that new connection with ClientDestroyedError.
|
|
105
|
+
if (dispatcher[kConnected] > 0 || dispatcher[kBusy] || dispatcher[kPending] > 0) {
|
|
101
106
|
return
|
|
102
107
|
}
|
|
103
108
|
|
|
@@ -107,15 +112,15 @@ class Agent extends DispatcherBase {
|
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
let hasOrigin = false
|
|
110
|
-
for (const
|
|
111
|
-
if (
|
|
115
|
+
for (const k of this[kClients].keys()) {
|
|
116
|
+
if (k === origin || k === `${origin}#http1-only`) {
|
|
112
117
|
hasOrigin = true
|
|
113
118
|
break
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
if (!hasOrigin) {
|
|
118
|
-
this[kOrigins].delete(
|
|
123
|
+
this[kOrigins].delete(origin)
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
kGetDispatcher
|
|
14
14
|
} = require('./pool-base')
|
|
15
15
|
const Pool = require('./pool')
|
|
16
|
-
const { kUrl } = require('../core/symbols')
|
|
16
|
+
const { kOriginless, kUrl } = require('../core/symbols')
|
|
17
17
|
const util = require('../core/util')
|
|
18
18
|
const kFactory = Symbol('factory')
|
|
19
19
|
|
|
@@ -49,14 +49,17 @@ function defaultFactory (origin, opts) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
class BalancedPool extends PoolBase {
|
|
52
|
-
constructor (upstreams = [], { factory = defaultFactory, ...opts } = {}) {
|
|
52
|
+
constructor (upstreams = [], { factory = defaultFactory, connect, tls, ...opts } = {}) {
|
|
53
53
|
if (typeof factory !== 'function') {
|
|
54
54
|
throw new InvalidArgumentError('factory must be a function.')
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
super()
|
|
57
|
+
super(opts)
|
|
58
58
|
|
|
59
|
-
this[
|
|
59
|
+
this[kOriginless] = true
|
|
60
|
+
if (connect && typeof connect !== 'function') connect = { ...connect }
|
|
61
|
+
if (tls && typeof tls !== 'function') tls = { ...tls }
|
|
62
|
+
this[kOptions] = { ...util.deepClone(opts), connect, tls }
|
|
60
63
|
this[kIndex] = -1
|
|
61
64
|
this[kCurrentWeight] = 0
|
|
62
65
|
|