@launchdarkly/mcp-server 0.6.2 → 0.7.0
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/README.md +17 -13
- package/bin/mcp-server.js +905 -168
- package/bin/mcp-server.js.map +26 -22
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/cli/start/command.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/command.js +12 -0
- package/dist/commonjs/mcp-server/cli/start/command.js.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/impl.d.ts +2 -0
- package/dist/commonjs/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/impl.js +60 -20
- package/dist/commonjs/mcp-server/cli/start/impl.js.map +1 -1
- package/dist/commonjs/mcp-server/cli/start/sse-security.d.ts +5 -0
- package/dist/commonjs/mcp-server/cli/start/sse-security.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/cli/start/sse-security.js +26 -0
- package/dist/commonjs/mcp-server/cli/start/sse-security.js.map +1 -0
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/cli/start/command.d.ts.map +1 -1
- package/dist/esm/mcp-server/cli/start/command.js +12 -0
- package/dist/esm/mcp-server/cli/start/command.js.map +1 -1
- package/dist/esm/mcp-server/cli/start/impl.d.ts +2 -0
- package/dist/esm/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/dist/esm/mcp-server/cli/start/impl.js +60 -20
- package/dist/esm/mcp-server/cli/start/impl.js.map +1 -1
- package/dist/esm/mcp-server/cli/start/sse-security.d.ts +5 -0
- package/dist/esm/mcp-server/cli/start/sse-security.d.ts.map +1 -0
- package/dist/esm/mcp-server/cli/start/sse-security.js +21 -0
- package/dist/esm/mcp-server/cli/start/sse-security.js.map +1 -0
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -1
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/cli/start/command.ts +14 -0
- package/src/mcp-server/cli/start/impl.ts +69 -20
- package/src/mcp-server/cli/start/sse-security.ts +31 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/test/sse-security.test.mjs +84 -0
package/bin/mcp-server.js
CHANGED
|
@@ -14880,7 +14880,54 @@ var init_stdio2 = __esm(() => {
|
|
|
14880
14880
|
init_stdio();
|
|
14881
14881
|
});
|
|
14882
14882
|
|
|
14883
|
-
// node_modules/
|
|
14883
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js
|
|
14884
|
+
function hostHeaderValidation(allowedHostnames) {
|
|
14885
|
+
return (req, res, next) => {
|
|
14886
|
+
const hostHeader = req.headers.host;
|
|
14887
|
+
if (!hostHeader) {
|
|
14888
|
+
res.status(403).json({
|
|
14889
|
+
jsonrpc: "2.0",
|
|
14890
|
+
error: {
|
|
14891
|
+
code: -32000,
|
|
14892
|
+
message: "Missing Host header"
|
|
14893
|
+
},
|
|
14894
|
+
id: null
|
|
14895
|
+
});
|
|
14896
|
+
return;
|
|
14897
|
+
}
|
|
14898
|
+
let hostname;
|
|
14899
|
+
try {
|
|
14900
|
+
hostname = new URL(`http://${hostHeader}`).hostname;
|
|
14901
|
+
} catch {
|
|
14902
|
+
res.status(403).json({
|
|
14903
|
+
jsonrpc: "2.0",
|
|
14904
|
+
error: {
|
|
14905
|
+
code: -32000,
|
|
14906
|
+
message: `Invalid Host header: ${hostHeader}`
|
|
14907
|
+
},
|
|
14908
|
+
id: null
|
|
14909
|
+
});
|
|
14910
|
+
return;
|
|
14911
|
+
}
|
|
14912
|
+
if (!allowedHostnames.includes(hostname)) {
|
|
14913
|
+
res.status(403).json({
|
|
14914
|
+
jsonrpc: "2.0",
|
|
14915
|
+
error: {
|
|
14916
|
+
code: -32000,
|
|
14917
|
+
message: `Invalid Host: ${hostname}`
|
|
14918
|
+
},
|
|
14919
|
+
id: null
|
|
14920
|
+
});
|
|
14921
|
+
return;
|
|
14922
|
+
}
|
|
14923
|
+
next();
|
|
14924
|
+
};
|
|
14925
|
+
}
|
|
14926
|
+
function localhostHostValidation() {
|
|
14927
|
+
return hostHeaderValidation(["localhost", "127.0.0.1", "[::1]"]);
|
|
14928
|
+
}
|
|
14929
|
+
|
|
14930
|
+
// node_modules/body-parser/node_modules/statuses/codes.json
|
|
14884
14931
|
var require_codes2 = __commonJS((exports, module) => {
|
|
14885
14932
|
module.exports = {
|
|
14886
14933
|
"100": "Continue",
|
|
@@ -14949,7 +14996,7 @@ var require_codes2 = __commonJS((exports, module) => {
|
|
|
14949
14996
|
};
|
|
14950
14997
|
});
|
|
14951
14998
|
|
|
14952
|
-
// node_modules/statuses/index.js
|
|
14999
|
+
// node_modules/body-parser/node_modules/statuses/index.js
|
|
14953
15000
|
var require_statuses2 = __commonJS((exports, module) => {
|
|
14954
15001
|
/*!
|
|
14955
15002
|
* statuses
|
|
@@ -15023,7 +15070,7 @@ var require_statuses2 = __commonJS((exports, module) => {
|
|
|
15023
15070
|
}
|
|
15024
15071
|
});
|
|
15025
15072
|
|
|
15026
|
-
// node_modules/http-errors/index.js
|
|
15073
|
+
// node_modules/body-parser/node_modules/http-errors/index.js
|
|
15027
15074
|
var require_http_errors2 = __commonJS((exports, module) => {
|
|
15028
15075
|
/*!
|
|
15029
15076
|
* http-errors
|
|
@@ -15186,7 +15233,7 @@ var require_http_errors2 = __commonJS((exports, module) => {
|
|
|
15186
15233
|
});
|
|
15187
15234
|
}
|
|
15188
15235
|
function toClassName(name) {
|
|
15189
|
-
return name.
|
|
15236
|
+
return name.slice(-5) === "Error" ? name : name + "Error";
|
|
15190
15237
|
}
|
|
15191
15238
|
});
|
|
15192
15239
|
|
|
@@ -28314,12 +28361,15 @@ var require_json = __commonJS((exports, module) => {
|
|
|
28314
28361
|
var JSON_SYNTAX_REGEXP = /#+/g;
|
|
28315
28362
|
function json(options) {
|
|
28316
28363
|
var opts = options || {};
|
|
28317
|
-
var limit = typeof opts.limit
|
|
28364
|
+
var limit = typeof opts.limit === "undefined" || opts.limit === null ? 102400 : bytes.parse(opts.limit);
|
|
28318
28365
|
var inflate = opts.inflate !== false;
|
|
28319
28366
|
var reviver = opts.reviver;
|
|
28320
28367
|
var strict = opts.strict !== false;
|
|
28321
28368
|
var type = opts.type || "application/json";
|
|
28322
28369
|
var verify = opts.verify || false;
|
|
28370
|
+
if (limit === null) {
|
|
28371
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid');
|
|
28372
|
+
}
|
|
28323
28373
|
if (verify !== false && typeof verify !== "function") {
|
|
28324
28374
|
throw new TypeError("option verify must be function");
|
|
28325
28375
|
}
|
|
@@ -28384,10 +28434,7 @@ var require_json = __commonJS((exports, module) => {
|
|
|
28384
28434
|
var index = str.indexOf(char);
|
|
28385
28435
|
var partial2 = "";
|
|
28386
28436
|
if (index !== -1) {
|
|
28387
|
-
partial2 = str.substring(0, index) + JSON_SYNTAX_CHAR;
|
|
28388
|
-
for (var i = index + 1;i < str.length; i++) {
|
|
28389
|
-
partial2 += JSON_SYNTAX_CHAR;
|
|
28390
|
-
}
|
|
28437
|
+
partial2 = str.substring(0, index) + new Array(str.length - index + 1).join(JSON_SYNTAX_CHAR);
|
|
28391
28438
|
}
|
|
28392
28439
|
try {
|
|
28393
28440
|
JSON.parse(partial2);
|
|
@@ -28446,9 +28493,12 @@ var require_raw = __commonJS((exports, module) => {
|
|
|
28446
28493
|
function raw(options) {
|
|
28447
28494
|
var opts = options || {};
|
|
28448
28495
|
var inflate = opts.inflate !== false;
|
|
28449
|
-
var limit = typeof opts.limit
|
|
28496
|
+
var limit = typeof opts.limit === "undefined" || opts.limit === null ? 102400 : bytes.parse(opts.limit);
|
|
28450
28497
|
var type = opts.type || "application/octet-stream";
|
|
28451
28498
|
var verify = opts.verify || false;
|
|
28499
|
+
if (limit === null) {
|
|
28500
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid');
|
|
28501
|
+
}
|
|
28452
28502
|
if (verify !== false && typeof verify !== "function") {
|
|
28453
28503
|
throw new TypeError("option verify must be function");
|
|
28454
28504
|
}
|
|
@@ -28506,9 +28556,12 @@ var require_text = __commonJS((exports, module) => {
|
|
|
28506
28556
|
var opts = options || {};
|
|
28507
28557
|
var defaultCharset = opts.defaultCharset || "utf-8";
|
|
28508
28558
|
var inflate = opts.inflate !== false;
|
|
28509
|
-
var limit = typeof opts.limit
|
|
28559
|
+
var limit = typeof opts.limit === "undefined" || opts.limit === null ? 102400 : bytes.parse(opts.limit);
|
|
28510
28560
|
var type = opts.type || "text/plain";
|
|
28511
28561
|
var verify = opts.verify || false;
|
|
28562
|
+
if (limit === null) {
|
|
28563
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid');
|
|
28564
|
+
}
|
|
28512
28565
|
if (verify !== false && typeof verify !== "function") {
|
|
28513
28566
|
throw new TypeError("option verify must be function");
|
|
28514
28567
|
}
|
|
@@ -29149,9 +29202,8 @@ var require_side_channel_list = __commonJS((exports, module) => {
|
|
|
29149
29202
|
}
|
|
29150
29203
|
},
|
|
29151
29204
|
delete: function(key) {
|
|
29152
|
-
var root = $o && $o.next;
|
|
29153
29205
|
var deletedNode = listDelete($o, key);
|
|
29154
|
-
if (deletedNode &&
|
|
29206
|
+
if (deletedNode && $o && !$o.next) {
|
|
29155
29207
|
$o = undefined;
|
|
29156
29208
|
}
|
|
29157
29209
|
return !!deletedNode;
|
|
@@ -29997,7 +30049,8 @@ var require_side_channel = __commonJS((exports, module) => {
|
|
|
29997
30049
|
var channel = {
|
|
29998
30050
|
assert: function(key) {
|
|
29999
30051
|
if (!channel.has(key)) {
|
|
30000
|
-
|
|
30052
|
+
var keyDesc = key && Object(key) === key ? "the given object key" : inspect(key);
|
|
30053
|
+
throw new $TypeError("Side channel does not contain " + keyDesc);
|
|
30001
30054
|
}
|
|
30002
30055
|
},
|
|
30003
30056
|
delete: function(key) {
|
|
@@ -30046,12 +30099,28 @@ var require_formats = __commonJS((exports, module) => {
|
|
|
30046
30099
|
// node_modules/qs/lib/utils.js
|
|
30047
30100
|
var require_utils = __commonJS((exports, module) => {
|
|
30048
30101
|
var formats = require_formats();
|
|
30102
|
+
var getSideChannel = require_side_channel();
|
|
30103
|
+
var defineProperty = require_es_define_property();
|
|
30049
30104
|
var has = Object.prototype.hasOwnProperty;
|
|
30050
30105
|
var isArray = Array.isArray;
|
|
30106
|
+
var overflowChannel = getSideChannel();
|
|
30107
|
+
var markOverflow = function markOverflow(obj, maxIndex) {
|
|
30108
|
+
overflowChannel.set(obj, maxIndex);
|
|
30109
|
+
return obj;
|
|
30110
|
+
};
|
|
30111
|
+
var isOverflow = function isOverflow(obj) {
|
|
30112
|
+
return overflowChannel.has(obj);
|
|
30113
|
+
};
|
|
30114
|
+
var getMaxIndex = function getMaxIndex(obj) {
|
|
30115
|
+
return overflowChannel.get(obj);
|
|
30116
|
+
};
|
|
30117
|
+
var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
|
30118
|
+
overflowChannel.set(obj, maxIndex);
|
|
30119
|
+
};
|
|
30051
30120
|
var hexTable = function() {
|
|
30052
30121
|
var array2 = [];
|
|
30053
30122
|
for (var i = 0;i < 256; ++i) {
|
|
30054
|
-
array2.
|
|
30123
|
+
array2[array2.length] = "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
|
|
30055
30124
|
}
|
|
30056
30125
|
return array2;
|
|
30057
30126
|
}();
|
|
@@ -30063,7 +30132,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30063
30132
|
var compacted = [];
|
|
30064
30133
|
for (var j2 = 0;j2 < obj.length; ++j2) {
|
|
30065
30134
|
if (typeof obj[j2] !== "undefined") {
|
|
30066
|
-
compacted.
|
|
30135
|
+
compacted[compacted.length] = obj[j2];
|
|
30067
30136
|
}
|
|
30068
30137
|
}
|
|
30069
30138
|
item.obj[item.prop] = compacted;
|
|
@@ -30071,7 +30140,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30071
30140
|
}
|
|
30072
30141
|
};
|
|
30073
30142
|
var arrayToObject = function arrayToObject(source, options) {
|
|
30074
|
-
var obj = options && options.plainObjects ?
|
|
30143
|
+
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
|
30075
30144
|
for (var i = 0;i < source.length; ++i) {
|
|
30076
30145
|
if (typeof source[i] !== "undefined") {
|
|
30077
30146
|
obj[i] = source[i];
|
|
@@ -30079,15 +30148,40 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30079
30148
|
}
|
|
30080
30149
|
return obj;
|
|
30081
30150
|
};
|
|
30151
|
+
var setProperty = function setProperty(obj, key, value) {
|
|
30152
|
+
if (key === "__proto__" && defineProperty) {
|
|
30153
|
+
defineProperty(obj, key, {
|
|
30154
|
+
configurable: true,
|
|
30155
|
+
enumerable: true,
|
|
30156
|
+
value,
|
|
30157
|
+
writable: true
|
|
30158
|
+
});
|
|
30159
|
+
} else {
|
|
30160
|
+
obj[key] = value;
|
|
30161
|
+
}
|
|
30162
|
+
};
|
|
30082
30163
|
var merge2 = function merge(target, source, options) {
|
|
30083
30164
|
if (!source) {
|
|
30084
30165
|
return target;
|
|
30085
30166
|
}
|
|
30086
|
-
if (typeof source !== "object") {
|
|
30167
|
+
if (typeof source !== "object" && typeof source !== "function") {
|
|
30087
30168
|
if (isArray(target)) {
|
|
30088
|
-
target.
|
|
30169
|
+
var nextIndex = target.length;
|
|
30170
|
+
if (options && typeof options.arrayLimit === "number" && nextIndex >= options.arrayLimit) {
|
|
30171
|
+
if (options.throwOnLimitExceeded) {
|
|
30172
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30173
|
+
}
|
|
30174
|
+
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
|
30175
|
+
}
|
|
30176
|
+
target[nextIndex] = source;
|
|
30089
30177
|
} else if (target && typeof target === "object") {
|
|
30090
|
-
if (
|
|
30178
|
+
if (isOverflow(target)) {
|
|
30179
|
+
var newIndex = getMaxIndex(target) + 1;
|
|
30180
|
+
target[newIndex] = source;
|
|
30181
|
+
setMaxIndex(target, newIndex);
|
|
30182
|
+
} else if (options && options.strictMerge) {
|
|
30183
|
+
return [target, source];
|
|
30184
|
+
} else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
|
|
30091
30185
|
target[source] = true;
|
|
30092
30186
|
}
|
|
30093
30187
|
} else {
|
|
@@ -30096,7 +30190,23 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30096
30190
|
return target;
|
|
30097
30191
|
}
|
|
30098
30192
|
if (!target || typeof target !== "object") {
|
|
30099
|
-
|
|
30193
|
+
if (isOverflow(source)) {
|
|
30194
|
+
var sourceKeys = Object.keys(source);
|
|
30195
|
+
var result = options && options.plainObjects ? { __proto__: null, 0: target } : { 0: target };
|
|
30196
|
+
for (var m = 0;m < sourceKeys.length; m++) {
|
|
30197
|
+
var oldKey = parseInt(sourceKeys[m], 10);
|
|
30198
|
+
result[oldKey + 1] = source[sourceKeys[m]];
|
|
30199
|
+
}
|
|
30200
|
+
return markOverflow(result, getMaxIndex(source) + 1);
|
|
30201
|
+
}
|
|
30202
|
+
var combined = [target].concat(source);
|
|
30203
|
+
if (options && typeof options.arrayLimit === "number" && combined.length > options.arrayLimit) {
|
|
30204
|
+
if (options.throwOnLimitExceeded) {
|
|
30205
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30206
|
+
}
|
|
30207
|
+
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
|
30208
|
+
}
|
|
30209
|
+
return combined;
|
|
30100
30210
|
}
|
|
30101
30211
|
var mergeTarget = target;
|
|
30102
30212
|
if (isArray(target) && !isArray(source)) {
|
|
@@ -30109,31 +30219,46 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30109
30219
|
if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
|
|
30110
30220
|
target[i] = merge(targetItem, item, options);
|
|
30111
30221
|
} else {
|
|
30112
|
-
target.
|
|
30222
|
+
target[target.length] = item;
|
|
30113
30223
|
}
|
|
30114
30224
|
} else {
|
|
30115
30225
|
target[i] = item;
|
|
30116
30226
|
}
|
|
30117
30227
|
});
|
|
30228
|
+
if (options && typeof options.arrayLimit === "number" && target.length > options.arrayLimit) {
|
|
30229
|
+
if (options.throwOnLimitExceeded) {
|
|
30230
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30231
|
+
}
|
|
30232
|
+
return markOverflow(arrayToObject(target, options), target.length - 1);
|
|
30233
|
+
}
|
|
30118
30234
|
return target;
|
|
30119
30235
|
}
|
|
30120
30236
|
return Object.keys(source).reduce(function(acc, key) {
|
|
30121
30237
|
var value = source[key];
|
|
30122
30238
|
if (has.call(acc, key)) {
|
|
30123
|
-
acc
|
|
30239
|
+
setProperty(acc, key, merge(acc[key], value, options));
|
|
30124
30240
|
} else {
|
|
30125
|
-
acc
|
|
30241
|
+
setProperty(acc, key, value);
|
|
30242
|
+
}
|
|
30243
|
+
if (isOverflow(source) && !isOverflow(acc)) {
|
|
30244
|
+
markOverflow(acc, getMaxIndex(source));
|
|
30245
|
+
}
|
|
30246
|
+
if (isOverflow(acc)) {
|
|
30247
|
+
var keyNum = parseInt(key, 10);
|
|
30248
|
+
if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
|
|
30249
|
+
setMaxIndex(acc, keyNum);
|
|
30250
|
+
}
|
|
30126
30251
|
}
|
|
30127
30252
|
return acc;
|
|
30128
30253
|
}, mergeTarget);
|
|
30129
30254
|
};
|
|
30130
30255
|
var assign = function assignSingleSource(target, source) {
|
|
30131
30256
|
return Object.keys(source).reduce(function(acc, key) {
|
|
30132
|
-
acc
|
|
30257
|
+
setProperty(acc, key, source[key]);
|
|
30133
30258
|
return acc;
|
|
30134
30259
|
}, target);
|
|
30135
30260
|
};
|
|
30136
|
-
var decode2 = function(str,
|
|
30261
|
+
var decode2 = function(str, defaultDecoder, charset) {
|
|
30137
30262
|
var strWithoutPlus = str.replace(/\+/g, " ");
|
|
30138
30263
|
if (charset === "iso-8859-1") {
|
|
30139
30264
|
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
@@ -30163,6 +30288,13 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30163
30288
|
var out = "";
|
|
30164
30289
|
for (var j2 = 0;j2 < string3.length; j2 += limit) {
|
|
30165
30290
|
var segment = string3.length >= limit ? string3.slice(j2, j2 + limit) : string3;
|
|
30291
|
+
if (j2 + limit < string3.length) {
|
|
30292
|
+
var last = segment.charCodeAt(segment.length - 1);
|
|
30293
|
+
if (last >= 55296 && last <= 56319) {
|
|
30294
|
+
segment = segment.slice(0, -1);
|
|
30295
|
+
j2 -= 1;
|
|
30296
|
+
}
|
|
30297
|
+
}
|
|
30166
30298
|
var arr = [];
|
|
30167
30299
|
for (var i = 0;i < segment.length; ++i) {
|
|
30168
30300
|
var c = segment.charCodeAt(i);
|
|
@@ -30192,7 +30324,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30192
30324
|
};
|
|
30193
30325
|
var compact = function compact(value) {
|
|
30194
30326
|
var queue = [{ obj: { o: value }, prop: "o" }];
|
|
30195
|
-
var refs =
|
|
30327
|
+
var refs = getSideChannel();
|
|
30196
30328
|
for (var i = 0;i < queue.length; ++i) {
|
|
30197
30329
|
var item = queue[i];
|
|
30198
30330
|
var obj = item.obj[item.prop];
|
|
@@ -30200,9 +30332,9 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30200
30332
|
for (var j2 = 0;j2 < keys.length; ++j2) {
|
|
30201
30333
|
var key = keys[j2];
|
|
30202
30334
|
var val = obj[key];
|
|
30203
|
-
if (typeof val === "object" && val !== null && refs.
|
|
30204
|
-
queue.
|
|
30205
|
-
refs.
|
|
30335
|
+
if (typeof val === "object" && val !== null && !refs.has(val)) {
|
|
30336
|
+
queue[queue.length] = { obj, prop: key };
|
|
30337
|
+
refs.set(val, true);
|
|
30206
30338
|
}
|
|
30207
30339
|
}
|
|
30208
30340
|
}
|
|
@@ -30218,14 +30350,30 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30218
30350
|
}
|
|
30219
30351
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
30220
30352
|
};
|
|
30221
|
-
var combine = function combine(a, b2) {
|
|
30222
|
-
|
|
30353
|
+
var combine = function combine(a, b2, arrayLimit, plainObjects, throwOnLimitExceeded) {
|
|
30354
|
+
if (isOverflow(a)) {
|
|
30355
|
+
if (throwOnLimitExceeded) {
|
|
30356
|
+
throw new RangeError("Array limit exceeded. Only " + arrayLimit + " element" + (arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30357
|
+
}
|
|
30358
|
+
var newIndex = getMaxIndex(a) + 1;
|
|
30359
|
+
a[newIndex] = b2;
|
|
30360
|
+
setMaxIndex(a, newIndex);
|
|
30361
|
+
return a;
|
|
30362
|
+
}
|
|
30363
|
+
var result = [].concat(a, b2);
|
|
30364
|
+
if (result.length > arrayLimit) {
|
|
30365
|
+
if (throwOnLimitExceeded) {
|
|
30366
|
+
throw new RangeError("Array limit exceeded. Only " + arrayLimit + " element" + (arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30367
|
+
}
|
|
30368
|
+
return markOverflow(arrayToObject(result, { plainObjects }), result.length - 1);
|
|
30369
|
+
}
|
|
30370
|
+
return result;
|
|
30223
30371
|
};
|
|
30224
30372
|
var maybeMap = function maybeMap(val, fn) {
|
|
30225
30373
|
if (isArray(val)) {
|
|
30226
30374
|
var mapped = [];
|
|
30227
30375
|
for (var i = 0;i < val.length; i += 1) {
|
|
30228
|
-
mapped.
|
|
30376
|
+
mapped[mapped.length] = fn(val[i]);
|
|
30229
30377
|
}
|
|
30230
30378
|
return mapped;
|
|
30231
30379
|
}
|
|
@@ -30239,7 +30387,9 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
30239
30387
|
decode: decode2,
|
|
30240
30388
|
encode: encode2,
|
|
30241
30389
|
isBuffer,
|
|
30390
|
+
isOverflow,
|
|
30242
30391
|
isRegExp,
|
|
30392
|
+
markOverflow,
|
|
30243
30393
|
maybeMap,
|
|
30244
30394
|
merge: merge2
|
|
30245
30395
|
};
|
|
@@ -30277,11 +30427,13 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
30277
30427
|
arrayFormat: "indices",
|
|
30278
30428
|
charset: "utf-8",
|
|
30279
30429
|
charsetSentinel: false,
|
|
30430
|
+
commaRoundTrip: false,
|
|
30280
30431
|
delimiter: "&",
|
|
30281
30432
|
encode: true,
|
|
30282
30433
|
encodeDotInKeys: false,
|
|
30283
30434
|
encoder: utils.encode,
|
|
30284
30435
|
encodeValuesOnly: false,
|
|
30436
|
+
filter: undefined,
|
|
30285
30437
|
format: defaultFormat,
|
|
30286
30438
|
formatter: formats.formatters[defaultFormat],
|
|
30287
30439
|
indices: false,
|
|
@@ -30328,7 +30480,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
30328
30480
|
}
|
|
30329
30481
|
if (obj === null) {
|
|
30330
30482
|
if (strictNullHandling) {
|
|
30331
|
-
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
|
|
30483
|
+
return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix);
|
|
30332
30484
|
}
|
|
30333
30485
|
obj = "";
|
|
30334
30486
|
}
|
|
@@ -30346,7 +30498,9 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
30346
30498
|
var objKeys;
|
|
30347
30499
|
if (generateArrayPrefix === "comma" && isArray(obj)) {
|
|
30348
30500
|
if (encodeValuesOnly && encoder) {
|
|
30349
|
-
obj = utils.maybeMap(obj,
|
|
30501
|
+
obj = utils.maybeMap(obj, function(v2) {
|
|
30502
|
+
return v2 == null ? v2 : encoder(v2);
|
|
30503
|
+
});
|
|
30350
30504
|
}
|
|
30351
30505
|
objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : undefined }];
|
|
30352
30506
|
} else if (isArray(filter)) {
|
|
@@ -30355,18 +30509,18 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
30355
30509
|
var keys = Object.keys(obj);
|
|
30356
30510
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
30357
30511
|
}
|
|
30358
|
-
var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, "%2E") : prefix;
|
|
30512
|
+
var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, "%2E") : String(prefix);
|
|
30359
30513
|
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
|
|
30360
30514
|
if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
|
|
30361
30515
|
return adjustedPrefix + "[]";
|
|
30362
30516
|
}
|
|
30363
30517
|
for (var j2 = 0;j2 < objKeys.length; ++j2) {
|
|
30364
30518
|
var key = objKeys[j2];
|
|
30365
|
-
var value = typeof key === "object" && typeof key.value !== "undefined" ? key.value : obj[key];
|
|
30519
|
+
var value = typeof key === "object" && key && typeof key.value !== "undefined" ? key.value : obj[key];
|
|
30366
30520
|
if (skipNulls && value === null) {
|
|
30367
30521
|
continue;
|
|
30368
30522
|
}
|
|
30369
|
-
var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, "%2E") : key;
|
|
30523
|
+
var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, "%2E") : String(key);
|
|
30370
30524
|
var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]");
|
|
30371
30525
|
sideChannel.set(object2, step);
|
|
30372
30526
|
var valueSideChannel = getSideChannel();
|
|
@@ -30423,7 +30577,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
30423
30577
|
arrayFormat,
|
|
30424
30578
|
charset,
|
|
30425
30579
|
charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
30426
|
-
commaRoundTrip: opts.commaRoundTrip,
|
|
30580
|
+
commaRoundTrip: !!opts.commaRoundTrip,
|
|
30427
30581
|
delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
|
|
30428
30582
|
encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
|
|
30429
30583
|
encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
|
|
@@ -30465,18 +30619,22 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
30465
30619
|
var sideChannel = getSideChannel();
|
|
30466
30620
|
for (var i = 0;i < objKeys.length; ++i) {
|
|
30467
30621
|
var key = objKeys[i];
|
|
30468
|
-
if (
|
|
30622
|
+
if (typeof key === "undefined" || key === null) {
|
|
30469
30623
|
continue;
|
|
30470
30624
|
}
|
|
30471
|
-
|
|
30625
|
+
var value = obj[key];
|
|
30626
|
+
if (options.skipNulls && value === null) {
|
|
30627
|
+
continue;
|
|
30628
|
+
}
|
|
30629
|
+
pushToArray(keys, stringify(value, key, generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel));
|
|
30472
30630
|
}
|
|
30473
30631
|
var joined = keys.join(options.delimiter);
|
|
30474
30632
|
var prefix = options.addQueryPrefix === true ? "?" : "";
|
|
30475
30633
|
if (options.charsetSentinel) {
|
|
30476
30634
|
if (options.charset === "iso-8859-1") {
|
|
30477
|
-
prefix += "utf8=%26%2310003%3B
|
|
30635
|
+
prefix += "utf8=%26%2310003%3B" + options.delimiter;
|
|
30478
30636
|
} else {
|
|
30479
|
-
prefix += "utf8=%E2%9C%93
|
|
30637
|
+
prefix += "utf8=%E2%9C%93" + options.delimiter;
|
|
30480
30638
|
}
|
|
30481
30639
|
}
|
|
30482
30640
|
return joined.length > 0 ? prefix + joined : "";
|
|
@@ -30508,17 +30666,33 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
30508
30666
|
parseArrays: true,
|
|
30509
30667
|
plainObjects: false,
|
|
30510
30668
|
strictDepth: false,
|
|
30511
|
-
|
|
30669
|
+
strictMerge: true,
|
|
30670
|
+
strictNullHandling: false,
|
|
30671
|
+
throwOnLimitExceeded: false
|
|
30512
30672
|
};
|
|
30513
30673
|
var interpretNumericEntities = function(str) {
|
|
30514
30674
|
return str.replace(/&#(\d+);/g, function($0, numberStr) {
|
|
30515
30675
|
return String.fromCharCode(parseInt(numberStr, 10));
|
|
30516
30676
|
});
|
|
30517
30677
|
};
|
|
30518
|
-
var parseArrayValue = function(val, options) {
|
|
30678
|
+
var parseArrayValue = function(val, options, currentArrayLength, isFlatArrayValue) {
|
|
30519
30679
|
if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) {
|
|
30680
|
+
if (isFlatArrayValue && options.throwOnLimitExceeded) {
|
|
30681
|
+
var commaCount = 0;
|
|
30682
|
+
var commaIndex = val.indexOf(",");
|
|
30683
|
+
while (commaIndex > -1) {
|
|
30684
|
+
commaCount += 1;
|
|
30685
|
+
if (commaCount >= options.arrayLimit) {
|
|
30686
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30687
|
+
}
|
|
30688
|
+
commaIndex = val.indexOf(",", commaIndex + 1);
|
|
30689
|
+
}
|
|
30690
|
+
}
|
|
30520
30691
|
return val.split(",");
|
|
30521
30692
|
}
|
|
30693
|
+
if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
|
|
30694
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30695
|
+
}
|
|
30522
30696
|
return val;
|
|
30523
30697
|
};
|
|
30524
30698
|
var isoSentinel = "utf8=%26%2310003%3B";
|
|
@@ -30528,7 +30702,10 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
30528
30702
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
|
|
30529
30703
|
cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
30530
30704
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
30531
|
-
var parts = cleanStr.split(options.delimiter, limit);
|
|
30705
|
+
var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded && typeof limit !== "undefined" ? limit + 1 : limit);
|
|
30706
|
+
if (options.throwOnLimitExceeded && typeof limit !== "undefined" && parts.length > limit) {
|
|
30707
|
+
throw new RangeError("Parameter limit exceeded. Only " + limit + " parameter" + (limit === 1 ? "" : "s") + " allowed.");
|
|
30708
|
+
}
|
|
30532
30709
|
var skipIndex = -1;
|
|
30533
30710
|
var i;
|
|
30534
30711
|
var charset = options.charset;
|
|
@@ -30552,48 +30729,71 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
30552
30729
|
var part = parts[i];
|
|
30553
30730
|
var bracketEqualsPos = part.indexOf("]=");
|
|
30554
30731
|
var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1;
|
|
30555
|
-
var key
|
|
30732
|
+
var key;
|
|
30733
|
+
var val;
|
|
30556
30734
|
if (pos === -1) {
|
|
30557
30735
|
key = options.decoder(part, defaults.decoder, charset, "key");
|
|
30558
30736
|
val = options.strictNullHandling ? null : "";
|
|
30559
30737
|
} else {
|
|
30560
30738
|
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key");
|
|
30561
|
-
|
|
30562
|
-
|
|
30563
|
-
|
|
30739
|
+
if (key !== null) {
|
|
30740
|
+
val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0, part.indexOf("[]=") === -1), function(encodedVal) {
|
|
30741
|
+
return options.decoder(encodedVal, defaults.decoder, charset, "value");
|
|
30742
|
+
});
|
|
30743
|
+
}
|
|
30564
30744
|
}
|
|
30565
30745
|
if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
|
|
30566
|
-
val = interpretNumericEntities(val);
|
|
30746
|
+
val = interpretNumericEntities(String(val));
|
|
30567
30747
|
}
|
|
30568
30748
|
if (part.indexOf("[]=") > -1) {
|
|
30569
30749
|
val = isArray(val) ? [val] : val;
|
|
30570
30750
|
}
|
|
30571
|
-
|
|
30572
|
-
|
|
30573
|
-
|
|
30574
|
-
|
|
30575
|
-
|
|
30751
|
+
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
30752
|
+
val = utils.combine([], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
|
|
30753
|
+
}
|
|
30754
|
+
if (key !== null) {
|
|
30755
|
+
var existing = has.call(obj, key);
|
|
30756
|
+
if (existing && (options.duplicates === "combine" || part.indexOf("[]=") > -1)) {
|
|
30757
|
+
obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
|
|
30758
|
+
} else if (!existing || options.duplicates === "last") {
|
|
30759
|
+
obj[key] = val;
|
|
30760
|
+
}
|
|
30576
30761
|
}
|
|
30577
30762
|
}
|
|
30578
30763
|
return obj;
|
|
30579
30764
|
};
|
|
30580
30765
|
var parseObject = function(chain, val, options, valuesParsed) {
|
|
30581
|
-
var
|
|
30766
|
+
var currentArrayLength = 0;
|
|
30767
|
+
if (chain.length > 0 && chain[chain.length - 1] === "[]") {
|
|
30768
|
+
var parentKey = chain.slice(0, -1).join("");
|
|
30769
|
+
currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
|
|
30770
|
+
}
|
|
30771
|
+
var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
|
|
30582
30772
|
for (var i = chain.length - 1;i >= 0; --i) {
|
|
30583
30773
|
var obj;
|
|
30584
30774
|
var root = chain[i];
|
|
30585
30775
|
if (root === "[]" && options.parseArrays) {
|
|
30586
|
-
|
|
30776
|
+
if (utils.isOverflow(leaf)) {
|
|
30777
|
+
obj = leaf;
|
|
30778
|
+
} else {
|
|
30779
|
+
obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : utils.combine([], leaf, options.arrayLimit, options.plainObjects, options.throwOnLimitExceeded);
|
|
30780
|
+
}
|
|
30587
30781
|
} else {
|
|
30588
|
-
obj = options.plainObjects ?
|
|
30782
|
+
obj = options.plainObjects ? { __proto__: null } : {};
|
|
30589
30783
|
var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
|
|
30590
30784
|
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
|
|
30591
30785
|
var index = parseInt(decodedRoot, 10);
|
|
30786
|
+
var isValidArrayIndex = !isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && options.parseArrays;
|
|
30592
30787
|
if (!options.parseArrays && decodedRoot === "") {
|
|
30593
30788
|
obj = { 0: leaf };
|
|
30594
|
-
} else if (
|
|
30789
|
+
} else if (isValidArrayIndex && index < options.arrayLimit) {
|
|
30595
30790
|
obj = [];
|
|
30596
30791
|
obj[index] = leaf;
|
|
30792
|
+
} else if (isValidArrayIndex && options.throwOnLimitExceeded) {
|
|
30793
|
+
throw new RangeError("Array limit exceeded. Only " + options.arrayLimit + " element" + (options.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
|
|
30794
|
+
} else if (isValidArrayIndex) {
|
|
30795
|
+
obj[index] = leaf;
|
|
30796
|
+
utils.markOverflow(obj, index);
|
|
30597
30797
|
} else if (decodedRoot !== "__proto__") {
|
|
30598
30798
|
obj[decodedRoot] = leaf;
|
|
30599
30799
|
}
|
|
@@ -30602,39 +30802,74 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
30602
30802
|
}
|
|
30603
30803
|
return leaf;
|
|
30604
30804
|
};
|
|
30605
|
-
var
|
|
30606
|
-
|
|
30607
|
-
|
|
30805
|
+
var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
|
|
30806
|
+
var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, "[$1]") : originalKey;
|
|
30807
|
+
if (options.depth <= 0) {
|
|
30808
|
+
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
30809
|
+
if (!options.allowPrototypes) {
|
|
30810
|
+
return;
|
|
30811
|
+
}
|
|
30812
|
+
}
|
|
30813
|
+
return [key];
|
|
30608
30814
|
}
|
|
30609
|
-
var
|
|
30610
|
-
var
|
|
30611
|
-
var
|
|
30612
|
-
var segment = options.depth > 0 && brackets.exec(key);
|
|
30613
|
-
var parent = segment ? key.slice(0, segment.index) : key;
|
|
30614
|
-
var keys = [];
|
|
30815
|
+
var segments = [];
|
|
30816
|
+
var first = key.indexOf("[");
|
|
30817
|
+
var parent = first >= 0 ? key.slice(0, first) : key;
|
|
30615
30818
|
if (parent) {
|
|
30616
30819
|
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
30617
30820
|
if (!options.allowPrototypes) {
|
|
30618
30821
|
return;
|
|
30619
30822
|
}
|
|
30620
30823
|
}
|
|
30621
|
-
|
|
30824
|
+
segments[segments.length] = parent;
|
|
30622
30825
|
}
|
|
30623
|
-
var
|
|
30624
|
-
|
|
30625
|
-
|
|
30626
|
-
|
|
30627
|
-
|
|
30628
|
-
|
|
30826
|
+
var n = key.length;
|
|
30827
|
+
var open = first;
|
|
30828
|
+
var collected = 0;
|
|
30829
|
+
while (open >= 0 && collected < options.depth) {
|
|
30830
|
+
var level = 1;
|
|
30831
|
+
var i = open + 1;
|
|
30832
|
+
var close = -1;
|
|
30833
|
+
while (i < n && close < 0) {
|
|
30834
|
+
var cu = key.charCodeAt(i);
|
|
30835
|
+
if (cu === 91) {
|
|
30836
|
+
level += 1;
|
|
30837
|
+
} else if (cu === 93) {
|
|
30838
|
+
level -= 1;
|
|
30839
|
+
if (level === 0) {
|
|
30840
|
+
close = i;
|
|
30841
|
+
}
|
|
30629
30842
|
}
|
|
30843
|
+
i += 1;
|
|
30844
|
+
}
|
|
30845
|
+
if (close < 0) {
|
|
30846
|
+
segments[segments.length] = "[" + key.slice(open) + "]";
|
|
30847
|
+
return segments;
|
|
30848
|
+
}
|
|
30849
|
+
var seg = key.slice(open, close + 1);
|
|
30850
|
+
var content = seg.slice(1, -1);
|
|
30851
|
+
if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
|
|
30852
|
+
return;
|
|
30630
30853
|
}
|
|
30631
|
-
|
|
30854
|
+
segments[segments.length] = seg;
|
|
30855
|
+
collected += 1;
|
|
30856
|
+
open = key.indexOf("[", close + 1);
|
|
30632
30857
|
}
|
|
30633
|
-
if (
|
|
30858
|
+
if (open >= 0) {
|
|
30634
30859
|
if (options.strictDepth === true) {
|
|
30635
30860
|
throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
|
|
30636
30861
|
}
|
|
30637
|
-
|
|
30862
|
+
segments[segments.length] = "[" + key.slice(open) + "]";
|
|
30863
|
+
}
|
|
30864
|
+
return segments;
|
|
30865
|
+
};
|
|
30866
|
+
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
30867
|
+
if (!givenKey) {
|
|
30868
|
+
return;
|
|
30869
|
+
}
|
|
30870
|
+
var keys = splitKeyIntoSegments(givenKey, options);
|
|
30871
|
+
if (!keys) {
|
|
30872
|
+
return;
|
|
30638
30873
|
}
|
|
30639
30874
|
return parseObject(keys, val, options, valuesParsed);
|
|
30640
30875
|
};
|
|
@@ -30654,6 +30889,9 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
30654
30889
|
if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
|
|
30655
30890
|
throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
|
|
30656
30891
|
}
|
|
30892
|
+
if (typeof opts.throwOnLimitExceeded !== "undefined" && typeof opts.throwOnLimitExceeded !== "boolean") {
|
|
30893
|
+
throw new TypeError("`throwOnLimitExceeded` option must be a boolean");
|
|
30894
|
+
}
|
|
30657
30895
|
var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
|
|
30658
30896
|
var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
|
|
30659
30897
|
if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") {
|
|
@@ -30680,16 +30918,18 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
30680
30918
|
parseArrays: opts.parseArrays !== false,
|
|
30681
30919
|
plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
|
|
30682
30920
|
strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
|
|
30683
|
-
|
|
30921
|
+
strictMerge: typeof opts.strictMerge === "boolean" ? !!opts.strictMerge : defaults.strictMerge,
|
|
30922
|
+
strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
30923
|
+
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === "boolean" ? opts.throwOnLimitExceeded : false
|
|
30684
30924
|
};
|
|
30685
30925
|
};
|
|
30686
30926
|
module.exports = function(str, opts) {
|
|
30687
30927
|
var options = normalizeParseOptions(opts);
|
|
30688
30928
|
if (str === "" || str === null || typeof str === "undefined") {
|
|
30689
|
-
return options.plainObjects ?
|
|
30929
|
+
return options.plainObjects ? { __proto__: null } : {};
|
|
30690
30930
|
}
|
|
30691
30931
|
var tempObj = typeof str === "string" ? parseValues(str, options) : str;
|
|
30692
|
-
var obj = options.plainObjects ?
|
|
30932
|
+
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
30693
30933
|
var keys = Object.keys(tempObj);
|
|
30694
30934
|
for (var i = 0;i < keys.length; ++i) {
|
|
30695
30935
|
var key = keys[i];
|
|
@@ -30739,10 +30979,12 @@ var require_urlencoded = __commonJS((exports, module) => {
|
|
|
30739
30979
|
}
|
|
30740
30980
|
var extended = opts.extended !== false;
|
|
30741
30981
|
var inflate = opts.inflate !== false;
|
|
30742
|
-
var limit = typeof opts.limit
|
|
30982
|
+
var limit = typeof opts.limit === "undefined" || opts.limit === null ? 102400 : bytes.parse(opts.limit);
|
|
30743
30983
|
var type = opts.type || "application/x-www-form-urlencoded";
|
|
30744
30984
|
var verify = opts.verify || false;
|
|
30745
|
-
|
|
30985
|
+
if (limit === null) {
|
|
30986
|
+
throw new TypeError('option limit "' + String(opts.limit) + '" is invalid');
|
|
30987
|
+
}
|
|
30746
30988
|
if (verify !== false && typeof verify !== "function") {
|
|
30747
30989
|
throw new TypeError("option verify must be function");
|
|
30748
30990
|
}
|
|
@@ -30783,14 +31025,13 @@ var require_urlencoded = __commonJS((exports, module) => {
|
|
|
30783
31025
|
encoding: charset,
|
|
30784
31026
|
inflate,
|
|
30785
31027
|
limit,
|
|
30786
|
-
verify
|
|
30787
|
-
depth
|
|
31028
|
+
verify
|
|
30788
31029
|
});
|
|
30789
31030
|
};
|
|
30790
31031
|
}
|
|
30791
31032
|
function extendedparser(options) {
|
|
30792
31033
|
var parameterLimit = options.parameterLimit !== undefined ? options.parameterLimit : 1000;
|
|
30793
|
-
var depth =
|
|
31034
|
+
var depth = options.depth !== undefined ? options.depth : 32;
|
|
30794
31035
|
var parse5 = parser("qs");
|
|
30795
31036
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
|
30796
31037
|
throw new TypeError("option parameterLimit must be a positive number");
|
|
@@ -30839,14 +31080,14 @@ var require_urlencoded = __commonJS((exports, module) => {
|
|
|
30839
31080
|
}
|
|
30840
31081
|
function parameterCount(body, limit) {
|
|
30841
31082
|
var count = 0;
|
|
30842
|
-
var index =
|
|
30843
|
-
|
|
31083
|
+
var index = -1;
|
|
31084
|
+
do {
|
|
30844
31085
|
count++;
|
|
30845
|
-
|
|
30846
|
-
if (count === limit) {
|
|
31086
|
+
if (count > limit) {
|
|
30847
31087
|
return;
|
|
30848
31088
|
}
|
|
30849
|
-
|
|
31089
|
+
index = body.indexOf("&", index + 1);
|
|
31090
|
+
} while (index !== -1);
|
|
30850
31091
|
return count;
|
|
30851
31092
|
}
|
|
30852
31093
|
function parser(name) {
|
|
@@ -31565,6 +31806,149 @@ var require_parseurl = __commonJS((exports, module) => {
|
|
|
31565
31806
|
}
|
|
31566
31807
|
});
|
|
31567
31808
|
|
|
31809
|
+
// node_modules/statuses/codes.json
|
|
31810
|
+
var require_codes3 = __commonJS((exports, module) => {
|
|
31811
|
+
module.exports = {
|
|
31812
|
+
"100": "Continue",
|
|
31813
|
+
"101": "Switching Protocols",
|
|
31814
|
+
"102": "Processing",
|
|
31815
|
+
"103": "Early Hints",
|
|
31816
|
+
"200": "OK",
|
|
31817
|
+
"201": "Created",
|
|
31818
|
+
"202": "Accepted",
|
|
31819
|
+
"203": "Non-Authoritative Information",
|
|
31820
|
+
"204": "No Content",
|
|
31821
|
+
"205": "Reset Content",
|
|
31822
|
+
"206": "Partial Content",
|
|
31823
|
+
"207": "Multi-Status",
|
|
31824
|
+
"208": "Already Reported",
|
|
31825
|
+
"226": "IM Used",
|
|
31826
|
+
"300": "Multiple Choices",
|
|
31827
|
+
"301": "Moved Permanently",
|
|
31828
|
+
"302": "Found",
|
|
31829
|
+
"303": "See Other",
|
|
31830
|
+
"304": "Not Modified",
|
|
31831
|
+
"305": "Use Proxy",
|
|
31832
|
+
"307": "Temporary Redirect",
|
|
31833
|
+
"308": "Permanent Redirect",
|
|
31834
|
+
"400": "Bad Request",
|
|
31835
|
+
"401": "Unauthorized",
|
|
31836
|
+
"402": "Payment Required",
|
|
31837
|
+
"403": "Forbidden",
|
|
31838
|
+
"404": "Not Found",
|
|
31839
|
+
"405": "Method Not Allowed",
|
|
31840
|
+
"406": "Not Acceptable",
|
|
31841
|
+
"407": "Proxy Authentication Required",
|
|
31842
|
+
"408": "Request Timeout",
|
|
31843
|
+
"409": "Conflict",
|
|
31844
|
+
"410": "Gone",
|
|
31845
|
+
"411": "Length Required",
|
|
31846
|
+
"412": "Precondition Failed",
|
|
31847
|
+
"413": "Payload Too Large",
|
|
31848
|
+
"414": "URI Too Long",
|
|
31849
|
+
"415": "Unsupported Media Type",
|
|
31850
|
+
"416": "Range Not Satisfiable",
|
|
31851
|
+
"417": "Expectation Failed",
|
|
31852
|
+
"418": "I'm a Teapot",
|
|
31853
|
+
"421": "Misdirected Request",
|
|
31854
|
+
"422": "Unprocessable Entity",
|
|
31855
|
+
"423": "Locked",
|
|
31856
|
+
"424": "Failed Dependency",
|
|
31857
|
+
"425": "Too Early",
|
|
31858
|
+
"426": "Upgrade Required",
|
|
31859
|
+
"428": "Precondition Required",
|
|
31860
|
+
"429": "Too Many Requests",
|
|
31861
|
+
"431": "Request Header Fields Too Large",
|
|
31862
|
+
"451": "Unavailable For Legal Reasons",
|
|
31863
|
+
"500": "Internal Server Error",
|
|
31864
|
+
"501": "Not Implemented",
|
|
31865
|
+
"502": "Bad Gateway",
|
|
31866
|
+
"503": "Service Unavailable",
|
|
31867
|
+
"504": "Gateway Timeout",
|
|
31868
|
+
"505": "HTTP Version Not Supported",
|
|
31869
|
+
"506": "Variant Also Negotiates",
|
|
31870
|
+
"507": "Insufficient Storage",
|
|
31871
|
+
"508": "Loop Detected",
|
|
31872
|
+
"509": "Bandwidth Limit Exceeded",
|
|
31873
|
+
"510": "Not Extended",
|
|
31874
|
+
"511": "Network Authentication Required"
|
|
31875
|
+
};
|
|
31876
|
+
});
|
|
31877
|
+
|
|
31878
|
+
// node_modules/statuses/index.js
|
|
31879
|
+
var require_statuses3 = __commonJS((exports, module) => {
|
|
31880
|
+
/*!
|
|
31881
|
+
* statuses
|
|
31882
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
31883
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
31884
|
+
* MIT Licensed
|
|
31885
|
+
*/
|
|
31886
|
+
var codes = require_codes3();
|
|
31887
|
+
module.exports = status;
|
|
31888
|
+
status.message = codes;
|
|
31889
|
+
status.code = createMessageToStatusCodeMap(codes);
|
|
31890
|
+
status.codes = createStatusCodeList(codes);
|
|
31891
|
+
status.redirect = {
|
|
31892
|
+
300: true,
|
|
31893
|
+
301: true,
|
|
31894
|
+
302: true,
|
|
31895
|
+
303: true,
|
|
31896
|
+
305: true,
|
|
31897
|
+
307: true,
|
|
31898
|
+
308: true
|
|
31899
|
+
};
|
|
31900
|
+
status.empty = {
|
|
31901
|
+
204: true,
|
|
31902
|
+
205: true,
|
|
31903
|
+
304: true
|
|
31904
|
+
};
|
|
31905
|
+
status.retry = {
|
|
31906
|
+
502: true,
|
|
31907
|
+
503: true,
|
|
31908
|
+
504: true
|
|
31909
|
+
};
|
|
31910
|
+
function createMessageToStatusCodeMap(codes2) {
|
|
31911
|
+
var map = {};
|
|
31912
|
+
Object.keys(codes2).forEach(function forEachCode(code) {
|
|
31913
|
+
var message = codes2[code];
|
|
31914
|
+
var status2 = Number(code);
|
|
31915
|
+
map[message.toLowerCase()] = status2;
|
|
31916
|
+
});
|
|
31917
|
+
return map;
|
|
31918
|
+
}
|
|
31919
|
+
function createStatusCodeList(codes2) {
|
|
31920
|
+
return Object.keys(codes2).map(function mapCode(code) {
|
|
31921
|
+
return Number(code);
|
|
31922
|
+
});
|
|
31923
|
+
}
|
|
31924
|
+
function getStatusCode(message) {
|
|
31925
|
+
var msg = message.toLowerCase();
|
|
31926
|
+
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
|
31927
|
+
throw new Error('invalid status message: "' + message + '"');
|
|
31928
|
+
}
|
|
31929
|
+
return status.code[msg];
|
|
31930
|
+
}
|
|
31931
|
+
function getStatusMessage(code) {
|
|
31932
|
+
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
|
31933
|
+
throw new Error("invalid status code: " + code);
|
|
31934
|
+
}
|
|
31935
|
+
return status.message[code];
|
|
31936
|
+
}
|
|
31937
|
+
function status(code) {
|
|
31938
|
+
if (typeof code === "number") {
|
|
31939
|
+
return getStatusMessage(code);
|
|
31940
|
+
}
|
|
31941
|
+
if (typeof code !== "string") {
|
|
31942
|
+
throw new TypeError("code must be a number or string");
|
|
31943
|
+
}
|
|
31944
|
+
var n = parseInt(code, 10);
|
|
31945
|
+
if (!isNaN(n)) {
|
|
31946
|
+
return getStatusMessage(n);
|
|
31947
|
+
}
|
|
31948
|
+
return getStatusCode(code);
|
|
31949
|
+
}
|
|
31950
|
+
});
|
|
31951
|
+
|
|
31568
31952
|
// node_modules/finalhandler/index.js
|
|
31569
31953
|
var require_finalhandler = __commonJS((exports, module) => {
|
|
31570
31954
|
/*!
|
|
@@ -31577,7 +31961,7 @@ var require_finalhandler = __commonJS((exports, module) => {
|
|
|
31577
31961
|
var escapeHtml = require_escape_html();
|
|
31578
31962
|
var onFinished = require_on_finished();
|
|
31579
31963
|
var parseUrl = require_parseurl();
|
|
31580
|
-
var statuses =
|
|
31964
|
+
var statuses = require_statuses3();
|
|
31581
31965
|
var unpipe = require_unpipe();
|
|
31582
31966
|
var DOUBLE_SPACE_REGEXP = /\x20{2}/g;
|
|
31583
31967
|
var NEWLINE_REGEXP = /\n/g;
|
|
@@ -32234,6 +32618,7 @@ var require_path_to_regexp = __commonJS((exports, module) => {
|
|
|
32234
32618
|
}
|
|
32235
32619
|
pos = offset + match.length;
|
|
32236
32620
|
if (match === "*") {
|
|
32621
|
+
backtrack = "";
|
|
32237
32622
|
extraOffset += 3;
|
|
32238
32623
|
return "(.*)";
|
|
32239
32624
|
}
|
|
@@ -32254,6 +32639,7 @@ var require_path_to_regexp = __commonJS((exports, module) => {
|
|
|
32254
32639
|
offset: offset + extraOffset
|
|
32255
32640
|
});
|
|
32256
32641
|
var result = "(?:" + format + slash + capture + (star ? "((?:[/" + format + "].+?)?)" : "") + ")" + optional2;
|
|
32642
|
+
backtrack = "";
|
|
32257
32643
|
extraOffset += result.length - match.length;
|
|
32258
32644
|
return result;
|
|
32259
32645
|
});
|
|
@@ -33306,6 +33692,173 @@ var require_content_disposition = __commonJS((exports, module) => {
|
|
|
33306
33692
|
}
|
|
33307
33693
|
});
|
|
33308
33694
|
|
|
33695
|
+
// node_modules/http-errors/index.js
|
|
33696
|
+
var require_http_errors3 = __commonJS((exports, module) => {
|
|
33697
|
+
/*!
|
|
33698
|
+
* http-errors
|
|
33699
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
33700
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
33701
|
+
* MIT Licensed
|
|
33702
|
+
*/
|
|
33703
|
+
var deprecate = require_depd()("http-errors");
|
|
33704
|
+
var setPrototypeOf = require_setprototypeof();
|
|
33705
|
+
var statuses = require_statuses3();
|
|
33706
|
+
var inherits = require_inherits();
|
|
33707
|
+
var toIdentifier = require_toidentifier();
|
|
33708
|
+
module.exports = createError;
|
|
33709
|
+
module.exports.HttpError = createHttpErrorConstructor();
|
|
33710
|
+
module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError);
|
|
33711
|
+
populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError);
|
|
33712
|
+
function codeClass(status) {
|
|
33713
|
+
return Number(String(status).charAt(0) + "00");
|
|
33714
|
+
}
|
|
33715
|
+
function createError() {
|
|
33716
|
+
var err;
|
|
33717
|
+
var msg;
|
|
33718
|
+
var status = 500;
|
|
33719
|
+
var props = {};
|
|
33720
|
+
for (var i = 0;i < arguments.length; i++) {
|
|
33721
|
+
var arg = arguments[i];
|
|
33722
|
+
var type = typeof arg;
|
|
33723
|
+
if (type === "object" && arg instanceof Error) {
|
|
33724
|
+
err = arg;
|
|
33725
|
+
status = err.status || err.statusCode || status;
|
|
33726
|
+
} else if (type === "number" && i === 0) {
|
|
33727
|
+
status = arg;
|
|
33728
|
+
} else if (type === "string") {
|
|
33729
|
+
msg = arg;
|
|
33730
|
+
} else if (type === "object") {
|
|
33731
|
+
props = arg;
|
|
33732
|
+
} else {
|
|
33733
|
+
throw new TypeError("argument #" + (i + 1) + " unsupported type " + type);
|
|
33734
|
+
}
|
|
33735
|
+
}
|
|
33736
|
+
if (typeof status === "number" && (status < 400 || status >= 600)) {
|
|
33737
|
+
deprecate("non-error status code; use only 4xx or 5xx status codes");
|
|
33738
|
+
}
|
|
33739
|
+
if (typeof status !== "number" || !statuses.message[status] && (status < 400 || status >= 600)) {
|
|
33740
|
+
status = 500;
|
|
33741
|
+
}
|
|
33742
|
+
var HttpError = createError[status] || createError[codeClass(status)];
|
|
33743
|
+
if (!err) {
|
|
33744
|
+
err = HttpError ? new HttpError(msg) : new Error(msg || statuses.message[status]);
|
|
33745
|
+
Error.captureStackTrace(err, createError);
|
|
33746
|
+
}
|
|
33747
|
+
if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
|
|
33748
|
+
err.expose = status < 500;
|
|
33749
|
+
err.status = err.statusCode = status;
|
|
33750
|
+
}
|
|
33751
|
+
for (var key in props) {
|
|
33752
|
+
if (key !== "status" && key !== "statusCode") {
|
|
33753
|
+
err[key] = props[key];
|
|
33754
|
+
}
|
|
33755
|
+
}
|
|
33756
|
+
return err;
|
|
33757
|
+
}
|
|
33758
|
+
function createHttpErrorConstructor() {
|
|
33759
|
+
function HttpError() {
|
|
33760
|
+
throw new TypeError("cannot construct abstract class");
|
|
33761
|
+
}
|
|
33762
|
+
inherits(HttpError, Error);
|
|
33763
|
+
return HttpError;
|
|
33764
|
+
}
|
|
33765
|
+
function createClientErrorConstructor(HttpError, name, code) {
|
|
33766
|
+
var className = toClassName(name);
|
|
33767
|
+
function ClientError(message) {
|
|
33768
|
+
var msg = message != null ? message : statuses.message[code];
|
|
33769
|
+
var err = new Error(msg);
|
|
33770
|
+
Error.captureStackTrace(err, ClientError);
|
|
33771
|
+
setPrototypeOf(err, ClientError.prototype);
|
|
33772
|
+
Object.defineProperty(err, "message", {
|
|
33773
|
+
enumerable: true,
|
|
33774
|
+
configurable: true,
|
|
33775
|
+
value: msg,
|
|
33776
|
+
writable: true
|
|
33777
|
+
});
|
|
33778
|
+
Object.defineProperty(err, "name", {
|
|
33779
|
+
enumerable: false,
|
|
33780
|
+
configurable: true,
|
|
33781
|
+
value: className,
|
|
33782
|
+
writable: true
|
|
33783
|
+
});
|
|
33784
|
+
return err;
|
|
33785
|
+
}
|
|
33786
|
+
inherits(ClientError, HttpError);
|
|
33787
|
+
nameFunc(ClientError, className);
|
|
33788
|
+
ClientError.prototype.status = code;
|
|
33789
|
+
ClientError.prototype.statusCode = code;
|
|
33790
|
+
ClientError.prototype.expose = true;
|
|
33791
|
+
return ClientError;
|
|
33792
|
+
}
|
|
33793
|
+
function createIsHttpErrorFunction(HttpError) {
|
|
33794
|
+
return function isHttpError(val) {
|
|
33795
|
+
if (!val || typeof val !== "object") {
|
|
33796
|
+
return false;
|
|
33797
|
+
}
|
|
33798
|
+
if (val instanceof HttpError) {
|
|
33799
|
+
return true;
|
|
33800
|
+
}
|
|
33801
|
+
return val instanceof Error && typeof val.expose === "boolean" && typeof val.statusCode === "number" && val.status === val.statusCode;
|
|
33802
|
+
};
|
|
33803
|
+
}
|
|
33804
|
+
function createServerErrorConstructor(HttpError, name, code) {
|
|
33805
|
+
var className = toClassName(name);
|
|
33806
|
+
function ServerError(message) {
|
|
33807
|
+
var msg = message != null ? message : statuses.message[code];
|
|
33808
|
+
var err = new Error(msg);
|
|
33809
|
+
Error.captureStackTrace(err, ServerError);
|
|
33810
|
+
setPrototypeOf(err, ServerError.prototype);
|
|
33811
|
+
Object.defineProperty(err, "message", {
|
|
33812
|
+
enumerable: true,
|
|
33813
|
+
configurable: true,
|
|
33814
|
+
value: msg,
|
|
33815
|
+
writable: true
|
|
33816
|
+
});
|
|
33817
|
+
Object.defineProperty(err, "name", {
|
|
33818
|
+
enumerable: false,
|
|
33819
|
+
configurable: true,
|
|
33820
|
+
value: className,
|
|
33821
|
+
writable: true
|
|
33822
|
+
});
|
|
33823
|
+
return err;
|
|
33824
|
+
}
|
|
33825
|
+
inherits(ServerError, HttpError);
|
|
33826
|
+
nameFunc(ServerError, className);
|
|
33827
|
+
ServerError.prototype.status = code;
|
|
33828
|
+
ServerError.prototype.statusCode = code;
|
|
33829
|
+
ServerError.prototype.expose = false;
|
|
33830
|
+
return ServerError;
|
|
33831
|
+
}
|
|
33832
|
+
function nameFunc(func, name) {
|
|
33833
|
+
var desc = Object.getOwnPropertyDescriptor(func, "name");
|
|
33834
|
+
if (desc && desc.configurable) {
|
|
33835
|
+
desc.value = name;
|
|
33836
|
+
Object.defineProperty(func, "name", desc);
|
|
33837
|
+
}
|
|
33838
|
+
}
|
|
33839
|
+
function populateConstructorExports(exports2, codes, HttpError) {
|
|
33840
|
+
codes.forEach(function forEachCode(code) {
|
|
33841
|
+
var CodeError;
|
|
33842
|
+
var name = toIdentifier(statuses.message[code]);
|
|
33843
|
+
switch (codeClass(code)) {
|
|
33844
|
+
case 400:
|
|
33845
|
+
CodeError = createClientErrorConstructor(HttpError, name, code);
|
|
33846
|
+
break;
|
|
33847
|
+
case 500:
|
|
33848
|
+
CodeError = createServerErrorConstructor(HttpError, name, code);
|
|
33849
|
+
break;
|
|
33850
|
+
}
|
|
33851
|
+
if (CodeError) {
|
|
33852
|
+
exports2[code] = CodeError;
|
|
33853
|
+
exports2[name] = CodeError;
|
|
33854
|
+
}
|
|
33855
|
+
});
|
|
33856
|
+
}
|
|
33857
|
+
function toClassName(name) {
|
|
33858
|
+
return name.substr(-5) !== "Error" ? name + "Error" : name;
|
|
33859
|
+
}
|
|
33860
|
+
});
|
|
33861
|
+
|
|
33309
33862
|
// node_modules/send/node_modules/debug/node_modules/ms/index.js
|
|
33310
33863
|
var require_ms4 = __commonJS((exports, module) => {
|
|
33311
33864
|
var s = 1000;
|
|
@@ -34117,7 +34670,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
34117
34670
|
* Copyright(c) 2014-2022 Douglas Christopher Wilson
|
|
34118
34671
|
* MIT Licensed
|
|
34119
34672
|
*/
|
|
34120
|
-
var createError =
|
|
34673
|
+
var createError = require_http_errors3();
|
|
34121
34674
|
var debug = require_src4()("send");
|
|
34122
34675
|
var deprecate = require_depd()("send");
|
|
34123
34676
|
var destroy = require_destroy();
|
|
@@ -34131,7 +34684,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
34131
34684
|
var onFinished = require_on_finished();
|
|
34132
34685
|
var parseRange = require_range_parser();
|
|
34133
34686
|
var path = __require("path");
|
|
34134
|
-
var statuses =
|
|
34687
|
+
var statuses = require_statuses3();
|
|
34135
34688
|
var Stream = __require("stream");
|
|
34136
34689
|
var util3 = __require("util");
|
|
34137
34690
|
var extname = path.extname;
|
|
@@ -35633,7 +36186,8 @@ var require_utils2 = __commonJS((exports) => {
|
|
|
35633
36186
|
}
|
|
35634
36187
|
function parseExtendedQueryString(str) {
|
|
35635
36188
|
return qs.parse(str, {
|
|
35636
|
-
allowPrototypes: true
|
|
36189
|
+
allowPrototypes: true,
|
|
36190
|
+
arrayLimit: 1000
|
|
35637
36191
|
});
|
|
35638
36192
|
}
|
|
35639
36193
|
function newObject() {
|
|
@@ -36950,7 +37504,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
36950
37504
|
*/
|
|
36951
37505
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
36952
37506
|
var contentDisposition = require_content_disposition();
|
|
36953
|
-
var createError =
|
|
37507
|
+
var createError = require_http_errors3();
|
|
36954
37508
|
var deprecate = require_depd()("express");
|
|
36955
37509
|
var encodeUrl = require_encodeurl();
|
|
36956
37510
|
var escapeHtml = require_escape_html();
|
|
@@ -36958,7 +37512,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
36958
37512
|
var isAbsolute = require_utils2().isAbsolute;
|
|
36959
37513
|
var onFinished = require_on_finished();
|
|
36960
37514
|
var path = __require("path");
|
|
36961
|
-
var statuses =
|
|
37515
|
+
var statuses = require_statuses3();
|
|
36962
37516
|
var merge2 = require_utils_merge();
|
|
36963
37517
|
var sign = require_cookie_signature().sign;
|
|
36964
37518
|
var normalizeType = require_utils2().normalizeType;
|
|
@@ -43224,6 +43778,9 @@ var require_data = __commonJS((exports, module) => {
|
|
|
43224
43778
|
var require_utils3 = __commonJS((exports, module) => {
|
|
43225
43779
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
43226
43780
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
43781
|
+
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
43782
|
+
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
43783
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
|
|
43227
43784
|
function stringArrayToHexStripped(input) {
|
|
43228
43785
|
let acc = "";
|
|
43229
43786
|
let code = 0;
|
|
@@ -43417,27 +43974,77 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
43417
43974
|
}
|
|
43418
43975
|
return output.join("");
|
|
43419
43976
|
}
|
|
43420
|
-
|
|
43421
|
-
|
|
43422
|
-
|
|
43423
|
-
|
|
43424
|
-
|
|
43425
|
-
|
|
43426
|
-
|
|
43427
|
-
|
|
43428
|
-
|
|
43429
|
-
|
|
43977
|
+
var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
43978
|
+
var HOST_DELIM_RE = /[@/?#:]/g;
|
|
43979
|
+
var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
43980
|
+
function reescapeHostDelimiters(host, isIP) {
|
|
43981
|
+
const re2 = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
43982
|
+
re2.lastIndex = 0;
|
|
43983
|
+
return host.replace(re2, (ch) => HOST_DELIMS[ch]);
|
|
43984
|
+
}
|
|
43985
|
+
function normalizePercentEncoding(input, decodeUnreserved = false) {
|
|
43986
|
+
if (input.indexOf("%") === -1) {
|
|
43987
|
+
return input;
|
|
43430
43988
|
}
|
|
43431
|
-
|
|
43432
|
-
|
|
43989
|
+
let output = "";
|
|
43990
|
+
for (let i = 0;i < input.length; i++) {
|
|
43991
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
43992
|
+
const hex = input.slice(i + 1, i + 3);
|
|
43993
|
+
if (isHexPair(hex)) {
|
|
43994
|
+
const normalizedHex = hex.toUpperCase();
|
|
43995
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
43996
|
+
if (decodeUnreserved && isUnreserved(decoded)) {
|
|
43997
|
+
output += decoded;
|
|
43998
|
+
} else {
|
|
43999
|
+
output += "%" + normalizedHex;
|
|
44000
|
+
}
|
|
44001
|
+
i += 2;
|
|
44002
|
+
continue;
|
|
44003
|
+
}
|
|
44004
|
+
}
|
|
44005
|
+
output += input[i];
|
|
43433
44006
|
}
|
|
43434
|
-
|
|
43435
|
-
|
|
44007
|
+
return output;
|
|
44008
|
+
}
|
|
44009
|
+
function normalizePathEncoding(input) {
|
|
44010
|
+
let output = "";
|
|
44011
|
+
for (let i = 0;i < input.length; i++) {
|
|
44012
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
44013
|
+
const hex = input.slice(i + 1, i + 3);
|
|
44014
|
+
if (isHexPair(hex)) {
|
|
44015
|
+
const normalizedHex = hex.toUpperCase();
|
|
44016
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
44017
|
+
if (decoded !== "." && isUnreserved(decoded)) {
|
|
44018
|
+
output += decoded;
|
|
44019
|
+
} else {
|
|
44020
|
+
output += "%" + normalizedHex;
|
|
44021
|
+
}
|
|
44022
|
+
i += 2;
|
|
44023
|
+
continue;
|
|
44024
|
+
}
|
|
44025
|
+
}
|
|
44026
|
+
if (isPathCharacter(input[i])) {
|
|
44027
|
+
output += input[i];
|
|
44028
|
+
} else {
|
|
44029
|
+
output += escape(input[i]);
|
|
44030
|
+
}
|
|
43436
44031
|
}
|
|
43437
|
-
|
|
43438
|
-
|
|
44032
|
+
return output;
|
|
44033
|
+
}
|
|
44034
|
+
function escapePreservingEscapes(input) {
|
|
44035
|
+
let output = "";
|
|
44036
|
+
for (let i = 0;i < input.length; i++) {
|
|
44037
|
+
if (input[i] === "%" && i + 2 < input.length) {
|
|
44038
|
+
const hex = input.slice(i + 1, i + 3);
|
|
44039
|
+
if (isHexPair(hex)) {
|
|
44040
|
+
output += "%" + hex.toUpperCase();
|
|
44041
|
+
i += 2;
|
|
44042
|
+
continue;
|
|
44043
|
+
}
|
|
44044
|
+
}
|
|
44045
|
+
output += escape(input[i]);
|
|
43439
44046
|
}
|
|
43440
|
-
return
|
|
44047
|
+
return output;
|
|
43441
44048
|
}
|
|
43442
44049
|
function recomposeAuthority(component) {
|
|
43443
44050
|
const uriTokens = [];
|
|
@@ -43452,7 +44059,7 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
43452
44059
|
if (ipV6res.isIPV6 === true) {
|
|
43453
44060
|
host = `[${ipV6res.escapedHost}]`;
|
|
43454
44061
|
} else {
|
|
43455
|
-
host =
|
|
44062
|
+
host = reescapeHostDelimiters(host, false);
|
|
43456
44063
|
}
|
|
43457
44064
|
}
|
|
43458
44065
|
uriTokens.push(host);
|
|
@@ -43466,7 +44073,10 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
43466
44073
|
module.exports = {
|
|
43467
44074
|
nonSimpleDomain,
|
|
43468
44075
|
recomposeAuthority,
|
|
43469
|
-
|
|
44076
|
+
reescapeHostDelimiters,
|
|
44077
|
+
normalizePercentEncoding,
|
|
44078
|
+
normalizePathEncoding,
|
|
44079
|
+
escapePreservingEscapes,
|
|
43470
44080
|
removeDotSegments,
|
|
43471
44081
|
isIPv4,
|
|
43472
44082
|
isUUID,
|
|
@@ -43651,11 +44261,11 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
43651
44261
|
|
|
43652
44262
|
// node_modules/fast-uri/index.js
|
|
43653
44263
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
43654
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
44264
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils3();
|
|
43655
44265
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
43656
44266
|
function normalize(uri, options) {
|
|
43657
44267
|
if (typeof uri === "string") {
|
|
43658
|
-
uri =
|
|
44268
|
+
uri = normalizeString(uri, options);
|
|
43659
44269
|
} else if (typeof uri === "object") {
|
|
43660
44270
|
uri = parse6(serialize(uri, options), options);
|
|
43661
44271
|
}
|
|
@@ -43663,7 +44273,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43663
44273
|
}
|
|
43664
44274
|
function resolve(baseURI, relativeURI, options) {
|
|
43665
44275
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
43666
|
-
const
|
|
44276
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
|
|
44277
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
|
|
44278
|
+
if (baseMalformed || relativeMalformed) {
|
|
44279
|
+
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
44280
|
+
}
|
|
44281
|
+
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
43667
44282
|
schemelessOptions.skipEscape = true;
|
|
43668
44283
|
return serialize(resolved, schemelessOptions);
|
|
43669
44284
|
}
|
|
@@ -43721,19 +44336,9 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43721
44336
|
return target;
|
|
43722
44337
|
}
|
|
43723
44338
|
function equal(uriA, uriB, options) {
|
|
43724
|
-
|
|
43725
|
-
|
|
43726
|
-
|
|
43727
|
-
} else if (typeof uriA === "object") {
|
|
43728
|
-
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
43729
|
-
}
|
|
43730
|
-
if (typeof uriB === "string") {
|
|
43731
|
-
uriB = unescape(uriB);
|
|
43732
|
-
uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
|
|
43733
|
-
} else if (typeof uriB === "object") {
|
|
43734
|
-
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
43735
|
-
}
|
|
43736
|
-
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
44339
|
+
const normalizedA = normalizeComparableURI(uriA, options);
|
|
44340
|
+
const normalizedB = normalizeComparableURI(uriB, options);
|
|
44341
|
+
return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
|
|
43737
44342
|
}
|
|
43738
44343
|
function serialize(cmpts, opts) {
|
|
43739
44344
|
const component = {
|
|
@@ -43759,12 +44364,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43759
44364
|
schemeHandler.serialize(component, options);
|
|
43760
44365
|
if (component.path !== undefined) {
|
|
43761
44366
|
if (!options.skipEscape) {
|
|
43762
|
-
component.path =
|
|
44367
|
+
component.path = escapePreservingEscapes(component.path);
|
|
43763
44368
|
if (component.scheme !== undefined) {
|
|
43764
44369
|
component.path = component.path.split("%3A").join(":");
|
|
43765
44370
|
}
|
|
43766
44371
|
} else {
|
|
43767
|
-
component.path =
|
|
44372
|
+
component.path = normalizePercentEncoding(component.path);
|
|
43768
44373
|
}
|
|
43769
44374
|
}
|
|
43770
44375
|
if (options.reference !== "suffix" && component.scheme) {
|
|
@@ -43799,7 +44404,18 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43799
44404
|
return uriTokens.join("");
|
|
43800
44405
|
}
|
|
43801
44406
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
43802
|
-
|
|
44407
|
+
var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
|
|
44408
|
+
var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
|
|
44409
|
+
function getParseError(parsed, matches) {
|
|
44410
|
+
if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
|
|
44411
|
+
return 'URI path must start with "/" when authority is present.';
|
|
44412
|
+
}
|
|
44413
|
+
if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
|
|
44414
|
+
return "URI port is malformed.";
|
|
44415
|
+
}
|
|
44416
|
+
return;
|
|
44417
|
+
}
|
|
44418
|
+
function parseWithStatus(uri, opts) {
|
|
43803
44419
|
const options = Object.assign({}, opts);
|
|
43804
44420
|
const parsed = {
|
|
43805
44421
|
scheme: undefined,
|
|
@@ -43810,6 +44426,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43810
44426
|
query: undefined,
|
|
43811
44427
|
fragment: undefined
|
|
43812
44428
|
};
|
|
44429
|
+
let malformedAuthorityOrPort = false;
|
|
43813
44430
|
let isIP = false;
|
|
43814
44431
|
if (options.reference === "suffix") {
|
|
43815
44432
|
if (options.scheme) {
|
|
@@ -43818,6 +44435,25 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43818
44435
|
uri = "//" + uri;
|
|
43819
44436
|
}
|
|
43820
44437
|
}
|
|
44438
|
+
const authorityMatch = uri.match(AUTHORITY_PREFIX);
|
|
44439
|
+
if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) {
|
|
44440
|
+
parsed.error = "URI authority must not contain a literal backslash.";
|
|
44441
|
+
malformedAuthorityOrPort = true;
|
|
44442
|
+
}
|
|
44443
|
+
const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
|
|
44444
|
+
if (introducerMatch !== null) {
|
|
44445
|
+
const region = introducerMatch[1];
|
|
44446
|
+
const normalizedRegion = region.replace(/[\t\n\r]/g, "");
|
|
44447
|
+
if (normalizedRegion.length >= 2) {
|
|
44448
|
+
if (normalizedRegion.slice(0, 2) !== "//") {
|
|
44449
|
+
parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
|
|
44450
|
+
malformedAuthorityOrPort = true;
|
|
44451
|
+
} else if (region.length !== normalizedRegion.length) {
|
|
44452
|
+
parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
|
|
44453
|
+
malformedAuthorityOrPort = true;
|
|
44454
|
+
}
|
|
44455
|
+
}
|
|
44456
|
+
}
|
|
43821
44457
|
const matches = uri.match(URI_PARSE);
|
|
43822
44458
|
if (matches) {
|
|
43823
44459
|
parsed.scheme = matches[1];
|
|
@@ -43830,6 +44466,11 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43830
44466
|
if (isNaN(parsed.port)) {
|
|
43831
44467
|
parsed.port = matches[5];
|
|
43832
44468
|
}
|
|
44469
|
+
const parseError = getParseError(parsed, matches);
|
|
44470
|
+
if (parseError !== undefined) {
|
|
44471
|
+
parsed.error = parsed.error || parseError;
|
|
44472
|
+
malformedAuthorityOrPort = true;
|
|
44473
|
+
}
|
|
43833
44474
|
if (parsed.host) {
|
|
43834
44475
|
const ipv4result = isIPv4(parsed.host);
|
|
43835
44476
|
if (ipv4result === false) {
|
|
@@ -43856,7 +44497,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43856
44497
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
43857
44498
|
if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
43858
44499
|
try {
|
|
43859
|
-
parsed.host = URL
|
|
44500
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
43860
44501
|
} catch (e) {
|
|
43861
44502
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
43862
44503
|
}
|
|
@@ -43868,14 +44509,18 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43868
44509
|
parsed.scheme = unescape(parsed.scheme);
|
|
43869
44510
|
}
|
|
43870
44511
|
if (parsed.host !== undefined) {
|
|
43871
|
-
parsed.host = unescape(parsed.host);
|
|
44512
|
+
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
43872
44513
|
}
|
|
43873
44514
|
}
|
|
43874
44515
|
if (parsed.path) {
|
|
43875
|
-
parsed.path =
|
|
44516
|
+
parsed.path = normalizePathEncoding(parsed.path);
|
|
43876
44517
|
}
|
|
43877
44518
|
if (parsed.fragment) {
|
|
43878
|
-
|
|
44519
|
+
try {
|
|
44520
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
44521
|
+
} catch {
|
|
44522
|
+
parsed.error = parsed.error || "URI malformed";
|
|
44523
|
+
}
|
|
43879
44524
|
}
|
|
43880
44525
|
}
|
|
43881
44526
|
if (schemeHandler && schemeHandler.parse) {
|
|
@@ -43884,7 +44529,29 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
43884
44529
|
} else {
|
|
43885
44530
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
43886
44531
|
}
|
|
43887
|
-
return parsed;
|
|
44532
|
+
return { parsed, malformedAuthorityOrPort };
|
|
44533
|
+
}
|
|
44534
|
+
function parse6(uri, opts) {
|
|
44535
|
+
return parseWithStatus(uri, opts).parsed;
|
|
44536
|
+
}
|
|
44537
|
+
function normalizeString(uri, opts) {
|
|
44538
|
+
return normalizeStringWithStatus(uri, opts).normalized;
|
|
44539
|
+
}
|
|
44540
|
+
function normalizeStringWithStatus(uri, opts) {
|
|
44541
|
+
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
44542
|
+
return {
|
|
44543
|
+
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
44544
|
+
malformedAuthorityOrPort
|
|
44545
|
+
};
|
|
44546
|
+
}
|
|
44547
|
+
function normalizeComparableURI(uri, opts) {
|
|
44548
|
+
if (typeof uri === "string") {
|
|
44549
|
+
const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
|
|
44550
|
+
return malformedAuthorityOrPort ? undefined : normalized;
|
|
44551
|
+
}
|
|
44552
|
+
if (typeof uri === "object") {
|
|
44553
|
+
return serialize(uri, opts);
|
|
44554
|
+
}
|
|
43888
44555
|
}
|
|
43889
44556
|
var fastUri = {
|
|
43890
44557
|
SCHEMES,
|
|
@@ -53672,9 +54339,9 @@ var init_config = __esm(() => {
|
|
|
53672
54339
|
SDK_METADATA = {
|
|
53673
54340
|
language: "typescript",
|
|
53674
54341
|
openapiDocVersion: "2.0",
|
|
53675
|
-
sdkVersion: "0.
|
|
54342
|
+
sdkVersion: "0.7.0",
|
|
53676
54343
|
genVersion: "2.845.15",
|
|
53677
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
54344
|
+
userAgent: "speakeasy-sdk/typescript 0.7.0 2.845.15 2.0 @launchdarkly/mcp-server"
|
|
53678
54345
|
};
|
|
53679
54346
|
});
|
|
53680
54347
|
|
|
@@ -61397,7 +62064,7 @@ var init_featureFlagsPatch2 = __esm(() => {
|
|
|
61397
62064
|
function createMCPServer(deps) {
|
|
61398
62065
|
const server = new McpServer({
|
|
61399
62066
|
name: "LaunchDarkly",
|
|
61400
|
-
version: "0.
|
|
62067
|
+
version: "0.7.0"
|
|
61401
62068
|
});
|
|
61402
62069
|
const client = new LaunchDarklyCore({
|
|
61403
62070
|
apiKey: deps.apiKey,
|
|
@@ -61460,6 +62127,29 @@ var init_server3 = __esm(() => {
|
|
|
61460
62127
|
init_featureFlagsPatch2();
|
|
61461
62128
|
});
|
|
61462
62129
|
|
|
62130
|
+
// src/mcp-server/cli/start/sse-security.ts
|
|
62131
|
+
import { timingSafeEqual } from "node:crypto";
|
|
62132
|
+
function isLoopbackHost(host) {
|
|
62133
|
+
return host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
62134
|
+
}
|
|
62135
|
+
function assertSafeSSEBind(host, authToken) {
|
|
62136
|
+
if (!authToken && !isLoopbackHost(host)) {
|
|
62137
|
+
throw new Error(`--auth-token is required when the SSE transport listens on a non-loopback host (${host})`);
|
|
62138
|
+
}
|
|
62139
|
+
}
|
|
62140
|
+
function requireBearerToken(token) {
|
|
62141
|
+
const expected = Buffer.from(`Bearer ${token}`);
|
|
62142
|
+
return (req, res, next) => {
|
|
62143
|
+
const actual = Buffer.from(req.headers.authorization ?? "");
|
|
62144
|
+
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) {
|
|
62145
|
+
res.status(401).send("Unauthorized");
|
|
62146
|
+
return;
|
|
62147
|
+
}
|
|
62148
|
+
next();
|
|
62149
|
+
};
|
|
62150
|
+
}
|
|
62151
|
+
var init_sse_security = () => {};
|
|
62152
|
+
|
|
61463
62153
|
// src/mcp-server/cli/start/impl.ts
|
|
61464
62154
|
var exports_impl = {};
|
|
61465
62155
|
__export(exports_impl, {
|
|
@@ -61501,34 +62191,68 @@ async function startStdio(flags) {
|
|
|
61501
62191
|
}
|
|
61502
62192
|
async function startSSE(flags) {
|
|
61503
62193
|
const logger = createConsoleLogger(flags["log-level"]);
|
|
62194
|
+
const host = flags.host;
|
|
62195
|
+
const authToken = flags["auth-token"];
|
|
62196
|
+
assertSafeSSEBind(host, authToken);
|
|
61504
62197
|
const app = import_express.default();
|
|
61505
|
-
|
|
61506
|
-
|
|
61507
|
-
|
|
61508
|
-
|
|
61509
|
-
|
|
61510
|
-
|
|
61511
|
-
|
|
61512
|
-
});
|
|
61513
|
-
let transport;
|
|
62198
|
+
if (isLoopbackHost(host)) {
|
|
62199
|
+
app.use(localhostHostValidation());
|
|
62200
|
+
}
|
|
62201
|
+
if (authToken) {
|
|
62202
|
+
app.use(requireBearerToken(authToken));
|
|
62203
|
+
}
|
|
62204
|
+
const sessions = new Map;
|
|
61514
62205
|
const controller = new AbortController;
|
|
61515
62206
|
app.get("/sse", async (_req, res) => {
|
|
61516
|
-
|
|
61517
|
-
|
|
61518
|
-
|
|
61519
|
-
|
|
61520
|
-
|
|
62207
|
+
const server = createMCPServer({
|
|
62208
|
+
logger,
|
|
62209
|
+
allowedTools: flags.tool,
|
|
62210
|
+
scopes: flags.scope,
|
|
62211
|
+
...{ apiKey: flags["api-key"] ?? "" },
|
|
62212
|
+
serverURL: flags["server-url"],
|
|
62213
|
+
serverIdx: flags["server-index"]
|
|
62214
|
+
});
|
|
62215
|
+
const transport = new SSEServerTransport("/message", res);
|
|
62216
|
+
sessions.set(transport.sessionId, { transport, server });
|
|
62217
|
+
res.on("close", () => {
|
|
62218
|
+
sessions.delete(transport.sessionId);
|
|
62219
|
+
server.close();
|
|
62220
|
+
});
|
|
62221
|
+
try {
|
|
62222
|
+
await server.connect(transport);
|
|
62223
|
+
} catch (err) {
|
|
62224
|
+
logger.error("Failed to open SSE session", {
|
|
62225
|
+
error: err instanceof Error ? err.message : String(err)
|
|
62226
|
+
});
|
|
62227
|
+
sessions.delete(transport.sessionId);
|
|
62228
|
+
server.close();
|
|
62229
|
+
if (!res.headersSent) {
|
|
62230
|
+
res.status(500).send("Internal Server Error");
|
|
62231
|
+
}
|
|
62232
|
+
}
|
|
61521
62233
|
});
|
|
61522
62234
|
app.post("/message", async (req, res) => {
|
|
61523
|
-
|
|
61524
|
-
|
|
62235
|
+
const sessionId = typeof req.query["sessionId"] === "string" ? req.query["sessionId"] : "";
|
|
62236
|
+
const session = sessions.get(sessionId);
|
|
62237
|
+
if (!session) {
|
|
62238
|
+
res.status(404).send("Unknown session");
|
|
62239
|
+
return;
|
|
62240
|
+
}
|
|
62241
|
+
try {
|
|
62242
|
+
await session.transport.handlePostMessage(req, res);
|
|
62243
|
+
} catch (err) {
|
|
62244
|
+
logger.error("Failed to handle SSE message", {
|
|
62245
|
+
error: err instanceof Error ? err.message : String(err)
|
|
62246
|
+
});
|
|
62247
|
+
if (!res.headersSent) {
|
|
62248
|
+
res.status(500).send("Internal Server Error");
|
|
62249
|
+
}
|
|
61525
62250
|
}
|
|
61526
|
-
await transport.handlePostMessage(req, res);
|
|
61527
62251
|
});
|
|
61528
|
-
const httpServer = app.listen(flags.port,
|
|
62252
|
+
const httpServer = app.listen(flags.port, host, () => {
|
|
61529
62253
|
const ha = httpServer.address();
|
|
61530
|
-
const
|
|
61531
|
-
logger.info("MCP HTTP server started", { host });
|
|
62254
|
+
const host2 = typeof ha === "string" ? ha : `${ha?.address}:${ha?.port}`;
|
|
62255
|
+
logger.info("MCP HTTP server started", { host: host2 });
|
|
61532
62256
|
});
|
|
61533
62257
|
let closing = false;
|
|
61534
62258
|
controller.signal.addEventListener("abort", async () => {
|
|
@@ -61537,8 +62261,8 @@ async function startSSE(flags) {
|
|
|
61537
62261
|
process.exit(1);
|
|
61538
62262
|
}
|
|
61539
62263
|
closing = true;
|
|
61540
|
-
logger.info("Shutting down MCP
|
|
61541
|
-
await
|
|
62264
|
+
logger.info("Shutting down MCP servers");
|
|
62265
|
+
await Promise.all([...sessions.values()].map(({ server }) => server.close()));
|
|
61542
62266
|
logger.info("Shutting down HTTP server");
|
|
61543
62267
|
const timer = setTimeout(() => {
|
|
61544
62268
|
logger.info("Forcing shutdown");
|
|
@@ -61561,6 +62285,7 @@ var init_impl = __esm(() => {
|
|
|
61561
62285
|
import_express = __toESM(require_express2(), 1);
|
|
61562
62286
|
init_console_logger();
|
|
61563
62287
|
init_server3();
|
|
62288
|
+
init_sse_security();
|
|
61564
62289
|
});
|
|
61565
62290
|
|
|
61566
62291
|
// node_modules/@stricli/core/dist/index.js
|
|
@@ -62566,6 +63291,18 @@ var startCommand = on({
|
|
|
62566
63291
|
default: "2718",
|
|
62567
63292
|
parse: (val) => coerce.number().int().gte(0).lt(65536).parse(val)
|
|
62568
63293
|
},
|
|
63294
|
+
host: {
|
|
63295
|
+
kind: "parsed",
|
|
63296
|
+
brief: "The host to listen on when the SSE transport is enabled. Non-loopback hosts require --auth-token",
|
|
63297
|
+
default: "127.0.0.1",
|
|
63298
|
+
parse: (value) => stringType().nonempty().parse(value)
|
|
63299
|
+
},
|
|
63300
|
+
"auth-token": {
|
|
63301
|
+
kind: "parsed",
|
|
63302
|
+
brief: "Bearer token that SSE clients must send in the Authorization header",
|
|
63303
|
+
optional: true,
|
|
63304
|
+
parse: (value) => stringType().min(16).parse(value)
|
|
63305
|
+
},
|
|
62569
63306
|
tool: {
|
|
62570
63307
|
kind: "parsed",
|
|
62571
63308
|
brief: "Specify tools to mount on the server",
|
|
@@ -62649,7 +63386,7 @@ var routes = an({
|
|
|
62649
63386
|
var app = He(routes, {
|
|
62650
63387
|
name: "mcp",
|
|
62651
63388
|
versionInfo: {
|
|
62652
|
-
currentVersion: "0.
|
|
63389
|
+
currentVersion: "0.7.0"
|
|
62653
63390
|
}
|
|
62654
63391
|
});
|
|
62655
63392
|
zt(app, process4.argv.slice(2), buildContext(process4));
|
|
@@ -62657,5 +63394,5 @@ export {
|
|
|
62657
63394
|
app
|
|
62658
63395
|
};
|
|
62659
63396
|
|
|
62660
|
-
//# debugId=
|
|
63397
|
+
//# debugId=1BB1876EEFF45EEC64756E2164756E21
|
|
62661
63398
|
//# sourceMappingURL=mcp-server.js.map
|