@dalmia/calibrate-mcp 0.0.66 → 0.0.68

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/bin/mcp-server.js CHANGED
@@ -364,6 +364,18 @@ function prefixIssues(path, issues) {
364
364
  function unwrapMessage(message) {
365
365
  return typeof message === "string" ? message : message?.message;
366
366
  }
367
+ function sizeCaps(defChecks) {
368
+ const caps = [];
369
+ for (const ch of defChecks ?? []) {
370
+ const d = ch._zod.def;
371
+ if (!/_(length|size)$|_equals$/.test(d.check))
372
+ break;
373
+ const max = d.maximum ?? d.length ?? d.size;
374
+ if (max >= 0)
375
+ caps.push([max, ch]);
376
+ }
377
+ return caps;
378
+ }
367
379
  function attachSchema(issues, start, inst) {
368
380
  var _a;
369
381
  for (let i = start;i < issues.length; i++) {
@@ -1431,7 +1443,7 @@ var init_versions = __esm(() => {
1431
1443
  version2 = {
1432
1444
  major: 4,
1433
1445
  minor: 6,
1434
- patch: 5
1446
+ patch: 6
1435
1447
  };
1436
1448
  });
1437
1449
 
@@ -1557,6 +1569,28 @@ function isValidJWT(token, algorithm = null) {
1557
1569
  return false;
1558
1570
  }
1559
1571
  }
1572
+ function capSize(inst, size) {
1573
+ const caps = sizeCaps(inst._zod.def.checks);
1574
+ if (!caps.length)
1575
+ return;
1576
+ const cap = Math.min(...caps.map((c) => c[0]));
1577
+ const parse = inst._zod.parse;
1578
+ inst._zod.parse = (payload, ctx) => {
1579
+ const n = size(payload.value);
1580
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
1581
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
1582
+ if (n > max && ch._zod.def.when(payload)) {
1583
+ const start = payload.issues.length;
1584
+ ch._zod.check(payload);
1585
+ payload.issues[start].continue = false;
1586
+ attachSchema(payload.issues, start, inst);
1587
+ return payload;
1588
+ }
1589
+ }
1590
+ }
1591
+ return parse(payload, ctx);
1592
+ };
1593
+ }
1560
1594
  function handleArrayResult(result, final, index) {
1561
1595
  if (result.issues.length) {
1562
1596
  final.issues.push(...prefixIssues(index, result.issues));
@@ -1862,7 +1896,7 @@ function handleRefineResult(result, payload, input, inst) {
1862
1896
  payload.issues.push(issue(_iss));
1863
1897
  }
1864
1898
  }
1865
- var $ZodType, toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value }, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT = 1, URL_UNPARSEABLE = 2, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodCustom;
1899
+ var $ZodType, toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, config())) } : { value: r.value }, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT = 1, URL_UNPARSEABLE = 2, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, arraySize = (input) => Array.isArray(input) ? input.length : -1, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodCustom;
1866
1900
  var init_schemas = __esm(() => {
1867
1901
  init_checks();
1868
1902
  init_core();
@@ -2352,6 +2386,7 @@ var init_schemas = __esm(() => {
2352
2386
  }
2353
2387
  return payload;
2354
2388
  };
2389
+ capSize(inst, arraySize);
2355
2390
  });
2356
2391
  NO_SYMBOL_KEYS = [];
2357
2392
  $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
@@ -27191,109 +27226,144 @@ var require_view = __commonJS(function(exports, module) {
27191
27226
  }
27192
27227
  });
27193
27228
 
