@qqbrowser/openclaw-qbot 0.10.18 → 0.10.20

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 (177) hide show
  1. package/dist/build-info.json +3 -3
  2. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  3. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/auth/httpAuthSchemeProvider.js +11 -17
  4. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/endpoint/bdd.js +2 -5
  5. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/endpoint/endpointResolver.js +7 -11
  6. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +147 -99
  7. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/models/BedrockRuntimeServiceException.js +4 -8
  8. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/models/errors.js +25 -40
  9. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.browser.js +27 -31
  10. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.js +40 -44
  11. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.native.js +6 -9
  12. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.shared.js +22 -26
  13. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/schemas/schemas_0.js +688 -315
  14. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/BedrockRuntime.js +2 -0
  15. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/commands/InvokeGuardrailChecksCommand.js +16 -0
  16. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/commands/index.js +1 -0
  17. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/models/enums.js +50 -0
  18. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/schemas/schemas_0.js +204 -16
  19. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +18 -18
  20. package/node_modules/@aws-sdk/core/dist-cjs/index.js +45 -50
  21. package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +2 -4
  22. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +21 -22
  23. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +51 -51
  24. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +21 -22
  25. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +19 -21
  26. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +107 -109
  27. package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -4
  28. package/node_modules/@aws-sdk/core/package.json +8 -8
  29. package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +4 -6
  30. package/node_modules/@aws-sdk/credential-provider-env/package.json +6 -6
  31. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +3 -7
  32. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js +12 -16
  33. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +16 -21
  34. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +14 -18
  35. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +1 -5
  36. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js +2 -5
  37. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +2 -7
  38. package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
  39. package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +47 -41
  40. package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js +8 -4
  41. package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js +14 -10
  42. package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
  43. package/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +31 -33
  44. package/node_modules/@aws-sdk/credential-provider-login/package.json +7 -7
  45. package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +16 -18
  46. package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
  47. package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +11 -13
  48. package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
  49. package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +22 -24
  50. package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BGYXHf8s.js +3 -0
  51. package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
  52. package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +10 -14
  53. package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +2 -6
  54. package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +3 -27
  55. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
  56. package/node_modules/@aws-sdk/eventstream-handler-node/dist-cjs/index.js +7 -9
  57. package/node_modules/@aws-sdk/eventstream-handler-node/package.json +5 -5
  58. package/node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js +3 -5
  59. package/node_modules/@aws-sdk/middleware-eventstream/package.json +5 -5
  60. package/node_modules/@aws-sdk/middleware-websocket/dist-cjs/index.js +16 -18
  61. package/node_modules/@aws-sdk/middleware-websocket/package.json +6 -6
  62. package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +0 -1
  63. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +82 -84
  64. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +158 -119
  65. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +80 -82
  66. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +80 -82
  67. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +99 -101
  68. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js +4 -1
  69. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +70 -35
  70. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +1 -1
  71. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +3 -0
  72. package/node_modules/@aws-sdk/nested-clients/package.json +9 -8
  73. package/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js +4 -6
  74. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +5 -5
  75. package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +26 -28
  76. package/node_modules/@aws-sdk/token-providers/package.json +7 -7
  77. package/node_modules/@aws-sdk/types/dist-cjs/index.js +7 -8
  78. package/node_modules/@aws-sdk/types/package.json +4 -4
  79. package/node_modules/@aws-sdk/util-locate-window/dist-cjs/index.js +0 -2
  80. package/node_modules/@aws-sdk/util-locate-window/package.json +4 -4
  81. package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +2 -4
  82. package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +4 -7
  83. package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +2 -5
  84. package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +7 -10
  85. package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
  86. package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +2 -2
  87. package/node_modules/@nodable/entities/package.json +4 -1
  88. package/node_modules/@nodable/entities/src/EntityDecoder.js +104 -3
  89. package/node_modules/@nodable/entities/src/index.js +1 -1
  90. package/node_modules/@slack/oauth/node_modules/@slack/web-api/dist/chat-stream.js +8 -0
  91. package/node_modules/@slack/oauth/node_modules/@slack/web-api/package.json +1 -1
  92. package/node_modules/@slack/socket-mode/node_modules/@slack/web-api/dist/chat-stream.js +8 -0
  93. package/node_modules/@slack/socket-mode/node_modules/@slack/web-api/package.json +1 -1
  94. package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
  95. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
  96. package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
  97. package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
  98. package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
  99. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
  100. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
  101. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
  102. package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
  103. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
  104. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
  105. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
  106. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
  107. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
  108. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +26 -27
  109. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +28 -29
  110. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
  111. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
  112. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
  113. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
  114. package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
  115. package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
  116. package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
  117. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
  118. package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
  119. package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +2 -2
  120. package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRateLimiter.js +1 -1
  121. package/node_modules/@smithy/core/package.json +18 -17
  122. package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
  123. package/node_modules/@smithy/credential-provider-imds/package.json +7 -7
  124. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
  125. package/node_modules/@smithy/fetch-http-handler/package.json +10 -10
  126. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
  127. package/node_modules/@smithy/node-http-handler/package.json +8 -8
  128. package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
  129. package/node_modules/@smithy/signature-v4/package.json +7 -7
  130. package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
  131. package/node_modules/@smithy/types/package.json +10 -10
  132. package/node_modules/axios/dist/axios.js +350 -134
  133. package/node_modules/axios/dist/axios.min.js +3 -3
  134. package/node_modules/axios/dist/browser/axios.cjs +355 -90
  135. package/node_modules/axios/dist/esm/axios.js +355 -90
  136. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  137. package/node_modules/axios/dist/node/axios.cjs +399 -104
  138. package/node_modules/axios/index.d.cts +2 -0
  139. package/node_modules/axios/lib/adapters/fetch.js +113 -37
  140. package/node_modules/axios/lib/adapters/http.js +132 -43
  141. package/node_modules/axios/lib/core/Axios.js +3 -2
  142. package/node_modules/axios/lib/core/AxiosHeaders.js +10 -7
  143. package/node_modules/axios/lib/core/buildFullPath.js +29 -1
  144. package/node_modules/axios/lib/core/mergeConfig.js +34 -0
  145. package/node_modules/axios/lib/defaults/transitional.js +1 -0
  146. package/node_modules/axios/lib/env/data.js +1 -1
  147. package/node_modules/axios/lib/helpers/buildURL.js +5 -3
  148. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
  149. package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -3
  150. package/node_modules/axios/lib/helpers/resolveConfig.js +5 -3
  151. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
  152. package/node_modules/axios/lib/helpers/toFormData.js +40 -10
  153. package/node_modules/axios/lib/utils.js +75 -11
  154. package/node_modules/axios/package.json +1 -1
  155. package/node_modules/body-parser/index.js +4 -20
  156. package/node_modules/body-parser/lib/read.js +17 -17
  157. package/node_modules/body-parser/lib/types/json.js +60 -32
  158. package/node_modules/body-parser/lib/types/raw.js +3 -3
  159. package/node_modules/body-parser/lib/types/text.js +3 -3
  160. package/node_modules/body-parser/lib/types/urlencoded.js +16 -20
  161. package/node_modules/body-parser/lib/utils.js +18 -16
  162. package/node_modules/body-parser/node_modules/content-type/dist/index.js +170 -0
  163. package/node_modules/body-parser/node_modules/content-type/package.json +52 -0
  164. package/node_modules/body-parser/package.json +23 -10
  165. package/node_modules/form-data/lib/form_data.js +14 -2
  166. package/node_modules/form-data/package.json +7 -7
  167. package/node_modules/protobufjs/dist/light/protobuf.js +145 -188
  168. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  169. package/node_modules/protobufjs/dist/minimal/protobuf.js +33 -76
  170. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  171. package/node_modules/protobufjs/dist/protobuf.js +165 -208
  172. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  173. package/node_modules/protobufjs/package.json +2 -3
  174. package/node_modules/protobufjs/src/util/minimal.js +0 -3
  175. package/package.json +1 -1
  176. package/skills/qqbrowser-skill/SKILL.md +90 -8
  177. package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js +0 -8
