recker 1.0.15-next.0e216c0 → 1.0.15-next.0eabd39
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/README.md +10 -1
- package/dist/ai/providers/anthropic.d.ts.map +1 -1
- package/dist/ai/providers/anthropic.js +4 -1
- package/dist/ai/providers/base.d.ts.map +1 -1
- package/dist/ai/providers/base.js +7 -2
- package/dist/ai/rate-limiter.d.ts.map +1 -1
- package/dist/ai/rate-limiter.js +4 -1
- package/dist/bench/generator.d.ts.map +1 -1
- package/dist/bench/generator.js +7 -3
- package/dist/bench/stats.d.ts.map +1 -1
- package/dist/bench/stats.js +43 -10
- package/dist/cache/memory-storage.d.ts.map +1 -1
- package/dist/cache/memory-storage.js +3 -2
- package/dist/cli/handler.js +14 -14
- package/dist/cli/index.js +582 -49
- package/dist/cli/presets.js +5 -5
- package/dist/cli/tui/ai-chat.js +10 -10
- package/dist/cli/tui/load-dashboard.d.ts.map +1 -1
- package/dist/cli/tui/load-dashboard.js +96 -55
- package/dist/cli/tui/scroll-buffer.d.ts +1 -1
- package/dist/cli/tui/scroll-buffer.d.ts.map +1 -1
- package/dist/cli/tui/scroll-buffer.js +2 -2
- package/dist/cli/tui/shell.d.ts +3 -0
- package/dist/cli/tui/shell.d.ts.map +1 -1
- package/dist/cli/tui/shell.js +202 -14
- package/dist/cli/tui/websocket.js +17 -17
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +18 -26
- package/dist/core/errors.d.ts +109 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +214 -1
- package/dist/core/request-promise.d.ts.map +1 -1
- package/dist/core/request-promise.js +5 -6
- package/dist/core/response.d.ts.map +1 -1
- package/dist/core/response.js +5 -6
- package/dist/dns/propagation.d.ts +3 -1
- package/dist/dns/propagation.d.ts.map +1 -1
- package/dist/dns/propagation.js +99 -59
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +10 -11
- package/dist/mcp/embeddings-loader.d.ts.map +1 -1
- package/dist/mcp/embeddings-loader.js +12 -2
- package/dist/mcp/geoip-loader.d.ts +11 -0
- package/dist/mcp/geoip-loader.d.ts.map +1 -0
- package/dist/mcp/geoip-loader.js +107 -0
- package/dist/mcp/ip-intel.d.ts +28 -0
- package/dist/mcp/ip-intel.d.ts.map +1 -0
- package/dist/mcp/ip-intel.js +209 -0
- package/dist/mcp/search/hybrid-search.d.ts.map +1 -1
- package/dist/mcp/search/hybrid-search.js +5 -1
- package/dist/mcp/search/math.d.ts.map +1 -1
- package/dist/mcp/search/math.js +5 -1
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +114 -1
- package/dist/plugins/compression.js +4 -2
- package/dist/plugins/har-player.d.ts.map +1 -1
- package/dist/plugins/har-player.js +8 -11
- package/dist/plugins/odata.d.ts.map +1 -1
- package/dist/plugins/odata.js +5 -2
- package/dist/protocols/ftp.d.ts.map +1 -1
- package/dist/protocols/ftp.js +69 -16
- package/dist/protocols/sftp.d.ts.map +1 -1
- package/dist/protocols/sftp.js +13 -3
- package/dist/protocols/telnet.d.ts.map +1 -1
- package/dist/protocols/telnet.js +25 -6
- package/dist/transport/base-udp.d.ts.map +1 -1
- package/dist/transport/base-udp.js +7 -4
- package/dist/transport/udp-response.d.ts.map +1 -1
- package/dist/transport/udp-response.js +10 -3
- package/dist/transport/udp.d.ts.map +1 -1
- package/dist/transport/udp.js +5 -1
- package/dist/transport/undici.d.ts.map +1 -1
- package/dist/transport/undici.js +75 -63
- package/dist/utils/agent-manager.d.ts +1 -0
- package/dist/utils/agent-manager.d.ts.map +1 -1
- package/dist/utils/agent-manager.js +11 -0
- package/dist/utils/client-pool.d.ts.map +1 -1
- package/dist/utils/client-pool.js +4 -1
- package/dist/utils/dns-toolkit.d.ts +88 -1
- package/dist/utils/dns-toolkit.d.ts.map +1 -1
- package/dist/utils/dns-toolkit.js +704 -6
- package/dist/utils/doh.d.ts.map +1 -1
- package/dist/utils/doh.js +13 -16
- package/dist/utils/download.d.ts.map +1 -1
- package/dist/utils/download.js +10 -11
- package/dist/utils/rdap.d.ts +9 -0
- package/dist/utils/rdap.d.ts.map +1 -1
- package/dist/utils/rdap.js +78 -9
- package/dist/utils/security-grader.d.ts +47 -0
- package/dist/utils/security-grader.d.ts.map +1 -0
- package/dist/utils/security-grader.js +637 -0
- package/dist/utils/sparkline.d.ts +18 -0
- package/dist/utils/sparkline.d.ts.map +1 -0
- package/dist/utils/sparkline.js +55 -0
- package/dist/utils/sse.d.ts.map +1 -1
- package/dist/utils/sse.js +5 -6
- package/dist/utils/system-metrics.d.ts +26 -0
- package/dist/utils/system-metrics.d.ts.map +1 -0
- package/dist/utils/system-metrics.js +81 -0
- package/dist/webrtc/index.d.ts.map +1 -1
- package/dist/webrtc/index.js +21 -7
- package/dist/websocket/client.d.ts.map +1 -1
- package/dist/websocket/client.js +13 -16
- package/package.json +3 -2
package/dist/cli/tui/shell.js
CHANGED
|
@@ -92,7 +92,7 @@ export class RekShell {
|
|
|
92
92
|
const commands = [
|
|
93
93
|
'get', 'post', 'put', 'delete', 'patch', 'head', 'options',
|
|
94
94
|
'ws', 'udp', 'load', 'chat', 'ai',
|
|
95
|
-
'whois', 'tls', 'ssl', 'dns', 'dns:propagate', 'rdap', 'ping',
|
|
95
|
+
'whois', 'tls', 'ssl', 'security', 'ip', 'dns', 'dns:propagate', 'dns:email', 'rdap', 'ping',
|
|
96
96
|
'scrap', '$', '$text', '$attr', '$html', '$links', '$images', '$scripts', '$css', '$sourcemaps', '$unmap', '$unmap:view', '$unmap:save', '$beautify', '$beautify:save', '$table',
|
|
97
97
|
'?', 'search', 'suggest', 'example',
|
|
98
98
|
'help', 'clear', 'exit', 'set', 'url', 'vars', 'env'
|
|
@@ -152,18 +152,44 @@ export class RekShell {
|
|
|
152
152
|
setupScrollKeyHandler() {
|
|
153
153
|
enableMouseReporting();
|
|
154
154
|
if (process.stdin.isTTY) {
|
|
155
|
-
process.stdin.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
155
|
+
const originalEmit = process.stdin.emit.bind(process.stdin);
|
|
156
|
+
const self = this;
|
|
157
|
+
process.stdin.emit = function (event, ...args) {
|
|
158
|
+
if (event === 'data') {
|
|
159
|
+
const data = args[0];
|
|
160
|
+
const str = data.toString();
|
|
161
|
+
if (str.includes('\x1b[<')) {
|
|
162
|
+
const mouseScroll = parseMouseScroll(data);
|
|
163
|
+
if (mouseScroll) {
|
|
164
|
+
self.handleScrollKey(mouseScroll);
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (data.length >= 6 && data[0] === 0x1b && data[1] === 0x5b && data[2] === 0x4d) {
|
|
169
|
+
const mouseScroll = parseMouseScroll(data);
|
|
170
|
+
if (mouseScroll) {
|
|
171
|
+
self.handleScrollKey(mouseScroll);
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
const scrollKey = parseScrollKey(data);
|
|
176
|
+
if (scrollKey) {
|
|
177
|
+
if (scrollKey === 'quit') {
|
|
178
|
+
if (self.inScrollMode) {
|
|
179
|
+
self.exitScrollMode();
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return originalEmit(event, ...args);
|
|
183
|
+
}
|
|
184
|
+
self.handleScrollKey(scrollKey);
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
if (self.inScrollMode) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
165
190
|
}
|
|
166
|
-
|
|
191
|
+
return originalEmit(event, ...args);
|
|
192
|
+
};
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
handleScrollKey(key) {
|
|
@@ -209,7 +235,7 @@ export class RekShell {
|
|
|
209
235
|
return;
|
|
210
236
|
}
|
|
211
237
|
break;
|
|
212
|
-
case '
|
|
238
|
+
case 'quit':
|
|
213
239
|
if (this.inScrollMode) {
|
|
214
240
|
this.exitScrollMode();
|
|
215
241
|
return;
|
|
@@ -261,7 +287,7 @@ export class RekShell {
|
|
|
261
287
|
const scrollInfo = this.scrollBuffer.isScrolledUp
|
|
262
288
|
? colors.yellow(`↑ ${this.scrollBuffer.position} lines | ${info.percent}% | `)
|
|
263
289
|
: '';
|
|
264
|
-
const helpText = colors.gray('Page Up/Down • Home/End •
|
|
290
|
+
const helpText = colors.gray('Page Up/Down • Home/End • Q to exit');
|
|
265
291
|
const statusBar = `\x1b[${rows};1H\x1b[7m ${scrollInfo}${helpText} \x1b[0m`;
|
|
266
292
|
this.originalStdoutWrite(statusBar);
|
|
267
293
|
}
|
|
@@ -315,12 +341,21 @@ export class RekShell {
|
|
|
315
341
|
case 'ssl':
|
|
316
342
|
await this.runTLS(parts[1], parts[2] ? parseInt(parts[2]) : 443);
|
|
317
343
|
return;
|
|
344
|
+
case 'security':
|
|
345
|
+
await this.runSecurityGrader(parts[1]);
|
|
346
|
+
return;
|
|
347
|
+
case 'ip':
|
|
348
|
+
await this.runIpIntelligence(parts[1]);
|
|
349
|
+
return;
|
|
318
350
|
case 'dns':
|
|
319
351
|
await this.runDNS(parts[1]);
|
|
320
352
|
return;
|
|
321
353
|
case 'dns:propagate':
|
|
322
354
|
await this.runDNSPropagation(parts[1], parts[2]);
|
|
323
355
|
return;
|
|
356
|
+
case 'dns:email':
|
|
357
|
+
await this.runDnsEmailCheck(parts[1], parts[2]);
|
|
358
|
+
return;
|
|
324
359
|
case 'rdap':
|
|
325
360
|
await this.runRDAP(parts[1]);
|
|
326
361
|
return;
|
|
@@ -863,6 +898,96 @@ export class RekShell {
|
|
|
863
898
|
}
|
|
864
899
|
console.log('');
|
|
865
900
|
}
|
|
901
|
+
async runSecurityGrader(url) {
|
|
902
|
+
if (!url) {
|
|
903
|
+
url = this.baseUrl || '';
|
|
904
|
+
if (!url) {
|
|
905
|
+
console.log(colors.yellow('Usage: security <url>'));
|
|
906
|
+
console.log(colors.gray(' Examples: security google.com | security https://example.com'));
|
|
907
|
+
console.log(colors.gray(' Or set a base URL first: url https://example.com'));
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
else if (!url.startsWith('http')) {
|
|
912
|
+
url = `https://${url}`;
|
|
913
|
+
}
|
|
914
|
+
console.log(colors.gray(`Analyzing security headers for ${url}...`));
|
|
915
|
+
try {
|
|
916
|
+
const { analyzeSecurityHeaders } = await import('../../utils/security-grader.js');
|
|
917
|
+
const res = await this.client.get(url);
|
|
918
|
+
const report = analyzeSecurityHeaders(res.headers);
|
|
919
|
+
let gradeColor = colors.red;
|
|
920
|
+
if (report.grade.startsWith('A'))
|
|
921
|
+
gradeColor = colors.green;
|
|
922
|
+
else if (report.grade.startsWith('B'))
|
|
923
|
+
gradeColor = colors.blue;
|
|
924
|
+
else if (report.grade.startsWith('C'))
|
|
925
|
+
gradeColor = colors.yellow;
|
|
926
|
+
console.log(`
|
|
927
|
+
${colors.bold(colors.cyan('🛡️ Security Headers Report'))}
|
|
928
|
+
Grade: ${gradeColor(colors.bold(report.grade))} (${report.score}/100)
|
|
929
|
+
|
|
930
|
+
${colors.bold('Details:')}`);
|
|
931
|
+
report.details.forEach(item => {
|
|
932
|
+
const icon = item.status === 'pass' ? colors.green('✔') : item.status === 'warn' ? colors.yellow('⚠') : colors.red('✖');
|
|
933
|
+
const headerName = colors.bold(item.header);
|
|
934
|
+
const value = item.value ? colors.gray(`= ${item.value.length > 50 ? item.value.slice(0, 47) + '...' : item.value}`) : colors.gray('(missing)');
|
|
935
|
+
console.log(` ${icon} ${headerName} ${value}`);
|
|
936
|
+
if (item.status !== 'pass') {
|
|
937
|
+
console.log(` ${colors.red('→')} ${item.message}`);
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
console.log('');
|
|
941
|
+
this.lastResponse = report;
|
|
942
|
+
}
|
|
943
|
+
catch (error) {
|
|
944
|
+
console.error(colors.red(`Analysis failed: ${error.message}`));
|
|
945
|
+
}
|
|
946
|
+
console.log('');
|
|
947
|
+
}
|
|
948
|
+
async runIpIntelligence(address) {
|
|
949
|
+
if (!address) {
|
|
950
|
+
console.log(colors.yellow('Usage: ip <address>'));
|
|
951
|
+
console.log(colors.gray(' Examples: ip 8.8.8.8 | ip 192.168.1.1'));
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
console.log(colors.gray(`Looking up ${address} using local GeoLite2 database...`));
|
|
955
|
+
try {
|
|
956
|
+
const { getIpInfo, isGeoIPAvailable } = await import('../../mcp/ip-intel.js');
|
|
957
|
+
if (!isGeoIPAvailable()) {
|
|
958
|
+
console.log(colors.gray(`Downloading GeoLite2 database...`));
|
|
959
|
+
}
|
|
960
|
+
const info = await getIpInfo(address);
|
|
961
|
+
if (info.bogon) {
|
|
962
|
+
console.log(colors.yellow(`\n⚠ ${address} is a Bogon/Private IP.`));
|
|
963
|
+
console.log(colors.gray(` Type: ${info.bogonType}`));
|
|
964
|
+
this.lastResponse = info;
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
console.log(`
|
|
968
|
+
${colors.bold(colors.cyan('🌍 IP Intelligence Report'))}
|
|
969
|
+
|
|
970
|
+
${colors.bold('Location:')}
|
|
971
|
+
${colors.gray('City:')} ${info.city || 'N/A'}
|
|
972
|
+
${colors.gray('Region:')} ${info.region || 'N/A'}
|
|
973
|
+
${colors.gray('Country:')} ${info.country || 'N/A'} ${info.countryCode ? `(${info.countryCode})` : ''}
|
|
974
|
+
${colors.gray('Continent:')} ${info.continent || 'N/A'}
|
|
975
|
+
${colors.gray('Timezone:')} ${info.timezone || 'N/A'}
|
|
976
|
+
${colors.gray('Coords:')} ${info.loc ? colors.cyan(info.loc) : 'N/A'}
|
|
977
|
+
${colors.gray('Accuracy:')} ${info.accuracy ? `~${info.accuracy} km` : 'N/A'}
|
|
978
|
+
|
|
979
|
+
${colors.bold('Network:')}
|
|
980
|
+
${colors.gray('IP:')} ${info.ip}
|
|
981
|
+
${colors.gray('Type:')} ${info.isIPv6 ? 'IPv6' : 'IPv4'}
|
|
982
|
+
${colors.gray('Postal:')} ${info.postal || 'N/A'}
|
|
983
|
+
`);
|
|
984
|
+
this.lastResponse = info;
|
|
985
|
+
}
|
|
986
|
+
catch (error) {
|
|
987
|
+
console.error(colors.red(`IP Lookup Failed: ${error.message}`));
|
|
988
|
+
}
|
|
989
|
+
console.log('');
|
|
990
|
+
}
|
|
866
991
|
async runDNS(domain) {
|
|
867
992
|
if (!domain) {
|
|
868
993
|
domain = this.getBaseDomain() || '';
|
|
@@ -944,6 +1069,69 @@ export class RekShell {
|
|
|
944
1069
|
console.error(colors.red(`Propagation check failed: ${error.message}`));
|
|
945
1070
|
}
|
|
946
1071
|
}
|
|
1072
|
+
async runDnsEmailCheck(domain, selector) {
|
|
1073
|
+
if (!domain) {
|
|
1074
|
+
domain = this.getBaseDomain() || '';
|
|
1075
|
+
if (!domain) {
|
|
1076
|
+
console.log(colors.yellow('Usage: dns:email <domain> [dkim-selector]'));
|
|
1077
|
+
console.log(colors.gray(' Examples: dns:email google.com | dns:email github.com google'));
|
|
1078
|
+
console.log(colors.gray(' Or set a base URL first: url https://example.com'));
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
console.log(colors.gray(`Checking email security for ${domain}...`));
|
|
1083
|
+
const startTime = performance.now();
|
|
1084
|
+
try {
|
|
1085
|
+
const { validateSpf, validateDmarc, checkDkim } = await import('../../utils/dns-toolkit.js');
|
|
1086
|
+
const [spf, dmarc, dkim] = await Promise.all([
|
|
1087
|
+
validateSpf(domain),
|
|
1088
|
+
validateDmarc(domain),
|
|
1089
|
+
checkDkim(domain, selector || 'default')
|
|
1090
|
+
]);
|
|
1091
|
+
const duration = Math.round(performance.now() - startTime);
|
|
1092
|
+
console.log(colors.green(`✔ Email security check completed`) + colors.gray(` (${duration}ms)\n`));
|
|
1093
|
+
console.log(colors.bold('SPF:'));
|
|
1094
|
+
if (spf.valid) {
|
|
1095
|
+
console.log(` ${colors.green('✔')} ${spf.record || 'No record'}`);
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
console.log(` ${colors.red('✖')} ${spf.errors?.join(', ') || 'Invalid'}`);
|
|
1099
|
+
}
|
|
1100
|
+
if (spf.warnings?.length) {
|
|
1101
|
+
spf.warnings.forEach((w) => console.log(` ${colors.yellow('⚠')} ${w}`));
|
|
1102
|
+
}
|
|
1103
|
+
console.log(colors.bold('\nDMARC:'));
|
|
1104
|
+
if (dmarc.valid) {
|
|
1105
|
+
console.log(` ${colors.green('✔')} Policy: ${dmarc.policy || 'none'}`);
|
|
1106
|
+
if (dmarc.percentage !== undefined && dmarc.percentage < 100) {
|
|
1107
|
+
console.log(` ${colors.yellow('⚠')} Only ${dmarc.percentage}% of emails affected`);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
console.log(` ${colors.red('✖')} No DMARC record found`);
|
|
1112
|
+
}
|
|
1113
|
+
if (dmarc.warnings?.length) {
|
|
1114
|
+
dmarc.warnings.forEach((w) => console.log(` ${colors.yellow('⚠')} ${w}`));
|
|
1115
|
+
}
|
|
1116
|
+
console.log(colors.bold(`\nDKIM (${selector || 'default'}):`));
|
|
1117
|
+
if (dkim.found) {
|
|
1118
|
+
console.log(` ${colors.green('✔')} Record found`);
|
|
1119
|
+
if (dkim.publicKey) {
|
|
1120
|
+
const keyPreview = dkim.publicKey.substring(0, 40) + '...';
|
|
1121
|
+
console.log(` ${colors.gray('Key:')} ${keyPreview}`);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
else {
|
|
1125
|
+
console.log(` ${colors.yellow('⚠')} No DKIM record for selector "${selector || 'default'}"`);
|
|
1126
|
+
console.log(` ${colors.gray('Try: dns:email ' + domain + ' <selector>')}`);
|
|
1127
|
+
}
|
|
1128
|
+
console.log('');
|
|
1129
|
+
this.lastResponse = { spf, dmarc, dkim };
|
|
1130
|
+
}
|
|
1131
|
+
catch (error) {
|
|
1132
|
+
console.error(colors.red(`Email security check failed: ${error.message}`));
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
947
1135
|
async runRDAP(domain) {
|
|
948
1136
|
if (!domain) {
|
|
949
1137
|
domain = this.getRootDomain() || '';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import readline from 'node:readline';
|
|
2
2
|
import { createClient } from '../../core/client.js';
|
|
3
|
-
import
|
|
3
|
+
import colors from '../../utils/colors.js';
|
|
4
4
|
export async function startInteractiveWebSocket(url, headers) {
|
|
5
|
-
console.log(
|
|
6
|
-
console.log(
|
|
7
|
-
console.log(
|
|
8
|
-
console.log(
|
|
5
|
+
console.log(colors.gray('--------------------------------------------------'));
|
|
6
|
+
console.log(colors.cyan(`Connecting to ${colors.bold(url)}...`));
|
|
7
|
+
console.log(colors.gray('Commands: /quit to exit, /ping to send heartbeat'));
|
|
8
|
+
console.log(colors.gray('--------------------------------------------------\n'));
|
|
9
9
|
const client = createClient();
|
|
10
10
|
let ws;
|
|
11
11
|
try {
|
|
12
12
|
ws = client.websocket(url, { headers });
|
|
13
13
|
}
|
|
14
14
|
catch (error) {
|
|
15
|
-
console.error(
|
|
15
|
+
console.error(colors.red(`Error creating WebSocket: ${error.message}`));
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
const rl = readline.createInterface({
|
|
19
19
|
input: process.stdin,
|
|
20
20
|
output: process.stdout,
|
|
21
|
-
prompt:
|
|
21
|
+
prompt: colors.green('>> '),
|
|
22
22
|
});
|
|
23
23
|
const printIncoming = (text) => {
|
|
24
24
|
readline.cursorTo(process.stdout, 0);
|
|
@@ -27,37 +27,37 @@ export async function startInteractiveWebSocket(url, headers) {
|
|
|
27
27
|
rl.prompt(true);
|
|
28
28
|
};
|
|
29
29
|
ws.on('open', () => {
|
|
30
|
-
printIncoming(
|
|
30
|
+
printIncoming(colors.green('✔ Connected!'));
|
|
31
31
|
rl.prompt();
|
|
32
32
|
});
|
|
33
33
|
ws.on('close', (code, reason) => {
|
|
34
|
-
printIncoming(
|
|
34
|
+
printIncoming(colors.red(`✖ Disconnected (Code: ${code}${reason ? `, Reason: ${reason}` : ''})`));
|
|
35
35
|
rl.close();
|
|
36
36
|
process.exit(0);
|
|
37
37
|
});
|
|
38
38
|
ws.on('error', (err) => {
|
|
39
|
-
printIncoming(
|
|
39
|
+
printIncoming(colors.red(`⚠ Error: ${err.message}`));
|
|
40
40
|
});
|
|
41
41
|
ws.on('message', (msg) => {
|
|
42
42
|
const content = msg.isBinary
|
|
43
|
-
?
|
|
43
|
+
? colors.yellow(`<Binary ${msg.data.length} bytes>`)
|
|
44
44
|
: msg.data.toString();
|
|
45
|
-
printIncoming(`${
|
|
45
|
+
printIncoming(`${colors.cyan('<<')} ${content}`);
|
|
46
46
|
});
|
|
47
47
|
rl.on('line', (line) => {
|
|
48
48
|
const input = line.trim();
|
|
49
49
|
readline.moveCursor(process.stdout, 0, -1);
|
|
50
50
|
readline.clearLine(process.stdout, 0);
|
|
51
|
-
console.log(`${
|
|
51
|
+
console.log(`${colors.green('>>')} ${input}`);
|
|
52
52
|
if (input === '/quit' || input === '/exit') {
|
|
53
|
-
console.log(
|
|
53
|
+
console.log(colors.gray('Closing connection...'));
|
|
54
54
|
ws.close();
|
|
55
55
|
rl.close();
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if (input === '/ping') {
|
|
59
59
|
ws.ping();
|
|
60
|
-
console.log(
|
|
60
|
+
console.log(colors.gray('(ping sent)'));
|
|
61
61
|
rl.prompt();
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -66,11 +66,11 @@ export async function startInteractiveWebSocket(url, headers) {
|
|
|
66
66
|
ws.send(input);
|
|
67
67
|
}
|
|
68
68
|
catch (err) {
|
|
69
|
-
console.error(
|
|
69
|
+
console.error(colors.red(`Failed to send: ${err.message}`));
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
else if (input && !ws.isConnected) {
|
|
73
|
-
console.log(
|
|
73
|
+
console.log(colors.yellow('Not connected.'));
|
|
74
74
|
}
|
|
75
75
|
rl.prompt();
|
|
76
76
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAgB,aAAa,EAAE,cAAc,EAAE,cAAc,EAAa,YAAY,EAAyC,UAAU,EAAmD,MAAM,mBAAmB,CAAC;AAIxP,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAStD,OAAO,EAAY,iBAAiB,EAAe,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAS,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAS,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAS,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAO1D,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAA4C,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElH,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIlF,UAAU,iBAAkB,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAC/D,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB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2BhG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,eAAe;IAqCxE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,eAAe;IAiB3D,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAclE,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlF;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,qBAA0B,UAE/D"}
|
package/dist/core/client.js
CHANGED
|
@@ -2,7 +2,7 @@ import { consoleLogger } from '../types/index.js';
|
|
|
2
2
|
import { HttpRequest } from './request.js';
|
|
3
3
|
import { UndiciTransport } from '../transport/undici.js';
|
|
4
4
|
import { RequestPromise } from './request-promise.js';
|
|
5
|
-
import { HttpError, MaxSizeExceededError,
|
|
5
|
+
import { HttpError, MaxSizeExceededError, ConfigurationError, ValidationError, TimeoutError } from '../core/errors.js';
|
|
6
6
|
import { processBody, createFormData, isPlainObject } from '../utils/body.js';
|
|
7
7
|
import { AgentManager } from '../utils/agent-manager.js';
|
|
8
8
|
import { RequestPool } from '../utils/request-pool.js';
|
|
@@ -94,11 +94,9 @@ export class Client {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
-
throw new
|
|
98
|
-
'
|
|
99
|
-
|
|
100
|
-
'Provide a custom transport if you need to handle relative paths differently.'
|
|
101
|
-
]);
|
|
97
|
+
throw new ConfigurationError('baseUrl is required for default UndiciTransport, or provide a custom transport.', {
|
|
98
|
+
configKey: 'baseUrl',
|
|
99
|
+
});
|
|
102
100
|
}
|
|
103
101
|
if (options.retry) {
|
|
104
102
|
retry(options.retry)(this);
|
|
@@ -375,11 +373,10 @@ export class Client {
|
|
|
375
373
|
usedParams.add(paramName);
|
|
376
374
|
return encodeURIComponent(String(mergedParams[paramName]));
|
|
377
375
|
}
|
|
378
|
-
throw new
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
]);
|
|
376
|
+
throw new ValidationError(`Missing required path parameter: ${paramName}`, {
|
|
377
|
+
field: paramName,
|
|
378
|
+
value: undefined,
|
|
379
|
+
});
|
|
383
380
|
});
|
|
384
381
|
}
|
|
385
382
|
let finalUrl;
|
|
@@ -392,11 +389,9 @@ export class Client {
|
|
|
392
389
|
finalUrl = base + p;
|
|
393
390
|
}
|
|
394
391
|
else {
|
|
395
|
-
throw new
|
|
396
|
-
'
|
|
397
|
-
|
|
398
|
-
'Provide a custom transport that resolves relative paths.'
|
|
399
|
-
]);
|
|
392
|
+
throw new ConfigurationError('Relative path provided without a baseUrl or explicit transport.', {
|
|
393
|
+
configKey: 'baseUrl',
|
|
394
|
+
});
|
|
400
395
|
}
|
|
401
396
|
const remainingKeys = Object.keys(mergedParams).filter((k) => !usedParams.has(k));
|
|
402
397
|
if (remainingKeys.length > 0) {
|
|
@@ -446,11 +441,10 @@ export class Client {
|
|
|
446
441
|
if (timeout) {
|
|
447
442
|
const totalTimeout = typeof timeout === 'number' ? timeout : timeout.request;
|
|
448
443
|
if (totalTimeout) {
|
|
449
|
-
timeoutId = setTimeout(() => controller.abort(new
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
])), totalTimeout);
|
|
444
|
+
timeoutId = setTimeout(() => controller.abort(new TimeoutError(req, {
|
|
445
|
+
phase: 'request',
|
|
446
|
+
timeout: totalTimeout,
|
|
447
|
+
})), totalTimeout);
|
|
454
448
|
}
|
|
455
449
|
}
|
|
456
450
|
}
|
|
@@ -645,11 +639,9 @@ export class Client {
|
|
|
645
639
|
wsUrl = new URL(path, base).toString();
|
|
646
640
|
}
|
|
647
641
|
else {
|
|
648
|
-
throw new
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
'Ensure the baseUrl uses http/https so it can be converted to ws/wss.'
|
|
652
|
-
]);
|
|
642
|
+
throw new ConfigurationError('WebSocket requires either a full ws:// URL or a baseUrl', {
|
|
643
|
+
configKey: 'baseUrl',
|
|
644
|
+
});
|
|
653
645
|
}
|
|
654
646
|
const headersObj = {};
|
|
655
647
|
if (this.defaultHeaders) {
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class HttpError extends ReckerError {
|
|
|
11
11
|
statusText: string;
|
|
12
12
|
constructor(response: ReckerResponse, request?: ReckerRequest);
|
|
13
13
|
}
|
|
14
|
-
export type TimeoutPhase = 'lookup' | 'connect' | 'secureConnect' | 'socket' | 'send' | 'response' | 'request';
|
|
14
|
+
export type TimeoutPhase = 'lookup' | 'connect' | 'secureConnect' | 'socket' | 'send' | 'response' | 'request' | 'webrtc-connect';
|
|
15
15
|
export declare class TimeoutError extends ReckerError {
|
|
16
16
|
phase: TimeoutPhase;
|
|
17
17
|
timeout: number;
|
|
@@ -32,4 +32,112 @@ export declare class MaxSizeExceededError extends ReckerError {
|
|
|
32
32
|
actualSize?: number;
|
|
33
33
|
constructor(maxSize: number, actualSize?: number, request?: ReckerRequest);
|
|
34
34
|
}
|
|
35
|
+
export declare class AbortError extends ReckerError {
|
|
36
|
+
reason?: string;
|
|
37
|
+
constructor(reason?: string, request?: ReckerRequest);
|
|
38
|
+
}
|
|
39
|
+
export declare class ConnectionError extends ReckerError {
|
|
40
|
+
host?: string;
|
|
41
|
+
port?: number;
|
|
42
|
+
code?: string;
|
|
43
|
+
constructor(message: string, options?: {
|
|
44
|
+
host?: string;
|
|
45
|
+
port?: number;
|
|
46
|
+
code?: string;
|
|
47
|
+
retriable?: boolean;
|
|
48
|
+
request?: ReckerRequest;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export declare class AuthenticationError extends ReckerError {
|
|
52
|
+
authType?: string;
|
|
53
|
+
constructor(message: string, options?: {
|
|
54
|
+
authType?: string;
|
|
55
|
+
request?: ReckerRequest;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export declare class ProtocolError extends ReckerError {
|
|
59
|
+
protocol: string;
|
|
60
|
+
code?: string | number;
|
|
61
|
+
phase?: string;
|
|
62
|
+
constructor(message: string, options: {
|
|
63
|
+
protocol: string;
|
|
64
|
+
code?: string | number;
|
|
65
|
+
phase?: string;
|
|
66
|
+
retriable?: boolean;
|
|
67
|
+
request?: ReckerRequest;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export declare class NotFoundError extends ReckerError {
|
|
71
|
+
resource?: string;
|
|
72
|
+
constructor(message: string, options?: {
|
|
73
|
+
resource?: string;
|
|
74
|
+
request?: ReckerRequest;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export declare class StateError extends ReckerError {
|
|
78
|
+
expectedState?: string;
|
|
79
|
+
actualState?: string;
|
|
80
|
+
constructor(message: string, options?: {
|
|
81
|
+
expectedState?: string;
|
|
82
|
+
actualState?: string;
|
|
83
|
+
request?: ReckerRequest;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export declare class ValidationError extends ReckerError {
|
|
87
|
+
field?: string;
|
|
88
|
+
value?: unknown;
|
|
89
|
+
constructor(message: string, options?: {
|
|
90
|
+
field?: string;
|
|
91
|
+
value?: unknown;
|
|
92
|
+
request?: ReckerRequest;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
export declare class ConfigurationError extends ReckerError {
|
|
96
|
+
configKey?: string;
|
|
97
|
+
constructor(message: string, options?: {
|
|
98
|
+
configKey?: string;
|
|
99
|
+
request?: ReckerRequest;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export declare class UnsupportedError extends ReckerError {
|
|
103
|
+
feature?: string;
|
|
104
|
+
constructor(message: string, options?: {
|
|
105
|
+
feature?: string;
|
|
106
|
+
request?: ReckerRequest;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
export declare class ParseError extends ReckerError {
|
|
110
|
+
format?: string;
|
|
111
|
+
position?: number;
|
|
112
|
+
constructor(message: string, options?: {
|
|
113
|
+
format?: string;
|
|
114
|
+
position?: number;
|
|
115
|
+
request?: ReckerRequest;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export declare class QueueCancelledError extends ReckerError {
|
|
119
|
+
queueName?: string;
|
|
120
|
+
constructor(message?: string, options?: {
|
|
121
|
+
queueName?: string;
|
|
122
|
+
request?: ReckerRequest;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export declare class StreamError extends ReckerError {
|
|
126
|
+
streamType?: string;
|
|
127
|
+
constructor(message: string, options?: {
|
|
128
|
+
streamType?: string;
|
|
129
|
+
retriable?: boolean;
|
|
130
|
+
request?: ReckerRequest;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export declare class DownloadError extends ReckerError {
|
|
134
|
+
url?: string;
|
|
135
|
+
statusCode?: number;
|
|
136
|
+
constructor(message: string, options?: {
|
|
137
|
+
url?: string;
|
|
138
|
+
statusCode?: number;
|
|
139
|
+
retriable?: boolean;
|
|
140
|
+
request?: ReckerRequest;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
35
143
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAElE,qBAAa,WAAY,SAAQ,KAAK;IACpC,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;gBAGjB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,EACvB,QAAQ,CAAC,EAAE,cAAc,EACzB,WAAW,GAAE,MAAM,EAAO,EAC1B,SAAS,UAAQ;CASpB;AAED,qBAAa,SAAU,SA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