@zuplo/cli 6.70.16 → 6.70.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/cli.js +0 -6
  2. package/dist/cli.js.map +1 -1
  3. package/node_modules/@cfworker/json-schema/README.md +75 -0
  4. package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.d.ts +1 -0
  5. package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.js +42 -0
  6. package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.d.ts +7 -0
  7. package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.js +147 -0
  8. package/node_modules/@cfworker/json-schema/dist/commonjs/format.d.ts +1 -0
  9. package/node_modules/@cfworker/json-schema/dist/commonjs/format.js +111 -0
  10. package/node_modules/@cfworker/json-schema/dist/commonjs/index.d.ts +8 -0
  11. package/node_modules/@cfworker/json-schema/dist/commonjs/index.js +24 -0
  12. package/node_modules/@cfworker/json-schema/dist/commonjs/package.json +3 -0
  13. package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.d.ts +2 -0
  14. package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.js +10 -0
  15. package/node_modules/@cfworker/json-schema/dist/commonjs/types.d.ts +72 -0
  16. package/node_modules/@cfworker/json-schema/dist/commonjs/types.js +9 -0
  17. package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.d.ts +1 -0
  18. package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.js +20 -0
  19. package/node_modules/@cfworker/json-schema/dist/commonjs/validate.d.ts +3 -0
  20. package/node_modules/@cfworker/json-schema/dist/commonjs/validate.js +805 -0
  21. package/node_modules/@cfworker/json-schema/dist/commonjs/validator.d.ts +10 -0
  22. package/node_modules/@cfworker/json-schema/dist/commonjs/validator.js +27 -0
  23. package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.d.ts +1 -0
  24. package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js +39 -0
  25. package/node_modules/@cfworker/json-schema/dist/esm/dereference.d.ts +7 -0
  26. package/node_modules/@cfworker/json-schema/dist/esm/dereference.js +143 -0
  27. package/node_modules/@cfworker/json-schema/dist/esm/format.d.ts +1 -0
  28. package/node_modules/@cfworker/json-schema/dist/esm/format.js +108 -0
  29. package/node_modules/@cfworker/json-schema/dist/esm/index.d.ts +8 -0
  30. package/node_modules/@cfworker/json-schema/dist/esm/index.js +8 -0
  31. package/node_modules/@cfworker/json-schema/dist/esm/package.json +3 -0
  32. package/node_modules/@cfworker/json-schema/dist/esm/pointer.d.ts +2 -0
  33. package/node_modules/@cfworker/json-schema/dist/esm/pointer.js +6 -0
  34. package/node_modules/@cfworker/json-schema/dist/esm/types.d.ts +72 -0
  35. package/node_modules/@cfworker/json-schema/dist/esm/types.js +6 -0
  36. package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.d.ts +1 -0
  37. package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js +17 -0
  38. package/node_modules/@cfworker/json-schema/dist/esm/validate.d.ts +3 -0
  39. package/node_modules/@cfworker/json-schema/dist/esm/validate.js +802 -0
  40. package/node_modules/@cfworker/json-schema/dist/esm/validator.d.ts +10 -0
  41. package/node_modules/@cfworker/json-schema/dist/esm/validator.js +23 -0
  42. package/node_modules/@cfworker/json-schema/package.json +68 -0
  43. package/node_modules/@cfworker/json-schema/src/deep-compare-strict.d.ts +1 -0
  44. package/node_modules/@cfworker/json-schema/src/deep-compare-strict.ts +39 -0
  45. package/node_modules/@cfworker/json-schema/src/dereference.d.ts +12 -0
  46. package/node_modules/@cfworker/json-schema/src/dereference.ts +188 -0
  47. package/node_modules/@cfworker/json-schema/src/format.d.ts +2 -0
  48. package/node_modules/@cfworker/json-schema/src/format.ts +164 -0
  49. package/node_modules/@cfworker/json-schema/src/index.d.ts +8 -0
  50. package/node_modules/@cfworker/json-schema/src/index.ts +8 -0
  51. package/node_modules/@cfworker/json-schema/src/pointer.d.ts +2 -0
  52. package/node_modules/@cfworker/json-schema/src/pointer.ts +7 -0
  53. package/node_modules/@cfworker/json-schema/src/types.d.ts +79 -0
  54. package/node_modules/@cfworker/json-schema/src/types.ts +92 -0
  55. package/node_modules/@cfworker/json-schema/src/ucs2-length.d.ts +1 -0
  56. package/node_modules/@cfworker/json-schema/src/ucs2-length.ts +24 -0
  57. package/node_modules/@cfworker/json-schema/src/validate.d.ts +13 -0
  58. package/node_modules/@cfworker/json-schema/src/validate.ts +1168 -0
  59. package/node_modules/@cfworker/json-schema/src/validator.d.ts +14 -0
  60. package/node_modules/@cfworker/json-schema/src/validator.ts +32 -0
  61. package/node_modules/@zuplo/core/package.json +1 -1
  62. package/node_modules/@zuplo/graphql/package.json +1 -1
  63. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  64. package/node_modules/@zuplo/otel/package.json +1 -1
  65. package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js → chunk-2ZQVIVZ3.js} +2 -2
  66. package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js → chunk-UMZORQLU.js} +67 -66
  67. package/node_modules/@zuplo/runtime/out/esm/chunk-UMZORQLU.js.map +1 -0
  68. package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js → chunk-YGYFQCBA.js} +6 -6
  69. package/node_modules/@zuplo/runtime/out/esm/chunk-YGYFQCBA.js.map +1 -0
  70. package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js → chunk-ZS34EO4B.js} +2 -2
  71. package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js.map → chunk-ZS34EO4B.js.map} +1 -1
  72. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  73. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  74. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  75. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +208 -72
  76. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  77. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  78. package/node_modules/@zuplo/runtime/out/types/index.d.ts +61 -12
  79. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +8 -17
  80. package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +3 -12
  81. package/node_modules/@zuplo/runtime/package.json +3 -2
  82. package/node_modules/agent-base/README.md +145 -0
  83. package/node_modules/agent-base/dist/src/index.d.ts +78 -0
  84. package/node_modules/agent-base/dist/src/index.js +203 -0
  85. package/node_modules/agent-base/dist/src/index.js.map +1 -0
  86. package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  87. package/node_modules/agent-base/dist/src/promisify.js +18 -0
  88. package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  89. package/node_modules/agent-base/package.json +64 -0
  90. package/node_modules/agent-base/src/index.ts +345 -0
  91. package/node_modules/agent-base/src/promisify.ts +33 -0
  92. package/node_modules/axios/CHANGELOG.md +71 -0
  93. package/node_modules/axios/README.md +46 -11
  94. package/node_modules/axios/dist/axios.js +81 -53
  95. package/node_modules/axios/dist/axios.js.map +1 -1
  96. package/node_modules/axios/dist/axios.min.js +2 -2
  97. package/node_modules/axios/dist/axios.min.js.map +1 -1
  98. package/node_modules/axios/dist/browser/axios.cjs +96 -64
  99. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  100. package/node_modules/axios/dist/esm/axios.js +96 -64
  101. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  102. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  103. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  104. package/node_modules/axios/dist/node/axios.cjs +206 -85
  105. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  106. package/node_modules/axios/index.d.cts +1 -1
  107. package/node_modules/axios/index.d.ts +1 -1
  108. package/node_modules/axios/lib/adapters/fetch.js +6 -2
  109. package/node_modules/axios/lib/adapters/http.js +139 -29
  110. package/node_modules/axios/lib/adapters/xhr.js +2 -1
  111. package/node_modules/axios/lib/core/AxiosHeaders.js +1 -33
  112. package/node_modules/axios/lib/env/data.js +1 -1
  113. package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
  114. package/node_modules/axios/lib/helpers/formDataToJSON.js +1 -1
  115. package/node_modules/axios/lib/helpers/fromDataURI.js +18 -5
  116. package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
  117. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  118. package/node_modules/axios/lib/utils.js +8 -7
  119. package/node_modules/axios/package.json +3 -1
  120. package/node_modules/https-proxy-agent/README.md +137 -0
  121. package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  122. package/node_modules/https-proxy-agent/dist/agent.js +177 -0
  123. package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  124. package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  125. package/node_modules/https-proxy-agent/dist/index.js +14 -0
  126. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  127. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  128. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  129. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  130. package/node_modules/https-proxy-agent/package.json +56 -0
  131. package/node_modules/type-is/index.js +8 -18
  132. package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
  133. package/node_modules/type-is/node_modules/content-type/README.md +69 -0
  134. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
  135. package/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
  136. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
  137. package/node_modules/type-is/node_modules/content-type/package.json +52 -0
  138. package/node_modules/type-is/package.json +9 -5
  139. package/package.json +6 -6
  140. package/node_modules/@zuplo/runtime/out/esm/chunk-KWR5BV7H.js.map +0 -1
  141. package/node_modules/@zuplo/runtime/out/esm/chunk-STBDRSX7.js.map +0 -1
  142. /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js.map → chunk-2ZQVIVZ3.js.map} +0 -0
  143. /package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js.LEGAL.txt → chunk-UMZORQLU.js.LEGAL.txt} +0 -0
  144. /package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js.LEGAL.txt → chunk-YGYFQCBA.js.LEGAL.txt} +0 -0
