@openclaw/slack 2026.7.2-beta.2 → 2026.7.2-beta.4

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 (161) hide show
  1. package/dist/{account-configured-DzC407uv.js → account-configured-BwfXBo_F.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{account-inspect-Di7ditqZ.js → account-inspect-jn1xLaVi.js} +9 -2
  4. package/dist/account-reply-mode-DrUXogvO.js +14 -0
  5. package/dist/{accounts-BOJJiHSr.js → accounts-BSr252c_.js} +13 -25
  6. package/dist/accounts.runtime-CjULMLTa.js +2 -0
  7. package/dist/{action-runtime-Cee2ih0s.js → action-runtime-CFU52n4W.js} +11 -17
  8. package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
  9. package/dist/{actions-BZiuSTIq.js → actions-D51foiwR.js} +5 -5
  10. package/dist/{actions.runtime-DoD0-gxw.js → actions.runtime-BMJwtf5C.js} +1 -1
  11. package/dist/api.js +15 -15
  12. package/dist/{approval-handler.runtime-CUPtIM4k.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
  13. package/dist/{channel-DaIiGUOp.js → channel-Ds8NKvfr.js} +75 -41
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel-type-Cfm6_6n1.js → channel-type-DXkUajFP.js} +3 -3
  17. package/dist/{channel.setup-C-mLz50O.js → channel.setup-DOSTEDfA.js} +8 -5
  18. package/dist/{config-schema-xPSnK2VK.js → config-schema-B4j4tCOI.js} +236 -30
  19. package/dist/{directory-config-DRkFujwG.js → directory-config-B08pm5ZT.js} +1 -1
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-D_yZhjgp.js → directory-live-DpPKzPrn.js} +2 -2
  22. package/dist/doctor-contract-U6oVntbM.js +173 -0
  23. package/dist/doctor-contract-api.js +1 -1
  24. package/dist/{group-policy-85UWiriS.js → group-policy-CdnQzQBI.js} +98 -125
  25. package/dist/{interactive-replies-BilWUdcI.js → interactive-replies-C3ffk6oN.js} +1 -1
  26. package/dist/interactive-replies-api.js +1 -1
  27. package/dist/{message-tool-api-CA9jZrCY.js → message-tool-api-ByVyIVOh.js} +3 -3
  28. package/dist/message-tool-api.js +1 -1
  29. package/dist/{monitor-CalGciTs.js → monitor-CnB_WKvF.js} +3 -3
  30. package/dist/{outbound-adapter-BiLKcnyH.js → outbound-adapter-DuPz2HHt.js} +49 -5
  31. package/dist/{pipeline.runtime-DofAvTtb.js → pipeline.runtime-5rRYZuX5.js} +490 -345
  32. package/dist/{policy-BVs4LiSa.js → policy-C31RYSuT.js} +1 -1
  33. package/dist/probe-CVRuArHA.js +340 -0
  34. package/dist/{provider-CmeoUiIM.js → provider-htuIJGFD.js} +791 -359
  35. package/dist/{relay-source-DMmgtvg4.js → relay-source-Df9EaiTF.js} +6 -11
  36. package/dist/{replies-CJJCp6qz.js → replies-Cgr2Gli4.js} +3 -3
  37. package/dist/{resolve-channels-Rfts6POK.js → resolve-channels-DodP2TFx.js} +1 -1
  38. package/dist/{resolve-users-y6wAxR8E.js → resolve-users-M9eF8891.js} +1 -1
  39. package/dist/{runtime-api-BGDyOt1D.js → runtime-api-D5XYMMsf.js} +3 -2
  40. package/dist/runtime-api.js +11 -11
  41. package/dist/{scopes-CuxNQZ6v.js → scopes-CJRpHkDC.js} +1 -2
  42. package/dist/{secret-contract-CMohXFWS.js → secret-contract-DxmvbxBF.js} +1 -0
  43. package/dist/secret-contract-api.js +1 -1
  44. package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
  45. package/dist/security-contract-api.js +1 -1
  46. package/dist/{send-DYp8ca-l.js → send-BZ1tPv7-.js} +28 -11
  47. package/dist/send.runtime-a2pilFor.js +2 -0
  48. package/dist/setup-core-tPxMuFez.js +600 -0
  49. package/dist/setup-plugin-api.js +1 -1
  50. package/dist/{setup-surface-oSd3NX9J.js → setup-surface-wV-S1dE_.js} +58 -32
  51. package/dist/{shared-D9yz5Otg.js → shared-BfMskaMx.js} +57 -10
  52. package/dist/{slash-dispatch.runtime-CSja9VuD.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
  53. package/node_modules/@types/node/README.md +1 -1
  54. package/node_modules/@types/node/fs/promises.d.ts +16 -6
  55. package/node_modules/@types/node/package.json +2 -2
  56. package/node_modules/agent-base/README.md +145 -0
  57. package/node_modules/agent-base/dist/src/index.d.ts +78 -0
  58. package/node_modules/agent-base/dist/src/index.js +203 -0
  59. package/node_modules/agent-base/dist/src/index.js.map +1 -0
  60. package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  61. package/node_modules/agent-base/dist/src/promisify.js +18 -0
  62. package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  63. package/node_modules/agent-base/package.json +64 -0
  64. package/node_modules/agent-base/src/index.ts +345 -0
  65. package/node_modules/agent-base/src/promisify.ts +33 -0
  66. package/node_modules/axios/CHANGELOG.md +197 -1
  67. package/node_modules/axios/README.md +424 -256
  68. package/node_modules/axios/dist/axios.js +589 -204
  69. package/node_modules/axios/dist/axios.min.js +3 -3
  70. package/node_modules/axios/dist/axios.min.js.map +1 -1
  71. package/node_modules/axios/dist/browser/axios.cjs +630 -185
  72. package/node_modules/axios/dist/esm/axios.js +630 -185
  73. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  74. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  75. package/node_modules/axios/dist/node/axios.cjs +949 -301
  76. package/node_modules/axios/index.d.cts +28 -5
  77. package/node_modules/axios/index.d.ts +24 -3
  78. package/node_modules/axios/lib/adapters/adapters.js +1 -1
  79. package/node_modules/axios/lib/adapters/fetch.js +223 -49
  80. package/node_modules/axios/lib/adapters/http.js +408 -193
  81. package/node_modules/axios/lib/adapters/xhr.js +3 -1
  82. package/node_modules/axios/lib/core/Axios.js +4 -2
  83. package/node_modules/axios/lib/core/AxiosError.js +13 -1
  84. package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
  85. package/node_modules/axios/lib/core/buildFullPath.js +29 -1
  86. package/node_modules/axios/lib/core/mergeConfig.js +35 -0
  87. package/node_modules/axios/lib/defaults/transitional.js +2 -0
  88. package/node_modules/axios/lib/env/data.js +1 -1
  89. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
  90. package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
  91. package/node_modules/axios/lib/helpers/buildURL.js +7 -4
  92. package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
  93. package/node_modules/axios/lib/helpers/cookies.js +5 -1
  94. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
  95. package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
  96. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
  97. package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
  98. package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
  99. package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
  100. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  101. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
  102. package/node_modules/axios/lib/helpers/toFormData.js +48 -12
  103. package/node_modules/axios/lib/helpers/validator.js +1 -1
  104. package/node_modules/axios/lib/utils.js +105 -19
  105. package/node_modules/axios/package.json +31 -13
  106. package/node_modules/https-proxy-agent/README.md +137 -0
  107. package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  108. package/node_modules/https-proxy-agent/dist/agent.js +177 -0
  109. package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  110. package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  111. package/node_modules/https-proxy-agent/dist/index.js +14 -0
  112. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  113. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  114. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  115. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  116. package/node_modules/https-proxy-agent/package.json +56 -0
  117. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  118. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  119. package/node_modules/iconv-lite/package.json +2 -2
  120. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  121. package/node_modules/path-to-regexp/Readme.md +3 -3
  122. package/node_modules/path-to-regexp/dist/index.js +135 -158
  123. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  124. package/node_modules/path-to-regexp/package.json +2 -2
  125. package/node_modules/qs/CHANGELOG.md +11 -0
  126. package/node_modules/qs/dist/qs.js +17 -17
  127. package/node_modules/qs/lib/parse.js +19 -8
  128. package/node_modules/qs/lib/utils.js +47 -8
  129. package/node_modules/qs/package.json +6 -5
  130. package/node_modules/qs/test/parse.js +230 -0
  131. package/node_modules/qs/test/utils.js +194 -0
  132. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  133. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  134. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  135. package/node_modules/typebox/build/guard/string.mjs +16 -4
  136. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  137. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  138. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  139. package/node_modules/typebox/build/typebox.d.mts +1 -1
  140. package/node_modules/typebox/build/typebox.mjs +1 -1
  141. package/node_modules/typebox/package.json +1 -1
  142. package/node_modules/typebox/readme.md +29 -32
  143. package/node_modules/ws/lib/receiver.js +15 -32
  144. package/node_modules/ws/lib/websocket-server.js +4 -4
  145. package/node_modules/ws/lib/websocket.js +4 -4
  146. package/node_modules/ws/package.json +5 -1
  147. package/npm-shrinkwrap.json +54 -27
  148. package/openclaw.plugin.json +1331 -1424
  149. package/package.json +92 -14
  150. package/dist/accounts.runtime-KvftRRek.js +0 -2
  151. package/dist/action-runtime.runtime-DZfd7IFr.js +0 -2
  152. package/dist/client-WIPAS3Yr.js +0 -160
  153. package/dist/config-api-Df9a1B8C.js +0 -3
  154. package/dist/doctor-contract-DddfkMlF.js +0 -134
  155. package/dist/probe-CN0ssfLN.js +0 -48
  156. package/dist/send.runtime-CJLxAt26.js +0 -2
  157. package/dist/setup-core-CkwVLzFO.js +0 -337
  158. package/node_modules/axios/dist/axios.js.map +0 -1
  159. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  160. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  161. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
@@ -8,6 +8,7 @@ import platform from '../platform/index.js';
8
8
  import AxiosHeaders from '../core/AxiosHeaders.js';
9
9
  import { progressEventReducer } from '../helpers/progressEventReducer.js';
10
10
  import resolveConfig from '../helpers/resolveConfig.js';
11
+ import { toByteStringHeaderObject } from '../helpers/sanitizeHeaderValue.js';
11
12
 
12
13
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
13
14
 
@@ -156,7 +157,7 @@ export default isXHRAdapterSupported &&
156
157
 
157
158
  // Add headers to the request
158
159
  if ('setRequestHeader' in request) {
159
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
160
+ utils.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
160
161
  request.setRequestHeader(key, val);
161
162
  });