27194
- // node_modules/content-type/index.js
27195
- var require_content_type = __commonJS(function(exports) {
27229
+ // node_modules/express/node_modules/content-type/dist/index.js
27230
+ var require_dist3 = __commonJS(function(exports) {
27196
27231
  /*!
27197
27232
  * content-type
27198
27233
  * Copyright(c) 2015 Douglas Christopher Wilson
27199
27234
  * MIT Licensed
27200
27235
  */
27201
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
27202
- var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
27203
- var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
27204
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
27205
- var QUOTE_REGEXP = /([\\"])/g;
27206
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
27236
+ Object.defineProperty(exports, "__esModule", { value: true });
27207
27237
  exports.format = format;
27208
27238
  exports.parse = parse;
27239
+ var TEXT_REGEXP = /^[\u0009\u0020-\u007e\u0080-\u00ff]*$/;
27240
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
27241
+ var QUOTE_REGEXP = /[\\"]/g;
27242
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
27243
+ var NullObject = /* @__PURE__ */ (() => {
27244
+ const C = function() {};
27245
+ C.prototype = Object.create(null);
27246
+ return C;
27247
+ })();
27209
27248
  function format(obj) {
27210
- if (!obj || typeof obj !== "object") {
27211
- throw new TypeError("argument obj is required");
27212
- }
27213
- var parameters = obj.parameters;
27214
- var type = obj.type;
27249
+ const { type, parameters } = obj;
27215
27250
  if (!type || !TYPE_REGEXP.test(type)) {
27216
- throw new TypeError("invalid type");
27251
+ throw new TypeError(`Invalid type: ${type}`);
27217
27252
  }
27218
- var string = type;
27219
- if (parameters && typeof parameters === "object") {
27220
- var param;
27221
- var params = Object.keys(parameters).sort();
27222
- for (var i = 0;i < params.length; i++) {
27223
- param = params[i];
27253
+ let result = type;
27254
+ if (parameters) {
27255
+ for (const param of Object.keys(parameters)) {
27224
27256
  if (!TOKEN_REGEXP.test(param)) {
27225
- throw new TypeError("invalid parameter name");
27257
+ throw new TypeError(`Invalid parameter name: ${param}`);
27226
27258
  }
27227
- string += "; " + param + "=" + qstring(parameters[param]);
27259
+ result += `; ${param}=${qstring(parameters[param])}`;
27228
27260
  }
27229
27261
  }
27230
- return string;
27262
+ return result;
27231
27263
  }
27232
- function parse(string) {
27233
- if (!string) {
27234
- throw new TypeError("argument string is required");
27235
- }
27236
- var header = typeof string === "object" ? getcontenttype(string) : string;
27237
- if (typeof header !== "string") {
27238
- throw new TypeError("argument string is required to be a string");
27239
- }
27240
- var index = header.indexOf(";");
27241
- var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
27242
- if (!TYPE_REGEXP.test(type)) {
27243
- throw new TypeError("invalid media type");
27264
+ function parse(header, options) {
27265
+ const stopChar = options?.comma === true ? COMMA : 65536;
27266
+ const len = header.length;
27267
+ let index = skipOWS(header, options?.start ?? 0, len);
27268
+ const valueStart = index;
27269
+ index = skipValue(header, index, len, stopChar);
27270
+ const valueEnd = trailingOWS(header, valueStart, index);
27271
+ const type = header.slice(valueStart, valueEnd).toLowerCase();
27272
+ if (options?.parameters === false) {
27273
+ return { type, index, parameters: new NullObject };
27244
27274
  }
27245
- var obj = new ContentType(type.toLowerCase());
27246
- if (index !== -1) {
27247
- var key;
27248
- var match;
27249
- var value;
27250
- PARAM_REGEXP.lastIndex = index;
27251
- while (match = PARAM_REGEXP.exec(header)) {
27252
- if (match.index !== index) {
27253
- throw new TypeError("invalid parameter format");
27254
- }
27255
- index += match[0].length;
27256
- key = match[1].toLowerCase();
27257
- value = match[2];
27258
- if (value.charCodeAt(0) === 34) {
27259
- value = value.slice(1, -1);
27260
- if (value.indexOf("\\") !== -1) {
27261
- value = value.replace(QESC_REGEXP, "$1");
27275
+ return parseParameters(header, type, index, len, stopChar);
27276
+ }
27277
+ var SP = 32;
27278
+ var HTAB = 9;
27279
+ var SEMI = 59;
27280
+ var EQ = 61;
27281
+ var DQUOTE = 34;
27282
+ var BSLASH = 92;
27283
+ var COMMA = 44;
27284
+ function parseParameters(header, type, index, len, stopChar) {
27285
+ const parameters = new NullObject;
27286
+ parameter:
27287
+ while (index < len) {
27288
+ if (header.charCodeAt(index) === stopChar)
27289
+ break;
27290
+ index = skipOWS(header, index + 1, len);
27291
+ const keyStart = index;
27292
+ while (index < len) {
27293
+ const code = header.charCodeAt(index);
27294
+ if (code === stopChar)
27295
+ break parameter;
27296
+ if (code === SEMI)
27297
+ continue parameter;
27298
+ if (code === EQ) {
27299
+ const keyEnd = trailingOWS(header, keyStart, index);
27300
+ const key = header.slice(keyStart, keyEnd).toLowerCase();
27301
+ index = skipOWS(header, index + 1, len);
27302
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
27303
+ index++;
27304
+ let value = "";
27305
+ while (index < len) {
27306
+ const code = header.charCodeAt(index++);
27307
+ if (code === DQUOTE) {
27308
+ index = skipValue(header, index, len, stopChar);
27309
+ if (parameters[key] === undefined)
27310
+ parameters[key] = value;
27311
+ break;
27312
+ }
27313
+ if (code === BSLASH && index < len) {
27314
+ value += header[index++];
27315
+ continue;
27316
+ }
27317
+ value += String.fromCharCode(code);
27318
+ }
27319
+ continue parameter;
27320
+ }
27321
+ const valueStart = index;
27322
+ index = skipValue(header, index, len, stopChar);
27323
+ if (parameters[key] === undefined) {
27324
+ const valueEnd = trailingOWS(header, valueStart, index);
27325
+ parameters[key] = header.slice(valueStart, valueEnd);
27326
+ }
27327
+ continue parameter;
27262
27328
  }
27329
+ index++;
27263
27330
  }
27264
- obj.parameters[key] = value;
27265
- }
27266
- if (index !== header.length) {
27267
- throw new TypeError("invalid parameter format");
27268
27331
  }
27269
- }
27270
- return obj;
27332
+ return { type, index, parameters };
27271
27333
  }
27272
- function getcontenttype(obj) {
27273
- var header;
27274
- if (typeof obj.getHeader === "function") {
27275
- header = obj.getHeader("content-type");
27276
- } else if (typeof obj.headers === "object") {
27277
- header = obj.headers && obj.headers["content-type"];
27278
- }
27279
- if (typeof header !== "string") {
27280
- throw new TypeError("content-type header is missing from object");
27334
+ function skipValue(str, index, len, stopChar) {
27335
+ while (index < len) {
27336
+ const code = str.charCodeAt(index);
27337
+ if (code === SEMI || code === stopChar)
27338
+ break;
27339
+ index++;
27281
27340
  }
27282
- return header;
27341
+ return index;
27283
27342
  }
27284
- function qstring(val) {
27285
- var str = String(val);
27286
- if (TOKEN_REGEXP.test(str)) {
27287
- return str;
27343
+ function skipOWS(header, index, len) {
27344
+ while (index < len) {
27345
+ const char = header.charCodeAt(index);
27346
+ if (char !== SP && char !== HTAB)
27347
+ break;
27348
+ index++;
27288
27349
  }
27289
- if (str.length > 0 && !TEXT_REGEXP.test(str)) {
27290
- throw new TypeError("invalid parameter value");
27350
+ return index;
27351
+ }
27352
+ function trailingOWS(header, start, end) {
27353
+ while (end > start) {
27354
+ const char = header.charCodeAt(end - 1);
27355
+ if (char !== SP && char !== HTAB)
27356
+ break;
27357
+ end--;
27291
27358
  }
27292
- return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
27359
+ return end;
27293
27360
  }
27294
- function ContentType(type) {
27295
- this.parameters = Object.create(null);
27296
- this.type = type;
27361
+ function qstring(str) {
27362
+ if (TOKEN_REGEXP.test(str))
27363
+ return str;
27364
+ if (TEXT_REGEXP.test(str))
27365
+ return `"${str.replace(QUOTE_REGEXP, "\\$&")}"`;
27366
+ throw new TypeError(`Invalid parameter value: ${str}`);
27297
27367
  }
27298
27368
  });
27299
27369
 
@@ -28199,7 +28269,7 @@ var require_utils3 = __commonJS(function(exports) {
28199
28269
  * MIT Licensed
28200
28270
  */
28201
28271
  var { METHODS } = __require("node:http");
28202
- var contentType = require_content_type();
28272
+ var contentType = require_dist3();
28203
28273
  var etag = require_etag();
28204
28274
  var mime = require_mime_types();
28205
28275
  var proxyaddr = require_proxy_addr();
@@ -28404,7 +28474,7 @@ var require_is_promise = __commonJS(function(exports, module) {
28404
28474
  });
28405
28475
 
28406
28476
  // node_modules/path-to-regexp/dist/index.js
28407
- var require_dist3 = __commonJS(function(exports) {
28477
+ var require_dist4 = __commonJS(function(exports) {
28408
28478
  Object.defineProperty(exports, "__esModule", { value: true });
28409
28479
  exports.PathError = exports.TokenData = undefined;
28410
28480
  exports.parse = parse;
@@ -28780,7 +28850,7 @@ var require_layer = __commonJS(function(exports, module) {
28780
28850
  * MIT Licensed
28781
28851
  */
28782
28852
  var isPromise = require_is_promise();
28783
- var pathRegexp = require_dist3();
28853
+ var pathRegexp = require_dist4();
28784
28854
  var debug = require_src()("router:layer");
28785
28855
  var deprecate = require_depd()("router");
28786
28856
  var TRAILING_SLASH_REGEXP = /\/+$/;
@@ -29660,7 +29730,7 @@ var require_application = __commonJS(function(exports, module) {
29660
29730
  var cache = this.cache;
29661
29731
  var done = callback;
29662
29732
  var engines = this.engines;
29663
- var opts = options;
29733
+ var opts = options || {};
29664
29734
  var view;
29665
29735
  if (typeof options === "function") {
29666
29736
  done = options;
@@ -29703,7 +29773,7 @@ var require_application = __commonJS(function(exports, module) {
29703
29773
  };
29704
29774
  function logerror(err) {
29705
29775
  if (this.get("env") !== "test")
29706
- console.error(err.stack || err.toString());
29776
+ console.error(err);
29707
29777
  }
29708
29778
  function tryRender(view, options, callback) {
29709
29779
  try {
@@ -29715,7 +29785,7 @@ var require_application = __commonJS(function(exports, module) {
29715
29785
  });
29716
29786
 
29717
29787
  // node_modules/negotiator/node_modules/content-type/dist/index.js
29718
- var require_dist4 = __commonJS(function(exports) {
29788
+ var require_dist5 = __commonJS(function(exports) {
29719
29789
  /*!
29720
29790
  * content-type
29721
29791
  * Copyright(c) 2015 Douglas Christopher Wilson
@@ -29862,7 +29932,7 @@ var require_accept = __commonJS(function(exports, module) {
29862
29932
  * Copyright(c) 2026 Blake Embrey
29863
29933
  * MIT Licensed
29864
29934
  */
29865
- var contentType = require_dist4();
29935
+ var contentType = require_dist5();
29866
29936
  module.exports = parseAccept;
29867
29937
  function parseAccept(header) {
29868
29938
  var values = [];
@@ -30056,7 +30126,7 @@ var require_encoding = __commonJS(function(exports, module) {
30056
30126
 
30057
30127
  // node_modules/negotiator/lib/language.js
30058
30128
  var require_language = __commonJS(function(exports, module) {
30059
- var contentType = require_dist4();
30129
+ var contentType = require_dist5();
30060
30130
  var parseAccept = require_accept();
30061
30131
  module.exports = preferredLanguages;
30062
30132
  module.exports.preferredLanguages = preferredLanguages;
@@ -30140,7 +30210,7 @@ var require_language = __commonJS(function(exports, module) {
30140
30210
 
30141
30211
  // node_modules/negotiator/lib/mediaType.js
30142
30212
  var require_mediaType = __commonJS(function(exports, module) {
30143
- var contentType = require_dist4();
30213
+ var contentType = require_dist5();
30144
30214
  var parseAcceptHeader = require_accept();
30145
30215
  module.exports = preferredMediaTypes;
30146
30216
  module.exports.preferredMediaTypes = preferredMediaTypes;
@@ -30593,9 +30663,9 @@ var require_request = __commonJS(function(exports, module) {
30593
30663
  var accept = accepts(this);
30594
30664
  return accept.encodings.apply(accept, arguments);
30595
30665
  };
30596
- req.acceptsCharsets = function() {
30597
- var accept = accepts(this);
30598
- return accept.charsets.apply(accept, arguments);
30666
+ req.acceptsCharsets = function(...charsets) {
30667
+ const accept = accepts(this);
30668
+ return accept.charsets(...charsets);
30599
30669
  };
30600
30670
  req.acceptsLanguages = function(...languages) {
30601
30671
  return accepts(this).languages(...languages);
@@ -30664,7 +30734,7 @@ var require_request = __commonJS(function(exports, module) {
30664
30734
  if (!val || !trust(this.socket.remoteAddress, 0)) {
30665
30735
  val = this.get("Host");
30666
30736
  } else if (val.indexOf(",") !== -1) {
30667
- val = val.substring(0, val.indexOf(",")).trimRight();
30737
+ val = val.substring(0, val.indexOf(",")).trimEnd();
30668
30738
  }
30669
30739
  return val || undefined;
30670
30740
  });
@@ -30680,7 +30750,7 @@ var require_request = __commonJS(function(exports, module) {
30680
30750
  var method = this.method;
30681
30751
  var res = this.res;
30682
30752
  var status = res.statusCode;
30683
- if (method !== "GET" && method !== "HEAD")
30753
+ if (method !== "GET" && method !== "HEAD" && method !== "QUERY")
30684
30754
  return false;
30685
30755
  if (status >= 200 && status < 300 || status === 304) {
30686
30756
  return fresh(this.headers, {
@@ -30706,199 +30776,279 @@ var require_request = __commonJS(function(exports, module) {
30706
30776
  }
30707
30777
  });
30708
30778
 
30709
- // node_modules/content-disposition/index.js
30710
- var require_content_disposition = __commonJS(function(exports, module) {
30779
+ // node_modules/content-disposition/dist/index.js
30780
+ var require_dist6 = __commonJS(function(exports) {
30711
30781
  /*!
30712
30782
  * content-disposition
30713
30783
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
30714
30784
  * MIT Licensed
30715
30785
  */
30716
- module.exports = contentDisposition;
30717
- module.exports.parse = parse;
30718
- var utf8Decoder = new TextDecoder("utf-8");
30786
+ Object.defineProperty(exports, "__esModule", { value: true });
30787
+ exports.create = create;
30788
+ exports.parse = parse;
30789
+ exports.decodeExtended = decodeExtended;
30790
+ exports.format = format;
30791
+ exports.encodeExtended = encodeExtended;
30792
+ var NullObject = /* @__PURE__ */ (() => {
30793
+ const C = function() {};
30794
+ C.prototype = Object.create(null);
30795
+ return C;
30796
+ })();
30797
+ function create(filename, options) {
30798
+ const type = options?.type || "attachment";
30799
+ const parameters = createParameters(filename, options?.fallback);
30800
+ return format({ type, parameters }, { extended: false });
30801
+ }
30802
+ var SP = 32;
30803
+ var HTAB = 9;
30804
+ var SEMI = 59;
30805
+ var EQ = 61;
30806
+ var DQUOTE = 34;
30807
+ var BSLASH = 92;
30808
+ var ASTERISK = 42;
30809
+ function parse(header, options) {
30810
+ const len = header.length;
30811
+ const multipart = options?.multipart === true;
30812
+ const extended = options?.extended !== false;
30813
+ let index = skipOWS(header, 0, header.length);
30814
+ const typeStart = index;
30815
+ index = parseToken(header, index, len);
30816
+ const typeEnd = trailingOWS(header, typeStart, index);
30817
+ const type = header.slice(typeStart, typeEnd).toLowerCase();
30818
+ const parameters = new NullObject;
30819
+ parameter:
30820
+ while (index < len) {
30821
+ index = skipOWS(header, index + 1, len);
30822
+ const keyStart = index;
30823
+ while (index < len) {
30824
+ const char = header.charCodeAt(index);
30825
+ if (char === SEMI)
30826
+ continue parameter;
30827
+ if (char === EQ) {
30828
+ const keyEnd = trailingOWS(header, keyStart, index);
30829
+ const key = header.slice(keyStart, keyEnd).toLowerCase();
30830
+ index = skipOWS(header, index + 1, len);
30831
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
30832
+ index++;
30833
+ let value = "";
30834
+ if (multipart) {
30835
+ while (index < len) {
30836
+ const code = header.charCodeAt(index++);
30837
+ if (code === DQUOTE) {
30838
+ index = parseToken(header, index, len);
30839
+ if (parameters[key] === undefined)
30840
+ parameters[key] = value;
30841
+ break;
30842
+ }
30843
+ if (code === 37 && index + 1 < len) {
30844
+ const code2 = header.charCodeAt(index);
30845
+ const code3 = header.charCodeAt(index + 1);
30846
+ if (code2 === 50 && code3 === 50) {
30847
+ value += '"';
30848
+ index += 2;
30849
+ continue;
30850
+ }
30851
+ if (code2 === 48) {
30852
+ if (code3 === 100 || code3 === 68) {
30853
+ value += "\r";
30854
+ index += 2;
30855
+ continue;
30856
+ }
30857
+ if (code3 === 97 || code3 === 65) {
30858
+ value += `
30859
+ `;
30860
+ index += 2;
30861
+ continue;
30862
+ }
30863
+ }
30864
+ }
30865
+ value += String.fromCharCode(code);
30866
+ }
30867
+ } else {
30868
+ while (index < len) {
30869
+ const code = header.charCodeAt(index++);
30870
+ if (code === DQUOTE) {
30871
+ index = parseToken(header, index, len);
30872
+ if (parameters[key] === undefined)
30873
+ parameters[key] = value;
30874
+ break;
30875
+ }
30876
+ if (code === BSLASH && index < len) {
30877
+ value += header[index++];
30878
+ continue;
30879
+ }
30880
+ value += String.fromCharCode(code);
30881
+ }
30882
+ }
30883
+ continue parameter;
30884
+ }
30885
+ const valueStart = index;
30886
+ index = parseToken(header, index, len);
30887
+ const valueEnd = trailingOWS(header, valueStart, index);
30888
+ const value = header.slice(valueStart, valueEnd);
30889
+ if (parameters[key] === undefined) {
30890
+ parameters[key] = value;
30891
+ if (extended && key.charCodeAt(key.length - 1) === ASTERISK) {
30892
+ const normalizedKey = key.slice(0, -1);
30893
+ const decoded = decodeExtended(value);
30894
+ if (decoded !== undefined)
30895
+ parameters[normalizedKey] = decoded;
30896
+ }
30897
+ }
30898
+ continue parameter;
30899
+ }
30900
+ index++;
30901
+ }
30902
+ }
30903
+ return { type, parameters };
30904
+ }
30719
30905
  var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
30720
- var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g;
30721
- var QESC_REGEXP = /\\([\u0000-\u007f])/g;
30722
- var QUOTE_REGEXP = /([\\"])/g;
30723
- var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g;
30724
- var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]+$/;
30906
+ var NON_ASCII_REGEXP = /[^\x20-\x7e]/g;
30907
+ var QUOTE_REGEXP = /[\\"]/g;
30908
+ var INVALID_FILENAME_REGEXP = /%[0-9A-Fa-f]{2}/;
30909
+ var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]*$/;
30910
+ var ASCII_TEXT_REGEXP = /^[\x20-\x7e]*$/;
30725
30911
  var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/;
30726
- var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/;
30727
- var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;
30728
- function contentDisposition(filename, options) {
30729
- var opts = options || {};
30730
- var type = opts.type || "attachment";
30731
- var params = createparams(filename, opts.fallback);
30732
- return format(new ContentDisposition(type, params));
30733
- }
30734
- function createparams(filename, fallback) {
30735
- if (filename === undefined) {
30912
+ function createParameters(filename, fallback = true) {
30913
+ if (filename === undefined)
30736
30914
  return;
30915
+ if (typeof fallback === "string") {
30916
+ if (!ASCII_TEXT_REGEXP.test(fallback)) {
30917
+ throw new TypeError("Fallback must be valid US-ASCII: " + fallback);
30918
+ }
30919
+ if (fallback === filename)
30920
+ return { filename };
30921
+ return { filename: fallback, "filename*": encodeExtended(filename) };
30737
30922
  }
30738
- var params = {};
30739
- if (typeof filename !== "string") {
30740
- throw new TypeError("filename must be a string");
30741
- }
30742
- if (fallback === undefined) {
30743
- fallback = true;
30744
- }
30745
- if (typeof fallback !== "string" && typeof fallback !== "boolean") {
30746
- throw new TypeError("fallback must be a string or boolean");
30747
- }
30748
- if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
30749
- throw new TypeError("fallback must be ISO-8859-1 string");
30750
- }
30751
- var name = basename(filename);
30752
- var isQuotedString = TEXT_REGEXP.test(name);
30753
- var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename(fallback);
30754
- var hasFallback = typeof fallbackName === "string" && fallbackName !== name;
30755
- if (hasFallback || !isQuotedString || hasHexEscape(name)) {
30756
- params["filename*"] = name;
30923
+ if (ASCII_TEXT_REGEXP.test(filename) && !INVALID_FILENAME_REGEXP.test(filename)) {
30924
+ return { filename };
30757
30925
  }
30758
- if (isQuotedString || hasFallback) {
30759
- params.filename = hasFallback ? fallbackName : name;
30926
+ if (fallback === false) {
30927
+ return { "filename*": encodeExtended(filename) };
30760
30928
  }
30761
- return params;
30929
+ return {
30930
+ filename: getAscii(filename),
30931
+ "filename*": encodeExtended(filename)
30932
+ };
30762
30933
  }
30763
- function format(obj) {
30764
- var parameters = obj.parameters;
30765
- var type = obj.type;
30766
- if (!type || typeof type !== "string" || !TOKEN_REGEXP.test(type)) {
30767
- throw new TypeError("invalid type");
30768
- }
30769
- var string = String(type).toLowerCase();
30770
- if (parameters && typeof parameters === "object") {
30771
- var param;
30772
- var params = Object.keys(parameters).sort();
30773
- for (var i = 0;i < params.length; i++) {
30774
- param = params[i];
30775
- var val = param.slice(-1) === "*" ? ustring(parameters[param]) : qstring(parameters[param]);
30776
- string += "; " + param + "=" + val;
30777
- }
30934
+ function decodeExtended(str) {
30935
+ const charsetEnd = str.indexOf("'");
30936
+ if (charsetEnd <= 0) {
30937
+ return;
30778
30938
  }
30779
- return string;
30780
- }
30781
- function decodefield(str) {
30782
- const match = EXT_VALUE_REGEXP.exec(str);
30783
- if (!match) {
30784
- throw new TypeError("invalid extended field value");
30939
+ const languageEnd = str.indexOf("'", charsetEnd + 1);
30940
+ if (languageEnd === -1) {
30941
+ return;
30785
30942
  }
30786
- const charset = match[1].toLowerCase();
30787
- const encoded = match[2];
30943
+ const charset = str.slice(0, charsetEnd).toLowerCase();
30944
+ const encoded = str.slice(languageEnd + 1);
30788
30945
  switch (charset) {
30789
30946
  case "iso-8859-1": {
30790
- const binary = decodeHexEscapes(encoded);
30791
- return getlatin1(binary);
30947
+ return decodeHexEscapes(encoded);
30792
30948
  }
30793
30949
  case "utf-8":
30794
30950
  case "utf8": {
30795
- try {
30796
- return decodeURIComponent(encoded);
30797
- } catch {
30798
- const binary = decodeHexEscapes(encoded);
30799
- const bytes = new Uint8Array(binary.length);
30800
- for (let idx = 0;idx < binary.length; idx++) {
30801
- bytes[idx] = binary.charCodeAt(idx);
30802
- }
30803
- return utf8Decoder.decode(bytes);
30804
- }
30951
+ return tryDecodeURIComponent(encoded);
30805
30952
  }
30806
30953
  }
30807
- throw new TypeError("unsupported charset in extended field");
30954
+ return;
30808
30955
  }
30809
- function getlatin1(val) {
30810
- return String(val).replace(NON_LATIN1_REGEXP, "?");
30956
+ function tryDecodeURIComponent(str) {
30957
+ try {
30958
+ return decodeURIComponent(str);
30959
+ } catch {
30960
+ return;
30961
+ }
30811
30962
  }
30812
- function parse(string) {
30813
- if (!string || typeof string !== "string") {
30814
- throw new TypeError("argument string is required");
30963
+ function parseToken(str, index, len) {
30964
+ while (index < len) {
30965
+ const char = str.charCodeAt(index);
30966
+ if (char === SEMI)
30967
+ break;
30968
+ index++;
30815
30969
  }
30816
- var match = DISPOSITION_TYPE_REGEXP.exec(string);
30817
- if (!match) {
30818
- throw new TypeError("invalid type format");
30970
+ return index;
30971
+ }
30972
+ function skipOWS(str, index, len) {
30973
+ while (index < len) {
30974
+ const char = str.charCodeAt(index);
30975
+ if (char !== SP && char !== HTAB)
30976
+ break;
30977
+ index++;
30819
30978
  }
30820
- var index = match[0].length;
30821
- var type = match[1].toLowerCase();
30822
- var key;
30823
- var names = [];
30824
- var params = {};
30825
- var value;
30826
- index = PARAM_REGEXP.lastIndex = match[0].slice(-1) === ";" ? index - 1 : index;
30827
- while (match = PARAM_REGEXP.exec(string)) {
30828
- if (match.index !== index) {
30829
- throw new TypeError("invalid parameter format");
30830
- }
30831
- index += match[0].length;
30832
- key = match[1].toLowerCase();
30833
- value = match[2];
30834
- if (names.indexOf(key) !== -1) {
30835
- throw new TypeError("invalid duplicate parameter");
30836
- }
30837
- names.push(key);
30838
- if (key.indexOf("*") + 1 === key.length) {
30839
- key = key.slice(0, -1);
30840
- value = decodefield(value);
30841
- params[key] = value;
30842
- continue;
30843
- }
30844
- if (typeof params[key] === "string") {
30845
- continue;
30846
- }
30847
- if (value[0] === '"') {
30848
- value = value.slice(1, -1).replace(QESC_REGEXP, "$1");
30849
- }
30850
- params[key] = value;
30979
+ return index;
30980
+ }
30981
+ function trailingOWS(str, start, end) {
30982
+ while (end > start) {
30983
+ const char = str.charCodeAt(end - 1);
30984
+ if (char !== SP && char !== HTAB)
30985
+ break;
30986
+ end--;
30851
30987
  }
30852
- if (index !== -1 && index !== string.length) {
30853
- throw new TypeError("invalid parameter format");
30988
+ return end;
30989
+ }
30990
+ function format(obj, options) {
30991
+ const { type, parameters } = obj;
30992
+ const multipart = options?.multipart === true;
30993
+ const extended = options?.extended !== false;
30994
+ if (!type || !TOKEN_REGEXP.test(type)) {
30995
+ throw new TypeError("Invalid type: " + type);
30996
+ }
30997
+ let result = type;
30998
+ if (parameters) {
30999
+ for (const param of Object.keys(parameters)) {
31000
+ const value = parameters[param];
31001
+ if (!TOKEN_REGEXP.test(param)) {
31002
+ throw new TypeError("Invalid parameter name: " + param);
31003
+ }
31004
+ if (multipart) {
31005
+ result += "; " + param + "=" + qmultipart(value);
31006
+ continue;
31007
+ }
31008
+ if (TOKEN_REGEXP.test(value)) {
31009
+ result += "; " + param + "=" + value;
31010
+ continue;
31011
+ }
31012
+ if (TEXT_REGEXP.test(value)) {
31013
+ result += "; " + param + "=" + qstring(value);
31014
+ continue;
31015
+ }
31016
+ if (!extended) {
31017
+ throw new TypeError("Invalid parameter value: " + value);
31018
+ }
31019
+ result += "; " + param + "*=" + encodeExtended(value);
31020
+ }
30854
31021
  }
30855
- return new ContentDisposition(type, params);
31022
+ return result;
31023
+ }
31024
+ function getAscii(val) {
31025
+ return val.replace(NON_ASCII_REGEXP, "?");
30856
31026
  }
30857
31027
  function pencode(char) {
30858
- return "%" + String(char).charCodeAt(0).toString(16).toUpperCase();
31028
+ return "%" + char.charCodeAt(0).toString(16).toUpperCase();
30859
31029
  }
30860
- function qstring(val) {
30861
- var str = String(val);
30862
- return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
31030
+ function qstring(str) {
31031
+ return '"' + str.replace(QUOTE_REGEXP, "\\$&") + '"';
30863
31032
  }
30864
- function ustring(val) {
30865
- var str = String(val);
30866
- var encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
30867
- return "UTF-8''" + encoded;
31033
+ function qmultipart(str) {
31034
+ return '"' + str.replace(/[\n\r"]/g, multipartEscape) + '"';
30868
31035
  }
30869
- function ContentDisposition(type, parameters) {
30870
- this.type = type;
30871
- this.parameters = parameters;
31036
+ function multipartEscape(char) {
31037
+ if (char === `
31038
+ `)
31039
+ return "%0A";
31040
+ if (char === "\r")
31041
+ return "%0D";
31042
+ return "%22";
30872
31043
  }
30873
- function basename(path) {
30874
- const normalized = path.replaceAll("\\", "/");
30875
- let end = normalized.length;
30876
- while (end > 0 && normalized[end - 1] === "/") {
30877
- end--;
30878
- }
30879
- if (end === 0) {
30880
- return "";
30881
- }
30882
- let start = end - 1;
30883
- while (start >= 0 && normalized[start] !== "/") {
30884
- start--;
30885
- }
30886
- return normalized.slice(start + 1, end);
31044
+ function encodeExtended(str) {
31045
+ const encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
31046
+ return "UTF-8''" + encoded;
30887
31047
  }
30888
31048
  function isHexDigit(char) {
30889
31049
  const code = char.charCodeAt(0);
30890
31050
  return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
30891
31051
  }
30892
- function hasHexEscape(str) {
30893
- const maxIndex = str.length - 3;
30894
- let lastIndex = -1;
30895
- while ((lastIndex = str.indexOf("%", lastIndex + 1)) !== -1 && lastIndex <= maxIndex) {
30896
- if (isHexDigit(str[lastIndex + 1]) && isHexDigit(str[lastIndex + 2])) {
30897
- return true;
30898
- }
30899
- }
30900
- return false;
30901
- }
30902
31052
  function decodeHexEscapes(str) {
30903
31053
  const firstEscape = str.indexOf("%");
30904
31054
  if (firstEscape === -1)
@@ -31699,7 +31849,7 @@ var require_response = __commonJS(function(exports, module) {
31699
31849
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
31700
31850
  * MIT Licensed
31701
31851
  */
31702
- var contentDisposition = require_content_disposition();
31852
+ var contentDisposition = require_dist6();
31703
31853
  var createError = require_http_errors();
31704
31854
  var deprecate = require_depd()("express");
31705
31855
  var encodeUrl = require_encodeurl();
@@ -31718,6 +31868,7 @@ var require_response = __commonJS(function(exports, module) {
31718
31868
  var send = require_send();
31719
31869
  var extname = path.extname;
31720
31870
  var resolve = path.resolve;
31871
+ var basename = path.basename;
31721
31872
  var vary = require_vary();
31722
31873
  var { Buffer: Buffer2 } = __require("node:buffer");
31723
31874
  var res = Object.create(http.ServerResponse.prototype);
@@ -31750,11 +31901,14 @@ var require_response = __commonJS(function(exports, module) {
31750
31901
  var chunk = body;
31751
31902
  var encoding;
31752
31903
  var req = this.req;
31753
- var type;
31754
31904
  var app = this.app;
31755
31905
  switch (typeof chunk) {
31756
31906
  case "string":
31757
- if (!this.get("Content-Type")) {
31907
+ encoding = "utf8";
31908
+ const type = this.get("Content-Type");
31909
+ if (typeof type === "string") {
31910
+ this.set("Content-Type", setCharset(type, "utf-8"));
31911
+ } else {
31758
31912
  this.type("html");
31759
31913
  }
31760
31914
  break;
@@ -31772,13 +31926,6 @@ var require_response = __commonJS(function(exports, module) {
31772
31926
  }
31773
31927
  break;
31774
31928
  }
31775
- if (typeof chunk === "string") {
31776
- encoding = "utf8";
31777
- type = this.get("Content-Type");
31778
- if (typeof type === "string") {
31779
- this.set("Content-Type", setCharset(type, "utf-8"));
31780
- }
31781
- }
31782
31929
  var etagFn = app.get("etag fn");
31783
31930
  var generateETag = !this.get("ETag") && typeof etagFn === "function";
31784
31931
  var len;
@@ -31792,7 +31939,9 @@ var require_response = __commonJS(function(exports, module) {
31792
31939
  encoding = undefined;
31793
31940
  len = chunk.length;
31794
31941
  }
31795
- this.set("Content-Length", len);
31942
+ if (!this.get("Transfer-Encoding")) {
31943
+ this.set("Content-Length", len);
31944
+ }
31796
31945
  }
31797
31946
  var etag;
31798
31947
  if (generateETag && len !== undefined) {
@@ -31913,7 +32062,7 @@ var require_response = __commonJS(function(exports, module) {
31913
32062
  opts = filename;
31914
32063
  }
31915
32064
  var headers = {
31916
- "Content-Disposition": contentDisposition(name || path)
32065
+ "Content-Disposition": contentDisposition.create(basename(name || path))
31917
32066
  };
31918
32067
  if (opts && opts.headers) {
31919
32068
  var keys = Object.keys(opts.headers);
@@ -31956,10 +32105,11 @@ var require_response = __commonJS(function(exports, module) {
31956
32105
  return this;
31957
32106
  };
31958
32107
  res.attachment = function attachment(filename) {
31959
- if (filename) {
31960
- this.type(extname(filename));
32108
+ const name = filename !== undefined ? basename(filename) : undefined;
32109
+ if (name) {
32110
+ this.type(extname(name));
31961
32111
  }
31962
- this.set("Content-Disposition", contentDisposition(filename));
32112
+ this.set("Content-Disposition", contentDisposition.create(name));
31963
32113
  return this;
31964
32114
  };
31965
32115
  res.append = function append(field, val) {
@@ -32046,7 +32196,7 @@ var require_response = __commonJS(function(exports, module) {
32046
32196
  },
32047
32197
  html: function() {
32048
32198
  var u = escapeHtml(address);
32049
- body = "<p>" + statuses.message[status] + ". Redirecting to " + u + "</p>";
32199
+ body = "<!DOCTYPE html><head><title>" + statuses.message[status] + "</title></head>" + "<body><p>" + statuses.message[status] + ". Redirecting to " + u + "</p></body>";
32050
32200
  },
32051
32201
  default: function() {
32052
32202
  body = "";
@@ -41715,6 +41865,8 @@ var require_utils4 = __commonJS(function(exports, module) {
41715
41865
  var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
41716
41866
  var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
41717
41867
  var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
41868
+ var isRegNameCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]$/u);
41869
+ var isLiteralRegName = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]*$/u);
41718
41870
  function stringArrayToHexStripped(input) {
41719
41871
  let acc = "";
41720
41872
  let code = 0;
@@ -41944,13 +42096,16 @@ var require_utils4 = __commonJS(function(exports, module) {
41944
42096
  }
41945
42097
  return output.join("");
41946
42098
  }
41947
- var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
41948
- var HOST_DELIM_RE = /[@/?#:]/g;
41949
- var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
41950
- function reescapeHostDelimiters(host, isIP) {
41951
- const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
41952
- re.lastIndex = 0;
41953
- return host.replace(re, (ch) => HOST_DELIMS[ch]);
42099
+ var IP_HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23" };
42100
+ var IP_HOST_DELIM_RE = /[@/?#]/g;
42101
+ function encodeHost(host, isIP, allowNonAscii = false) {
42102
+ if (!isIP) {
42103
+ if (isLiteralRegName(host))
42104
+ return host;
42105
+ return encodeComponent(host, isRegNameCharacter, allowNonAscii);
42106
+ }
42107
+ IP_HOST_DELIM_RE.lastIndex = 0;
42108
+ return host.replace(IP_HOST_DELIM_RE, (ch) => IP_HOST_DELIMS[ch]);
41954
42109
  }
41955
42110
  function normalizePercentEncoding(input, decodeUnreserved = false) {
41956
42111
  if (input.indexOf("%") === -1) {
@@ -42116,7 +42271,7 @@ var require_utils4 = __commonJS(function(exports, module) {
42116
42271
  }
42117
42272
  return output;
42118
42273
  }
42119
- function encodeComponent(input, isAllowed) {
42274
+ function encodeComponent(input, isAllowed, allowNonAscii = false) {
42120
42275
  let output = "";
42121
42276
  for (let i = 0;i < input.length; i++) {
42122
42277
  const ch = input[i];
@@ -42135,17 +42290,17 @@ var require_utils4 = __commonJS(function(exports, module) {
42135
42290
  if (code < 128) {
42136
42291
  output += BYTE_HEX[code];
42137
42292
  } else if (code < 55296 || code > 57343) {
42138
- output += percentEncodeNonAscii(code);
42293
+ output += allowNonAscii ? ch : percentEncodeNonAscii(code);
42139
42294
  } else if (code <= 56319 && i + 1 < input.length) {
42140
42295
  const low = input.charCodeAt(i + 1);
42141
42296
  if (low >= 56320 && low <= 57343) {
42142
- output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
42297
+ output += allowNonAscii ? ch + input[i + 1] : percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
42143
42298
  i++;
42144
42299
  } else {
42145
- output += percentEncodeNonAscii(65533);
42300
+ output += allowNonAscii ? "�" : percentEncodeNonAscii(65533);
42146
42301
  }
42147
42302
  } else {
42148
- output += percentEncodeNonAscii(65533);
42303
+ output += allowNonAscii ? "�" : percentEncodeNonAscii(65533);
42149
42304
  }
42150
42305
  }
42151
42306
  }
@@ -42207,7 +42362,7 @@ var require_utils4 = __commonJS(function(exports, module) {
42207
42362
  }
42208
42363
  return;
42209
42364
  }
42210
- function recomposeAuthority(component) {
42365
+ function recomposeAuthority(component, allowNonAscii = false) {
42211
42366
  const uriTokens = [];
42212
42367
  if (component.userinfo !== undefined) {
42213
42368
  uriTokens.push(encodeUserinfo(component.userinfo));
@@ -42228,7 +42383,7 @@ var require_utils4 = __commonJS(function(exports, module) {
42228
42383
  if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
42229
42384
  host = `[${ipV6res.escapedHost}]`;
42230
42385
  } else {
42231
- host = reescapeHostDelimiters(host, false);
42386
+ host = encodeHost(host, false, allowNonAscii);
42232
42387
  }
42233
42388
  }
42234
42389
  }
@@ -42250,7 +42405,7 @@ var require_utils4 = __commonJS(function(exports, module) {
42250
42405
  nonSimpleDomain,
42251
42406
  nonSimpleMailtoDomain,
42252
42407
  recomposeAuthority,
42253
- reescapeHostDelimiters,
42408
+ encodeHost,
42254
42409
  normalizePercentEncoding,
42255
42410
  normalizePathEncoding,
42256
42411
  serializePathEncoding,
@@ -42415,7 +42570,8 @@ var require_schemes = __commonJS(function(exports, module) {
42415
42570
  scheme: "urn",
42416
42571
  parse: urnParse,
42417
42572
  serialize: urnSerialize,
42418
- skipNormalize: true
42573
+ skipNormalize: true,
42574
+ absolutePath: true
42419
42575
  };
42420
42576
  var urnuuid = {
42421
42577
  scheme: "urn:uuid",
@@ -42694,7 +42850,7 @@ var require_schemes = __commonJS(function(exports, module) {
42694
42850
 
42695
42851
  // node_modules/fast-uri/index.js
42696
42852
  var require_fast_uri = __commonJS(function(exports, module) {
42697
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils4();
42853
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, encodeHost, isIPv4, nonSimpleDomain } = require_utils4();
42698
42854
  var { SCHEMES, getSchemeHandler } = require_schemes();
42699
42855
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
42700
42856
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
@@ -42718,6 +42874,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
42718
42874
  const {
42719
42875
  parsed: baseParsed,
42720
42876
  malformedAuthorityOrPort: baseMalformed,
42877
+ malformedReferenceEdge: baseMalformedReferenceEdge,
42721
42878
  malformedPercentEncoding: baseMalformedPercentEncoding,
42722
42879
  malformedSchemeSpecific: baseMalformedSchemeSpecific,
42723
42880
  malformedHost: baseMalformedHost,
@@ -42726,17 +42883,21 @@ var require_fast_uri = __commonJS(function(exports, module) {
42726
42883
  const {
42727
42884
  parsed: relativeParsed,
42728
42885
  malformedAuthorityOrPort: relativeMalformed,
42886
+ malformedReferenceEdge: relativeMalformedReferenceEdge,
42729
42887
  malformedPercentEncoding: relativeMalformedPercentEncoding,
42730
42888
  malformedSchemeSpecific: relativeMalformedSchemeSpecific,
42731
42889
  malformedHost: relativeMalformedHost,
42732
42890
  malformedScheme: relativeMalformedScheme
42733
42891
  } = parseWithStatus(relativeURI, schemelessOptions);
42734
- if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
42892
+ if (baseMalformed || relativeMalformed || baseMalformedReferenceEdge || relativeMalformedReferenceEdge || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
42735
42893
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
42736
42894
  }
42737
42895
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
42738
42896
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
42739
42897
  const resolvedHost = resolved.host;
42898
+ if ((resolved.scheme === "http" || resolved.scheme === "https") && !resolvedHost) {
42899
+ throw new Error("HTTP URIs must have a host.");
42900
+ }
42740
42901
  const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
42741
42902
  canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
42742
42903
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
@@ -42744,6 +42905,9 @@ var require_fast_uri = __commonJS(function(exports, module) {
42744
42905
  throw new Error(resolved.error);
42745
42906
  }
42746
42907
  schemelessOptions.skipEscape = true;
42908
+ if (resolvedSchemeHandler && resolvedSchemeHandler.absolutePath) {
42909
+ schemelessOptions.absolutePath = true;
42910
+ }
42747
42911
  return serialize(resolved, schemelessOptions);
42748
42912
  }
42749
42913
  function copyHost(target, source) {
@@ -42764,7 +42928,8 @@ var require_fast_uri = __commonJS(function(exports, module) {
42764
42928
  target.userinfo = relative.userinfo;
42765
42929
  copyHost(target, relative);
42766
42930
  target.port = relative.port;
42767
- target.path = removeDotSegments(relative.path || "");
42931
+ const relativeSchemeHandler = getSchemeHandler(relative.scheme);
42932
+ target.path = relativeSchemeHandler && relativeSchemeHandler.absolutePath ? relative.path || "" : removeDotSegments(relative.path || "");
42768
42933
  target.query = relative.query;
42769
42934
  } else {
42770
42935
  if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
@@ -42853,7 +43018,8 @@ var require_fast_uri = __commonJS(function(exports, module) {
42853
43018
  component.scheme = decodeValidScheme(component.scheme);
42854
43019
  uriTokens.push(component.scheme, ":");
42855
43020
  }
42856
- const authority = recomposeAuthority(component);
43021
+ const allowNonAsciiHost = options.unicodeSupport === true || Boolean(schemeHandler && schemeHandler.unicodeSupport);
43022
+ const authority = recomposeAuthority(component, allowNonAsciiHost);
42857
43023
  if (authority !== undefined) {
42858
43024
  if (options.reference !== "suffix") {
42859
43025
  uriTokens.push("//");
@@ -42939,6 +43105,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
42939
43105
  fragment: undefined
42940
43106
  };
42941
43107
  let malformedAuthorityOrPort = false;
43108
+ const malformedReferenceEdge = uri.length !== 0 && (uri.charCodeAt(0) <= 32 || uri.charCodeAt(uri.length - 1) <= 32);
42942
43109
  let malformedPercentEncoding = false;
42943
43110
  let malformedSchemeSpecific = false;
42944
43111
  let malformedHost = false;
@@ -42971,6 +43138,9 @@ var require_fast_uri = __commonJS(function(exports, module) {
42971
43138
  }
42972
43139
  }
42973
43140
  }
43141
+ if (malformedReferenceEdge) {
43142
+ parsed.error = parsed.error || "URI must not contain leading or trailing C0 controls or spaces.";
43143
+ }
42974
43144
  const matches = uri.match(URI_PARSE);
42975
43145
  if (matches) {
42976
43146
  parsed.scheme = matches[1];
@@ -43037,12 +43207,18 @@ var require_fast_uri = __commonJS(function(exports, module) {
43037
43207
  if (!malformedIPLiteral) {
43038
43208
  malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
43039
43209
  }
43040
- if (uri.indexOf("%") !== -1 && parsed.host !== undefined && !malformedIPLiteral) {
43041
- let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
43042
- if (!isIP) {
43210
+ if (parsed.host !== undefined && !malformedIPLiteral) {
43211
+ let host = parsed.host;
43212
+ if (uri.indexOf("%") !== -1 && !isIP) {
43213
+ host = normalizePercentEncoding(host, true);
43043
43214
  host = normalizePercentEncoding(host.toLowerCase());
43044
43215
  }
43045
- parsed.host = reescapeHostDelimiters(host, isIP);
43216
+ if (options.scheme !== "null") {
43217
+ const allowNonAsciiHost = options.unicodeSupport === true || Boolean(schemeHandler && schemeHandler.unicodeSupport);
43218
+ parsed.host = encodeHost(host, isIP, allowNonAsciiHost);
43219
+ } else {
43220
+ parsed.host = host;
43221
+ }
43046
43222
  }
43047
43223
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
43048
43224
  if (parsed.path) {
@@ -43064,7 +43240,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
43064
43240
  } else {
43065
43241
  parsed.error = parsed.error || "URI can not be parsed.";
43066
43242
  }
43067
- return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
43243
+ return { parsed, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
43068
43244
  }
43069
43245
  function parse(uri, opts) {
43070
43246
  return parseWithStatus(uri, opts).parsed;
@@ -43073,10 +43249,11 @@ var require_fast_uri = __commonJS(function(exports, module) {
43073
43249
  return normalizeStringWithStatus(uri, opts).normalized;
43074
43250
  }
43075
43251
  function normalizeStringWithStatus(uri, opts) {
43076
- const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
43252
+ const { parsed, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
43077
43253
  return {
43078
- normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
43254
+ normalized: malformedAuthorityOrPort || malformedReferenceEdge || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
43079
43255
  malformedAuthorityOrPort,
43256
+ malformedReferenceEdge,
43080
43257
  malformedPercentEncoding,
43081
43258
  malformedSchemeSpecific,
43082
43259
  malformedHost,
@@ -43093,8 +43270,8 @@ var require_fast_uri = __commonJS(function(exports, module) {
43093
43270
  } catch {
43094
43271
  return;
43095
43272
  }
43096
- const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
43097
- return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
43273
+ const { normalized, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
43274
+ return malformedAuthorityOrPort || malformedReferenceEdge || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
43098
43275
  }
43099
43276
  var fastUri = {
43100
43277
  SCHEMES,
@@ -51327,7 +51504,7 @@ var require_limit = __commonJS(function(exports) {
51327
51504
  });
51328
51505
 
51329
51506
  // node_modules/ajv-formats/dist/index.js
51330
- var require_dist5 = __commonJS(function(exports, module) {
51507
+ var require_dist7 = __commonJS(function(exports, module) {
51331
51508
  Object.defineProperty(exports, "__esModule", { value: true });
51332
51509
  var formats_1 = require_formats2();
51333
51510
  var limit_1 = require_limit();
@@ -51405,7 +51582,7 @@ class AjvJsonSchemaValidator {
51405
51582
  var import_ajv, import_ajv_formats;
51406
51583
  var init_ajv_provider = __esm(() => {
51407
51584
  import_ajv = __toESM(require_ajv(), 1);
51408
- import_ajv_formats = __toESM(require_dist5(), 1);
51585
+ import_ajv_formats = __toESM(require_dist7(), 1);
51409
51586
  });
51410
51587
 
51411
51588
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
@@ -52802,9 +52979,9 @@ var init_config = __esm(() => {
52802
52979
  SDK_METADATA = {
52803
52980
  language: "typescript",
52804
52981
  openapiDocVersion: "0.1.0",
52805
- sdkVersion: "0.0.66",
52982
+ sdkVersion: "0.0.68",
52806
52983
  genVersion: "2.915.1",
52807
- userAgent: "speakeasy-sdk/mcp-typescript 0.0.66 2.915.1 0.1.0 @dalmia/calibrate-mcp"
52984
+ userAgent: "speakeasy-sdk/mcp-typescript 0.0.68 2.915.1 0.1.0 @dalmia/calibrate-mcp"
52808
52985
  };
52809
52986
  });
52810
52987
 
@@ -61606,7 +61783,7 @@ hits its trace limit.
61606
61783
  function createMCPServer(deps) {
61607
61784
  const server = new McpServer({
61608
61785
  name: "CalibrateMcp",
61609
- version: "0.0.66"
61786
+ version: "0.0.68"
61610
61787
  });
61611
61788
  const getClient = deps.getSDK || (() => new CalibrateMcpCore({
61612
61789
  security: deps.security,
@@ -62895,7 +63072,7 @@ http_headers = { "api-key-auth" = "YOUR_API_KEY_AUTH" }`;
62895
63072
  <h1>Instructions</h1>
62896
63073
  <p>One-click installation for Claude Desktop users</p>
62897
63074
  <div class="instruction-item">
62898
- <a href="https://github.com/dalmia/calibrate-mcp/releases/download/v0.0.66/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
63075
+ <a href="https://github.com/dalmia/calibrate-mcp/releases/download/v0.0.68/mcp-server.mcpb" download="mcp-server.mcpb" class="action-button header-action" style="display: inline-flex; margin-bottom: 16px;">
62899
63076
  \uD83D\uDCE5 Download MCP Bundle
62900
63077
  </a>
62901
63078
  </div>
@@ -63123,6 +63300,76 @@ var init_impl = __esm(() => {
63123
63300
  import_express = __toESM(require_express(), 1);
63124
63301
  });
63125
63302
 
63303
+ // node_modules/content-type/index.js
63304
+ function parse6(string) {
63305
+ if (!string) {
63306
+ throw new TypeError("argument string is required");
63307
+ }
63308
+ var header = typeof string === "object" ? getcontenttype(string) : string;
63309
+ if (typeof header !== "string") {
63310
+ throw new TypeError("argument string is required to be a string");
63311
+ }
63312
+ var index = header.indexOf(";");
63313
+ var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
63314
+ if (!TYPE_REGEXP.test(type)) {
63315
+ throw new TypeError("invalid media type");
63316
+ }
63317
+ var obj = new ContentType(type.toLowerCase());
63318
+ if (index !== -1) {
63319
+ var key;
63320
+ var match;
63321
+ var value;
63322
+ PARAM_REGEXP.lastIndex = index;
63323
+ while (match = PARAM_REGEXP.exec(header)) {
63324
+ if (match.index !== index) {
63325
+ throw new TypeError("invalid parameter format");
63326
+ }
63327
+ index += match[0].length;
63328
+ key = match[1].toLowerCase();
63329
+ value = match[2];
63330
+ if (value.charCodeAt(0) === 34) {
63331
+ value = value.slice(1, -1);
63332
+ if (value.indexOf("\\") !== -1) {
63333
+ value = value.replace(QESC_REGEXP, "$1");
63334
+ }
63335
+ }
63336
+ obj.parameters[key] = value;
63337
+ }
63338
+ if (index !== header.length) {
63339
+ throw new TypeError("invalid parameter format");
63340
+ }
63341
+ }
63342
+ return obj;
63343
+ }
63344
+ function getcontenttype(obj) {
63345
+ var header;
63346
+ if (typeof obj.getHeader === "function") {
63347
+ header = obj.getHeader("content-type");
63348
+ } else if (typeof obj.headers === "object") {
63349
+ header = obj.headers && obj.headers["content-type"];
63350
+ }
63351
+ if (typeof header !== "string") {
63352
+ throw new TypeError("content-type header is missing from object");
63353
+ }
63354
+ return header;
63355
+ }
63356
+ function ContentType(type) {
63357
+ this.parameters = Object.create(null);
63358
+ this.type = type;
63359
+ }
63360
+ var PARAM_REGEXP, QESC_REGEXP, TYPE_REGEXP, $parse;
63361
+ var init_content_type = __esm(() => {
63362
+ /*!
63363
+ * content-type
63364
+ * Copyright(c) 2015 Douglas Christopher Wilson
63365
+ * MIT Licensed
63366
+ */
63367
+ PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
63368
+ QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
63369
+ TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
63370
+ $parse = parse6;
63371
+ });
63372
+
63126
63373
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js
63127
63374
  import { randomUUID } from "node:crypto";
63128
63375
  import { URL as URL2 } from "node:url";
@@ -63191,7 +63438,7 @@ data: ${relativeUrlWithSession}
63191
63438
  const requestInfo = { headers: req.headers };
63192
63439
  let body;
63193
63440
  try {
63194
- const ct = import_content_type.default.parse(req.headers["content-type"] ?? "");
63441
+ const ct = $parse(req.headers["content-type"] ?? "");
63195
63442
  if (ct.type !== "application/json") {
63196
63443
  throw new Error(`Unsupported content-type: ${ct.type}`);
63197
63444
  }
@@ -63240,11 +63487,11 @@ data: ${JSON.stringify(message)}
63240
63487
  return this._sessionId;
63241
63488
  }
63242
63489
  }
63243
- var import_raw_body, import_content_type, MAXIMUM_MESSAGE_SIZE = "4mb";
63490
+ var import_raw_body, MAXIMUM_MESSAGE_SIZE = "4mb";
63244
63491
  var init_sse = __esm(() => {
63245
63492
  init_types();
63493
+ init_content_type();
63246
63494
  import_raw_body = __toESM(require_raw_body(), 1);
63247
- import_content_type = __toESM(require_content_type(), 1);
63248
63495
  });
63249
63496
 
63250
63497
  // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
@@ -65779,7 +66026,7 @@ var routes = buildRouteMap({
65779
66026
  var app = buildApplication(routes, {
65780
66027
  name: "mcp",
65781
66028
  versionInfo: {
65782
- currentVersion: "0.0.66"
66029
+ currentVersion: "0.0.68"
65783
66030
  }
65784
66031
  });
65785
66032
  run(app, process3.argv.slice(2), buildContext(process3));
@@ -65787,5 +66034,5 @@ export {
65787
66034
  app
65788
66035
  };
65789
66036
 
65790
- //# debugId=06973EA2094C0A0264756E2164756E21
66037
+ //# debugId=EE93391F8D4C1CAE64756E2164756E21
65791
66038
  //# sourceMappingURL=mcp-server.js.map