@@ -12,9 +12,9 @@
12
12
  * @private
13
13
  */
14
14
 
15
- var debug = require('debug')('body-parser:json')
16
- var read = require('../read')
17
- var { normalizeOptions } = require('../utils')
15
+ const debug = require('debug')('body-parser:json')
16
+ const read = require('../read')
17
+ const { normalizeOptions } = require('../utils')
18
18
 
19
19
  /**
20
20
  * Module exports.
@@ -33,10 +33,10 @@ module.exports = json
33
33
  * %x0A / ; Line feed or New line
34
34
  * %x0D ) ; Carriage return
35
35
  */
36
- var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
36
+ const FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
37
37
 
38
- var JSON_SYNTAX_CHAR = '#'
39
- var JSON_SYNTAX_REGEXP = /#+/g
38
+ const JSON_SYNTAX_CHAR = '#'
39
+ const JSON_SYNTAX_REGEXP = /#+/g
40
40
 
41
41
  /**
42
42
  * Create a middleware to parse JSON bodies.
@@ -48,23 +48,61 @@ var JSON_SYNTAX_REGEXP = /#+/g
48
48
  function json (options) {
49
49
  const normalizedOptions = normalizeOptions(options, 'application/json')
50
50
 
51
- var reviver = options?.reviver
52
- var strict = options?.strict !== false
51
+ const parse = createJsonParser(options)
53
52
 
54
- function parse (body) {
55
- if (body.length === 0) {
56
- // special-case empty json body, as it's a common client-side mistake
57
- // TODO: maybe make this configurable or part of "strict" option
58
- return {}
59
- }
53
+ const readOptions = {
54
+ ...normalizedOptions,
55
+ // assert charset per RFC 7159 sec 8.1
56
+ isValidCharset: (charset) => charset.slice(0, 4) === 'utf-'
57
+ }
60
58
 
61
- if (strict) {
62
- var first = firstchar(body)
59
+ return function jsonParser (req, res, next) {
60
+ read(req, res, next, parse, debug, readOptions)
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Create a JSON parse function
66
+ *
67
+ * @param {object} [options]
68
+ * @return {function}
69
+ * @private
70
+ */
71
+ function createJsonParser (options) {
72
+ const reviver = options?.reviver
73
+ const strict = options?.strict !== false
74
+
75
+ if (strict) {
76
+ return function parse (body) {
77
+ if (body.length === 0) {
78
+ // special-case empty json body, as it's a common client-side mistake
79
+ // TODO: maybe make this configurable or part of "strict" option
80
+ return {}
81
+ }
63
82
 
83
+ const first = firstchar(body)
64
84
  if (first !== '{' && first !== '[') {
65
85
  debug('strict violation')
66
86
  throw createStrictSyntaxError(body, first)
67
87
  }
88
+
89
+ try {
90
+ debug('parse json')
91
+ return JSON.parse(body, reviver)
92
+ } catch (e) {
93
+ throw normalizeJsonSyntaxError(e, {
94
+ message: e.message,
95
+ stack: e.stack
96
+ })
97
+ }
98
+ }
99
+ }
100
+
101
+ return function parse (body) {
102
+ if (body.length === 0) {
103
+ // special-case empty json body, as it's a common client-side mistake
104
+ // TODO: maybe make this configurable or part of "strict" option
105
+ return {}
68
106
  }
69
107
 
70
108
  try {
@@ -77,16 +115,6 @@ function json (options) {
77
115
  })
78
116
  }
79
117
  }