@@ -1,9 +1,10 @@
1
- /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  'use strict';
3
3
 
4
4
  var FormData$1 = require('form-data');
5
5
  var crypto = require('crypto');
6
6
  var url = require('url');
7
+ var HttpsProxyAgent = require('https-proxy-agent');
7
8
  var http = require('http');
8
9
  var https = require('https');
9
10
  var http2 = require('http2');
@@ -737,10 +738,10 @@ function isSpecCompliantForm(thing) {
737
738
  * @returns {Object} The JSON-compatible object.
738
739
  */
739
740
  const toJSONObject = obj => {
740
- const stack = new Array(10);
741
- const visit = (source, i) => {
741
+ const visited = new WeakSet();
742
+ const visit = source => {
742
743
  if (isObject(source)) {
743
- if (stack.indexOf(source) >= 0) {
744
+ if (visited.has(source)) {
744
745
  return;
745
746
  }
746
747
 
@@ -749,19 +750,20 @@ const toJSONObject = obj => {
749
750
  return source;
750
751
  }
751
752
  if (!('toJSON' in source)) {
752
- stack[i] = source;
753
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
754
+ visited.add(source);
753
755
  const target = isArray(source) ? [] : {};
754
756
  forEach(source, (value, key) => {
755
- const reducedValue = visit(value, i + 1);
757
+ const reducedValue = visit(value);
756
758
  !isUndefined(reducedValue) && (target[key] = reducedValue);
757
759
  });
758
- stack[i] = undefined;
760
+ visited.delete(source);
759
761
  return target;
760
762
  }
761
763
  }
762
764
  return source;
763
765
  };
764
- return visit(obj, 0);
766
+ return visit(obj);
765
767
  };
766
768
 
767
769
  /**
@@ -928,8 +930,6 @@ var parseHeaders = rawHeaders => {
928
930
  return parsed;
929
931
  };
930
932
 
931
- const $internals = Symbol('internals');
932
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
933
933
  function trimSPorHTAB(str) {
934
934
  let start = 0;
935
935
  let end = str.length;
@@ -949,12 +949,32 @@ function trimSPorHTAB(str) {
949
949
  }
950
950
  return start === 0 && end === str.length ? str : str.slice(start, end);
951
951
  }
952
+
953
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
954
+ // eslint-disable-next-line no-control-regex
955
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
956
+ // eslint-disable-next-line no-control-regex
957
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
958
+ function sanitizeValue(value, invalidChars) {
959
+ if (utils$1.isArray(value)) {
960
+ return value.map(item => sanitizeValue(item, invalidChars));
961
+ }
962
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
963
+ }
964
+ const sanitizeHeaderValue = value => sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
965
+ const sanitizeByteStringHeaderValue = value => sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
966
+ function toByteStringHeaderObject(headers) {
967
+ const byteStringHeaders = Object.create(null);
968
+ utils$1.forEach(headers.toJSON(), (value, header) => {
969
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
970
+ });
971
+ return byteStringHeaders;
972
+ }
973
+
974
+ const $internals = Symbol('internals');
952
975
  function normalizeHeader(header) {
953
976
  return header && String(header).trim().toLowerCase();
954
977
  }
955
- function sanitizeHeaderValue(str) {
956
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
957
- }
958
978
  function normalizeValue(value) {
959
979
  if (value === false || value == null) {
960
980
  return value;
@@ -1852,7 +1872,7 @@ function formDataToJSON(formData) {
1852
1872
  }
1853
1873
  return !isNumericKey;
1854
1874
  }
1855
- if (!target[name] || !utils$1.isObject(target[name])) {
1875
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
1856
1876
  target[name] = [];
1857
1877
  }
1858
1878
  const result = buildPath(path, value, target[name], index);
@@ -2193,14 +2213,16 @@ function getEnv(key) {
2193
2213
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
2194
2214
  }
2195
2215
 
2196
- const VERSION = "1.16.0";
2216
+ const VERSION = "1.16.1";
2197
2217
 
2198
2218
  function parseProtocol(url) {
2199
2219
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2200
2220
  return match && match[1] || '';
2201
2221
  }
2202
2222
 
2203
- const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
2223
+ // RFC 2397: data:[<mediatype>][;base64],<data>
2224
+ // mediatype = type/subtype followed by optional ;name=value parameters
2225
+ const DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
2204
2226
 
2205
2227
  /**
2206
2228
  * Parse data uri to a Buffer or Blob
@@ -2224,10 +2246,20 @@ function fromDataURI(uri, asBlob, options) {
2224
2246
  if (!match) {
2225
2247
  throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
2226
2248
  }
2227
- const mime = match[1];
2228
- const isBase64 = match[2];
2229
- const body = match[3];
2230
- const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');
2249
+ const type = match[1];
2250
+ const params = match[2];
2251
+ const encoding = match[3] ? 'base64' : 'utf8';
2252
+ const body = match[4];
2253
+
2254
+ // RFC 2397 section 3: default mediatype is text/plain;charset=US-ASCII
2255
+ // Bare `data:,` leaves mime undefined; Blob normalises that to "" per spec.
2256
+ let mime;
2257
+ if (type) {
2258
+ mime = params ? type + params : type;
2259
+ } else if (params) {
2260
+ mime = 'text/plain' + params;
2261
+ }
2262
+ const buffer = Buffer.from(decodeURIComponent(body), encoding);
2231
2263
  if (asBlob) {
2232
2264
  if (!_Blob) {
2233
2265
  throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
@@ -2707,6 +2739,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2707
2739
  let bytesNotified = 0;
2708
2740
  const _speedometer = speedometer(50, 250);
2709
2741
  return throttle(e => {
2742
+ if (!e || typeof e.loaded !== 'number') {
2743
+ return;
2744
+ }
2710
2745
  const rawLoaded = e.loaded;
2711
2746
  const total = e.lengthComputable ? e.total : undefined;
2712
2747
  const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -2858,6 +2893,35 @@ function setFormDataHeaders$1(headers, formHeaders, policy) {
2858
2893
  // the request currently owning that socket across keep-alive reuse (issue #10780).
2859
2894
  const kAxiosSocketListener = Symbol('axios.http.socketListener');
2860
2895
  const kAxiosCurrentReq = Symbol('axios.http.currentReq');
2896
+
2897
+ // Tags HttpsProxyAgent instances installed by setProxy() so the redirect path
2898
+ // can strip them without clobbering a user-supplied agent that happens to be
2899
+ // an HttpsProxyAgent.
2900
+ const kAxiosInstalledTunnel = Symbol('axios.http.installedTunnel');
2901
+
2902
+ // Cache of CONNECT-tunneling agents keyed by proxy config so repeat requests
2903
+ // through the same proxy reuse a single agent (and its socket pool). The
2904
+ // keyspace is bounded by the set of distinct proxy configs the process uses,
2905
+ // so unbounded growth is not a concern in practice.
2906
+ const tunnelingAgentCache = new Map();
2907
+ const tunnelingAgentCacheUser = new WeakMap();
2908
+ function getTunnelingAgent(agentOptions, userHttpsAgent) {
2909
+ const key = agentOptions.protocol + '//' + agentOptions.hostname + ':' + (agentOptions.port || '') + '#' + (agentOptions.auth || '');
2910
+ const cache = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, new Map()).get(userHttpsAgent) : tunnelingAgentCache;
2911
+ let agent = cache.get(key);
2912
+ if (agent) return agent;
2913
+ // Forward the user's TLS options (custom CA, rejectUnauthorized, client cert,
2914
+ // etc.) into the tunneling agent so they apply to the origin TLS upgrade
2915
+ // performed after CONNECT. Our proxy fields take precedence on conflict.
2916
+ const merged = userHttpsAgent && userHttpsAgent.options ? {
2917
+ ...userHttpsAgent.options,
2918
+ ...agentOptions
2919
+ } : agentOptions;
2920
+ agent = new HttpsProxyAgent(merged);
2921
+ agent[kAxiosInstalledTunnel] = true;
2922
+ cache.set(key, agent);
2923
+ return agent;
2924
+ }
2861
2925
  const supportedProtocols = platform.protocols.map(protocol => {
2862
2926
  return protocol + ':';
2863
2927
  });
@@ -2981,7 +3045,7 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
2981
3045
  *
2982
3046
  * @returns {http.ClientRequestArgs}
2983
3047
  */
2984
- function setProxy(options, configProxy, location, isRedirect) {
3048
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent) {
2985
3049
  let proxy = configProxy;
2986
3050
  if (!proxy && proxy !== false) {
2987
3051
  const proxyUrl = getProxyForUrl(location);
@@ -3002,6 +3066,13 @@ function setProxy(options, configProxy, location, isRedirect) {
3002
3066
  }
3003
3067
  }
3004
3068
  }
3069
+ // Strip any tunneling agent we installed for the previous hop so a redirect
3070
+ // that drops the proxy or crosses an HTTPS↔HTTP boundary doesn't reuse a
3071
+ // stale one. Match on our Symbol marker so a user-supplied HttpsProxyAgent
3072
+ // (which won't carry the marker) is left alone.
3073
+ if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
3074
+ options.agent = undefined;
3075
+ }
3005
3076
  if (proxy) {
3006
3077
  // Read proxy fields without traversing the prototype chain. URL instances expose
3007
3078
  // username/password/hostname/host/port/protocol via getters on URL.prototype (so
@@ -3034,37 +3105,84 @@ function setProxy(options, configProxy, location, isRedirect) {
3034
3105
  proxy
3035
3106
  });
3036
3107
  }
3037
- const base64 = Buffer.from(proxyAuth, 'utf8').toString('base64');
3038
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
3039
3108
  }
