@openclaw/slack 2026.10.10-beta.5 → 2026.10.10

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.
Files changed (136) hide show
  1. package/dist/.setup/{account-configured-zcR9TJJN.mjs → account-configured-35y0-Hso.mjs} +1 -2
  2. package/dist/.setup/{account-inspect-CmkKiSb9.mjs → account-inspect-Bc7TVU8F.mjs} +3 -4
  3. package/dist/.setup/{accounts-msihSF3-.mjs → accounts-CEgdyqoW.mjs} +6 -10
  4. package/dist/.setup/{action-runtime-ChRfnnBu.mjs → action-runtime-DPoxYao5.mjs} +9 -10
  5. package/dist/.setup/action-runtime.runtime-DWKWaKgC.mjs +1 -0
  6. package/dist/.setup/{actions-By7tvpvv.mjs → actions-PF2cP6to.mjs} +14 -22
  7. package/dist/.setup/{approval-handler.runtime-D8ArtDQt.mjs → approval-handler.runtime-BtRklemy.mjs} +7 -8
  8. package/dist/.setup/{approval-message-updates-DT7XBPbV.mjs → approval-message-updates-CpwbsEj6.mjs} +2 -3
  9. package/dist/.setup/{channel-6YzXl_63.mjs → channel-B6bRmYmX.mjs} +32 -39
  10. package/dist/.setup/{channel-meta-C443t-lI.mjs → channel-meta-C5vsCo3a.mjs} +1 -2
  11. package/dist/.setup/{channel-type-BEFP2ORi.mjs → channel-type-Dh4vwh1Y.mjs} +5 -6
  12. package/dist/.setup/{channel.setup-u6QQdbTa.mjs → channel.setup-BBzT6uKA.mjs} +10 -14
  13. package/dist/.setup/{config-schema-DNnh6bWU.mjs → config-schema-Cz3uId-c.mjs} +2 -4
  14. package/dist/.setup/{directory-config-Cjj0N8R0.mjs → directory-config-BEPra1E2.mjs} +5 -6
  15. package/dist/.setup/{directory-live-BIKD-5B_.mjs → directory-live-BkUwPrS0.mjs} +4 -5
  16. package/dist/.setup/{doctor-contract-Cd4-VzIM.mjs → doctor-contract-HK8aedwU.mjs} +7 -13
  17. package/dist/.setup/http-GpAVKwSX.mjs +2 -0
  18. package/dist/.setup/{message-tool-api-BS5ekEA_.mjs → message-tool-api-DeiQJoRV.mjs} +5 -7
  19. package/dist/.setup/{monitor-BFilOuM_.mjs → monitor-DsZUQtTM.mjs} +78 -137
  20. package/dist/.setup/{outbound-adapter-9dbnYtL1.mjs → outbound-adapter-C0R5jz6S.mjs} +8 -9
  21. package/dist/.setup/{pipeline.runtime-BG5swHnj.mjs → pipeline.runtime-CIFVL0kf.mjs} +41 -68
  22. package/dist/.setup/{plugin-routes-D4qozHVn.mjs → plugin-routes-lXsy_bNV.mjs} +2 -3
  23. package/dist/.setup/{policy-yhn48xf5.mjs → policy-Bp1FvE6m.mjs} +4 -6
  24. package/dist/.setup/{probe-IiHogLQN.mjs → probe-C5VWf3sz.mjs} +11 -19
  25. package/dist/.setup/{registry-DizWcnNp.mjs → registry-1G0f1zuZ.mjs} +2 -4
  26. package/dist/.setup/{relay-source-oY9SbDiX.mjs → relay-source-DFBDTA5Z.mjs} +3 -4
  27. package/dist/.setup/{replies-CJwjTqDr.mjs → replies-7DRN46EL.mjs} +7 -9
  28. package/dist/.setup/{reply-blocks-Ca-raz2z.mjs → reply-blocks-DOjiDr44.mjs} +4 -7
  29. package/dist/.setup/{resolve-channels-DRRhElwz.mjs → resolve-channels-BNQ1KZXh.mjs} +4 -5
  30. package/dist/.setup/{resolve-users-Cz8e17ky.mjs → resolve-users-C4dC8Z7D.mjs} +4 -5
  31. package/dist/.setup/{rolldown-runtime-B4FMCO8f.mjs → rolldown-runtime-nwUcYXjP.mjs} +1 -2
  32. package/dist/.setup/{runtime-JSVZSWAj.mjs → runtime-C6HKn7Av.mjs} +1 -2
  33. package/dist/.setup/runtime-setter-api-DrXr965r.mjs +2 -0
  34. package/dist/.setup/{scopes-DfQVi8Jw.mjs → scopes-C1aeCBa6.mjs} +2 -3
  35. package/dist/.setup/{secret-contract-B-Qm6aQQ.mjs → secret-contract-D0UY2JWF.mjs} +1 -2
  36. package/dist/.setup/{secret-contract-api-DB6CMdgc.mjs → secret-contract-api-BhzGpUb0.mjs} +1 -1
  37. package/dist/.setup/{security-audit-DFGiFLqd.mjs → security-audit-C3hXCfDt.mjs} +2 -3
  38. package/dist/.setup/{send-C-8wY0lK.mjs → send-C5uXkmZV.mjs} +14 -21
  39. package/dist/.setup/{send-results-eeOu_HYm.mjs → send-results-D-o6PgtS.mjs} +1 -2
  40. package/dist/.setup/{session-status-Dv8wNBEt.mjs → session-status-CHkEn3HM.mjs} +31 -57
  41. package/dist/.setup/setup-plugin-api-D7DoueEh.mjs +2 -0
  42. package/dist/.setup/{setup-surface-9WVQgYCT.mjs → setup-surface-CtM1pm-9.mjs} +7 -8
  43. package/dist/.setup/{shared-DpHCoKy2.mjs → shared-CohTHxM1.mjs} +14 -18
  44. package/dist/.setup/{slash-dispatch.runtime-v5kQqJPh.mjs → slash-dispatch.runtime-Bnn9a5qB.mjs} +1 -1
  45. package/dist/.setup/{target-parsing-FFE26kOV.mjs → target-parsing-0pRZtahO.mjs} +1 -2
  46. package/dist/.setup/{targets-C6LZQL1Q.mjs → targets-BqXz7CpG.mjs} +2 -3
  47. package/dist/.setup/{thread-ts-Cvt7WD6B.mjs → thread-ts-47Au2-Yn.mjs} +1 -2
  48. package/dist/.source-module-urls/562d694877afe9d9dcbb3b32a8883c16974738f2aa892c48d45572cdc9a62529.json +1 -1
  49. package/dist/account-inspect-api.js +2 -3
  50. package/dist/api.js +17 -17
  51. package/dist/channel-config-api.js +1 -1
  52. package/dist/channel-entry.js +1 -2
  53. package/dist/channel-plugin-api.js +1 -1
  54. package/dist/configured-state.js +2 -3
  55. package/dist/directory-contract-api.js +1 -1
  56. package/dist/doctor-contract-api.js +1 -1
  57. package/dist/http-routes-api.js +1 -1
  58. package/dist/index.js +2 -3
  59. package/dist/message-tool-api.js +1 -1
  60. package/dist/runtime-api.js +12 -12
  61. package/dist/runtime-setter-api.js +1 -1
  62. package/dist/secret-contract-api.js +1 -1
  63. package/dist/security-contract-api.js +1 -1
  64. package/dist/setup-entry.js +4 -5
  65. package/dist/setup-plugin-api.js +1 -1
  66. package/node_modules/@slack/bolt/node_modules/body-parser/README.md +17 -13
  67. package/node_modules/@slack/bolt/node_modules/body-parser/lib/read.js +74 -57
  68. package/node_modules/@slack/bolt/node_modules/body-parser/lib/types/json.js +11 -11
  69. package/node_modules/@slack/bolt/node_modules/body-parser/lib/types/urlencoded.js +5 -5
  70. package/node_modules/@slack/bolt/node_modules/body-parser/lib/utils.js +0 -15
  71. package/node_modules/@slack/bolt/node_modules/body-parser/package.json +7 -12
  72. package/node_modules/undici/README.md +25 -3
  73. package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
  74. package/node_modules/undici/docs/docs/api/Client.md +11 -6
  75. package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
  76. package/node_modules/undici/docs/docs/api/Errors.md +76 -1
  77. package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
  78. package/node_modules/undici/docs/docs/api/Interceptors.md +13 -6
  79. package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
  80. package/node_modules/undici/docs/docs/index.md +12 -12
  81. package/node_modules/undici/docs/docs/type-map.json +66 -66
  82. package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
  83. package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
  84. package/node_modules/undici/lib/core/connect.js +10 -4
  85. package/node_modules/undici/lib/core/constants.js +12 -1
  86. package/node_modules/undici/lib/core/errors.js +38 -1
  87. package/node_modules/undici/lib/core/request.js +16 -1
  88. package/node_modules/undici/lib/core/symbols.js +2 -0
  89. package/node_modules/undici/lib/core/util.js +26 -1
  90. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  91. package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
  92. package/node_modules/undici/lib/dispatcher/client-h2.js +46 -14
  93. package/node_modules/undici/lib/dispatcher/client.js +4 -1
  94. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
  95. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
  96. package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
  97. package/node_modules/undici/lib/dispatcher/pool-base.js +65 -28
  98. package/node_modules/undici/lib/dispatcher/pool.js +11 -8
  99. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
  100. package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
  101. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
  102. package/node_modules/undici/lib/handler/cache-handler.js +153 -15
  103. package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
  104. package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
  105. package/node_modules/undici/lib/handler/retry-handler.js +44 -11
  106. package/node_modules/undici/lib/interceptor/cache.js +11 -3
  107. package/node_modules/undici/lib/interceptor/decompress.js +22 -9
  108. package/node_modules/undici/lib/interceptor/dns.js +11 -0
  109. package/node_modules/undici/lib/interceptor/response-error.js +72 -28
  110. package/node_modules/undici/lib/milo/LICENSE.md +7 -0
  111. package/node_modules/undici/lib/milo/no-simd.js +1002 -0
  112. package/node_modules/undici/lib/milo/simd.js +1002 -0
  113. package/node_modules/undici/lib/mock/mock-agent.js +11 -0
  114. package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
  115. package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
  116. package/node_modules/undici/lib/util/cache.js +11 -5
  117. package/node_modules/undici/lib/web/cookies/util.js +19 -2
  118. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
  119. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
  120. package/node_modules/undici/lib/web/fetch/body.js +47 -38
  121. package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
  122. package/node_modules/undici/lib/web/fetch/headers.js +2 -2
  123. package/node_modules/undici/lib/web/fetch/index.js +8 -4
  124. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  125. package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
  126. package/node_modules/undici/package.json +7 -5
  127. package/node_modules/undici/types/cache-interceptor.d.ts +10 -0
  128. package/node_modules/undici/types/client.d.ts +10 -4
  129. package/node_modules/undici/types/errors.d.ts +16 -1
  130. package/node_modules/undici/types/h2c-client.d.ts +1 -1
  131. package/node_modules/undici/types/interceptors.d.ts +6 -1
  132. package/package.json +5 -5
  133. package/dist/.setup/action-runtime.runtime-Ck_j1YTn.mjs +0 -1
  134. package/dist/.setup/http-C9sM-FXe.mjs +0 -2
  135. package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +0 -2
  136. package/dist/.setup/setup-plugin-api-B18kDKtr.mjs +0 -2