80
-
81
- const readOptions = {
82
- ...normalizedOptions,
83
- // assert charset per RFC 7159 sec 8.1
84
- isValidCharset: (charset) => charset.slice(0, 4) === 'utf-'
85
- }
86
-
87
- return function jsonParser (req, res, next) {
88
- read(req, res, next, parse, debug, readOptions)
89
- }
90
118
  }
91
119
 
92
120
  /**
@@ -98,8 +126,8 @@ function json (options) {
98
126
  * @private
99
127
  */
100
128
  function createStrictSyntaxError (str, char) {
101
- var index = str.indexOf(char)
102
- var partial = ''
129
+ const index = str.indexOf(char)
130
+ let partial = ''
103
131
 
104
132
  if (index !== -1) {
105
133
  partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index)
@@ -125,7 +153,7 @@ function createStrictSyntaxError (str, char) {
125
153
  * @private
126
154
  */
127
155
  function firstchar (str) {
128
- var match = FIRST_CHAR_REGEXP.exec(str)
156
+ const match = FIRST_CHAR_REGEXP.exec(str)
129
157
 
130
158
  return match
131
159
  ? match[1]
@@ -141,10 +169,10 @@ function firstchar (str) {
141
169
  * @private
142
170
  */
143
171
  function normalizeJsonSyntaxError (error, obj) {
144
- var keys = Object.getOwnPropertyNames(error)
172
+ const keys = Object.getOwnPropertyNames(error)
145
173
 
146
- for (var i = 0; i < keys.length; i++) {
147
- var key = keys[i]
174
+ for (let i = 0; i < keys.length; i++) {
175
+ const key = keys[i]
148
176
  if (key !== 'stack' && key !== 'message') {
149
177
  delete error[key]
150
178
  }
@@ -10,9 +10,9 @@
10
10
  * Module dependencies.
11
11
  */
12
12
 
13
- var debug = require('debug')('body-parser:raw')
14
- var read = require('../read')
15
- var { normalizeOptions, passthrough } = require('../utils')
13
+ const debug = require('debug')('body-parser:raw')
14
+ const read = require('../read')
15
+ const { normalizeOptions, passthrough } = require('../utils')
16
16
 
17
17
  /**
18
18
  * Module exports.
@@ -10,9 +10,9 @@
10
10
  * Module dependencies.
11
11
  */
12
12
 
13
- var debug = require('debug')('body-parser:text')
14
- var read = require('../read')
15
- var { normalizeOptions, passthrough } = require('../utils')
13
+ const debug = require('debug')('body-parser:text')
14
+ const read = require('../read')
15
+ const { normalizeOptions, passthrough } = require('../utils')
16
16
 
17
17
  /**
18
18
  * Module exports.
@@ -12,11 +12,11 @@
12
12
  * @private
13
13
  */
14
14
 
15
- var createError = require('http-errors')
16
- var debug = require('debug')('body-parser:urlencoded')
17
- var read = require('../read')
18
- var qs = require('qs')
19
- var { normalizeOptions } = require('../utils')
15
+ const createError = require('http-errors')
16
+ const debug = require('debug')('body-parser:urlencoded')
17
+ const read = require('../read')
18
+ const qs = require('qs')
19
+ const { normalizeOptions } = require('../utils')
20
20
 
21
21
  /**
22
22
  * Module exports.
@@ -39,13 +39,7 @@ function urlencoded (options) {
39
39
  }
40
40
 
41
41
  // create the appropriate query parser
42
- var queryparse = createQueryParser(options)
43
-
44
- function parse (body, encoding) {
45
- return body.length
46
- ? queryparse(body, encoding)
47
- : {}
48
- }
42
+ const parse = createQueryParser(options)
49
43
 
50
44
  const readOptions = {
51
45
  ...normalizedOptions,
@@ -66,13 +60,13 @@ function urlencoded (options) {
66
60
  * @private
67
61
  */
68
62
  function createQueryParser (options) {
69
- var extended = Boolean(options?.extended)
70
- var parameterLimit = options?.parameterLimit !== undefined
63
+ const extended = Boolean(options?.extended)
64
+ let parameterLimit = options?.parameterLimit !== undefined
71
65
  ? options?.parameterLimit
72
66
  : 1000
73
- var charsetSentinel = options?.charsetSentinel
74
- var interpretNumericEntities = options?.interpretNumericEntities
75
- var depth = extended ? (options?.depth !== undefined ? options?.depth : 32) : 0
67
+ const charsetSentinel = options?.charsetSentinel
68
+ const interpretNumericEntities = options?.interpretNumericEntities
69
+ const depth = extended ? (options?.depth !== undefined ? options?.depth : 32) : 0
76
70
 
77
71
  if (isNaN(parameterLimit) || parameterLimit < 1) {
78
72
  throw new TypeError('option parameterLimit must be a positive number')
@@ -86,8 +80,10 @@ function createQueryParser (options) {
86
80
  parameterLimit = parameterLimit | 0
87
81
  }
88
82
 
89
- return function queryparse (body, encoding) {
90
- var paramCount = parameterCount(body, parameterLimit)
83
+ return function parse (body, encoding) {
84
+ if (!body.length) return {}
85
+
86
+ const paramCount = parameterCount(body, parameterLimit)
91
87
 
92
88
  if (paramCount === undefined) {
93
89
  debug('too many parameters')
@@ -96,7 +92,7 @@ function createQueryParser (options) {
96
92
  })
97
93
  }
98
94
 
99
- var arrayLimit = extended ? Math.max(100, paramCount) : paramCount
95
+ const arrayLimit = extended ? Math.max(100, paramCount) : paramCount
100
96
 
101
97
  debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')
102
98
  try {
@@ -4,9 +4,9 @@
4
4
  * Module dependencies.
5
5
  */
6
6
 
7
- var bytes = require('bytes')
8
- var contentType = require('content-type')
9
- var typeis = require('type-is')
7
+ const bytes = require('bytes')
8
+ const contentType = require('content-type')
9
+ const typeis = require('type-is')
10
10
 
11
11
  /**
12
12
  * Module exports.
@@ -25,11 +25,9 @@ module.exports = {
25
25
  * @private
26
26
  */
27
27
  function getCharset (req) {
28
- try {
29
- return (contentType.parse(req).parameters.charset || '').toLowerCase()
30
- } catch {
31
- return undefined
32
- }
28
+ const header = req.headers['content-type']
29
+ if (!header) return undefined
30
+ return contentType.parse(header).parameters.charset?.toLowerCase()
33
31
  }
34
32
 
35
33
  /**
@@ -59,20 +57,24 @@ function normalizeOptions (options, defaultType) {
59
57
  throw new TypeError('defaultType must be provided')
60
58
  }
61
59
 
62
- var inflate = options?.inflate !== false
63
- var limit = typeof options?.limit !== 'number'
64
- ? bytes.parse(options?.limit || '100kb')
65
- : options?.limit
66
- var type = options?.type || defaultType
67
- var verify = options?.verify || false
68
- var defaultCharset = options?.defaultCharset || 'utf-8'
60
+ const inflate = options?.inflate !== false
61
+ const limit = typeof options?.limit === 'undefined' || options?.limit === null
62
+ ? 102400 // 100kb default
63
+ : bytes.parse(options.limit)
64
+ const type = options?.type || defaultType
65
+ const verify = options?.verify || false
66
+ const defaultCharset = options?.defaultCharset || 'utf-8'
67
+
68
+ if (limit === null) {
69
+ throw new TypeError(`option limit "${String(options.limit)}" is invalid`)
70
+ }
69
71
 
70
72
  if (verify !== false && typeof verify !== 'function') {
71
73
  throw new TypeError('option verify must be function')
72
74
  }
73
75
 
74
76
  // create the appropriate type checking function
75
- var shouldParse = typeof type !== 'function'
77
+ const shouldParse = typeof type !== 'function'
76
78
  ? typeChecker(type)
77
79
  : type
78
80
 
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ /*!
3
+ * content-type
4
+ * Copyright(c) 2015 Douglas Christopher Wilson
5
+ * MIT Licensed
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.format = format;
9
+ exports.parse = parse;
10
+ const TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
11
+ const TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
12
+ /**
13
+ * RegExp to match chars that must be quoted-pair in RFC 9110 sec 5.6.4
14
+ */
15
+ const QUOTE_REGEXP = /[\\"]/g;
16
+ /**
17
+ * RegExp to match type in RFC 9110 sec 8.3.1
18
+ *
19
+ * media-type = type "/" subtype
20
+ * type = token
21
+ * subtype = token
22
+ */
23
+ const TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
24
+ /**
25
+ * Null object perf optimization. Faster than `Object.create(null)` and `{ __proto__: null }`.
26
+ */
27
+ const NullObject = /* @__PURE__ */ (() => {
28
+ const C = function () { };
29
+ C.prototype = Object.create(null);
30
+ return C;
31
+ })();
32
+ /**
33
+ * Format an object into a `Content-Type` header.
34
+ */
35
+ function format(obj) {
36
+ const { type, parameters } = obj;
37
+ if (!type || !TYPE_REGEXP.test(type)) {
38
+ throw new TypeError(`Invalid type: ${type}`);
39
+ }
40
+ let result = type;
41
+ if (parameters) {
42
+ for (const param of Object.keys(parameters)) {
43
+ if (!TOKEN_REGEXP.test(param)) {
44
+ throw new TypeError(`Invalid parameter name: ${param}`);
45
+ }
46
+ result += `; ${param}=${qstring(parameters[param])}`;
47
+ }
48
+ }
49
+ return result;
50
+ }
51
+ /**
52
+ * Parse a `Content-Type` header.
53
+ */
54
+ function parse(header, options) {
55
+ const len = header.length;
56
+ let index = skipOWS(header, 0, len);
57
+ const valueStart = index;
58
+ index = skipValue(header, index, len);
59
+ const valueEnd = trailingOWS(header, valueStart, index);
60
+ const type = header.slice(valueStart, valueEnd).toLowerCase();
61
+ const parameters = options?.parameters === false
62
+ ? new NullObject()
63
+ : parseParameters(header, index, len);
64
+ return { type, parameters };
65
+ }
66
+ const SP = 32; // " "
67
+ const HTAB = 9; // "\t"
68
+ const SEMI = 59; // ";"
69
+ const EQ = 61; // "="
70
+ const DQUOTE = 34; // '"'
71
+ const BSLASH = 92; // "\\"
72
+ /**
73
+ * Parses the parameters of a `Content-Type` header starting at the given index.
74
+ */
75
+ function parseParameters(header, index, len) {
76
+ const parameters = new NullObject();
77
+ parameter: while (index < len) {
78
+ index = skipOWS(header, index + 1 /* Skip over ; */, len);
79
+ const keyStart = index;
80
+ while (index < len) {
81
+ const code = header.charCodeAt(index);
82
+ if (code === SEMI)
83
+ continue parameter;
84
+ if (code === EQ) {
85
+ const keyEnd = trailingOWS(header, keyStart, index);
86
+ const key = header.slice(keyStart, keyEnd).toLowerCase();
87
+ index = skipOWS(header, index + 1, len);
88
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
89
+ index++;
90
+ let value = "";
91
+ while (index < len) {
92
+ const code = header.charCodeAt(index++);
93
+ if (code === DQUOTE) {
94
+ index = skipValue(header, index, len);
95
+ if (parameters[key] === undefined)
96
+ parameters[key] = value;
97
+ break;
98
+ }
99
+ if (code === BSLASH && index < len) {
100
+ value += header[index++];
101
+ continue;
102
+ }
103
+ value += String.fromCharCode(code);
104
+ }
105
+ continue parameter;
106
+ }
107
+ const valueStart = index;
108
+ index = skipValue(header, index, len);
109
+ if (parameters[key] === undefined) {
110
+ const valueEnd = trailingOWS(header, valueStart, index);
111
+ parameters[key] = header.slice(valueStart, valueEnd);
112
+ }
113
+ continue parameter;
114
+ }
115
+ index++;
116
+ }
117
+ }
118
+ return parameters;
119
+ }
120
+ /**
121
+ * Skip over characters until a semicolon.
122
+ */
123
+ function skipValue(str, index, len) {
124
+ while (index < len) {
125
+ const char = str.charCodeAt(index);
126
+ if (char === SEMI)
127
+ break;
128
+ index++;
129
+ }
130
+ return index;
131
+ }
132
+ /**
133
+ * Skip optional whitespace (OWS) in an HTTP header value.
134
+ *
135
+ * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
136
+ */
137
+ function skipOWS(header, index, len) {
138
+ while (index < len) {
139
+ const char = header.charCodeAt(index);
140
+ if (char !== SP && char !== HTAB)
141
+ break;
142
+ index++;
143
+ }
144
+ return index;
145
+ }
146
+ /**
147
+ * Trim optional whitespace (OWS) from the end of a substring.
148
+ *
149
+ * OWS is defined in RFC 9110 sec 5.6.3 as SP (" ") or HTAB ("\t").
150
+ */
151
+ function trailingOWS(header, start, end) {
152
+ while (end > start) {
153
+ const char = header.charCodeAt(end - 1);
154
+ if (char !== SP && char !== HTAB)
155
+ break;
156
+ end--;
157
+ }
158
+ return end;
159
+ }
160
+ /**
161
+ * Serialize a parameter value.
162
+ */
163
+ function qstring(str) {
164
+ if (TOKEN_REGEXP.test(str))
165
+ return str;
166
+ if (TEXT_REGEXP.test(str))
167
+ return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
168
+ throw new TypeError(`Invalid parameter value: ${str}`);
169
+ }
170
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "content-type",
3
+ "version": "2.0.0",
4
+ "description": "Create and parse HTTP Content-Type header",
5
+ "keywords": [
6
+ "content-type",
7
+ "http",
8
+ "req",
9
+ "res",
10
+ "rfc7231",
11
+ "rfc9110"
12
+ ],
13
+ "repository": "jshttp/content-type",
14
+ "funding": {
15
+ "type": "opencollective",
16
+ "url": "https://opencollective.com/express"
17
+ },
18
+ "license": "MIT",
19
+ "author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
20
+ "type": "commonjs",
21
+ "exports": "./dist/index.js",
22
+ "main": "./dist/index.js",
23
+ "typings": "./dist/index.d.ts",
24
+ "files": [
25
+ "dist/"
26
+ ],
27
+ "scripts": {
28
+ "bench": "vitest bench",
29
+ "build": "ts-scripts build",
30
+ "format": "ts-scripts format",
31
+ "prepare": "ts-scripts install && npm run build",
32
+ "specs": "ts-scripts specs",
33
+ "test": "ts-scripts test"
34
+ },
35
+ "devDependencies": {
36
+ "@borderless/ts-scripts": "^0.15.0",
37
+ "@vitest/coverage-v8": "^3.0.5",
38
+ "typescript": "^5.7.3",
39
+ "vitest": "^3.2.4"
40
+ },
41
+ "engines": {
42
+ "node": ">=18"
43
+ },
44
+ "ts-scripts": {
45
+ "dist": [
46
+ "dist"
47
+ ],
48
+ "project": [
49
+ "tsconfig.build.json"
50
+ ]
51
+ }
52
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "body-parser",
3
3
  "description": "Node.js body parsing middleware",
4
- "version": "2.2.2",
4
+ "version": "2.3.0",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
7
  "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
@@ -12,28 +12,41 @@
12
12
  "type": "opencollective",
13
13
  "url": "https://opencollective.com/express"
14
14
  },
15
+ "type": "commonjs",
16
+ "exports": {
17
+ ".": "./index.js",
18
+ "./package.json": "./package.json",
19
+ "./json": "./lib/types/json.js",
20
+ "./raw": "./lib/types/raw.js",
21
+ "./text": "./lib/types/text.js",
22
+ "./urlencoded": "./lib/types/urlencoded.js",
23
+ "./lib/*": "./lib/*.js",
24
+ "./lib/*.js": "./lib/*.js",
25
+ "./lib/types/*": "./lib/types/*.js",
26
+ "./lib/types/*.js": "./lib/types/*.js"
27
+ },
15
28
  "dependencies": {
16
29
  "bytes": "^3.1.2",
17
- "content-type": "^1.0.5",
30
+ "content-type": "^2.0.0",
18
31
  "debug": "^4.4.3",
19
- "http-errors": "^2.0.0",
20
- "iconv-lite": "^0.7.0",
32
+ "http-errors": "^2.0.1",
33
+ "iconv-lite": "^0.7.2",
21
34
  "on-finished": "^2.4.1",
22
- "qs": "^6.14.1",
23
- "raw-body": "^3.0.1",
24
- "type-is": "^2.0.1"
35
+ "qs": "^6.15.2",
36
+ "raw-body": "^3.0.2",
37
+ "type-is": "^2.1.0"
25
38
  },
26
39
  "devDependencies": {
27
40
  "eslint": "^8.57.1",
28
41
  "eslint-config-standard": "^14.1.1",
29
- "eslint-plugin-import": "^2.31.0",
42
+ "eslint-plugin-import": "^2.32.0",
30
43
  "eslint-plugin-markdown": "^3.0.1",
31
44
  "eslint-plugin-node": "^11.1.0",
32
45
  "eslint-plugin-promise": "^6.6.0",
33
46
  "eslint-plugin-standard": "^4.1.0",
34
- "mocha": "^11.1.0",
47
+ "mocha": "^11.7.6",
35
48
  "nyc": "^17.1.0",
36
- "supertest": "^7.0.0"
49
+ "supertest": "^7.2.2"
37
50
  },
38
51
  "files": [
39
52
  "lib/",
@@ -15,6 +15,18 @@ var setToStringTag = require('es-set-tostringtag');
15
15
  var hasOwn = require('hasown');
16
16
  var populate = require('./populate.js');
17
17
 
18
+ /**
19
+ * Escape CR, LF, and `"` in a multipart `name`/`filename` parameter, so a field
20
+ * name or filename can not break out of its header line to inject headers or
21
+ * smuggle additional parts. Matches the WHATWG HTML multipart/form-data encoding.
22
+ *
23
+ * @param {string} str - the parameter value to escape
24
+ * @returns {string} the escaped value
25
+ */
26
+ function escapeHeaderParam(str) {
27
+ return String(str).replace(/\r/g, '%0D').replace(/\n/g, '%0A').replace(/"/g, '%22');
28
+ }
29
+
18
30
  /**
19
31
  * Create readable "multipart/form-data" streams.
20
32
  * Can be used to submit forms
@@ -180,7 +192,7 @@ FormData.prototype._multiPartHeader = function (field, value, options) {
180
192
  var contents = '';
181
193
  var headers = {
182
194
  // add custom disposition as third element or keep it two elements if not
183
- 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
195
+ 'Content-Disposition': ['form-data', 'name="' + escapeHeaderParam(field) + '"'].concat(contentDisposition || []),
184
196
  // if no content type. allow it to be empty array
185
197
  'Content-Type': [].concat(contentType || [])
186
198
  };
@@ -234,7 +246,7 @@ FormData.prototype._getContentDisposition = function (value, options) { // eslin
234
246
  }
235
247
 
236
248
  if (filename) {
237
- return 'filename="' + filename + '"';
249
+ return 'filename="' + escapeHeaderParam(filename) + '"';
238
250
  }
239
251
  };
240
252
 
@@ -2,7 +2,7 @@
2
2
  "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
3
3
  "name": "form-data",
4
4
  "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
5
- "version": "4.0.5",
5
+ "version": "4.0.6",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git://github.com/form-data/form-data.git"
@@ -43,12 +43,12 @@
43
43
  "asynckit": "^0.4.0",
44
44
  "combined-stream": "^1.0.8",
45
45
  "es-set-tostringtag": "^2.1.0",
46
- "hasown": "^2.0.2",
47
- "mime-types": "^2.1.12"
46
+ "hasown": "^2.0.4",
47
+ "mime-types": "^2.1.35"
48
48
  },
49
49
  "devDependencies": {
50
- "@ljharb/eslint-config": "^21.4.0",
51
- "auto-changelog": "^2.5.0",
50
+ "@ljharb/eslint-config": "^22.2.3",
51
+ "auto-changelog": "^2.6.0",
52
52
  "browserify": "^13.3.0",
53
53
  "browserify-istanbul": "^2.0.0",
54
54
  "coveralls": "^3.1.1",
@@ -60,7 +60,7 @@
60
60
  "in-publish": "^2.0.1",
61
61
  "is-node-modern": "^1.0.0",
62
62
  "istanbul": "^0.4.5",
63
- "js-randomness-predictor": "^1.5.5",
63
+ "js-randomness-predictor": "^3.6.0",
64
64
  "obake": "^0.1.2",
65
65
  "pkgfiles": "^2.3.2",
66
66
  "pre-commit": "^1.2.2",
@@ -68,7 +68,7 @@
68
68
  "request": "~2.87.0",
69
69
  "rimraf": "^2.7.1",
70
70
  "semver": "^6.3.1",
71
- "tape": "^5.9.0"
71
+ "tape": "^5.10.1"
72
72
  },
73
73
  "license": "MIT",
74
74
  "auto-changelog": {