3109
+ const targetIsHttps = isHttps.test(options.protocol);
3110
+ if (targetIsHttps) {
3111
+ // CONNECT-tunneling path for HTTPS targets. Preserves end-to-end TLS to
3112
+ // the origin so the proxy cannot inspect the URL, headers, or body — the
3113
+ // behavior already promised by THREATMODEL.md (T-R9). HttpsProxyAgent
3114
+ // sends Proxy-Authorization on the CONNECT request only, never on the
3115
+ // wrapped TLS request, which is why we don't stamp it onto
3116
+ // options.headers here. If the user already supplied an HttpsProxyAgent,
3117
+ // they own tunneling end-to-end and we leave them alone; otherwise we
3118
+ // install our own tunneling agent and forward their TLS options (if any)
3119
+ // so a custom httpsAgent for cert pinning / rejectUnauthorized still
3120
+ // applies to the origin TLS upgrade.
3121
+ if (!(configHttpsAgent instanceof HttpsProxyAgent)) {
3122
+ const proxyHost = readProxyField('hostname') || readProxyField('host');
3123
+ const proxyPort = readProxyField('port');
3124
+ const rawProxyProtocol = readProxyField('protocol');
3125
+ const normalizedProtocol = rawProxyProtocol ? rawProxyProtocol.includes(':') ? rawProxyProtocol : `${rawProxyProtocol}:` : 'http:';
3126
+ // Bracket IPv6 literals for URL parsing; URL.hostname strips the
3127
+ // brackets again on read so the agent receives the raw form.
3128
+ const proxyHostForURL = proxyHost && proxyHost.includes(':') && !proxyHost.startsWith('[') ? `[${proxyHost}]` : proxyHost;
3129
+ const proxyURL = new URL(`${normalizedProtocol}//${proxyHostForURL}${proxyPort ? ':' + proxyPort : ''}`);
3130
+ const agentOptions = {
3131
+ protocol: proxyURL.protocol,
3132
+ hostname: proxyURL.hostname.replace(/^\[|\]$/g, ''),
3133
+ port: proxyURL.port,
3134
+ auth: proxyAuth && typeof proxyAuth === 'string' ? proxyAuth : undefined
3135
+ };
3136
+ if (proxyURL.protocol === 'https:') {
3137
+ agentOptions.ALPNProtocols = ['http/1.1'];
3138
+ }
3139
+ const tunnelingAgent = getTunnelingAgent(agentOptions, configHttpsAgent);
3140
+ // Set both: `options.agent` is consumed by the native https.request path
3141
+ // (config.maxRedirects === 0); `options.agents.https` is consumed by
3142
+ // follow-redirects, which ignores `options.agent` when `options.agents`
3143
+ // is present.
3144
+ options.agent = tunnelingAgent;
3145
+ if (options.agents) {
3146
+ options.agents.https = tunnelingAgent;
3147
+ }
3148
+ }
3149
+ } else {
3150
+ // Forward-proxy mode for plaintext HTTP targets. The request line carries
3151
+ // the absolute URL and the proxy sees everything — acceptable for plain
3152
+ // HTTP since the wire was already plaintext.
3153
+ if (proxyAuth) {
3154
+ const base64 = Buffer.from(proxyAuth, 'utf8').toString('base64');
3155
+ options.headers['Proxy-Authorization'] = 'Basic ' + base64;
3156
+ }
3040
3157
 
3041
- // Preserve a user-supplied Host header (case-insensitive) so callers can override
3042
- // the value forwarded to the proxy; otherwise default to the request URL's host.
3043
- let hasUserHostHeader = false;
3044
- for (const name of Object.keys(options.headers)) {
3045
- if (name.toLowerCase() === 'host') {
3046
- hasUserHostHeader = true;
3047
- break;
3158
+ // Preserve a user-supplied Host header (case-insensitive) so callers can override
3159
+ // the value forwarded to the proxy; otherwise default to the request URL's host.
3160
+ let hasUserHostHeader = false;
3161
+ for (const name of Object.keys(options.headers)) {
3162
+ if (name.toLowerCase() === 'host') {
3163
+ hasUserHostHeader = true;
3164
+ break;
3165
+ }
3166
+ }
3167
+ if (!hasUserHostHeader) {
3168
+ options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
3169
+ }
3170
+ const proxyHost = readProxyField('hostname') || readProxyField('host');
3171
+ options.hostname = proxyHost;
3172
+ // Replace 'host' since options is not a URL object
3173
+ options.host = proxyHost;
3174
+ options.port = readProxyField('port');
3175
+ options.path = location;
3176
+ const proxyProtocol = readProxyField('protocol');
3177
+ if (proxyProtocol) {
3178
+ options.protocol = proxyProtocol.includes(':') ? proxyProtocol : `${proxyProtocol}:`;
3048
3179
  }
3049
- }
3050
- if (!hasUserHostHeader) {
3051
- options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
3052
- }
3053
- const proxyHost = readProxyField('hostname') || readProxyField('host');
3054
- options.hostname = proxyHost;
3055
- // Replace 'host' since options is not a URL object
3056
- options.host = proxyHost;
3057
- options.port = readProxyField('port');
3058
- options.path = location;
3059
- const proxyProtocol = readProxyField('protocol');
3060
- if (proxyProtocol) {
3061
- options.protocol = proxyProtocol.includes(':') ? proxyProtocol : `${proxyProtocol}:`;
3062
3180
  }
3063
3181
  }
3064
3182
  options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
3065
3183
  // Configure proxy for redirected request, passing the original config proxy to apply
3066
3184
  // the exact same logic as if the redirected request was performed by axios directly.
3067
- setProxy(redirectOptions, configProxy, redirectOptions.href, true);
3185
+ setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent);
3068
3186
  };