@@ -17,7 +17,7 @@ const iconv = require('iconv-lite')
17
17
  const onFinished = require('on-finished')
18
18
  const zlib = require('node:zlib')
19
19
  const hasBody = require('type-is').hasBody
20
- const { getCharset } = require('./utils')
20
+ const contentType = require('content-type')
21
21
 
22
22
  /**
23
23
  * Module exports.
@@ -25,6 +25,12 @@ const { getCharset } = require('./utils')
25
25
 
26
26
  module.exports = read
27
27
 
28
+ /**
29
+ * @const
30
+ * whether current node version has zstandard support
31
+ */
32
+ const hasZstandardSupport = 'createZstdDecompress' in zlib
33
+
28
34
  /**
29
35
  * Read a request into a buffer and parse.
30
36
  *
@@ -79,38 +85,53 @@ function read (req, res, next, parse, debug, options) {
79
85
  }
80
86
 
81
87
  let length
82
- const opts = options
83
88
  let stream
84
89
 
85
- // read options
86
- const verify = opts.verify
90
+ const verify = options.verify
91
+
92
+ // assert charset is supported before creating the decompression stream, so an
93
+ // unsupported charset cannot leave a decoder piped with no error listener
94
+ if (verify && encoding !== null && !iconv.encodingExists(encoding)) {
95
+ return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
96
+ charset: encoding.toLowerCase(),
97
+ type: 'charset.unsupported'
98
+ }))
99
+ }
87
100
 
88
101
  try {
102
+ const contentEncoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
103
+
104
+ debug('content-encoding "%s"', contentEncoding)
105
+
106
+ if (options.inflate === false && contentEncoding !== 'identity') {
107
+ throw createError(415, 'content encoding unsupported', {
108
+ encoding: contentEncoding,
109
+ type: 'encoding.unsupported'
110
+ })
111
+ }
112
+
89
113
  // get the content stream
90
- stream = contentstream(req, debug, opts.inflate)
91
- length = stream.length
92
- stream.length = undefined
114
+ if (contentEncoding === 'identity') {
115
+ length = req.headers['content-length']
116
+ stream = req
117
+ } else {
118
+ stream = createDecompressionStream(contentEncoding, debug)
119
+ req.pipe(stream)
120
+ }
93
121
  } catch (err) {
94
122
  return next(err)
95
123
  }
96
124
 
97
125
  // set raw-body options
98
- opts.length = length
99
- opts.encoding = verify
100
- ? null
101
- : encoding
102
-
103
- // assert charset is supported
104
- if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
105
- return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
106
- charset: encoding.toLowerCase(),
107
- type: 'charset.unsupported'
108
- }))
126
+ const rawBodyOptions = {
127
+ length,
128
+ encoding: verify ? null : encoding,
129
+ limit: options.limit
109
130
  }
110
131
 
111
132
  // read body
112
133
  debug('read body')
113
- getBody(stream, opts, function (error, body) {
134
+ getBody(stream, rawBodyOptions, function (error, body) {
114
135
  if (error) {
115
136
  let _error
116
137
 
@@ -138,6 +159,17 @@ function read (req, res, next, parse, debug, options) {
138
159
  return
139
160
  }
140
161
 
162
+ // detach and destroy the decompression stream to
163
+ // avoid decompression errors on the finished stream
164
+ if (stream !== req) {
165
+ req.unpipe(stream)
166
+ stream.on('error', () => {})
167
+ stream.destroy()
168
+
169
+ // consume any remaining bytes so the HTTP request can finish
170
+ req.resume()
171
+ }
172
+
141
173
  // verify
142
174
  if (verify) {
143
175
  try {
@@ -145,7 +177,7 @@ function read (req, res, next, parse, debug, options) {
145
177
  verify(req, res, body, encoding)
146
178
  } catch (err) {
147
179
  next(createError(403, err, {
148
- body: body,
180
+ body,
149
181
  type: err.type || 'entity.verify.failed'
150
182
  }))
151
183
  return
@@ -172,38 +204,6 @@ function read (req, res, next, parse, debug, options) {
172
204
  })
173
205
  }
174
206
 
175
- /**
176
- * Get the content stream of the request.
177
- *
178
- * @param {Object} req
179
- * @param {Function} debug
180
- * @param {boolean} inflate
181
- * @returns {Object}
182
- * @private
183
- */
184
- function contentstream (req, debug, inflate) {
185
- const encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
186
- const length = req.headers['content-length']
187
-
188
- debug('content-encoding "%s"', encoding)
189
-
190
- if (inflate === false && encoding !== 'identity') {
191
- throw createError(415, 'content encoding unsupported', {
192
- encoding: encoding,
193
- type: 'encoding.unsupported'
194
- })
195
- }
196
-
197
- if (encoding === 'identity') {
198
- req.length = length
199
- return req
200
- }
201
-
202
- const stream = createDecompressionStream(encoding, debug)
203
- req.pipe(stream)
204
- return stream
205
- }
206
-
207
207
  /**
208
208
  * Create a decompression stream for the given encoding.
209
209
  * @param {string} encoding
@@ -222,12 +222,16 @@ function createDecompressionStream (encoding, debug) {
222
222
  case 'br':
223
223
  debug('brotli decompress body')
224
224
  return zlib.createBrotliDecompress()
225
- default:
226
- throw createError(415, 'unsupported content encoding "' + encoding + '"', {
227
- encoding: encoding,
228
- type: 'encoding.unsupported'
229
- })
225
+ case 'zstd':
226
+ if (hasZstandardSupport) {
227
+ debug('zstd decompress body')
228
+ return zlib.createZstdDecompress()
229
+ }
230
230
  }
231
+ throw createError(415, 'unsupported content encoding "' + encoding + '"', {
232
+ encoding,
233
+ type: 'encoding.unsupported'
234
+ })
231
235
  }
232
236
 
233
237
  /**
@@ -245,3 +249,16 @@ function dump (req, callback) {
245
249
  req.resume()
246
250
  }
247
251
  }
252
+
253
+ /**
254
+ * Get the charset of a request.
255
+ *
256
+ * @param {Object} req
257
+ * @returns {string | undefined}
258
+ * @private
259
+ */
260
+ function getCharset (req) {
261
+ const header = req.headers['content-type']
262
+ if (!header) return undefined
263
+ return contentType.parse(header).parameters.charset?.toLowerCase()
264
+ }
@@ -23,7 +23,7 @@ const { normalizeOptions } = require('../utils')
23
23
  module.exports = json
