@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
@@ -0,0 +1,137 @@
1
+ https-proxy-agent
2
+ ================
3
+ ### An HTTP(s) proxy `http.Agent` implementation for HTTPS
4
+ [![Build Status](https://github.com/TooTallNate/node-https-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-https-proxy-agent/actions?workflow=Node+CI)
5
+
6
+ This module provides an `http.Agent` implementation that connects to a specified
7
+ HTTP or HTTPS proxy server, and can be used with the built-in `https` module.
8
+
9
+ Specifically, this `Agent` implementation connects to an intermediary "proxy"
10
+ server and issues the [CONNECT HTTP method][CONNECT], which tells the proxy to
11
+ open a direct TCP connection to the destination server.
12
+
13
+ Since this agent implements the CONNECT HTTP method, it also works with other
14
+ protocols that use this method when connecting over proxies (i.e. WebSockets).
15
+ See the "Examples" section below for more.
16
+
17
+
18
+ Installation
19
+ ------------
20
+
21
+ Install with `npm`:
22
+
23
+ ``` bash
24
+ $ npm install https-proxy-agent
25
+ ```
26
+
27
+
28
+ Examples
29
+ --------
30
+
31
+ #### `https` module example
32
+
33
+ ``` js
34
+ var url = require('url');
35
+ var https = require('https');
36
+ var HttpsProxyAgent = require('https-proxy-agent');
37
+
38
+ // HTTP/HTTPS proxy to connect to
39
+ var proxy = process.env.http_proxy || 'http://168.63.76.32:3128';
40
+ console.log('using proxy server %j', proxy);
41
+
42
+ // HTTPS endpoint for the proxy to connect to
43
+ var endpoint = process.argv[2] || 'https://graph.facebook.com/tootallnate';
44
+ console.log('attempting to GET %j', endpoint);
45
+ var options = url.parse(endpoint);
46
+
47
+ // create an instance of the `HttpsProxyAgent` class with the proxy server information
48
+ var agent = new HttpsProxyAgent(proxy);
49
+ options.agent = agent;
50
+
51
+ https.get(options, function (res) {
52
+ console.log('"response" event!', res.headers);
53
+ res.pipe(process.stdout);
54
+ });
55
+ ```
56
+
57
+ #### `ws` WebSocket connection example
58
+
59
+ ``` js
60
+ var url = require('url');
61
+ var WebSocket = require('ws');
62
+ var HttpsProxyAgent = require('https-proxy-agent');
63
+
64
+ // HTTP/HTTPS proxy to connect to
65
+ var proxy = process.env.http_proxy || 'http://168.63.76.32:3128';
66
+ console.log('using proxy server %j', proxy);
67
+
68
+ // WebSocket endpoint for the proxy to connect to
69
+ var endpoint = process.argv[2] || 'ws://echo.websocket.org';
70
+ var parsed = url.parse(endpoint);
71
+ console.log('attempting to connect to WebSocket %j', endpoint);
72
+
73
+ // create an instance of the `HttpsProxyAgent` class with the proxy server information
74
+ var options = url.parse(proxy);
75
+
76
+ var agent = new HttpsProxyAgent(options);
77
+
78
+ // finally, initiate the WebSocket connection
79
+ var socket = new WebSocket(endpoint, { agent: agent });
80
+
81
+ socket.on('open', function () {
82
+ console.log('"open" event!');
83
+ socket.send('hello world');
84
+ });
85
+
86
+ socket.on('message', function (data, flags) {
87
+ console.log('"message" event! %j %j', data, flags);
88
+ socket.close();
89
+ });
90
+ ```
91
+
92
+ API
93
+ ---
94
+
95
+ ### new HttpsProxyAgent(Object options)
96
+
97
+ The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects
98
+ to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket
99
+ requests. This is achieved by using the [HTTP `CONNECT` method][CONNECT].
100
+
101
+ The `options` argument may either be a string URI of the proxy server to use, or an
102
+ "options" object with more specific properties:
103
+
104
+ * `host` - String - Proxy host to connect to (may use `hostname` as well). Required.
105
+ * `port` - Number - Proxy port to connect to. Required.
106
+ * `protocol` - String - If `https:`, then use TLS to connect to the proxy.
107
+ * `headers` - Object - Additional HTTP headers to be sent on the HTTP CONNECT method.
108
+ * Any other options given are passed to the `net.connect()`/`tls.connect()` functions.
109
+
110
+
111
+ License
112
+ -------
113
+
114
+ (The MIT License)
115
+
116
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
117
+
118
+ Permission is hereby granted, free of charge, to any person obtaining
119
+ a copy of this software and associated documentation files (the
120
+ 'Software'), to deal in the Software without restriction, including
121
+ without limitation the rights to use, copy, modify, merge, publish,
122
+ distribute, sublicense, and/or sell copies of the Software, and to
123
+ permit persons to whom the Software is furnished to do so, subject to
124
+ the following conditions:
125
+
126
+ The above copyright notice and this permission notice shall be
127
+ included in all copies or substantial portions of the Software.
128
+
129
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
130
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
131
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
132
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
133
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
134
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
135
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136
+
137
+ [CONNECT]: http://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_Tunneling
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ import net from 'net';
3
+ import { Agent, ClientRequest, RequestOptions } from 'agent-base';
4
+ import { HttpsProxyAgentOptions } from '.';
5
+ /**
6
+ * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
7
+ * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
8
+ *
9
+ * Outgoing HTTP requests are first tunneled through the proxy server using the
10
+ * `CONNECT` HTTP request method to establish a connection to the proxy server,
11
+ * and then the proxy server connects to the destination target and issues the
12
+ * HTTP request from the proxy server.
13
+ *
14
+ * `https:` requests have their socket connection upgraded to TLS once
15
+ * the connection to the proxy server has been established.
16
+ *
17
+ * @api public
18
+ */
19
+ export default class HttpsProxyAgent extends Agent {
20
+ private secureProxy;
21
+ private proxy;
22
+ constructor(_opts: string | HttpsProxyAgentOptions);
23
+ /**
24
+ * Called when the node-core HTTP client library is creating a
25
+ * new HTTP request.
26
+ *
27
+ * @api protected
28
+ */
29
+ callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket>;
30
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const net_1 = __importDefault(require("net"));
16
+ const tls_1 = __importDefault(require("tls"));
17
+ const url_1 = __importDefault(require("url"));
18
+ const assert_1 = __importDefault(require("assert"));
19
+ const debug_1 = __importDefault(require("debug"));
20
+ const agent_base_1 = require("agent-base");
21
+ const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response"));
22
+ const debug = debug_1.default('https-proxy-agent:agent');
23
+ /**
24
+ * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
25
+ * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
26
+ *
27
+ * Outgoing HTTP requests are first tunneled through the proxy server using the
28
+ * `CONNECT` HTTP request method to establish a connection to the proxy server,
29
+ * and then the proxy server connects to the destination target and issues the
30
+ * HTTP request from the proxy server.
31
+ *
32
+ * `https:` requests have their socket connection upgraded to TLS once
33
+ * the connection to the proxy server has been established.
34
+ *
35
+ * @api public
36
+ */
37
+ class HttpsProxyAgent extends agent_base_1.Agent {
38
+ constructor(_opts) {
39
+ let opts;
40
+ if (typeof _opts === 'string') {
41
+ opts = url_1.default.parse(_opts);
42
+ }
43
+ else {
44
+ opts = _opts;
45
+ }
46
+ if (!opts) {
47
+ throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
48
+ }
49
+ debug('creating new HttpsProxyAgent instance: %o', opts);
50
+ super(opts);
51
+ const proxy = Object.assign({}, opts);
52
+ // If `true`, then connect to the proxy server over TLS.
53
+ // Defaults to `false`.
54
+ this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
55
+ // Prefer `hostname` over `host`, and set the `port` if needed.
56
+ proxy.host = proxy.hostname || proxy.host;
57
+ if (typeof proxy.port === 'string') {
58
+ proxy.port = parseInt(proxy.port, 10);
59
+ }
60
+ if (!proxy.port && proxy.host) {
61
+ proxy.port = this.secureProxy ? 443 : 80;
62
+ }
63
+ // ALPN is supported by Node.js >= v5.
64
+ // attempt to negotiate http/1.1 for proxy servers that support http/2
65
+ if (this.secureProxy && !('ALPNProtocols' in proxy)) {
66
+ proxy.ALPNProtocols = ['http 1.1'];
67
+ }
68
+ if (proxy.host && proxy.path) {
69
+ // If both a `host` and `path` are specified then it's most likely
70
+ // the result of a `url.parse()` call... we need to remove the
71
+ // `path` portion so that `net.connect()` doesn't attempt to open
72
+ // that as a Unix socket file.
73
+ delete proxy.path;
74
+ delete proxy.pathname;
75
+ }
76
+ this.proxy = proxy;
77
+ }
78
+ /**
79
+ * Called when the node-core HTTP client library is creating a
80
+ * new HTTP request.
81
+ *
82
+ * @api protected
83
+ */
84
+ callback(req, opts) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ const { proxy, secureProxy } = this;
87
+ // Create a socket connection to the proxy server.
88
+ let socket;
89
+ if (secureProxy) {
90
+ debug('Creating `tls.Socket`: %o', proxy);
91
+ socket = tls_1.default.connect(proxy);
92
+ }
93
+ else {
94
+ debug('Creating `net.Socket`: %o', proxy);
95
+ socket = net_1.default.connect(proxy);
96
+ }
97
+ const headers = Object.assign({}, proxy.headers);
98
+ const hostname = `${opts.host}:${opts.port}`;
99
+ let payload = `CONNECT ${hostname} HTTP/1.1\r\n`;
100
+ // Inject the `Proxy-Authorization` header if necessary.
101
+ if (proxy.auth) {
102
+ headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;
103
+ }
104
+ // The `Host` header should only include the port
105
+ // number when it is not the default port.
106
+ let { host, port, secureEndpoint } = opts;
107
+ if (!isDefaultPort(port, secureEndpoint)) {
108
+ host += `:${port}`;
109
+ }
110
+ headers.Host = host;
111
+ headers.Connection = 'close';
112
+ for (const name of Object.keys(headers)) {
113
+ payload += `${name}: ${headers[name]}\r\n`;
114
+ }
115
+ const proxyResponsePromise = parse_proxy_response_1.default(socket);
116
+ socket.write(`${payload}\r\n`);
117
+ const { statusCode, buffered } = yield proxyResponsePromise;
118
+ if (statusCode === 200) {
119
+ req.once('socket', resume);
120
+ if (opts.secureEndpoint) {
121
+ // The proxy is connecting to a TLS server, so upgrade
122
+ // this socket connection to a TLS connection.
123
+ debug('Upgrading socket connection to TLS');
124
+ const servername = opts.servername || opts.host;
125
+ return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,
126
+ servername }));
127
+ }
128
+ return socket;
129
+ }
130
+ // Some other status code that's not 200... need to re-play the HTTP
131
+ // header "data" events onto the socket once the HTTP machinery is
132
+ // attached so that the node core `http` can parse and handle the
133
+ // error status code.
134
+ // Close the original socket, and a new "fake" socket is returned
135
+ // instead, so that the proxy doesn't get the HTTP request
136
+ // written to it (which may contain `Authorization` headers or other
137
+ // sensitive data).
138
+ //
139
+ // See: https://hackerone.com/reports/541502
140
+ socket.destroy();
141
+ const fakeSocket = new net_1.default.Socket({ writable: false });
142
+ fakeSocket.readable = true;
143
+ // Need to wait for the "socket" event to re-play the "data" events.
144
+ req.once('socket', (s) => {
145
+ debug('replaying proxy buffer for failed request');
146
+ assert_1.default(s.listenerCount('data') > 0);
147
+ // Replay the "buffered" Buffer onto the fake `socket`, since at
148
+ // this point the HTTP module machinery has been hooked up for
149
+ // the user.
150
+ s.push(buffered);
151
+ s.push(null);
152
+ });
153
+ return fakeSocket;
154
+ });
155
+ }
156
+ }
157
+ exports.default = HttpsProxyAgent;
158
+ function resume(socket) {
159
+ socket.resume();
160
+ }
161
+ function isDefaultPort(port, secure) {
162
+ return Boolean((!secure && port === 80) || (secure && port === 443));
163
+ }
164
+ function isHTTPS(protocol) {
165
+ return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
166
+ }
167
+ function omit(obj, ...keys) {
168
+ const ret = {};
169
+ let key;
170
+ for (key in obj) {
171
+ if (!keys.includes(key)) {
172
+ ret[key] = obj[key];
173
+ }
174
+ }
175
+ return ret;
176
+ }
177
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,8CAAsB;AACtB,8CAAsB;AACtB,oDAA4B;AAC5B,kDAAgC;AAEhC,2CAAkE;AAElE,kFAAwD;AAExD,MAAM,KAAK,GAAG,eAAW,CAAC,yBAAyB,CAAC,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAqB,eAAgB,SAAQ,kBAAK;IAIjD,YAAY,KAAsC;QACjD,IAAI,IAA4B,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC9B,IAAI,GAAG,aAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;aAA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AY;gBACZ,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACjB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC;QACnB,CAAC;KAAA;CACD;AA3JD,kCA2JC;AAED,SAAS,MAAM,CAAC,MAAkC;IACjD,MAAM,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,MAAe;IACnD,OAAO,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,OAAO,CAAC,QAAwB;IACxC,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3E,CAAC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="node" />
2
+ import net from 'net';
3
+ import tls from 'tls';
4
+ import { Url } from 'url';
5
+ import { AgentOptions } from 'agent-base';
6
+ import { OutgoingHttpHeaders } from 'http';
7
+ import _HttpsProxyAgent from './agent';
8
+ declare function createHttpsProxyAgent(opts: string | createHttpsProxyAgent.HttpsProxyAgentOptions): _HttpsProxyAgent;
9
+ declare namespace createHttpsProxyAgent {
10
+ interface BaseHttpsProxyAgentOptions {
11
+ headers?: OutgoingHttpHeaders;
12
+ secureProxy?: boolean;
13
+ host?: string | null;
14
+ path?: string | null;
15
+ port?: string | number | null;
16
+ }
17
+ export interface HttpsProxyAgentOptions extends AgentOptions, BaseHttpsProxyAgentOptions, Partial<Omit<Url & net.NetConnectOpts & tls.ConnectionOptions, keyof BaseHttpsProxyAgentOptions>> {
18
+ }
19
+ export type HttpsProxyAgent = _HttpsProxyAgent;
20
+ export const HttpsProxyAgent: typeof _HttpsProxyAgent;
21
+ export {};
22
+ }
23
+ export = createHttpsProxyAgent;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const agent_1 = __importDefault(require("./agent"));
6
+ function createHttpsProxyAgent(opts) {
7
+ return new agent_1.default(opts);
8
+ }
9
+ (function (createHttpsProxyAgent) {
10
+ createHttpsProxyAgent.HttpsProxyAgent = agent_1.default;
11
+ createHttpsProxyAgent.prototype = agent_1.default.prototype;
12
+ })(createHttpsProxyAgent || (createHttpsProxyAgent = {}));
13
+ module.exports = createHttpsProxyAgent;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAoBjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAvBS,qBAAqB,KAArB,qBAAqB,QAuB9B;AAED,iBAAS,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+ import { Readable } from 'stream';
3
+ export interface ProxyResponse {
4
+ statusCode: number;
5
+ buffered: Buffer;
6
+ }
7
+ export default function parseProxyResponse(socket: Readable): Promise<ProxyResponse>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const debug_1 = __importDefault(require("debug"));
7
+ const debug = debug_1.default('https-proxy-agent:parse-proxy-response');
8
+ function parseProxyResponse(socket) {
9
+ return new Promise((resolve, reject) => {
10
+ // we need to buffer any HTTP traffic that happens with the proxy before we get
11
+ // the CONNECT response, so that if the response is anything other than an "200"
12
+ // response code, then we can re-play the "data" events on the socket once the
13
+ // HTTP parser is hooked up...
14
+ let buffersLength = 0;
15
+ const buffers = [];
16
+ function read() {
17
+ const b = socket.read();
18
+ if (b)
19
+ ondata(b);
20
+ else
21
+ socket.once('readable', read);
22
+ }
23
+ function cleanup() {
24
+ socket.removeListener('end', onend);
25
+ socket.removeListener('error', onerror);
26
+ socket.removeListener('close', onclose);
27
+ socket.removeListener('readable', read);
28
+ }
29
+ function onclose(err) {
30
+ debug('onclose had error %o', err);
31
+ }
32
+ function onend() {
33
+ debug('onend');
34
+ }
35
+ function onerror(err) {
36
+ cleanup();
37
+ debug('onerror %o', err);
38
+ reject(err);
39
+ }
40
+ function ondata(b) {
41
+ buffers.push(b);
42
+ buffersLength += b.length;
43
+ const buffered = Buffer.concat(buffers, buffersLength);
44
+ const endOfHeaders = buffered.indexOf('\r\n\r\n');
45
+ if (endOfHeaders === -1) {
46
+ // keep buffering
47
+ debug('have not received end of HTTP headers yet...');
48
+ read();
49
+ return;
50
+ }
51
+ const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n'));
52
+ const statusCode = +firstLine.split(' ')[1];
53
+ debug('got proxy server response: %o', firstLine);
54
+ resolve({
55
+ statusCode,
56
+ buffered
57
+ });
58
+ }
59
+ socket.on('error', onerror);
60
+ socket.on('close', onclose);
61
+ socket.on('end', onend);
62
+ read();
63
+ });
64
+ }
65
+ exports.default = parseProxyResponse;
66
+ //# sourceMappingURL=parse-proxy-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-proxy-response.js","sourceRoot":"","sources":["../src/parse-proxy-response.ts"],"names":[],"mappings":";;;;;AAAA,kDAAgC;AAGhC,MAAM,KAAK,GAAG,eAAW,CAAC,wCAAwC,CAAC,CAAC;AAOpE,SAAwB,kBAAkB,CACzC,MAAgB;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,+EAA+E;QAC/E,gFAAgF;QAChF,8EAA8E;QAC9E,8BAA8B;QAC9B,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,SAAS,IAAI;YACZ,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBAAE,MAAM,CAAC,CAAC,CAAC,CAAC;;gBACZ,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,SAAS,OAAO;YACf,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;QAED,SAAS,OAAO,CAAC,GAAW;YAC3B,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,SAAS,KAAK;YACb,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;QAED,SAAS,OAAO,CAAC,GAAU;YAC1B,OAAO,EAAE,CAAC;YACV,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QAED,SAAS,MAAM,CAAC,CAAS;YACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,aAAa,IAAI,CAAC,CAAC,MAAM,CAAC;YAE1B,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;YACvD,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAElD,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE;gBACxB,iBAAiB;gBACjB,KAAK,CAAC,8CAA8C,CAAC,CAAC;gBACtD,IAAI,EAAE,CAAC;gBACP,OAAO;aACP;YAED,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAClC,OAAO,EACP,CAAC,EACD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CACxB,CAAC;YACF,MAAM,UAAU,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,KAAK,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC;YAClD,OAAO,CAAC;gBACP,UAAU;gBACV,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAExB,IAAI,EAAE,CAAC;IACR,CAAC,CAAC,CAAC;AACJ,CAAC;AAvED,qCAuEC"}
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "https-proxy-agent",
3
+ "version": "5.0.1",
4
+ "description": "An HTTP(s) proxy `http.Agent` implementation for HTTPS",
5
+ "main": "dist/index",
6
+ "types": "dist/index",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "prebuild": "rimraf dist",
12
+ "build": "tsc",
13
+ "test": "mocha --reporter spec",
14
+ "test-lint": "eslint src --ext .js,.ts",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git://github.com/TooTallNate/node-https-proxy-agent.git"
20
+ },
21
+ "keywords": [
22
+ "https",
23
+ "proxy",
24
+ "endpoint",
25
+ "agent"
26
+ ],
27
+ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
28
+ "license": "MIT",
29
+ "bugs": {
30
+ "url": "https://github.com/TooTallNate/node-https-proxy-agent/issues"
31
+ },
32
+ "dependencies": {
33
+ "agent-base": "6",
34
+ "debug": "4"
35
+ },
36
+ "devDependencies": {
37
+ "@types/debug": "4",
38
+ "@types/node": "^12.12.11",
39
+ "@typescript-eslint/eslint-plugin": "1.6.0",
40
+ "@typescript-eslint/parser": "1.1.0",
41
+ "eslint": "5.16.0",
42
+ "eslint-config-airbnb": "17.1.0",
43
+ "eslint-config-prettier": "4.1.0",
44
+ "eslint-import-resolver-typescript": "1.1.1",
45
+ "eslint-plugin-import": "2.16.0",
46
+ "eslint-plugin-jsx-a11y": "6.2.1",
47
+ "eslint-plugin-react": "7.12.4",
48
+ "mocha": "^6.2.2",
49
+ "proxy": "1",
50
+ "rimraf": "^3.0.0",
51
+ "typescript": "^3.5.3"
52
+ },
53
+ "engines": {
54
+ "node": ">= 6"
55
+ }
56
+ }
@@ -109,6 +109,8 @@ module.exports = {
109
109
 
110
110
  hebrew: "iso88598",
111
111
  hebrew8: "iso88598",
112
+ iso88598i: "iso88598",
113
+ iso88598e: "iso88598",
112
114
 
113
115
  turkish: "iso88599",
114
116
  turkish8: "iso88599",
@@ -31,7 +31,9 @@ function Utf32Encoder (options, codec) {
31
31
 
32
32
  Utf32Encoder.prototype.write = function (str) {
33
33
  var src = Buffer.from(str, "ucs2")
34
- var dst = Buffer.alloc(src.length * 2)
34
+ // src.length * 2 covers this chunk's code units (4 bytes each); the extra 4 bytes leave room for a
35
+ // high surrogate held over from a previous chunk, which is flushed ahead of this chunk's units.
36
+ var dst = Buffer.alloc(src.length * 2 + 4)
35
37
  var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE
36
38
  var offset = 0
37
39
 
@@ -113,9 +115,9 @@ Utf32Decoder.prototype.write = function (src) {
113
115
  // NOTE: codepoint is a signed int32 and can be negative.
114
116
  // NOTE: We copied this block from below to help V8 optimize it (it works with array, not buffer).
115
117
  if (isLE) {
116
- codepoint = overflow[i] | (overflow[i + 1] << 8) | (overflow[i + 2] << 16) | (overflow[i + 3] << 24)
118
+ codepoint = overflow[0] | (overflow[1] << 8) | (overflow[2] << 16) | (overflow[3] << 24)
117
119
  } else {
118
- codepoint = overflow[i + 3] | (overflow[i + 2] << 8) | (overflow[i + 1] << 16) | (overflow[i] << 24)
120
+ codepoint = overflow[3] | (overflow[2] << 8) | (overflow[1] << 16) | (overflow[0] << 24)
119
121
  }
120
122
  overflow.length = 0
121
123
 
@@ -169,7 +171,12 @@ function _writeCodepoint (dst, offset, codepoint, badChar) {
169
171
  };
170
172
 
171
173
  Utf32Decoder.prototype.end = function () {
174
+ if (this.overflow.length === 0) { return }
175
+
176
+ // A leftover, incomplete 4-byte code unit at the end of the input is ill-formed. Substitute a
177
+ // single U+FFFD (Unicode Standard conformance clause C10) instead of silently dropping the bytes.
172
178
  this.overflow.length = 0
179
+ return String.fromCharCode(this.badChar)
173
180
  }
174
181
 
175
182
  // == UTF-32 Auto codec =============================================================
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iconv-lite",
3
3
  "description": "Convert character encodings in pure javascript.",
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "iconv",
@@ -46,7 +46,7 @@
46
46
  "stream": false
47
47
  },
48
48
  "devDependencies": {
49
- "@arethetypeswrong/cli": "^0.17.4",
49
+ "@arethetypeswrong/cli": "^0.18.4",
50
50
  "@stylistic/eslint-plugin": "^5.1.0",
51
51
  "@stylistic/eslint-plugin-js": "^4.1.0",
52
52
  "@types/node": "^24.0.12",
@@ -276,6 +276,8 @@ export type Encoding =
276
276
  | "iso88596"
277
277
  | "iso88597"
278
278
  | "iso88598"
279
+ | "iso88598e"
280
+ | "iso88598i"
279
281
  | "iso88599"
280
282
  | "isoceltic"
281
283
  | "isoir100"
@@ -153,7 +153,7 @@ The `parse` function accepts a string and returns `TokenData`, which can be used
153
153
 
154
154
  `TokenData` has two properties:
155
155
 
156
- - **tokens** A sequence of tokens, currently of types `text`, `parameter`, `wildcard`, or `group`.
156
+ - **tokens** A sequence of tokens, currently of types `text`, `param`, `wildcard`, or `group`.
157
157
  - **originalPath** The original path used with `parse`, shown in error messages to assist debugging.
158
158
 
159
159
  ### Custom path
@@ -165,13 +165,13 @@ import { match } from "path-to-regexp";
165
165
 
166
166
  const tokens = [
167
167
  { type: "text", value: "/" },
168
- { type: "parameter", name: "foo" },
168
+ { type: "param", name: "foo" },
169
169
  ];
170
170
  const originalPath = "/[foo]"; // To help debug error messages.
171
171
  const path = { tokens, originalPath };
172
172
  const fn = match(path);
173
173
 
174
- fn("/test"); //=> { path: '/test', index: 0, params: { foo: 'test' } }
174
+ fn("/test"); //=> { path: '/test', params: { foo: 'test' } }
175
175
  ```
176
176
 
177
177
  ## Errors