162
163
  }
@@ -217,6 +218,7 @@ export default isXHRAdapterSupported &&
217
218
  config
218
219
  )
219
220
  );
221
+ done();
220
222
  return;
221
223
  }
222
224
 
@@ -101,6 +101,8 @@ class Axios {
101
101
  forcedJSONParsing: validators.transitional(validators.boolean),
102
102
  clarifyTimeoutError: validators.transitional(validators.boolean),
103
103
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
104
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
105
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
104
106
  },
105
107
  false
106
108
  );
@@ -232,7 +234,7 @@ class Axios {
232
234
 
233
235
  getUri(config) {
234
236
  config = mergeConfig(this.defaults, config);
235
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
237
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
236
238
  return buildURL(fullPath, config.params, config.paramsSerializer);
237
239
  }
238
240
  }
@@ -245,7 +247,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
245
247
  mergeConfig(config || {}, {
246
248
  method,
247
249
  url,
248
- data: (config || {}).data,
250
+ data: config && utils.hasOwnProp(config, 'data') ? config.data : undefined,
249
251
  })
250
252
  );
251
253
  };
@@ -75,7 +75,19 @@ function redactConfig(config, redactKeys) {
75
75
  class AxiosError extends Error {
76
76
  static from(error, code, config, request, response, customProps) {
77
77
  const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
78
- axiosError.cause = error;
78
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
79
+ // error often carries circular internals (sockets, requests, agents), so
80
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
81
+ // own-property walk throw "Converting circular structure to JSON".
82
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
83
+ // `message` descriptor below (prototype-pollution-safe descriptor).
84
+ Object.defineProperty(axiosError, 'cause', {
85
+ __proto__: null,
86
+ value: error,
87
+ writable: true,
88
+ enumerable: false,
89
+ configurable: true,
90
+ });
79
91
  axiosError.name = error.name;
80
92
 
81
93
  // Preserve status from the original error if not already set from response
@@ -2,46 +2,14 @@
2
2
 
3
3
  import utils from '../utils.js';
4
4
  import parseHeaders from '../helpers/parseHeaders.js';
5
+ import { sanitizeHeaderValue } from '../helpers/sanitizeHeaderValue.js';
5
6
 
6
7
  const $internals = Symbol('internals');
7
8
 
8
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
9
-
10
- function trimSPorHTAB(str) {
11
- let start = 0;
12
- let end = str.length;
13
-
14
- while (start < end) {
15
- const code = str.charCodeAt(start);
16
-
17
- if (code !== 0x09 && code !== 0x20) {
18
- break;
19
- }
20
-
21
- start += 1;
22
- }
23
-
24
- while (end > start) {
25
- const code = str.charCodeAt(end - 1);
26
-
27
- if (code !== 0x09 && code !== 0x20) {
28
- break;
29
- }
30
-
31
- end -= 1;
32
- }
33
-
34
- return start === 0 && end === str.length ? str : str.slice(start, end);
35
- }
36
-
37
9
  function normalizeHeader(header) {
38
10
  return header && String(header).trim().toLowerCase();
39
11
  }
40
12
 
41
- function sanitizeHeaderValue(str) {
42
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
43
- }
44
-
45
13
  function normalizeValue(value) {
46
14
  if (value === false || value == null) {
47
15
  return value;
@@ -121,7 +89,7 @@ class AxiosHeaders {
121
89
  const lHeader = normalizeHeader(_header);
122
90
 
123
91
  if (!lHeader) {
124
- throw new Error('header name must be a non-empty string');
92
+ return;
125
93
  }
126
94
 
127
95
  const key = utils.findKey(self, lHeader);
@@ -143,20 +111,23 @@ class AxiosHeaders {
143
111
  setHeaders(header, valueOrRewrite);
144
112
  } else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
145
113
  setHeaders(parseHeaders(header), valueOrRewrite);
146
- } else if (utils.isObject(header) && utils.isIterable(header)) {
147
- let obj = {},
114
+ } else if (utils.isObject(header) && utils.isSafeIterable(header)) {
115
+ let obj = Object.create(null),
148
116
  dest,
149
117
  key;
150
118
  for (const entry of header) {
151
119
  if (!utils.isArray(entry)) {
152
- throw TypeError('Object iterator must return a key-value pair');
120
+ throw new TypeError('Object iterator must return a key-value pair');
153
121
  }
154
122
 
155
- obj[(key = entry[0])] = (dest = obj[key])
156
- ? utils.isArray(dest)
157
- ? [...dest, entry[1]]
158
- : [dest, entry[1]]
159
- : entry[1];
123
+ key = entry[0];
124
+
125
+ if (utils.hasOwnProp(obj, key)) {
126
+ dest = obj[key];
127
+ obj[key] = utils.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
128
+ } else {
129
+ obj[key] = entry[1];
130
+ }
160
131
  }
161
132
 
162
133
  setHeaders(obj, valueOrRewrite);
@@ -1,8 +1,34 @@
1
1
  'use strict';
2
2
 
3
+ import AxiosError from './AxiosError.js';
3
4
  import isAbsoluteURL from '../helpers/isAbsoluteURL.js';
4
5
  import combineURLs from '../helpers/combineURLs.js';
5
6
 
7
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
8
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
9
+
10
+ function stripLeadingC0ControlOrSpace(url) {
11
+ let i = 0;
12
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
13
+ i++;
14
+ }
15
+ return url.slice(i);
16
+ }
17
+
18
+ function normalizeURLForProtocolCheck(url) {
19
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
20
+ }
21
+
22
+ function assertValidHttpProtocolURL(url, config) {
23
+ if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
24
+ throw new AxiosError(
25
+ 'Invalid URL: missing "//" after protocol',
26
+ AxiosError.ERR_INVALID_URL,
27
+ config
28
+ );
29
+ }
30
+ }
31
+
6
32
  /**
7
33
  * Creates a new URL by combining the baseURL with the requestedURL,
8
34
  * only when the requestedURL is not already an absolute URL.
@@ -13,9 +39,11 @@ import combineURLs from '../helpers/combineURLs.js';
13
39
  *
14
40
  * @returns {string} The combined full path
15
41
  */
16
- export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
42
+ export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
43
+ assertValidHttpProtocolURL(requestedURL, config);
17
44
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
18
45
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
46
+ assertValidHttpProtocolURL(baseURL, config);
19
47
  return combineURLs(baseURL, requestedURL);
20
48
  }
21
49
  return requestedURL;
@@ -16,6 +16,7 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders ? { ...thing }
16
16
  */
17
17
  export default function mergeConfig(config1, config2) {
18
18
  // eslint-disable-next-line no-param-reassign
19
+ config1 = config1 || {};
19
20
  config2 = config2 || {};
20
21
 
21
22
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -68,6 +69,28 @@ export default function mergeConfig(config1, config2) {
68
69
  }
69
70
  }
70
71
 
72
+ function getMergedTransitionalOption(prop) {
73
+ const transitional2 = utils.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
74
+
75
+ if (!utils.isUndefined(transitional2)) {
76
+ if (utils.isPlainObject(transitional2)) {
77
+ if (utils.hasOwnProp(transitional2, prop)) {
78
+ return transitional2[prop];
79
+ }
80
+ } else {
81
+ return undefined;
82
+ }
83
+ }
84
+
85
+ const transitional1 = utils.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
86
+
87
+ if (utils.isPlainObject(transitional1) && utils.hasOwnProp(transitional1, prop)) {
88
+ return transitional1[prop];
89
+ }
90
+
91
+ return undefined;
92
+ }
93
+
71
94
  // eslint-disable-next-line consistent-return
72
95
  function mergeDirectKeys(a, b, prop) {
73
96
  if (utils.hasOwnProp(config2, prop)) {
@@ -120,5 +143,17 @@ export default function mergeConfig(config1, config2) {
120
143
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
121
144
  });
122
145
 
146
+ if (
147
+ utils.hasOwnProp(config2, 'validateStatus') &&
148
+ utils.isUndefined(config2.validateStatus) &&
149
+ getMergedTransitionalOption('validateStatusUndefinedResolves') === false
150
+ ) {
151
+ if (utils.hasOwnProp(config1, 'validateStatus')) {
152
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
153
+ } else {
154
+ delete config.validateStatus;
155
+ }
156
+ }
157
+
123
158
  return config;
124
159
  }
@@ -5,4 +5,6 @@ export default {
5
5
  forcedJSONParsing: true,
6
6
  clarifyTimeoutError: false,
7
7
  legacyInterceptorReqResOrdering: true,
8
+ advertiseZstdAcceptEncoding: false,
9
+ validateStatusUndefinedResolves: true,
8
10
  };
@@ -1 +1 @@
1
- export const VERSION = "1.16.0";
1
+ export const VERSION = "1.18.1";
@@ -46,9 +46,7 @@ prototype.append = function append(name, value) {
46
46
 
47
47
  prototype.toString = function toString(encoder) {
48
48
  const _encode = encoder
49
- ? function (value) {
50
- return encoder.call(this, value, encode);
51
- }
49
+ ? (value) => encoder.call(this, value, encode)
52
50
  : encode;
53
51
 
54
52
  return this._pairs
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ // Node-only: relies on the built-in `http2` module. Browser/react-native
4
+ // builds replace `lib/adapters/http.js` (the sole importer) with `lib/helpers/null.js`
5
+ // via the `browser` package.json field, so this module is never reached in
6
+ // those environments. Do not import it from any browser-reachable code path.
7
+
8
+ import http2 from 'http2';
9
+ import util from 'util';
10
+
11
+ class Http2Sessions {
12
+ constructor() {
13
+ this.sessions = Object.create(null);
14
+ }
15
+
16
+ getSession(authority, options) {
17
+ options = Object.assign(
18
+ {
19
+ sessionTimeout: 1000,
20
+ },
21
+ options
22
+ );
23
+
24
+ let authoritySessions = this.sessions[authority];
25
+
26
+ if (authoritySessions) {
27
+ let len = authoritySessions.length;
28
+
29
+ for (let i = 0; i < len; i++) {
30
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
31
+ if (
32
+ !sessionHandle.destroyed &&
33
+ !sessionHandle.closed &&
34
+ util.isDeepStrictEqual(sessionOptions, options)
35
+ ) {
36
+ return sessionHandle;
37
+ }
38
+ }
39
+ }
40
+
41
+ const session = http2.connect(authority, options);
42
+
43
+ let removed;
44
+ let timer;
45
+
46
+ const removeSession = () => {
47
+ if (removed) {
48
+ return;
49
+ }
50
+
51
+ removed = true;
52
+
53
+ if (timer) {
54
+ clearTimeout(timer);
55
+ timer = null;
56
+ }
57
+
58
+ let entries = authoritySessions,
59
+ len = entries.length,
60
+ i = len;
61
+
62
+ while (i--) {
63
+ if (entries[i][0] === session) {
64
+ if (len === 1) {
65
+ delete this.sessions[authority];
66
+ } else {
67
+ entries.splice(i, 1);
68
+ }
69
+ if (!session.closed) {
70
+ session.close();
71
+ }
72
+ return;
73
+ }
74
+ }
75
+ };
76
+
77
+ const originalRequestFn = session.request;
78
+
79
+ const { sessionTimeout } = options;
80
+
81
+ if (sessionTimeout != null) {
82
+ let streamsCount = 0;
83
+
84
+ session.request = function () {
85
+ const stream = originalRequestFn.apply(this, arguments);
86
+
87
+ streamsCount++;
88
+
89
+ if (timer) {
90
+ clearTimeout(timer);
91
+ timer = null;
92
+ }
93
+
94
+ stream.once('close', () => {
95
+ if (!--streamsCount) {
96
+ timer = setTimeout(() => {
97
+ timer = null;
98
+ removeSession();
99
+ }, sessionTimeout);
100
+ }
101
+ });
102
+
103
+ return stream;
104
+ };
105
+ }
106
+
107
+ session.once('close', removeSession);
108
+
109
+ let entry = [session, options];
110
+
111
+ authoritySessions
112
+ ? authoritySessions.push(entry)
113
+ : (authoritySessions = this.sessions[authority] = [entry]);
114
+
115
+ return session;
116
+ }
117
+ }
118
+
119
+ export default Http2Sessions;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  import utils from '../utils.js';
4
- import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';
4
+ import AxiosURLSearchParams from './AxiosURLSearchParams.js';
5
5
 
6
6
  /**
7
7
  * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
@@ -32,8 +32,7 @@ export default function buildURL(url, params, options) {
32
32
  if (!params) {
33
33
  return url;
34
34
  }
35
-
36
- const _encode = (options && options.encode) || encode;
35
+ url = url || '';
37
36
 
38
37
  const _options = utils.isFunction(options)
39
38
  ? {
@@ -41,7 +40,11 @@ export default function buildURL(url, params, options) {
41
40
  }
42
41
  : options;
43
42
 
44
- const serializeFn = _options && _options.serialize;
43
+ // Read serializer options pollution-safely: own properties and methods on a
44
+ // class/template prototype are honored, but values injected onto a polluted
45
+ // Object.prototype are ignored.
46
+ const _encode = utils.getSafeProp(_options, 'encode') || encode;
47
+ const serializeFn = utils.getSafeProp(_options, 'serialize');
45
48
 
46
49
  let serializedParams;
47
50
 
@@ -3,54 +3,55 @@ import AxiosError from '../core/AxiosError.js';
3
3
  import utils from '../utils.js';
4
4
 
5
5
  const composeSignals = (signals, timeout) => {
6
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
7
-
8
- if (timeout || length) {
9
- let controller = new AbortController();
10
-
11
- let aborted;
12
-
13
- const onabort = function (reason) {
14
- if (!aborted) {
15
- aborted = true;
16
- unsubscribe();
17
- const err = reason instanceof Error ? reason : this.reason;
18
- controller.abort(
19
- err instanceof AxiosError
20
- ? err
21
- : new CanceledError(err instanceof Error ? err.message : err)
22
- );
23
- }
24
- };
25
-
26
- let timer =
27
- timeout &&
28
- setTimeout(() => {
29
- timer = null;
30
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
31
- }, timeout);
32
-
33
- const unsubscribe = () => {
34
- if (signals) {
35
- timer && clearTimeout(timer);
36
- timer = null;
37
- signals.forEach((signal) => {
38
- signal.unsubscribe
39
- ? signal.unsubscribe(onabort)
40
- : signal.removeEventListener('abort', onabort);
41
- });
42
- signals = null;
43
- }
44
- };
45
-
46
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
47
-
48
- const { signal } = controller;
49
-
50
- signal.unsubscribe = () => utils.asap(unsubscribe);
51
-
52
- return signal;
6
+ signals = signals ? signals.filter(Boolean) : [];
7
+
8
+ if (!timeout && !signals.length) {
9
+ return;
53
10
  }
11
+
12
+ const controller = new AbortController();
13
+
14
+ let aborted = false;
15
+
16
+ const onabort = function (reason) {
17
+ if (!aborted) {
18
+ aborted = true;
19
+ unsubscribe();
20
+ const err = reason instanceof Error ? reason : this.reason;
21
+ controller.abort(
22
+ err instanceof AxiosError
23
+ ? err
24
+ : new CanceledError(err instanceof Error ? err.message : err)
25
+ );
26
+ }
27
+ };
28
+
29
+ let timer =
30
+ timeout &&
31
+ setTimeout(() => {
32
+ timer = null;
33
+ onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
34
+ }, timeout);
35
+
36
+ const unsubscribe = () => {
37
+ if (!signals) { return; }
38
+ timer && clearTimeout(timer);
39
+ timer = null;
40
+ signals.forEach((signal) => {
41
+ signal.unsubscribe
42
+ ? signal.unsubscribe(onabort)
43
+ : signal.removeEventListener('abort', onabort);
44
+ });
45
+ signals = null;
46
+ };
47
+
48
+ signals.forEach((signal) => signal.addEventListener('abort', onabort, { once: true }));
49
+
50
+ const { signal } = controller;
51
+
52
+ signal.unsubscribe = () => utils.asap(unsubscribe);
53
+
54
+ return signal;
54
55
  };
55
56
 
56
57
  export default composeSignals;
@@ -40,7 +40,11 @@ export default platform.hasStandardBrowserEnv
40
40
  const cookie = cookies[i].replace(/^\s+/, '');
41
41
  const eq = cookie.indexOf('=');
42
42
  if (eq !== -1 && cookie.slice(0, eq) === name) {
43
- return decodeURIComponent(cookie.slice(eq + 1));
43
+ try {
44
+ return decodeURIComponent(cookie.slice(eq + 1));
45
+ } catch (e) {
46
+ return cookie.slice(eq + 1);
47
+ }
44
48
  }
45
49
  }
46
50
  return null;
@@ -2,11 +2,19 @@
2
2
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3
3
  * - For base64: compute exact decoded size using length and padding;
4
4
  * handle %XX at the character-count level (no string allocation).
5
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
5
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
6
6
  *
7
7
  * @param {string} url
8
8
  * @returns {number}
9
9
  */
10
+ const isHexDigit = (charCode) =>
11
+ (charCode >= 48 && charCode <= 57) ||
12
+ (charCode >= 65 && charCode <= 70) ||
13
+ (charCode >= 97 && charCode <= 102);
14
+
15
+ const isPercentEncodedByte = (str, i, len) =>
16
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
17
+
10
18
  export default function estimateDataURLDecodedBytes(url) {
11
19
  if (!url || typeof url !== 'string') return 0;
12
20
  if (!url.startsWith('data:')) return 0;
@@ -26,9 +34,7 @@ export default function estimateDataURLDecodedBytes(url) {
26
34
  if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
27
35
  const a = body.charCodeAt(i + 1);
28
36
  const b = body.charCodeAt(i + 2);
29
- const isHex =
30
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
31
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
37
+ const isHex = isHexDigit(a) && isHexDigit(b);
32
38
 
33
39
  if (isHex) {
34
40
  effectiveLen -= 2;
@@ -69,18 +75,17 @@ export default function estimateDataURLDecodedBytes(url) {
69
75
  return bytes > 0 ? bytes : 0;
70
76
  }
71
77
 
72
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
73
- return Buffer.byteLength(body, 'utf8');
74
- }
75
-
76
78
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
77
79
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
78
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
79
- // but 3 UTF-8 bytes).
80
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
81
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
80
82
  let bytes = 0;
81
83
  for (let i = 0, len = body.length; i < len; i++) {
82
84
  const c = body.charCodeAt(i);
83
- if (c < 0x80) {
85
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
86
+ bytes += 1;
87
+ i += 2;
88
+ } else if (c < 0x80) {
84
89
  bytes += 1;
85
90
  } else if (c < 0x800) {
86
91
  bytes += 2;
@@ -1,6 +1,19 @@
1
1
  'use strict';
2
2
 
3
3
  import utils from '../utils.js';
4
+ import AxiosError from '../core/AxiosError.js';
5
+ import { DEFAULT_FORM_DATA_MAX_DEPTH } from './toFormData.js';
6
+
7
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
8
+
9
+ function throwIfDepthExceeded(index) {
10
+ if (index > MAX_DEPTH) {
11
+ throw new AxiosError(
12
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
13
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
14
+ );
15
+ }
16
+ }
4
17
 
5
18
  /**
6
19
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
@@ -14,9 +27,16 @@ function parsePropPath(name) {
14
27
  // foo.x.y.z
15
28
  // foo-x-y-z
16
29
  // foo x y z
17
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
18
- return match[0] === '[]' ? '' : match[1] || match[0];
19
- });
30
+ const path = [];
31
+ const pattern = /\w+|\[(\w*)]/g;
32
+ let match;
33
+
34
+ while ((match = pattern.exec(name)) !== null) {
35
+ throwIfDepthExceeded(path.length);
36
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
37
+ }
38
+
39
+ return path;
20
40
  }
21
41
 
22
42
  /**
@@ -48,6 +68,8 @@ function arrayToObject(arr) {
48
68
  */
49
69
  function formDataToJSON(formData) {
50
70
  function buildPath(path, value, target, index) {
71
+ throwIfDepthExceeded(index);
72
+
51
73
  let name = path[index++];
52
74
 
53
75
  if (name === '__proto__') return true;
@@ -68,7 +90,7 @@ function formDataToJSON(formData) {
68
90
  return !isNumericKey;
69
91
  }
70
92
 
71
- if (!target[name] || !utils.isObject(target[name])) {
93
+ if (!utils.hasOwnProp(target, name) || !utils.isObject(target[name])) {
72
94
  target[name] = [];
73
95
  }
74
96
 
@@ -73,11 +73,11 @@ const formDataToStream = (form, headersHandler, options) => {
73
73
  } = options || {};
74
74
 
75
75
  if (!utils.isFormData(form)) {
76
- throw TypeError('FormData instance required');
76
+ throw new TypeError('FormData instance required');
77
77
  }
78
78
 
79
79
  if (boundary.length < 1 || boundary.length > 70) {
80
- throw Error('boundary must be 1-70 characters long');
80
+ throw new Error('boundary must be 1-70 characters long');
81
81
  }
82
82
 
83
83
  const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);