3069
3187
  }
3070
3188
  const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
@@ -3394,7 +3512,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3394
3512
  const options = Object.assign(Object.create(null), {
3395
3513
  path: path$1,
3396
3514
  method: method,
3397
- headers: headers.toJSON(),
3515
+ headers: toByteStringHeaderObject(headers),
3398
3516
  agents: {
3399
3517
  http: config.httpAgent,
3400
3518
  https: config.httpsAgent
@@ -3425,12 +3543,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3425
3543
  } else {
3426
3544
  options.hostname = parsed.hostname.startsWith('[') ? parsed.hostname.slice(1, -1) : parsed.hostname;
3427
3545
  options.port = parsed.port;
3428
- setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
3546
+ setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path, false, config.httpsAgent);
3429
3547
  }
3430
3548
  let transport;
3431
3549
  let isNativeTransport = false;
3432
3550
  const isHttpsRequest = isHttps.test(options.protocol);
3433
- options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
3551
+ // Don't clobber a CONNECT-tunneling agent installed by setProxy() for an
3552
+ // HTTPS target.
3553
+ if (options.agent == null) {
3554
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
3555
+ }
3434
3556
  if (isHttp2) {
3435
3557
  transport = http2Transport;
3436
3558
  } else {
@@ -4102,7 +4224,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4102
4224
 
4103
4225
  // Add headers to the request
4104
4226
  if ('setRequestHeader' in request) {
4105
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
4227
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
4106
4228
  request.setRequestHeader(key, val);
4107
4229
  });
4108
4230
  }