24
24
 
25
25
  /**
26
- * RegExp to match the first non-space in a string.
26
+ * RegExp to match the first non-whitespace character in a string.
27
27
  *
28
28
  * Allowed whitespace is defined in RFC 7159:
29
29
  *
@@ -33,7 +33,7 @@ module.exports = json
33
33
  * %x0A / ; Line feed or New line
34
34
  * %x0D ) ; Carriage return
35
35
  */
36
- const FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
36
+ const FIRST_NON_WHITESPACE_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d]|$)/ // eslint-disable-line no-control-regex
37
37
 
38
38
  const JSON_SYNTAX_CHAR = '#'
39
39
  const JSON_SYNTAX_REGEXP = /#+/g
@@ -80,10 +80,12 @@ function createJsonParser (options) {
80
80
  return {}
81
81
  }
82
82
 
83
- const first = firstchar(body)
84
- if (first !== '{' && first !== '[') {
85
- debug('strict violation')
86
- throw createStrictSyntaxError(body, first)
83
+ if (body[0] !== '{' && body[0] !== '[') {
84
+ const first = firstNonWhitespaceChar(body)
85
+ if (first !== '{' && first !== '[') {
86
+ debug('strict violation')
87
+ throw createStrictSyntaxError(body, first)
88
+ }
87
89
  }
88
90
 
89
91
  try {
@@ -152,12 +154,10 @@ function createStrictSyntaxError (str, char) {
152
154
  * @returns {string|undefined}
153
155
  * @private
154
156
  */
155
- function firstchar (str) {
156
- const match = FIRST_CHAR_REGEXP.exec(str)
157
+ function firstNonWhitespaceChar (str) {
158
+ const match = FIRST_NON_WHITESPACE_REGEXP.exec(str)
157
159
 
158
- return match
159
- ? match[1]
160
- : undefined
160
+ return match && match[1] ? match[1] : undefined
161
161
  }
162
162
 
163
163
  /**
@@ -98,12 +98,12 @@ function createQueryParser (options) {
98
98
  try {
99
99
  return qs.parse(body, {
100
100
  allowPrototypes: true,
101
- arrayLimit: arrayLimit,
102
- depth: depth,
103
- charsetSentinel: charsetSentinel,
104
- interpretNumericEntities: interpretNumericEntities,
101
+ arrayLimit,
102
+ depth,
103
+ charsetSentinel,
104
+ interpretNumericEntities,
105
105
  charset: encoding,
106
- parameterLimit: parameterLimit,
106
+ parameterLimit,
107
107
  strictDepth: true
108
108
  })
109
109
  } catch (err) {
@@ -5,31 +5,16 @@
5
5
  */
6
6
 
7
7
  const bytes = require('bytes')
8
- const contentType = require('content-type')
9
8
  const typeis = require('type-is')
10
9
 
11
10
  /**
12
11
  * Module exports.
13
12
  */
14
13
  module.exports = {
15
- getCharset,
16
14
  normalizeOptions,
17
15
  passthrough
18
16
  }
19
17
 
20
- /**
21
- * Get the charset of a request.
22
- *
23
- * @param {Object} req
24
- * @returns {string | undefined}
25
- * @private
26
- */
27
- function getCharset (req) {
28
- const header = req.headers['content-type']
29
- if (!header) return undefined
30
- return contentType.parse(header).parameters.charset?.toLowerCase()
31
- }
32
-
33
18
  /**
34
19
  * Get the simple type checker.
35
20
  *
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "body-parser",
3
3
  "description": "Node.js body parsing middleware",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
7
  "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
@@ -27,26 +27,21 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "bytes": "^3.1.2",
30
- "content-type": "^2.0.0",
30
+ "content-type": "^2.1.0",
31
31
  "debug": "^4.4.3",
32
32
  "http-errors": "^2.0.1",
33
- "iconv-lite": "^0.7.2",
33
+ "iconv-lite": "^0.7.3",
34
34
  "on-finished": "^2.4.1",
35
- "qs": "^6.15.2",
35
+ "qs": "^6.16.1",
36
36
  "raw-body": "^3.0.2",
37
37
  "type-is": "^2.1.0"
38
38
  },
39
39
  "devDependencies": {
40
- "eslint": "^8.57.1",
41
- "eslint-config-standard": "^14.1.1",
42
- "eslint-plugin-import": "^2.32.0",
43
- "eslint-plugin-markdown": "^3.0.1",
44
- "eslint-plugin-node": "^11.1.0",
45
- "eslint-plugin-promise": "^6.6.0",
46
- "eslint-plugin-standard": "^4.1.0",
40
+ "eslint": "^9.39.5",
47
41
  "mocha": "^11.7.6",
42
+ "neostandard": "^0.13.0",
48
43
  "nyc": "^17.1.0",
49
- "supertest": "^7.2.2"
44
+ "supertest": "7.3.0"
50
45
  },
51
46
  "files": [
52
47
  "lib/",
@@ -86,6 +86,24 @@ Using [benchmark-http2.js](https://github.com/nodejs/undici/blob/main/benchmarks
86
86
 
87
87
  Node.js includes a built-in `fetch()` implementation powered by undici starting from Node.js v18. However, there are important differences between using the built-in fetch and installing undici as a separate module.
88
88
 
89
+ ### WebAssembly requirement
90
+
91
+ Undici's HTTP/1 parser requires WebAssembly. There is no alternative parser when
92
+ WebAssembly is unavailable, for example in Node.js configurations where
93
+ `--jitless` disables it. The existence of `fetch` does not imply that it can make
94
+ HTTP/1 requests in that environment.
95
+
96
+ When the HTTP/1 parser is needed without WebAssembly, Client and dispatcher
97
+ requests fail with an `Error` whose code is `ERR_WEBASSEMBLY_NOT_SUPPORTED`.
98
+ `fetch` rejects with a `TypeError` carrying that error in `error.cause`. Importing
99
+ Undici, accessing `fetch`, and using `Headers`, `FormData`, `Request`, or `Response`
100
+ do not themselves require the HTTP/1 parser.
101
+
102
+ The error is defined locally in Undici and does not depend on Node.js providing
103
+ that error code. For built-in fetch, this behavior depends on the bundled Undici
104
+ version. Node.js receives upstream fixes through its normal vendored Undici
105
+ update, rather than changes to the generated bundle alone.
106
+
89
107
  ### Built-in Fetch (Node.js v18+)
90
108
 
91
109
  Node.js's built-in fetch is powered by a bundled version of undici:
@@ -773,14 +791,18 @@ and `undici.Agent`) which will enable the family autoselection algorithm when es
773
791
 
774
792
  ## Collaborators
775
793
 
776
- * [__Daniele Belardi__](https://github.com/dnlup), <https://www.npmjs.com/~dnlup>
777
- * [__Ethan Arrowood__](https://github.com/ethan-arrowood), <https://www.npmjs.com/~ethan_arrowood>
794
+ * [__Aras Abbasi__](https://github.com/Uzlopak)
795
+ * [__Carlos Fuentes__](https://github.com/metcoder95), <https://www.npmjs.com/~metcoder95>
796
+ * [__Ethan Arrowood__](https://github.com/Ethan-Arrowood), <https://www.npmjs.com/~ethan_arrowood>
778
797
  * [__Matteo Collina__](https://github.com/mcollina), <https://www.npmjs.com/~matteo.collina>
779
798
  * [__Matthew Aitken__](https://github.com/KhafraDev), <https://www.npmjs.com/~khaf>
799
+ * [__Mert Can Altin__](https://github.com/mertcanaltin), <https://www.npmjs.com/~mertcanaltin>
780
800
  * [__Robert Nagy__](https://github.com/ronag), <https://www.npmjs.com/~ronag>
781
- * [__Szymon Marczak__](https://github.com/szmarczak), <https://www.npmjs.com/~szmarczak>
801
+ * [__Trivikram Kamat__](https://github.com/trivikr), <https://www.npmjs.com/~trivikr>
802
+ * [__tsctx__](https://github.com/tsctx)
782
803
 
783
804
  ## Past Collaborators
805
+ * [__Szymon Marczak__](https://github.com/szmarczak), <https://www.npmjs.com/~szmarczak>
784
806
  * [__Tomas Della Vedova__](https://github.com/delvedor), <https://www.npmjs.com/~delvedor>
785
807
 
786
808
  ### Releasers
@@ -42,7 +42,8 @@ added: v7.0.0
42
42
  Stores cached responses in memory. The store enforces upper bounds on the total
43
43
  number of responses, the total size of all responses, and the size of any single
44
44
  response. When a limit is exceeded, the store evicts approximately half of its
45
- entries and emits a [`'maxSizeExceeded'`](#event-maxsizeexceeded) event.
45
+ entries, least recently used first, and emits a
46
+ [`'maxSizeExceeded'`](#event-maxsizeexceeded) event.
46
47
 
47
48
  ```mjs
48
49
  import { interceptors, cacheStores, Agent, setGlobalDispatcher } from 'undici'
@@ -163,7 +164,9 @@ added: v7.0.0
163
164
  -->
164
165
 
165
166
  Stores cached responses in a SQLite database using the [`node:sqlite`][] API.
166
- The constructor throws when [`node:sqlite`][] is not available.
167
+ The constructor throws when [`node:sqlite`][] is not available. Response bodies
168
+ larger than `compressThreshold` are stored compressed with zstd and
169
+ decompressed when read back, saving database space.
167
170
 
168
171
  ```mjs
169
172
  import { interceptors, cacheStores, Agent, setGlobalDispatcher } from 'undici'
@@ -189,9 +192,16 @@ added: v7.0.0
189
192
  * `maxEntrySize` {number} The maximum size, in bytes, of a single response
190
193
  body. Responses whose body exceeds this value are not cached. Must not
191
194
  exceed `2000000000` (2 GB). **Default:** `2000000000` (2 GB).
195
+ * `compressThreshold` {number} The size, in bytes, above which a response
196
+ body is stored compressed with zstd. Responses with an easily compressible
197
+ Content-Type (e.g. json, xml, plain text) are compressed regardless of
198
+ size. Requires a Node version with zstd
199
+ support (22.19+); when unavailable, bodies are stored uncompressed.
200
+ **Default:** `1048576` (1 MiB).
192
201
 
193
- `maxCount` and `maxEntrySize` must be non-negative integers; a `TypeError` is
194
- thrown otherwise, or if `maxEntrySize` is greater than 2 GB.
202
+ `maxCount`, `maxEntrySize`, and `compressThreshold` must be non-negative
203
+ integers; a `TypeError` is thrown otherwise, or if `maxEntrySize` is greater
204
+ than 2 GB.
195
205
 
196
206
  ### `sqliteCacheStore.close()`
197
207
 
@@ -225,7 +235,8 @@ added: v7.0.0
225
235
  See [`GetResult`](#getresult).
226
236
 
227
237
  Looks up a cached response for `key`, comparing the request method and every
228
- header named in the stored `vary` map.
238
+ header named in the stored `vary` map. A body that was stored compressed is
239
+ decompressed before being returned.
229
240
 
230
241
  ### `sqliteCacheStore.set(key, value)`
231
242
 
@@ -240,9 +251,11 @@ added: v7.0.0
240
251
  * Returns: {undefined}
241
252
 
242
253
  Writes a response into the database directly, without going through a stream. If
243
- the body exceeds `maxEntrySize`, nothing is stored. When an entry already exists
244
- for `key` it is overwritten; otherwise a new row is inserted and old entries are
245
- pruned to honour `maxCount`. This method is used internally by
254
+ the body exceeds `maxEntrySize`, nothing is stored. A body larger than
255
+ `compressThreshold`, or with an easily compressible Content-Type (e.g. json,
256
+ xml, plain text), is compressed with zstd before being written. When an entry
257
+ already exists for `key` it is overwritten; otherwise a new row is inserted and
258
+ old entries are pruned to honour `maxCount`. This method is used internally by
246
259
  [`sqliteCacheStore.createWriteStream()`](#sqlitecachestorecreatewritestreamkey-value).
247
260
 
248
261
  ### `sqliteCacheStore.createWriteStream(key, value)`
@@ -260,7 +273,9 @@ added: v7.0.0
260
273
 
261
274
  Returns a {Writable} stream used to write the response body into the store. When
262
275
  the stream finishes, the buffered body is committed via
263
- [`sqliteCacheStore.set()`](#sqlitecachestoresetkey-value). If the body exceeds
276
+ [`sqliteCacheStore.set()`](#sqlitecachestoresetkey-value), where bodies larger
277
+ than `compressThreshold` or with an easily compressible Content-Type are
278
+ compressed with zstd. If the body exceeds
264
279
  `maxEntrySize`, the stream is destroyed and nothing is stored.
265
280
 
266
281
  ### `sqliteCacheStore.delete(key)`
@@ -116,8 +116,8 @@ added: v1.0.0
116
116
  * `maxConcurrentStreams` {number} _Deprecated: use h2Options.useH2c instead_ The maximum number of concurrent HTTP/2
117
117
  streams for a single session. Once h2 is negotiated this — not `pipelining`,
118
118
  which is HTTP/1.1 only — is the ceiling used to dispatch in-flight requests.
119
- It may be overridden by the server's `SETTINGS_MAX_CONCURRENT_STREAMS`
120
- frame. **Default:** `100`.
119
+ The server's `SETTINGS_MAX_CONCURRENT_STREAMS` can lower this limit, but
120
+ not raise it. **Default:** `100`.
121
121
  * `connectionWindowSize` {number} _Deprecated: use h2Options.connectionWindowSize instead_ The HTTP/2 connection-level flow-control
122
122
  window size set via `ClientHttp2Session.setLocalWindowSize()`. Must be a
123
123
  positive integer. **Default:** `524288`.
@@ -130,8 +130,8 @@ added: v1.0.0
130
130
  * `maxConcurrentStreams` {number} The maximum number of concurrent HTTP/2
131
131
  streams for a single session. Once h2 is negotiated this — not `pipelining`,
132
132
  which is HTTP/1.1 only — is the ceiling used to dispatch in-flight requests.
133
- It may be overridden by the server's `SETTINGS_MAX_CONCURRENT_STREAMS`
134
- frame. **Default:** `100`.
133
+ The server's `SETTINGS_MAX_CONCURRENT_STREAMS` can lower this limit, but
134
+ not raise it. **Default:** `100`.
135
135
  * `connectionWindowSize` {number} The HTTP/2 connection-level flow-control
136
136
  window size set via `ClientHttp2Session.setLocalWindowSize()`. Must be a
137
137
  positive integer. **Default:** `524288`.
@@ -148,8 +148,13 @@ added: v1.0.0
148
148
  payloads, and decompressed (`permessage-deflate`) messages. Set to `0` to
149
149
  disable the limit. **Default:** `134217728`.
150
150
  * `eventSource` {Object} (optional) EventSource-specific configuration.
151
- * `maxEventSize` {number} The maximum allowed event size, in bytes, for
152
- EventSource messages. Set to `0` to disable the limit.
151
+ * `maxEventSize` {number} The maximum total bytes of data and metadata
152
+ field values retained for a pending EventSource event. Each unfinished
153
+ line is separately limited to this value plus seven syntax bytes, before
154
+ its line ending arrives. The number of `data:` lines per event and input
155
+ chunks buffered for an unfinished line are each limited to
156
+ `min(131072, max(1024, floor(maxEventSize / 128)))` to bound object overhead.
157
+ Set to `0` to disable these limits.
153
158
  **Default:** `buffer.kStringMaxLength`.
154
159
  * Returns: {Client}
155
160
 
@@ -209,6 +209,9 @@ added: v4.0.0
209
209
  * `path` {string} The request path.
210
210
  * `method` {string} The HTTP method, e.g. `'GET'` or `'POST'`.
211
211
  * `body` {string|Buffer|Uint8Array|Readable|FormData|null} The request body.
212
+ Undici's network clients require a `FormData` body created by the same
213
+ undici package instance. A body from another source, including Node.js's
214
+ built-in `FormData`, is rejected with an `InvalidArgumentError`.
212
215
  **Default:** `null`.
213
216
  * `headers` {UndiciHeaders} Request headers. **Default:** `null`.
214
217
  * `query` {Object} Query string parameters embedded into the request URL. Both
@@ -18,7 +18,7 @@ if (err instanceof errors.ConnectTimeoutError) {
18
18
  }
19
19
  ```
20
20
 
21
- All errors, except [`HTTPParserError`][], extend [`UndiciError`][]. Each error
21
+ All errors, except [`HTTPParserError`][] and `WebAssemblyNotSupportedError`, extend [`UndiciError`][]. Each error
22
22
  carries a stable `code` string (for example `UND_ERR_CONNECT_TIMEOUT`) and a
23
23
  `name`.
24
24
 
@@ -32,6 +32,37 @@ if (err.code === 'UND_ERR_CONNECT_TIMEOUT') {
32
32
  }
33
33
  ```
34
34
 
35
+ ## Timeout-related errors
36
+
37
+ The timeout errors below are controlled by dispatcher/client options:
38
+
39
+ | Error code | When it is thrown | Related option |
40
+ | ---------- | ----------------- | -------------- |
41
+ | `UND_ERR_CONNECT_TIMEOUT` | A connection could not be established before the connection timeout elapsed. | [`connect.timeout`](Client.md) |
42
+ | `UND_ERR_HEADERS_TIMEOUT` | The full response headers were not received before the headers timeout elapsed. | [`headersTimeout`](Client.md) |
43
+ | `UND_ERR_BODY_TIMEOUT` | While reading the response body, no new data arrived before the body timeout elapsed. | [`bodyTimeout`](Client.md) |
44
+ | `UND_ERR_SOCKET` | A generic socket-level failure happened. | Inspect `error.socket` for connection details. |
45
+
46
+ ### Configuring timeouts for `fetch`
47
+
48
+ If you are using `fetch` (including Node.js built-in `fetch`), configure timeouts
49
+ through the global dispatcher:
50
+
51
+ ```js
52
+ import { Agent, setGlobalDispatcher, fetch } from 'undici'
53
+
54
+ setGlobalDispatcher(new Agent({
55
+ connect: { timeout: 10_000 }, // connection phase
56
+ headersTimeout: 15_000, // wait for response headers
57
+ bodyTimeout: 30_000 // wait between response body chunks
58
+ }))
59
+
60
+ await fetch('https://example.com/data')
61
+ ```
62
+
63
+ You can inspect timeout error codes from `error.code` or (for wrapped fetch
64
+ errors) from `error.cause?.code`.
65
+
35
66
  ## Class: `UndiciError`
36
67
 
37
68
  <!-- YAML
@@ -52,6 +83,35 @@ on a well-known symbol rather than the prototype chain.
52
83
  * `name` {string} Always `'UndiciError'`.
53
84
  * `code` {string} Always `'UND_ERR'`.
54
85
 
86
+ ## Class: `WebAssemblyNotSupportedError`
87
+
88
+ * Extends: {Error}
89
+
90
+ WebAssembly is unavailable when Undici initializes its HTTP/1 parser. Undici does
91
+ not provide an alternative parser for environments without WebAssembly, including
92
+ Node.js configurations where `--jitless` disables it. The check is performed when
93
+ the parser is needed, not when importing Undici or accessing `fetch`.
94
+
95
+ * `name` {string} Always `'Error'`.
96
+ * `code` {string} Always `'ERR_WEBASSEMBLY_NOT_SUPPORTED'`.
97
+ * `message` {string} By default `'WebAssembly is not supported in this environment, but is required for HTTP/1 parsing'`.
98
+
99
+ Client and dispatcher requests report this error directly. `fetch` rejects with
100
+ a `TypeError` whose `cause` is this error:
101
+
102
+ ```js
103
+ try {
104
+ await fetch('http://localhost:3000')
105
+ } catch (error) {
106
+ if (error.cause?.code === 'ERR_WEBASSEMBLY_NOT_SUPPORTED') {
107
+ // HTTP/1 parsing requires WebAssembly in this environment.
108
+ }
109
+ }
110
+ ```
111
+
112
+ `Headers`, `FormData`, `Request`, `Response`, and other operations that do not need
113
+ the HTTP/1 parser remain usable without WebAssembly.
114
+
55
115
  ## Class: `ConnectTimeoutError`
56
116
 
57
117
  <!-- YAML
@@ -436,6 +496,7 @@ The response returned an error status code. This is raised, for example, when th
436
496
  * `code` {string} Always `'UND_ERR_RESPONSE'`.
437
497
  * `statusCode` {number} The HTTP status code of the response.
438
498
  * `body` {Object|string|null} The response body.
499
+ * `bodyTruncated` {boolean} Whether `body` was truncated by a configured limit.
439
500
  * `headers` {Object|string[]|null} The response headers.
440
501
 
441
502
  ### `new ResponseError(message, code, options)`
@@ -445,6 +506,7 @@ The response returned an error status code. This is raised, for example, when th
445
506
  * `options` {Object}
446
507
  * `headers` {Object|string[]|null} The response headers. (optional)
447
508
  * `body` {Object|string|null} The response body. (optional)
509
+ * `bodyTruncated` {boolean} Whether `body` was truncated. **Default:** `false`.
448
510
 
449
511
  ## Class: `ProxyConnectionError`
450
512
 
@@ -512,6 +574,19 @@ The maximum number of allowed origins has been reached.
512
574
  * `name` {string} Always `'MaxOriginsReachedError'`.
513
575
  * `code` {string} Always `'UND_ERR_MAX_ORIGINS_REACHED'`.
514
576
 
577
+ ## Class: `MaxRedirectsError`
578
+
579
+ <!-- YAML
580
+ added: v8.12.0
581
+ -->
582
+
583
+ * Extends: {UndiciError}
584
+
585
+ The maximum number of redirects has been reached.
586
+
587
+ * `name` {string} Always `'MaxRedirectsError'`.
588
+ * `code` {string} Always `'UND_ERR_REDIRECT_MAX'`.
589
+
515
590
  ## Class: `Socks5ProxyError`
516
591
 
517
592
  <!-- YAML
@@ -55,8 +55,9 @@ added: v7.7.0
55
55
  hostname, and port. Only the `http:` protocol is supported.
56
56
  * `options` {H2CClientOptions} (optional)
57
57
  * `maxConcurrentStreams` {number} The maximum number of concurrent HTTP/2
58
- streams for the session. It is advertised to the server and may be overridden
59
- by a remote `SETTINGS` frame. Must be a positive integer. **Default:** `100`.
58
+ streams for the session. The server's `SETTINGS_MAX_CONCURRENT_STREAMS` can
59
+ lower this limit, but not raise it. Must be a positive integer.
60
+ **Default:** `100`.
60
61
  * `pipelining` {number} The number of concurrent requests multiplexed over the
61
62
  single connection. For an `H2CClient` this is aliased to
62
63
  `maxConcurrentStreams` and may not exceed it. Must be a positive integer.