@quantiya/codevibe-claude-plugin 1.0.36 → 1.0.38
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/.claude-plugin/plugin.json +1 -1
- package/bin/codevibe-claude +17 -3
- package/dist/server.js +13 -13
- package/hooks/stop.sh +30 -10
- package/node_modules/@quantiya/codevibe-core/dist/auth/auth-telemetry.d.ts +56 -0
- package/node_modules/@quantiya/codevibe-core/dist/index.js +30 -30
- package/node_modules/@quantiya/codevibe-core/dist/keychain/keychain-manager.d.ts +16 -2
- package/node_modules/@quantiya/codevibe-core/dist/session/session-rekey.d.ts +40 -0
- package/node_modules/@quantiya/codevibe-core/dist/session/session-resume.d.ts +1 -0
- package/node_modules/@quantiya/codevibe-core/package.json +1 -1
- package/node_modules/body-parser/README.md +18 -18
- package/node_modules/body-parser/index.js +6 -15
- package/node_modules/body-parser/lib/read.js +17 -20
- package/node_modules/body-parser/lib/types/json.js +8 -16
- package/node_modules/body-parser/lib/types/raw.js +3 -4
- package/node_modules/body-parser/lib/types/text.js +3 -4
- package/node_modules/body-parser/lib/types/urlencoded.js +8 -8
- package/node_modules/body-parser/lib/utils.js +11 -9
- package/node_modules/body-parser/package.json +2 -2
- package/node_modules/content-disposition/README.md +7 -8
- package/node_modules/content-disposition/index.js +118 -40
- package/node_modules/content-disposition/package.json +8 -11
- package/node_modules/express/Readme.md +39 -29
- package/node_modules/express/lib/application.js +1 -1
- package/node_modules/express/lib/request.js +5 -6
- package/node_modules/express/lib/response.js +14 -0
- package/node_modules/express/lib/utils.js +3 -1
- package/node_modules/express/package.json +6 -5
- package/node_modules/finalhandler/HISTORY.md +6 -0
- package/node_modules/finalhandler/README.md +26 -23
- package/node_modules/finalhandler/package.json +13 -9
- package/node_modules/graphql/execution/execute.d.ts +14 -1
- package/node_modules/graphql/execution/execute.js +63 -13
- package/node_modules/graphql/execution/execute.mjs +63 -13
- package/node_modules/graphql/execution/subscribe.js +1 -0
- package/node_modules/graphql/execution/subscribe.mjs +2 -0
- package/node_modules/graphql/execution/values.js +4 -4
- package/node_modules/graphql/execution/values.mjs +4 -4
- package/node_modules/graphql/index.d.ts +1 -0
- package/node_modules/graphql/language/ast.d.ts +10 -1
- package/node_modules/graphql/language/ast.js +8 -1
- package/node_modules/graphql/language/ast.mjs +8 -1
- package/node_modules/graphql/language/directiveLocation.d.ts +1 -0
- package/node_modules/graphql/language/directiveLocation.js +1 -0
- package/node_modules/graphql/language/directiveLocation.mjs +1 -0
- package/node_modules/graphql/language/index.d.ts +1 -0
- package/node_modules/graphql/language/kinds.d.ts +1 -0
- package/node_modules/graphql/language/kinds.js +1 -0
- package/node_modules/graphql/language/kinds.mjs +1 -0
- package/node_modules/graphql/language/parser.d.ts +14 -0
- package/node_modules/graphql/language/parser.js +33 -0
- package/node_modules/graphql/language/parser.mjs +33 -0
- package/node_modules/graphql/language/predicates.js +3 -1
- package/node_modules/graphql/language/predicates.mjs +5 -1
- package/node_modules/graphql/language/printer.js +13 -1
- package/node_modules/graphql/language/printer.mjs +13 -1
- package/node_modules/graphql/package.json +1 -1
- package/node_modules/graphql/type/directives.d.ts +9 -1
- package/node_modules/graphql/type/directives.js +10 -1
- package/node_modules/graphql/type/directives.mjs +10 -1
- package/node_modules/graphql/type/introspection.js +24 -1
- package/node_modules/graphql/type/introspection.mjs +24 -1
- package/node_modules/graphql/utilities/buildASTSchema.js +4 -0
- package/node_modules/graphql/utilities/buildASTSchema.mjs +4 -0
- package/node_modules/graphql/utilities/buildClientSchema.js +1 -0
- package/node_modules/graphql/utilities/buildClientSchema.mjs +1 -0
- package/node_modules/graphql/utilities/coerceInputValue.js +2 -2
- package/node_modules/graphql/utilities/coerceInputValue.mjs +2 -2
- package/node_modules/graphql/utilities/extendSchema.js +58 -3
- package/node_modules/graphql/utilities/extendSchema.mjs +58 -3
- package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +16 -0
- package/node_modules/graphql/utilities/getIntrospectionQuery.js +31 -38
- package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +31 -38
- package/node_modules/graphql/utilities/introspectionFromSchema.js +1 -0
- package/node_modules/graphql/utilities/introspectionFromSchema.mjs +1 -0
- package/node_modules/graphql/utilities/printSchema.js +1 -0
- package/node_modules/graphql/utilities/printSchema.mjs +1 -0
- package/node_modules/graphql/utilities/valueFromAST.js +12 -2
- package/node_modules/graphql/utilities/valueFromAST.mjs +12 -2
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +4 -0
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +4 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +12 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +12 -0
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +5 -11
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -11
- package/node_modules/graphql/validation/validate.js +12 -0
- package/node_modules/graphql/validation/validate.mjs +13 -2
- package/node_modules/graphql/version.js +2 -2
- package/node_modules/graphql/version.mjs +2 -2
- package/node_modules/hasown/CHANGELOG.md +11 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +1 -0
- package/node_modules/hasown/package.json +14 -14
- package/node_modules/iconv-lite/lib/index.d.ts +114 -26
- package/node_modules/iconv-lite/lib/index.js +39 -40
- package/node_modules/iconv-lite/package.json +13 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +423 -0
- package/node_modules/node-abi/abi_registry.json +10 -3
- package/node_modules/{semver → node-abi/node_modules/semver}/README.md +19 -4
- package/node_modules/{semver → node-abi/node_modules/semver}/bin/semver.js +14 -10
- package/node_modules/node-abi/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/index.js +2 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/internal/re.js +1 -1
- package/node_modules/{semver → node-abi/node_modules/semver}/package.json +3 -3
- package/node_modules/{semver → node-abi/node_modules/semver}/range.bnf +5 -4
- package/node_modules/node-abi/package.json +1 -1
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.d.ts +3 -0
- package/node_modules/path-to-regexp/dist/index.js +215 -193
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/.editorconfig +1 -1
- package/node_modules/qs/.github/SECURITY.md +11 -0
- package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/node_modules/qs/CHANGELOG.md +190 -0
- package/node_modules/qs/README.md +29 -4
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +56 -0
- package/node_modules/qs/lib/parse.js +94 -49
- package/node_modules/qs/lib/utils.js +85 -11
- package/node_modules/qs/package.json +10 -9
- package/node_modules/qs/test/parse.js +391 -13
- package/node_modules/qs/test/stringify.js +16 -3
- package/node_modules/qs/test/utils.js +173 -3
- package/node_modules/send/package.json +11 -8
- package/node_modules/serve-static/README.md +23 -23
- package/node_modules/serve-static/package.json +6 -3
- package/node_modules/side-channel-list/CHANGELOG.md +25 -4
- package/node_modules/side-channel-list/index.js +1 -3
- package/node_modules/side-channel-list/package.json +8 -8
- package/node_modules/side-channel-list/test/index.js +50 -0
- package/node_modules/uuid/dist/v35.js +3 -0
- package/node_modules/uuid/dist/v6.js +3 -0
- package/node_modules/uuid/dist-node/v35.js +3 -0
- package/node_modules/uuid/dist-node/v6.js +3 -0
- package/node_modules/uuid/package.json +1 -1
- package/node_modules/ws/index.js +15 -6
- package/node_modules/ws/lib/constants.js +1 -0
- package/node_modules/ws/lib/permessage-deflate.js +6 -6
- package/node_modules/ws/lib/websocket-server.js +10 -6
- package/node_modules/ws/lib/websocket.js +19 -14
- package/node_modules/ws/package.json +4 -3
- package/node_modules/ws/wrapper.mjs +14 -1
- package/package.json +2 -2
- package/node_modules/content-disposition/HISTORY.md +0 -72
- package/node_modules/express/History.md +0 -3858
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/iconv-lite/Changelog.md +0 -236
- package/node_modules/qs/.eslintrc +0 -39
- package/node_modules/send/HISTORY.md +0 -580
- package/node_modules/serve-static/HISTORY.md +0 -516
- /package/node_modules/{semver → node-abi/node_modules/semver}/LICENSE +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/comparator.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/index.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/range.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/semver.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/clean.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/cmp.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/coerce.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-build.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-loose.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/diff.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/eq.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gt.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gte.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/inc.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lt.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lte.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/major.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/minor.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/neq.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/parse.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/patch.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/prerelease.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rcompare.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rsort.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/satisfies.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/sort.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/valid.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/constants.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/debug.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/identifiers.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/lrucache.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/parse-options.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/preload.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/gtr.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/intersects.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/ltr.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/max-satisfying.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-satisfying.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-version.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/outside.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/simplify.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/subset.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/to-comparators.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/valid.js +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/index.js +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/license +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/package.json +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/readme.md +0 -0
|
@@ -7,26 +7,23 @@
|
|
|
7
7
|
'use strict'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @typedef Parsers
|
|
11
|
-
* @
|
|
12
|
-
* @property {
|
|
13
|
-
* @property {
|
|
14
|
-
* @property {
|
|
15
|
-
* @property {function} urlencoded
|
|
10
|
+
* @typedef {Object} Parsers
|
|
11
|
+
* @property {Function} json JSON parser
|
|
12
|
+
* @property {Function} raw Raw parser
|
|
13
|
+
* @property {Function} text Text parser
|
|
14
|
+
* @property {Function} urlencoded URL-encoded parser
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Module exports.
|
|
20
|
-
* @type {Parsers}
|
|
19
|
+
* @type {Function & Parsers}
|
|
21
20
|
*/
|
|
22
|
-
|
|
23
21
|
exports = module.exports = bodyParser
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* JSON parser.
|
|
27
25
|
* @public
|
|
28
26
|
*/
|
|
29
|
-
|
|
30
27
|
Object.defineProperty(exports, 'json', {
|
|
31
28
|
configurable: true,
|
|
32
29
|
enumerable: true,
|
|
@@ -37,7 +34,6 @@ Object.defineProperty(exports, 'json', {
|
|
|
37
34
|
* Raw parser.
|
|
38
35
|
* @public
|
|
39
36
|
*/
|
|
40
|
-
|
|
41
37
|
Object.defineProperty(exports, 'raw', {
|
|
42
38
|
configurable: true,
|
|
43
39
|
enumerable: true,
|
|
@@ -48,7 +44,6 @@ Object.defineProperty(exports, 'raw', {
|
|
|
48
44
|
* Text parser.
|
|
49
45
|
* @public
|
|
50
46
|
*/
|
|
51
|
-
|
|
52
47
|
Object.defineProperty(exports, 'text', {
|
|
53
48
|
configurable: true,
|
|
54
49
|
enumerable: true,
|
|
@@ -59,7 +54,6 @@ Object.defineProperty(exports, 'text', {
|
|
|
59
54
|
* URL-encoded parser.
|
|
60
55
|
* @public
|
|
61
56
|
*/
|
|
62
|
-
|
|
63
57
|
Object.defineProperty(exports, 'urlencoded', {
|
|
64
58
|
configurable: true,
|
|
65
59
|
enumerable: true,
|
|
@@ -69,12 +63,9 @@ Object.defineProperty(exports, 'urlencoded', {
|
|
|
69
63
|
/**
|
|
70
64
|
* Create a middleware to parse json and urlencoded bodies.
|
|
71
65
|
*
|
|
72
|
-
* @param {object} [options]
|
|
73
|
-
* @return {function}
|
|
74
66
|
* @deprecated
|
|
75
67
|
* @public
|
|
76
68
|
*/
|
|
77
|
-
|
|
78
69
|
function bodyParser () {
|
|
79
70
|
throw new Error('The bodyParser() generic has been split into individual middleware to use instead.')
|
|
80
71
|
}
|
|
@@ -28,15 +28,14 @@ module.exports = read
|
|
|
28
28
|
/**
|
|
29
29
|
* Read a request into a buffer and parse.
|
|
30
30
|
*
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
35
|
-
* @param {
|
|
36
|
-
* @param {
|
|
31
|
+
* @param {Object} req
|
|
32
|
+
* @param {Object} res
|
|
33
|
+
* @param {Function} next
|
|
34
|
+
* @param {Function} parse
|
|
35
|
+
* @param {Function} debug
|
|
36
|
+
* @param {Object} options
|
|
37
37
|
* @private
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
39
|
function read (req, res, next, parse, debug, options) {
|
|
41
40
|
if (onFinished.isFinished(req)) {
|
|
42
41
|
debug('body already parsed')
|
|
@@ -176,13 +175,12 @@ function read (req, res, next, parse, debug, options) {
|
|
|
176
175
|
/**
|
|
177
176
|
* Get the content stream of the request.
|
|
178
177
|
*
|
|
179
|
-
* @param {
|
|
180
|
-
* @param {
|
|
181
|
-
* @param {boolean}
|
|
182
|
-
* @
|
|
183
|
-
* @
|
|
178
|
+
* @param {Object} req
|
|
179
|
+
* @param {Function} debug
|
|
180
|
+
* @param {boolean} inflate
|
|
181
|
+
* @returns {Object}
|
|
182
|
+
* @private
|
|
184
183
|
*/
|
|
185
|
-
|
|
186
184
|
function contentstream (req, debug, inflate) {
|
|
187
185
|
var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
|
188
186
|
var length = req.headers['content-length']
|
|
@@ -209,9 +207,9 @@ function contentstream (req, debug, inflate) {
|
|
|
209
207
|
/**
|
|
210
208
|
* Create a decompression stream for the given encoding.
|
|
211
209
|
* @param {string} encoding
|
|
212
|
-
* @param {
|
|
213
|
-
* @
|
|
214
|
-
* @
|
|
210
|
+
* @param {Function} debug
|
|
211
|
+
* @returns {Object}
|
|
212
|
+
* @private
|
|
215
213
|
*/
|
|
216
214
|
function createDecompressionStream (encoding, debug) {
|
|
217
215
|
switch (encoding) {
|
|
@@ -235,11 +233,10 @@ function createDecompressionStream (encoding, debug) {
|
|
|
235
233
|
/**
|
|
236
234
|
* Dump the contents of a request.
|
|
237
235
|
*
|
|
238
|
-
* @param {
|
|
239
|
-
* @param {
|
|
240
|
-
* @
|
|
236
|
+
* @param {Object} req
|
|
237
|
+
* @param {Function} callback
|
|
238
|
+
* @private
|
|
241
239
|
*/
|
|
242
|
-
|
|
243
240
|
function dump (req, callback) {
|
|
244
241
|
if (onFinished.isFinished(req)) {
|
|
245
242
|
callback(null)
|
|
@@ -33,7 +33,6 @@ module.exports = json
|
|
|
33
33
|
* %x0A / ; Line feed or New line
|
|
34
34
|
* %x0D ) ; Carriage return
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
36
|
var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
|
|
38
37
|
|
|
39
38
|
var JSON_SYNTAX_CHAR = '#'
|
|
@@ -42,11 +41,10 @@ var JSON_SYNTAX_REGEXP = /#+/g
|
|
|
42
41
|
/**
|
|
43
42
|
* Create a middleware to parse JSON bodies.
|
|
44
43
|
*
|
|
45
|
-
* @param {
|
|
46
|
-
* @
|
|
44
|
+
* @param {Object} [options]
|
|
45
|
+
* @returns {Function}
|
|
47
46
|
* @public
|
|
48
47
|
*/
|
|
49
|
-
|
|
50
48
|
function json (options) {
|
|
51
49
|
const normalizedOptions = normalizeOptions(options, 'application/json')
|
|
52
50
|
|
|
@@ -96,20 +94,15 @@ function json (options) {
|
|
|
96
94
|
*
|
|
97
95
|
* @param {string} str
|
|
98
96
|
* @param {string} char
|
|
99
|
-
* @
|
|
97
|
+
* @returns {Error}
|
|
100
98
|
* @private
|
|
101
99
|
*/
|
|
102
|
-
|
|
103
100
|
function createStrictSyntaxError (str, char) {
|
|
104
101
|
var index = str.indexOf(char)
|
|
105
102
|
var partial = ''
|
|
106
103
|
|
|
107
104
|
if (index !== -1) {
|
|
108
|
-
partial = str.substring(0, index) + JSON_SYNTAX_CHAR
|
|
109
|
-
|
|
110
|
-
for (var i = index + 1; i < str.length; i++) {
|
|
111
|
-
partial += JSON_SYNTAX_CHAR
|
|
112
|
-
}
|
|
105
|
+
partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index)
|
|
113
106
|
}
|
|
114
107
|
|
|
115
108
|
try {
|
|
@@ -128,10 +121,9 @@ function createStrictSyntaxError (str, char) {
|
|
|
128
121
|
* Get the first non-whitespace character in a string.
|
|
129
122
|
*
|
|
130
123
|
* @param {string} str
|
|
131
|
-
* @
|
|
124
|
+
* @returns {string|undefined}
|
|
132
125
|
* @private
|
|
133
126
|
*/
|
|
134
|
-
|
|
135
127
|
function firstchar (str) {
|
|
136
128
|
var match = FIRST_CHAR_REGEXP.exec(str)
|
|
137
129
|
|
|
@@ -144,10 +136,10 @@ function firstchar (str) {
|
|
|
144
136
|
* Normalize a SyntaxError for JSON.parse.
|
|
145
137
|
*
|
|
146
138
|
* @param {SyntaxError} error
|
|
147
|
-
* @param {
|
|
148
|
-
* @
|
|
139
|
+
* @param {Object} obj
|
|
140
|
+
* @returns {SyntaxError}
|
|
141
|
+
* @private
|
|
149
142
|
*/
|
|
150
|
-
|
|
151
143
|
function normalizeJsonSyntaxError (error, obj) {
|
|
152
144
|
var keys = Object.getOwnPropertyNames(error)
|
|
153
145
|
|
|
@@ -23,11 +23,10 @@ module.exports = raw
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a middleware to parse raw bodies.
|
|
25
25
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
26
|
+
* @param {Object} [options]
|
|
27
|
+
* @returns {Function}
|
|
28
|
+
* @public
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
function raw (options) {
|
|
32
31
|
const normalizedOptions = normalizeOptions(options, 'application/octet-stream')
|
|
33
32
|
|
|
@@ -23,11 +23,10 @@ module.exports = text
|
|
|
23
23
|
/**
|
|
24
24
|
* Create a middleware to parse text bodies.
|
|
25
25
|
*
|
|
26
|
-
* @param {
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
26
|
+
* @param {Object} [options]
|
|
27
|
+
* @returns {Function}
|
|
28
|
+
* @public
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
function text (options) {
|
|
32
31
|
const normalizedOptions = normalizeOptions(options, 'text/plain')
|
|
33
32
|
|
|
@@ -27,11 +27,10 @@ module.exports = urlencoded
|
|
|
27
27
|
/**
|
|
28
28
|
* Create a middleware to parse urlencoded bodies.
|
|
29
29
|
*
|
|
30
|
-
* @param {
|
|
31
|
-
* @
|
|
30
|
+
* @param {Object} [options]
|
|
31
|
+
* @returns {Function}
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
|
|
35
34
|
function urlencoded (options) {
|
|
36
35
|
const normalizedOptions = normalizeOptions(options, 'application/x-www-form-urlencoded')
|
|
37
36
|
|
|
@@ -62,9 +61,10 @@ function urlencoded (options) {
|
|
|
62
61
|
/**
|
|
63
62
|
* Get the extended query parser.
|
|
64
63
|
*
|
|
65
|
-
* @param {
|
|
64
|
+
* @param {Object} options
|
|
65
|
+
* @returns {Function}
|
|
66
|
+
* @private
|
|
66
67
|
*/
|
|
67
|
-
|
|
68
68
|
function createQueryParser (options) {
|
|
69
69
|
var extended = Boolean(options?.extended)
|
|
70
70
|
var parameterLimit = options?.parameterLimit !== undefined
|
|
@@ -96,7 +96,7 @@ function createQueryParser (options) {
|
|
|
96
96
|
})
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
var arrayLimit = extended ? Math.max(100, paramCount) :
|
|
99
|
+
var arrayLimit = extended ? Math.max(100, paramCount) : paramCount
|
|
100
100
|
|
|
101
101
|
debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')
|
|
102
102
|
try {
|
|
@@ -127,8 +127,8 @@ function createQueryParser (options) {
|
|
|
127
127
|
*
|
|
128
128
|
* @param {string} body
|
|
129
129
|
* @param {number} limit
|
|
130
|
-
* @
|
|
131
|
-
* @
|
|
130
|
+
* @returns {number|undefined} Returns undefined if limit exceeded
|
|
131
|
+
* @private
|
|
132
132
|
*/
|
|
133
133
|
function parameterCount (body, limit) {
|
|
134
134
|
let count = 0
|
|
@@ -20,10 +20,10 @@ module.exports = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Get the charset of a request.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
24
|
-
* @
|
|
23
|
+
* @param {Object} req
|
|
24
|
+
* @returns {string | undefined}
|
|
25
|
+
* @private
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
27
|
function getCharset (req) {
|
|
28
28
|
try {
|
|
29
29
|
return (contentType.parse(req).parameters.charset || '').toLowerCase()
|
|
@@ -36,9 +36,9 @@ function getCharset (req) {
|
|
|
36
36
|
* Get the simple type checker.
|
|
37
37
|
*
|
|
38
38
|
* @param {string | string[]} type
|
|
39
|
-
* @
|
|
39
|
+
* @returns {Function}
|
|
40
|
+
* @private
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
42
|
function typeChecker (type) {
|
|
43
43
|
return function checkType (req) {
|
|
44
44
|
return Boolean(typeis(req, type))
|
|
@@ -48,9 +48,10 @@ function typeChecker (type) {
|
|
|
48
48
|
/**
|
|
49
49
|
* Normalizes the common options for all parsers.
|
|
50
50
|
*
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {string | string[] |
|
|
53
|
-
* @returns {
|
|
51
|
+
* @param {Object} options options to normalize
|
|
52
|
+
* @param {string | string[] | Function} defaultType default content type(s) or a function to determine it
|
|
53
|
+
* @returns {Object}
|
|
54
|
+
* @private
|
|
54
55
|
*/
|
|
55
56
|
function normalizeOptions (options, defaultType) {
|
|
56
57
|
if (!defaultType) {
|
|
@@ -89,7 +90,8 @@ function normalizeOptions (options, defaultType) {
|
|
|
89
90
|
* Used by parsers that don't need to transform the data.
|
|
90
91
|
*
|
|
91
92
|
* @param {*} value
|
|
92
|
-
* @
|
|
93
|
+
* @returns {*}
|
|
94
|
+
* @private
|
|
93
95
|
*/
|
|
94
96
|
function passthrough (value) {
|
|
95
97
|
return value
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "body-parser",
|
|
3
3
|
"description": "Node.js body parsing middleware",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
7
7
|
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"http-errors": "^2.0.0",
|
|
20
20
|
"iconv-lite": "^0.7.0",
|
|
21
21
|
"on-finished": "^2.4.1",
|
|
22
|
-
"qs": "^6.14.
|
|
22
|
+
"qs": "^6.14.1",
|
|
23
23
|
"raw-body": "^3.0.1",
|
|
24
24
|
"type-is": "^2.0.1"
|
|
25
25
|
},
|
|
@@ -87,7 +87,6 @@ are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-
|
|
|
87
87
|
|
|
88
88
|
```js
|
|
89
89
|
const contentDisposition = require('content-disposition')
|
|
90
|
-
const destroy = require('destroy')
|
|
91
90
|
const fs = require('fs')
|
|
92
91
|
const http = require('http')
|
|
93
92
|
const onFinished = require('on-finished')
|
|
@@ -103,7 +102,7 @@ http.createServer(function onRequest (req, res) {
|
|
|
103
102
|
const stream = fs.createReadStream(filePath)
|
|
104
103
|
stream.pipe(res)
|
|
105
104
|
onFinished(res, function () {
|
|
106
|
-
destroy(
|
|
105
|
+
stream.destroy()
|
|
107
106
|
})
|
|
108
107
|
})
|
|
109
108
|
```
|
|
@@ -121,9 +120,9 @@ $ npm test
|
|
|
121
120
|
- [RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)][rfc-6266]
|
|
122
121
|
- [Test Cases for HTTP Content-Disposition header field (RFC 6266) and the Encodings defined in RFCs 2047, 2231 and 5987][tc-2231]
|
|
123
122
|
|
|
124
|
-
[rfc-2616]: https://
|
|
125
|
-
[rfc-5987]: https://
|
|
126
|
-
[rfc-6266]: https://
|
|
123
|
+
[rfc-2616]: https://datatracker.ietf.org/doc/html/rfc2616
|
|
124
|
+
[rfc-5987]: https://datatracker.ietf.org/doc/html/rfc5987
|
|
125
|
+
[rfc-6266]: https://datatracker.ietf.org/doc/html/rfc6266
|
|
127
126
|
[tc-2231]: http://greenbytes.de/tech/tc2231/
|
|
128
127
|
|
|
129
128
|
## License
|
|
@@ -131,12 +130,12 @@ $ npm test
|
|
|
131
130
|
[MIT](LICENSE)
|
|
132
131
|
|
|
133
132
|
[npm-image]: https://img.shields.io/npm/v/content-disposition
|
|
134
|
-
[npm-url]: https://npmjs.
|
|
133
|
+
[npm-url]: https://www.npmjs.com/package/content-disposition
|
|
135
134
|
[node-version-image]: https://img.shields.io/node/v/content-disposition
|
|
136
135
|
[node-version-url]: https://nodejs.org/en/download
|
|
137
136
|
[coveralls-image]: https://img.shields.io/coverallsCoverage/github/jshttp/content-disposition
|
|
138
|
-
[coveralls-url]: https://coveralls.io/
|
|
137
|
+
[coveralls-url]: https://coveralls.io/github/jshttp/content-disposition?branch=master
|
|
139
138
|
[downloads-image]: https://img.shields.io/npm/dm/content-disposition
|
|
140
|
-
[downloads-url]: https://npmjs.
|
|
139
|
+
[downloads-url]: https://www.npmjs.com/package/content-disposition
|
|
141
140
|
[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-disposition/ci.yml
|
|
142
141
|
[github-actions-ci-url]: https://github.com/jshttp/content-disposition/actions/workflows/ci.yml
|
|
@@ -15,11 +15,11 @@ module.exports = contentDisposition
|
|
|
15
15
|
module.exports.parse = parse
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* TextDecoder instance for UTF-8 decoding when decodeURIComponent fails due to invalid byte sequences.
|
|
19
|
+
* @type {TextDecoder}
|
|
19
20
|
* @private
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
-
var basename = require('path').basename
|
|
22
|
+
const utf8Decoder = new TextDecoder('utf-8')
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")
|
|
@@ -28,14 +28,6 @@ var basename = require('path').basename
|
|
|
28
28
|
|
|
29
29
|
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* RegExp to match percent encoding escape.
|
|
33
|
-
* @private
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/
|
|
37
|
-
var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g
|
|
38
|
-
|
|
39
31
|
/**
|
|
40
32
|
* RegExp to match non-latin1 characters.
|
|
41
33
|
* @private
|
|
@@ -199,7 +191,7 @@ function createparams (filename, fallback) {
|
|
|
199
191
|
var hasFallback = typeof fallbackName === 'string' && fallbackName !== name
|
|
200
192
|
|
|
201
193
|
// set extended filename parameter
|
|
202
|
-
if (hasFallback || !isQuotedString ||
|
|
194
|
+
if (hasFallback || !isQuotedString || hasHexEscape(name)) {
|
|
203
195
|
params['filename*'] = name
|
|
204
196
|
}
|
|
205
197
|
|
|
@@ -262,32 +254,41 @@ function format (obj) {
|
|
|
262
254
|
*/
|
|
263
255
|
|
|
264
256
|
function decodefield (str) {
|
|
265
|
-
|
|
257
|
+
const match = EXT_VALUE_REGEXP.exec(str)
|
|
266
258
|
|
|
267
259
|
if (!match) {
|
|
268
260
|
throw new TypeError('invalid extended field value')
|
|
269
261
|
}
|
|
270
262
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
var value
|
|
274
|
-
|
|
275
|
-
// to binary string
|
|
276
|
-
var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode)
|
|
263
|
+
const charset = match[1].toLowerCase()
|
|
264
|
+
const encoded = match[2]
|
|
277
265
|
|
|
278
266
|
switch (charset) {
|
|
279
267
|
case 'iso-8859-1':
|
|
280
|
-
|
|
281
|
-
|
|
268
|
+
{
|
|
269
|
+
const binary = decodeHexEscapes(encoded)
|
|
270
|
+
return getlatin1(binary)
|
|
271
|
+
}
|
|
282
272
|
case 'utf-8':
|
|
283
273
|
case 'utf8':
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
274
|
+
{
|
|
275
|
+
try {
|
|
276
|
+
return decodeURIComponent(encoded)
|
|
277
|
+
} catch {
|
|
278
|
+
// Failed to decode with decodeURIComponent, fallback to lenient decoding which replaces invalid UTF-8 byte sequences with the Unicode replacement character
|
|
279
|
+
// TODO: Consider removing in the next major version to be more strict about invalid percent-encodings
|
|
280
|
+
const binary = decodeHexEscapes(encoded)
|
|
281
|
+
|
|
282
|
+
const bytes = new Uint8Array(binary.length)
|
|
283
|
+
for (let idx = 0; idx < binary.length; idx++) {
|
|
284
|
+
bytes[idx] = binary.charCodeAt(idx)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return utf8Decoder.decode(bytes)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
288
290
|
}
|
|
289
|
-
|
|
290
|
-
return value
|
|
291
|
+
throw new TypeError('unsupported charset in extended field')
|
|
291
292
|
}
|
|
292
293
|
|
|
293
294
|
/**
|
|
@@ -383,19 +384,6 @@ function parse (string) {
|
|
|
383
384
|
return new ContentDisposition(type, params)
|
|
384
385
|
}
|
|
385
386
|
|
|
386
|
-
/**
|
|
387
|
-
* Percent decode a single character.
|
|
388
|
-
*
|
|
389
|
-
* @param {string} str
|
|
390
|
-
* @param {string} hex
|
|
391
|
-
* @return {string}
|
|
392
|
-
* @private
|
|
393
|
-
*/
|
|
394
|
-
|
|
395
|
-
function pdecode (str, hex) {
|
|
396
|
-
return String.fromCharCode(parseInt(hex, 16))
|
|
397
|
-
}
|
|
398
|
-
|
|
399
387
|
/**
|
|
400
388
|
* Percent encode a single character.
|
|
401
389
|
*
|
|
@@ -456,3 +444,93 @@ function ContentDisposition (type, parameters) {
|
|
|
456
444
|
this.type = type
|
|
457
445
|
this.parameters = parameters
|
|
458
446
|
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Return the last portion of a path
|
|
450
|
+
*
|
|
451
|
+
* @param {string} path
|
|
452
|
+
* @returns {string}
|
|
453
|
+
*/
|
|
454
|
+
function basename (path) {
|
|
455
|
+
const normalized = path.replaceAll('\\', '/')
|
|
456
|
+
|
|
457
|
+
let end = normalized.length
|
|
458
|
+
while (end > 0 && normalized[end - 1] === '/') {
|
|
459
|
+
end--
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (end === 0) {
|
|
463
|
+
return ''
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
let start = end - 1
|
|
467
|
+
while (start >= 0 && normalized[start] !== '/') {
|
|
468
|
+
start--
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return normalized.slice(start + 1, end)
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Check if a character is a hex digit [0-9A-Fa-f]
|
|
476
|
+
*
|
|
477
|
+
* @param {string} char
|
|
478
|
+
* @return {boolean}
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
function isHexDigit (char) {
|
|
482
|
+
const code = char.charCodeAt(0)
|
|
483
|
+
return (
|
|
484
|
+
(code >= 48 && code <= 57) || // 0-9
|
|
485
|
+
(code >= 65 && code <= 70) || // A-F
|
|
486
|
+
(code >= 97 && code <= 102) // a-f
|
|
487
|
+
)
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Check if a string contains percent encoding escapes.
|
|
492
|
+
*
|
|
493
|
+
* @param {string} str
|
|
494
|
+
* @return {boolean}
|
|
495
|
+
* @private
|
|
496
|
+
*/
|
|
497
|
+
function hasHexEscape (str) {
|
|
498
|
+
const maxIndex = str.length - 3
|
|
499
|
+
let lastIndex = -1
|
|
500
|
+
|
|
501
|
+
while ((lastIndex = str.indexOf('%', lastIndex + 1)) !== -1 && lastIndex <= maxIndex) {
|
|
502
|
+
if (isHexDigit(str[lastIndex + 1]) && isHexDigit(str[lastIndex + 2])) {
|
|
503
|
+
return true
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return false
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Decode hex escapes in a string (e.g., %20 -> space)
|
|
512
|
+
*
|
|
513
|
+
* @param {string} str
|
|
514
|
+
* @return {string}
|
|
515
|
+
* @private
|
|
516
|
+
*/
|
|
517
|
+
function decodeHexEscapes (str) {
|
|
518
|
+
const firstEscape = str.indexOf('%')
|
|
519
|
+
if (firstEscape === -1) return str
|
|
520
|
+
|
|
521
|
+
let result = str.slice(0, firstEscape)
|
|
522
|
+
for (let idx = firstEscape; idx < str.length; idx++) {
|
|
523
|
+
if (
|
|
524
|
+
str[idx] === '%' &&
|
|
525
|
+
idx + 2 < str.length &&
|
|
526
|
+
isHexDigit(str[idx + 1]) &&
|
|
527
|
+
isHexDigit(str[idx + 2])
|
|
528
|
+
) {
|
|
529
|
+
result += String.fromCharCode(Number.parseInt(str[idx + 1] + str[idx + 2], 16))
|
|
530
|
+
idx += 2
|
|
531
|
+
} else {
|
|
532
|
+
result += str[idx]
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return result
|
|
536
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "content-disposition",
|
|
3
3
|
"description": "Create and parse Content-Disposition header",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -17,18 +17,15 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"c8": "^10.1.2",
|
|
20
|
-
"eslint": "
|
|
21
|
-
"eslint-config-standard": "
|
|
22
|
-
"eslint-plugin-import": "2.
|
|
23
|
-
"eslint-plugin-markdown": "
|
|
24
|
-
"eslint-plugin-node": "11.1.0",
|
|
25
|
-
"eslint-plugin-promise": "
|
|
26
|
-
"eslint-plugin-standard": "4.1.0"
|
|
20
|
+
"eslint": "^8.57.1",
|
|
21
|
+
"eslint-config-standard": "^14.1.1",
|
|
22
|
+
"eslint-plugin-import": "^2.32.0",
|
|
23
|
+
"eslint-plugin-markdown": "^3.0.1",
|
|
24
|
+
"eslint-plugin-node": "^11.1.0",
|
|
25
|
+
"eslint-plugin-promise": "^6.6.0",
|
|
26
|
+
"eslint-plugin-standard": "^4.1.0"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"LICENSE",
|
|
30
|
-
"HISTORY.md",
|
|
31
|
-
"README.md",
|
|
32
29
|
"index.js"
|
|
33
30
|
],
|
|
34
31
|
"engines": {
|