@@ -4158,41 +4280,41 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4158
4280
  };
4159
4281
 
4160
4282
  const composeSignals = (signals, timeout) => {
4161
- const {
4162
- length
4163
- } = signals = signals ? signals.filter(Boolean) : [];
4164
- if (timeout || length) {
4165
- let controller = new AbortController();
4166
- let aborted;
4167
- const onabort = function (reason) {
4168
- if (!aborted) {
4169
- aborted = true;
4170
- unsubscribe();
4171
- const err = reason instanceof Error ? reason : this.reason;
4172
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
4173
- }
4174
- };
4175
- let timer = timeout && setTimeout(() => {
4176
- timer = null;
4177
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
4178
- }, timeout);
4179
- const unsubscribe = () => {
4180
- if (signals) {
4181
- timer && clearTimeout(timer);
4182
- timer = null;
4183
- signals.forEach(signal => {
4184
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
4185
- });
4186
- signals = null;
4187
- }
4188
- };
4189
- signals.forEach(signal => signal.addEventListener('abort', onabort));
4190
- const {
4191
- signal
4192
- } = controller;
4193
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
4194
- return signal;
4283
+ signals = signals ? signals.filter(Boolean) : [];
4284
+ if (!timeout && !signals.length) {
4285
+ return;
4195
4286
  }
4287
+ const controller = new AbortController();
4288
+ let aborted = false;
4289
+ const onabort = function (reason) {
4290
+ if (!aborted) {
4291
+ aborted = true;
4292
+ unsubscribe();
4293
+ const err = reason instanceof Error ? reason : this.reason;
4294
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
4295
+ }
4296
+ };
4297
+ let timer = timeout && setTimeout(() => {
4298
+ timer = null;
4299
+ onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
4300
+ }, timeout);
4301
+ const unsubscribe = () => {
4302
+ if (!signals) {
4303
+ return;
4304
+ }
4305
+ timer && clearTimeout(timer);
4306
+ timer = null;
4307
+ signals.forEach(signal => {
4308
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
4309
+ });
4310
+ signals = null;
4311
+ };
4312
+ signals.forEach(signal => signal.addEventListener('abort', onabort));
4313
+ const {
4314
+ signal
4315
+ } = controller;
4316
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
4317
+ return signal;
4196
4318
  };
4197
4319
 
4198
4320
  const streamChunk = function* (chunk, chunkSize) {
@@ -4289,8 +4411,7 @@ const test = (fn, ...args) => {
4289
4411
  }
4290
4412
  };
4291
4413
  const factory = env => {
4292
- var _utils$global;
4293
- const globalObject = (_utils$global = utils$1.global) !== null && _utils$global !== void 0 ? _utils$global : globalThis;
4414
+ const globalObject = utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
4294
4415
  const {
4295
4416
  ReadableStream,
4296
4417
  TextEncoder
@@ -4459,7 +4580,7 @@ const factory = env => {
4459
4580
  ...fetchOptions,
4460
4581
  signal: composedSignal,
4461
4582
  method: method.toUpperCase(),
4462
- headers: headers.normalize().toJSON(),
4583
+ headers: toByteStringHeaderObject(headers.normalize()),
4463
4584
  body: data,
4464
4585
  duplex: 'half',
4465
4586
  credentials: isCredentialsSupported ? withCredentials : undefined