@hyperttp/core 1.1.12 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Core/HyperCore.d.ts +21 -9
- package/Core/HyperCore.d.ts.map +1 -1
- package/Core/HyperCore.js +187 -116
- package/Core/HyperCore.js.map +1 -1
- package/Core/index.d.ts +0 -1
- package/Core/index.d.ts.map +1 -1
- package/Core/index.js +0 -1
- package/Core/index.js.map +1 -1
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/defaultConfig.d.ts +1 -1
- package/defaultConfig.d.ts.map +1 -1
- package/defaultConfig.js +0 -1
- package/defaultConfig.js.map +1 -1
- package/index.d.ts +1 -4
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +19 -6
- package/transports/node.d.ts +11 -7
- package/transports/node.d.ts.map +1 -1
- package/transports/node.js +367 -135
- package/transports/node.js.map +1 -1
- package/utils/errors.d.ts +49 -0
- package/utils/errors.d.ts.map +1 -0
- package/utils/errors.js +63 -0
- package/utils/errors.js.map +1 -0
- package/utils/merge.d.ts +8 -1
- package/utils/merge.d.ts.map +1 -1
- package/utils/merge.js +27 -13
- package/utils/merge.js.map +1 -1
- package/utils/pipeline.d.ts +42 -0
- package/utils/pipeline.d.ts.map +1 -0
- package/utils/pipeline.js +86 -0
- package/utils/pipeline.js.map +1 -0
- package/utils/response.d.ts +44 -0
- package/utils/response.d.ts.map +1 -0
- package/utils/response.js +86 -0
- package/utils/response.js.map +1 -0
- package/utils/retryUtils.d.ts +5 -0
- package/utils/retryUtils.d.ts.map +1 -0
- package/utils/retryUtils.js +35 -0
- package/utils/retryUtils.js.map +1 -0
- package/Core/RequestExecutor.d.ts +0 -64
- package/Core/RequestExecutor.d.ts.map +0 -1
- package/Core/RequestExecutor.js +0 -213
- package/Core/RequestExecutor.js.map +0 -1
- package/transports/bun.d.ts +0 -16
- package/transports/bun.d.ts.map +0 -1
- package/transports/bun.js +0 -181
- package/transports/bun.js.map +0 -1
- package/types/errors.d.ts +0 -20
- package/types/errors.d.ts.map +0 -1
- package/types/errors.js +0 -28
- package/types/errors.js.map +0 -1
- package/types/http.d.ts +0 -5
- package/types/http.d.ts.map +0 -1
- package/types/http.js +0 -2
- package/types/http.js.map +0 -1
- package/types/hyper.d.ts +0 -34
- package/types/hyper.d.ts.map +0 -1
- package/types/hyper.js +0 -2
- package/types/hyper.js.map +0 -1
- package/types/index.d.ts +0 -12
- package/types/index.d.ts.map +0 -1
- package/types/index.js +0 -12
- package/types/index.js.map +0 -1
- package/types/metrics.d.ts +0 -65
- package/types/metrics.d.ts.map +0 -1
- package/types/metrics.js +0 -2
- package/types/metrics.js.map +0 -1
- package/types/network.d.ts +0 -65
- package/types/network.d.ts.map +0 -1
- package/types/network.js +0 -2
- package/types/network.js.map +0 -1
- package/types/options.d.ts +0 -51
- package/types/options.d.ts.map +0 -1
- package/types/options.js +0 -2
- package/types/options.js.map +0 -1
- package/types/plugins.d.ts +0 -47
- package/types/plugins.d.ts.map +0 -1
- package/types/plugins.js +0 -2
- package/types/plugins.js.map +0 -1
- package/types/request.d.ts +0 -114
- package/types/request.d.ts.map +0 -1
- package/types/request.js +0 -2
- package/types/request.js.map +0 -1
- package/types/retry.d.ts +0 -28
- package/types/retry.d.ts.map +0 -1
- package/types/retry.js +0 -2
- package/types/retry.js.map +0 -1
- package/types/stream.d.ts +0 -39
- package/types/stream.d.ts.map +0 -1
- package/types/stream.js +0 -2
- package/types/stream.js.map +0 -1
- package/types/transport.d.ts +0 -25
- package/types/transport.d.ts.map +0 -1
- package/types/transport.js +0 -2
- package/types/transport.js.map +0 -1
package/transports/node.js
CHANGED
|
@@ -1,160 +1,392 @@
|
|
|
1
|
-
import
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import https from "node:https";
|
|
2
3
|
import zlib from "node:zlib";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
: 1;
|
|
21
|
-
this.agent = new CookieAgent({
|
|
22
|
-
connections: concurrency === Infinity ? null : concurrency,
|
|
23
|
-
pipelining,
|
|
24
|
-
keepAliveTimeout: config.network?.keepAliveTimeout ?? 30000,
|
|
25
|
-
keepAliveMaxTimeout: config.network?.keepAliveTimeout ?? 30000,
|
|
26
|
-
clientTtl: 60000,
|
|
27
|
-
connect: { rejectUnauthorized: config.network?.rejectUnauthorized },
|
|
28
|
-
allowH2,
|
|
29
|
-
});
|
|
30
|
-
const retryOptions = {
|
|
31
|
-
maxRetries: config.retry?.maxRetries ?? 3,
|
|
32
|
-
...config.retry,
|
|
33
|
-
};
|
|
34
|
-
this.executor = new RequestExecutor(this.agent, {
|
|
35
|
-
timeout: config.network?.timeout ?? 30000,
|
|
36
|
-
maxRetries: retryOptions.maxRetries ?? 3,
|
|
37
|
-
followRedirects: config.network?.followRedirects ?? true,
|
|
38
|
-
maxRedirects: config.network?.maxRedirects ?? 5,
|
|
39
|
-
retryOptions: retryOptions,
|
|
40
|
-
verbose: config.verbose ?? false,
|
|
41
|
-
logger: config.logger,
|
|
42
|
-
});
|
|
4
|
+
import { Readable } from "node:stream";
|
|
5
|
+
import { ReadableStream } from "node:stream/web";
|
|
6
|
+
const REDIRECT_STATUS_CODES = new Set([301, 302, 303, 307, 308]);
|
|
7
|
+
const DEFAULT_RETRY_STATUS_CODES = [502, 503, 504];
|
|
8
|
+
const RETRYABLE_NETWORK_CODES = [
|
|
9
|
+
"ECONNREFUSED",
|
|
10
|
+
"ETIMEDOUT",
|
|
11
|
+
"ECONNRESET",
|
|
12
|
+
"EPIPE",
|
|
13
|
+
];
|
|
14
|
+
export function isRedirect(status) {
|
|
15
|
+
return REDIRECT_STATUS_CODES.has(status);
|
|
16
|
+
}
|
|
17
|
+
export function shouldRetry(status, retryOptions) {
|
|
18
|
+
const codes = retryOptions.retryStatusCodes;
|
|
19
|
+
if (codes && codes.length > 0) {
|
|
20
|
+
return codes.includes(status);
|
|
43
21
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
22
|
+
return DEFAULT_RETRY_STATUS_CODES.includes(status);
|
|
23
|
+
}
|
|
24
|
+
export function sleep(ms) {
|
|
25
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
26
|
+
}
|
|
27
|
+
export function calcDelay(attempt, retryOptions) {
|
|
28
|
+
const { baseDelay = 1000, maxDelay = 10000, jitter = true } = retryOptions;
|
|
29
|
+
const base = Math.min(baseDelay * Math.pow(2, attempt), maxDelay);
|
|
30
|
+
return jitter ? base * (0.75 + Math.random() * 0.5) : base;
|
|
31
|
+
}
|
|
32
|
+
class NodeTransportResponse {
|
|
33
|
+
status;
|
|
34
|
+
headers;
|
|
35
|
+
url;
|
|
36
|
+
baseUrl;
|
|
37
|
+
_decodedStream;
|
|
38
|
+
_cachedBuffer;
|
|
39
|
+
_cachedText;
|
|
40
|
+
_cachedJson;
|
|
41
|
+
_cachedJsonReady = false;
|
|
42
|
+
_cachedWebStream;
|
|
43
|
+
constructor(status, headers, url, rawStream) {
|
|
44
|
+
this.status = status;
|
|
45
|
+
this.headers = headers;
|
|
46
|
+
this.url = url;
|
|
47
|
+
this.baseUrl = url;
|
|
48
|
+
let stream = rawStream;
|
|
49
|
+
const contentEncoding = headers["content-encoding"];
|
|
50
|
+
if (typeof contentEncoding === "string") {
|
|
51
|
+
const encoding = contentEncoding.toLowerCase();
|
|
52
|
+
if (encoding.includes("gzip")) {
|
|
53
|
+
stream = stream.pipe(zlib.createGunzip());
|
|
58
54
|
}
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
lowerKey === "set-cookie" ? value.join("\n") : value.join(", ");
|
|
55
|
+
else if (encoding.includes("deflate")) {
|
|
56
|
+
stream = stream.pipe(zlib.createInflate());
|
|
62
57
|
}
|
|
63
|
-
else {
|
|
64
|
-
|
|
58
|
+
else if (encoding.includes("br")) {
|
|
59
|
+
stream = stream.pipe(zlib.createBrotliDecompress());
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.resume();
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
writable: true,
|
|
91
|
-
configurable: true,
|
|
62
|
+
this._decodedStream = stream;
|
|
63
|
+
}
|
|
64
|
+
get body() {
|
|
65
|
+
if (!this._cachedWebStream) {
|
|
66
|
+
let webStream;
|
|
67
|
+
if (this._cachedBuffer) {
|
|
68
|
+
const buf = this._cachedBuffer;
|
|
69
|
+
webStream = new ReadableStream({
|
|
70
|
+
start(controller) {
|
|
71
|
+
controller.enqueue(new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength));
|
|
72
|
+
controller.close();
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
webStream = Readable.toWeb(this._decodedStream);
|
|
78
|
+
}
|
|
79
|
+
Object.defineProperty(webStream, "dump", {
|
|
80
|
+
value: () => this.dump(),
|
|
81
|
+
writable: false,
|
|
92
82
|
enumerable: false,
|
|
83
|
+
configurable: true,
|
|
93
84
|
});
|
|
85
|
+
this._cachedWebStream = webStream;
|
|
94
86
|
}
|
|
95
|
-
return
|
|
96
|
-
status: rawResponse.status,
|
|
97
|
-
headers: normalizedHeaders,
|
|
98
|
-
body: decompressedBody,
|
|
99
|
-
url: rawResponse.url,
|
|
100
|
-
};
|
|
87
|
+
return this._cachedWebStream;
|
|
101
88
|
}
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
89
|
+
async _getBuffer() {
|
|
90
|
+
if (this._cachedBuffer)
|
|
91
|
+
return this._cachedBuffer;
|
|
92
|
+
if (this._cachedWebStream) {
|
|
93
|
+
const reader = this._cachedWebStream.getReader();
|
|
94
|
+
const chunks = [];
|
|
95
|
+
while (true) {
|
|
96
|
+
const { done, value } = await reader.read();
|
|
97
|
+
if (done)
|
|
98
|
+
break;
|
|
99
|
+
if (value)
|
|
100
|
+
chunks.push(value);
|
|
101
|
+
}
|
|
102
|
+
let totalLength = 0;
|
|
103
|
+
for (const chunk of chunks)
|
|
104
|
+
totalLength += chunk.byteLength;
|
|
105
|
+
const merged = new Uint8Array(totalLength);
|
|
106
|
+
let offset = 0;
|
|
107
|
+
for (const chunk of chunks) {
|
|
108
|
+
merged.set(chunk, offset);
|
|
109
|
+
offset += chunk.byteLength;
|
|
110
|
+
}
|
|
111
|
+
this._cachedBuffer = Buffer.from(merged.buffer, merged.byteOffset, merged.byteLength);
|
|
112
|
+
return this._cachedBuffer;
|
|
108
113
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
return new Promise((resolve, reject) => {
|
|
115
|
+
const chunks = [];
|
|
116
|
+
const onData = (chunk) => {
|
|
117
|
+
chunks.push(chunk);
|
|
118
|
+
};
|
|
119
|
+
const onEnd = () => {
|
|
120
|
+
cleanup();
|
|
121
|
+
this._cachedBuffer = Buffer.concat(chunks);
|
|
122
|
+
resolve(this._cachedBuffer);
|
|
123
|
+
};
|
|
124
|
+
const onError = (err) => {
|
|
125
|
+
cleanup();
|
|
126
|
+
reject(err);
|
|
127
|
+
};
|
|
128
|
+
const cleanup = () => {
|
|
129
|
+
this._decodedStream.removeListener("data", onData);
|
|
130
|
+
this._decodedStream.removeListener("end", onEnd);
|
|
131
|
+
this._decodedStream.removeListener("error", onError);
|
|
132
|
+
};
|
|
133
|
+
this._decodedStream.on("data", onData);
|
|
134
|
+
this._decodedStream.on("end", onEnd);
|
|
135
|
+
this._decodedStream.on("error", onError);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async text() {
|
|
139
|
+
if (this._cachedText === undefined) {
|
|
140
|
+
const buf = await this._getBuffer();
|
|
141
|
+
this._cachedText = buf.toString("utf-8");
|
|
112
142
|
}
|
|
113
|
-
|
|
114
|
-
|
|
143
|
+
return this._cachedText;
|
|
144
|
+
}
|
|
145
|
+
async json() {
|
|
146
|
+
if (this._cachedJsonReady) {
|
|
147
|
+
return this._cachedJson;
|
|
115
148
|
}
|
|
116
|
-
|
|
117
|
-
|
|
149
|
+
const text = await this.text();
|
|
150
|
+
if (!text.trim()) {
|
|
151
|
+
this._cachedJson = null;
|
|
152
|
+
this._cachedJsonReady = true;
|
|
153
|
+
return null;
|
|
118
154
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return
|
|
155
|
+
this._cachedJson = JSON.parse(text);
|
|
156
|
+
this._cachedJsonReady = true;
|
|
157
|
+
return this._cachedJson;
|
|
122
158
|
}
|
|
123
|
-
async
|
|
124
|
-
if (this.
|
|
159
|
+
async dump() {
|
|
160
|
+
if (this._cachedBuffer)
|
|
125
161
|
return;
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
162
|
+
this._decodedStream.resume();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export class NodeTransport {
|
|
166
|
+
config;
|
|
167
|
+
httpAgent;
|
|
168
|
+
httpsAgent;
|
|
169
|
+
constructor(config) {
|
|
170
|
+
this.config = config;
|
|
171
|
+
const agentOptions = {
|
|
172
|
+
keepAlive: true,
|
|
173
|
+
keepAliveMsecs: config.network?.keepAliveTimeout ?? 30000,
|
|
174
|
+
maxSockets: config.network?.maxConcurrent ?? 500,
|
|
175
|
+
maxFreeSockets: Math.min(256, Math.floor((config.network?.maxConcurrent ?? 500) / 2)),
|
|
176
|
+
scheduling: "lifo",
|
|
177
|
+
};
|
|
178
|
+
this.httpAgent = new http.Agent(agentOptions);
|
|
179
|
+
this.httpsAgent = new https.Agent(agentOptions);
|
|
180
|
+
}
|
|
181
|
+
get timeout() {
|
|
182
|
+
return this.config.network?.timeout ?? 30000;
|
|
183
|
+
}
|
|
184
|
+
logRetry(reason, attempt, maxRetries) {
|
|
185
|
+
this.config.logger?.("warn", `Retrying request: ${reason}. Attempt ${attempt}/${maxRetries}`);
|
|
186
|
+
}
|
|
187
|
+
async execute(req) {
|
|
188
|
+
let currentUrl = req.url;
|
|
189
|
+
let currentMethod = req.method;
|
|
190
|
+
let currentHeaders = { ...req.headers };
|
|
191
|
+
let currentBody = req.body;
|
|
192
|
+
let redirects = 0;
|
|
193
|
+
const startTime = Date.now();
|
|
194
|
+
let attempt = 1;
|
|
195
|
+
const maxRedirects = this.config.network?.maxRedirects ?? 5;
|
|
196
|
+
const maxRetries = this.config.retry?.maxRetries ?? 3;
|
|
197
|
+
const isStreamBody = currentBody instanceof ReadableStream;
|
|
198
|
+
while (true) {
|
|
199
|
+
try {
|
|
200
|
+
const fullUrl = new URL(currentUrl);
|
|
201
|
+
const result = await this.dispatchOnce(fullUrl, {
|
|
202
|
+
method: currentMethod,
|
|
203
|
+
headers: currentHeaders,
|
|
204
|
+
body: currentBody,
|
|
205
|
+
externalSignal: req.signal,
|
|
206
|
+
timeoutMs: this.timeout,
|
|
207
|
+
});
|
|
208
|
+
if ((this.config.network?.followRedirects ?? true) &&
|
|
209
|
+
isRedirect(result.status)) {
|
|
210
|
+
result.body.resume();
|
|
211
|
+
if (redirects >= maxRedirects) {
|
|
212
|
+
throw new Error("Too many redirects");
|
|
213
|
+
}
|
|
214
|
+
const location = result.headers["location"];
|
|
215
|
+
const locationStr = Array.isArray(location) ? location[0] : location;
|
|
216
|
+
if (typeof locationStr !== "string") {
|
|
217
|
+
throw new Error("Invalid redirect location");
|
|
218
|
+
}
|
|
219
|
+
const nextUrl = new URL(locationStr, fullUrl.toString()).toString();
|
|
220
|
+
let nextMethod = currentMethod;
|
|
221
|
+
if (result.status === 303 ||
|
|
222
|
+
((result.status === 301 || result.status === 302) &&
|
|
223
|
+
currentMethod === "POST")) {
|
|
224
|
+
nextMethod = "GET";
|
|
225
|
+
}
|
|
226
|
+
currentUrl = nextUrl;
|
|
227
|
+
currentMethod = nextMethod;
|
|
228
|
+
currentBody =
|
|
229
|
+
nextMethod === "GET" || isStreamBody ? undefined : currentBody;
|
|
230
|
+
const nextHeaders = { ...currentHeaders };
|
|
231
|
+
if (nextMethod === "GET") {
|
|
232
|
+
delete nextHeaders["content-type"];
|
|
233
|
+
delete nextHeaders["content-length"];
|
|
234
|
+
}
|
|
235
|
+
currentHeaders = nextHeaders;
|
|
236
|
+
redirects += 1;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (!isStreamBody &&
|
|
240
|
+
shouldRetry(result.status, this.config.retry ?? {})) {
|
|
241
|
+
if (attempt < maxRetries) {
|
|
242
|
+
result.body.resume();
|
|
243
|
+
await sleep(calcDelay(attempt, this.config.retry ?? {}));
|
|
244
|
+
attempt += 1;
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return new NodeTransportResponse(result.status, result.headers, fullUrl.toString(), result.body);
|
|
131
249
|
}
|
|
132
|
-
|
|
133
|
-
|
|
250
|
+
catch (err) {
|
|
251
|
+
const error = err;
|
|
252
|
+
if (error.name === "AbortError") {
|
|
253
|
+
if (req.signal?.aborted) {
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
const msg = `Request timeout after ${this.timeout}ms`;
|
|
257
|
+
this.config.logger?.("error", msg);
|
|
258
|
+
const timeoutErr = new Error(msg);
|
|
259
|
+
timeoutErr.name = "AbortError";
|
|
260
|
+
timeoutErr.code = "TIMEOUT";
|
|
261
|
+
timeoutErr.request = {
|
|
262
|
+
url: req.url,
|
|
263
|
+
method: req.method,
|
|
264
|
+
headers: req.headers,
|
|
265
|
+
};
|
|
266
|
+
timeoutErr.meta = {
|
|
267
|
+
retryCount: attempt - 1,
|
|
268
|
+
isRetryable: false,
|
|
269
|
+
duration: Date.now() - startTime,
|
|
270
|
+
};
|
|
271
|
+
throw timeoutErr;
|
|
272
|
+
}
|
|
273
|
+
if (!isStreamBody &&
|
|
274
|
+
attempt < maxRetries &&
|
|
275
|
+
error.code &&
|
|
276
|
+
RETRYABLE_NETWORK_CODES.includes(error.code)) {
|
|
277
|
+
this.logRetry(`due to ${error.code}`, attempt, maxRetries);
|
|
278
|
+
await sleep(calcDelay(attempt, this.config.retry ?? {}));
|
|
279
|
+
attempt += 1;
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
error.code = error.code ?? "NETWORK_ERROR";
|
|
283
|
+
error.request = {
|
|
284
|
+
url: req.url,
|
|
285
|
+
method: req.method,
|
|
286
|
+
headers: req.headers,
|
|
287
|
+
};
|
|
288
|
+
error.meta = {
|
|
289
|
+
retryCount: attempt - 1,
|
|
290
|
+
isRetryable: false,
|
|
291
|
+
duration: Date.now() - startTime,
|
|
292
|
+
};
|
|
293
|
+
throw error;
|
|
134
294
|
}
|
|
135
295
|
}
|
|
136
|
-
catch (err) {
|
|
137
|
-
this.logWarning("Transport close error:", err);
|
|
138
|
-
}
|
|
139
296
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
297
|
+
dispatchOnce(url, options) {
|
|
298
|
+
return new Promise((resolve, reject) => {
|
|
299
|
+
const isHttps = url.protocol === "https:";
|
|
300
|
+
const requestFn = isHttps ? https.request : http.request;
|
|
301
|
+
const agent = isHttps ? this.httpsAgent : this.httpAgent;
|
|
302
|
+
let isDone = false;
|
|
303
|
+
let timer;
|
|
304
|
+
const reqOptions = {
|
|
305
|
+
method: options.method,
|
|
306
|
+
headers: options.headers,
|
|
307
|
+
agent,
|
|
308
|
+
};
|
|
309
|
+
if (options.externalSignal?.aborted) {
|
|
310
|
+
const abortError = new Error("The operation was aborted.");
|
|
311
|
+
abortError.name = "AbortError";
|
|
312
|
+
return reject(abortError);
|
|
147
313
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
314
|
+
const req = requestFn(url, reqOptions, (res) => {
|
|
315
|
+
if (timer)
|
|
316
|
+
clearTimeout(timer);
|
|
317
|
+
cleanupExternalSignal();
|
|
318
|
+
isDone = true;
|
|
319
|
+
resolve({
|
|
320
|
+
status: res.statusCode ?? 200,
|
|
321
|
+
headers: res.headers,
|
|
322
|
+
body: res,
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
if (options.timeoutMs > 0) {
|
|
326
|
+
timer = setTimeout(() => {
|
|
327
|
+
if (isDone)
|
|
328
|
+
return;
|
|
329
|
+
isDone = true;
|
|
330
|
+
cleanupExternalSignal();
|
|
331
|
+
req.destroy();
|
|
332
|
+
const err = new Error("The operation was aborted.");
|
|
333
|
+
err.name = "AbortError";
|
|
334
|
+
reject(err);
|
|
335
|
+
}, options.timeoutMs);
|
|
336
|
+
}
|
|
337
|
+
let onExternalAbort;
|
|
338
|
+
if (options.externalSignal) {
|
|
339
|
+
onExternalAbort = () => {
|
|
340
|
+
if (isDone)
|
|
341
|
+
return;
|
|
342
|
+
isDone = true;
|
|
343
|
+
if (timer)
|
|
344
|
+
clearTimeout(timer);
|
|
345
|
+
req.destroy();
|
|
346
|
+
const err = new Error("The operation was aborted.");
|
|
347
|
+
err.name = "AbortError";
|
|
348
|
+
reject(err);
|
|
349
|
+
};
|
|
350
|
+
options.externalSignal.addEventListener("abort", onExternalAbort, {
|
|
351
|
+
once: true,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function cleanupExternalSignal() {
|
|
355
|
+
if (options.externalSignal && onExternalAbort) {
|
|
356
|
+
options.externalSignal.removeEventListener("abort", onExternalAbort);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
req.on("error", (err) => {
|
|
360
|
+
if (isDone)
|
|
361
|
+
return;
|
|
362
|
+
isDone = true;
|
|
363
|
+
if (timer)
|
|
364
|
+
clearTimeout(timer);
|
|
365
|
+
cleanupExternalSignal();
|
|
366
|
+
reject(err);
|
|
367
|
+
});
|
|
368
|
+
if (options.body !== undefined && options.body !== null) {
|
|
369
|
+
if (Buffer.isBuffer(options.body) || typeof options.body === "string") {
|
|
370
|
+
req.end(options.body);
|
|
371
|
+
}
|
|
372
|
+
else if (options.body instanceof ReadableStream) {
|
|
373
|
+
Readable.fromWeb(options.body).pipe(req);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
req.end(JSON.stringify(options.body));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
req.end();
|
|
381
|
+
}
|
|
382
|
+
});
|
|
152
383
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
384
|
+
async close() {
|
|
385
|
+
this.httpAgent.destroy();
|
|
386
|
+
this.httpsAgent.destroy();
|
|
387
|
+
}
|
|
388
|
+
async destroy() {
|
|
389
|
+
await this.close();
|
|
158
390
|
}
|
|
159
391
|
}
|
|
160
392
|
//# sourceMappingURL=node.js.map
|
package/transports/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/transports/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAChE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MA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M,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;YAEH,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACxD,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACtE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACxB,CAAC;qBAAM,IAAI,OAAO,CAAC,IAAI,YAAY,cAAc,EAAE,CAAC;oBAClD,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;gBACxC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,GAAG,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ru Базовый класс ошибок клиента Hyperttp, агрегирующий контекст неудачного сетевого запроса.
|
|
3
|
+
* @en Base error class for the Hyperttp client, providing explicit layout context for failed requests.
|
|
4
|
+
*/
|
|
5
|
+
export declare class HttpClientError extends Error {
|
|
6
|
+
code: string;
|
|
7
|
+
statusCode?: number | undefined;
|
|
8
|
+
originalError?: Error | undefined;
|
|
9
|
+
url?: string | undefined;
|
|
10
|
+
method?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* @ru Создает новый экземпляр HttpClientError.
|
|
13
|
+
* @en Creates a new HttpClientError instance.
|
|
14
|
+
* @param message - Human-readable error message text.
|
|
15
|
+
* @param code - Internal stringified error state identifier code.
|
|
16
|
+
* @param statusCode - Numerical HTTP response status code received from the server.
|
|
17
|
+
* @param originalError - Raw captured exception instance causing this failure.
|
|
18
|
+
* @param url - Targeted request URL destination string.
|
|
19
|
+
* @param method - HTTP method verb utilized for the request.
|
|
20
|
+
*/
|
|
21
|
+
constructor(message: string, code?: string, statusCode?: number | undefined, originalError?: Error | undefined, url?: string | undefined, method?: string | undefined);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @ru Ошибка, возникающая при превышении лимита времени ожидания ответа от сервера.
|
|
25
|
+
* @en Error thrown when a network request exceeds its allocated execution timeout threshold.
|
|
26
|
+
*/
|
|
27
|
+
export declare class TimeoutError extends HttpClientError {
|
|
28
|
+
/**
|
|
29
|
+
* @ru Создает новый экземпляр TimeoutError.
|
|
30
|
+
* @en Creates a new TimeoutError instance.
|
|
31
|
+
* @param url - Targeted request URL destination string.
|
|
32
|
+
* @param timeout - Threshold duration statement in milliseconds.
|
|
33
|
+
*/
|
|
34
|
+
constructor(url: string, timeout: number);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @ru Ошибка, генерируемая при получении HTTP-статуса 429 (превышение лимита частоты запросов).
|
|
38
|
+
* @en Error triggered when encountering an HTTP 429 status code indicating rate limit exhaustion.
|
|
39
|
+
*/
|
|
40
|
+
export declare class RateLimitError extends HttpClientError {
|
|
41
|
+
/**
|
|
42
|
+
* @ru Создает новый экземпляр RateLimitError.
|
|
43
|
+
* @en Creates a new RateLimitError instance.
|
|
44
|
+
* @param url - Targeted request URL destination string.
|
|
45
|
+
* @param retryAfter - Optional cool-down period duration in milliseconds before the next retry attempt.
|
|
46
|
+
*/
|
|
47
|
+
constructor(url: string, retryAfter?: number);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IAa/B,IAAI,EAAE,MAAM;IACZ,UAAU,CAAC,EAAE,MAAM;IACnB,aAAa,CAAC,EAAE,KAAK;IACrB,GAAG,CAAC,EAAE,MAAM;IACZ,MAAM,CAAC,EAAE,MAAM;IAhBxB;;;;;;;;;OASG;gBAED,OAAO,EAAE,MAAM,EACR,IAAI,GAAE,MAAqB,EAC3B,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,aAAa,CAAC,EAAE,KAAK,YAAA,EACrB,GAAG,CAAC,EAAE,MAAM,YAAA,EACZ,MAAM,CAAC,EAAE,MAAM,YAAA;CAKzB;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAIzC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,eAAe;IACjD;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAU7C"}
|