@mikkelscheike/email-provider-links 4.0.6 → 4.0.8
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/dist/concurrent-dns.js +14 -9
- package/dist/hash-verifier.js +1 -1
- package/package.json +10 -10
package/dist/concurrent-dns.js
CHANGED
|
@@ -224,7 +224,7 @@ class ConcurrentDNSDetector {
|
|
|
224
224
|
async queryMX(domain) {
|
|
225
225
|
const startTime = Date.now();
|
|
226
226
|
try {
|
|
227
|
-
const records = await this.withTimeout(resolveMxAsync(domain), this.config.timeout);
|
|
227
|
+
const records = await this.withTimeout(() => resolveMxAsync(domain), this.config.timeout);
|
|
228
228
|
return {
|
|
229
229
|
type: 'mx',
|
|
230
230
|
success: true,
|
|
@@ -248,7 +248,7 @@ class ConcurrentDNSDetector {
|
|
|
248
248
|
async queryTXT(domain) {
|
|
249
249
|
const startTime = Date.now();
|
|
250
250
|
try {
|
|
251
|
-
const records = await this.withTimeout(resolveTxtAsync(domain), this.config.timeout);
|
|
251
|
+
const records = await this.withTimeout(() => resolveTxtAsync(domain), this.config.timeout);
|
|
252
252
|
const flatRecords = records.flat();
|
|
253
253
|
return {
|
|
254
254
|
type: 'txt',
|
|
@@ -396,29 +396,34 @@ class ConcurrentDNSDetector {
|
|
|
396
396
|
/**
|
|
397
397
|
* Wrap a promise with a timeout
|
|
398
398
|
*/
|
|
399
|
-
withTimeout(
|
|
399
|
+
withTimeout(fn, ms) {
|
|
400
|
+
// For extremely small timeouts, avoid starting the underlying DNS query at all
|
|
401
|
+
if (ms <= 1) {
|
|
402
|
+
return Promise.reject(new Error(`DNS query timeout after ${ms}ms`));
|
|
403
|
+
}
|
|
400
404
|
let rejectFn;
|
|
401
|
-
const
|
|
405
|
+
const wrappedPromise = new Promise((resolve, reject) => {
|
|
402
406
|
rejectFn = reject;
|
|
403
407
|
const timeout = setTimeout(() => reject(new Error(`DNS query timeout after ${ms}ms`)), ms).unref();
|
|
404
|
-
|
|
408
|
+
// Start the underlying operation only after setting up the timeout
|
|
409
|
+
fn()
|
|
405
410
|
.then(resolve)
|
|
406
411
|
.catch(reject)
|
|
407
412
|
.finally(() => {
|
|
408
413
|
clearTimeout(timeout);
|
|
409
414
|
// Clean up active query
|
|
410
|
-
const queryEntry = Array.from(this.activeQueries).find(entry => entry.promise ===
|
|
415
|
+
const queryEntry = Array.from(this.activeQueries).find(entry => entry.promise === wrappedPromise);
|
|
411
416
|
if (queryEntry) {
|
|
412
417
|
this.activeQueries.delete(queryEntry);
|
|
413
418
|
}
|
|
414
419
|
});
|
|
415
420
|
});
|
|
416
|
-
//
|
|
421
|
+
// Track active query for potential cleanup in tests
|
|
417
422
|
if (rejectFn) {
|
|
418
|
-
const queryEntry = { promise:
|
|
423
|
+
const queryEntry = { promise: wrappedPromise, reject: rejectFn };
|
|
419
424
|
this.activeQueries.add(queryEntry);
|
|
420
425
|
}
|
|
421
|
-
return
|
|
426
|
+
return wrappedPromise;
|
|
422
427
|
}
|
|
423
428
|
}
|
|
424
429
|
exports.ConcurrentDNSDetector = ConcurrentDNSDetector;
|
package/dist/hash-verifier.js
CHANGED
|
@@ -29,7 +29,7 @@ const KNOWN_GOOD_HASHES = {
|
|
|
29
29
|
// SHA-256 hash of the legitimate emailproviders.json
|
|
30
30
|
'emailproviders.json': 'c74455b537534268c28b7312664c676cb0f511e6674367da603a15c5fe30e16f',
|
|
31
31
|
// You can add hashes for other critical files
|
|
32
|
-
'package.json': '
|
|
32
|
+
'package.json': '693c72d89b7f53de72d1c5519a60e7bbdbfef619458f383c76ef82ec2866c289',
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* Calculates SHA-256 hash of a file or string content
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikkelscheike/email-provider-links",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"description": "TypeScript library for email provider detection with 93 providers (207 domains), concurrent DNS resolution, optimized performance, 94.65% test coverage, and enterprise security for login and password reset flows",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -66,20 +66,20 @@
|
|
|
66
66
|
"test-exclude": "^7.0.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@jest/globals": "^30.
|
|
69
|
+
"@jest/globals": "^30.1.2",
|
|
70
70
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
71
71
|
"@semantic-release/exec": "^7.1.0",
|
|
72
72
|
"@semantic-release/git": "^10.0.1",
|
|
73
|
-
"@semantic-release/github": "^11.0.
|
|
73
|
+
"@semantic-release/github": "^11.0.5",
|
|
74
74
|
"@semantic-release/npm": "^12.0.2",
|
|
75
75
|
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
76
76
|
"@types/jest": "^30.0.0",
|
|
77
|
-
"@types/node": "^24.0
|
|
78
|
-
"conventional-changelog-conventionalcommits": "^9.
|
|
79
|
-
"jest": "^30.
|
|
80
|
-
"semantic-release": "^24.2.
|
|
81
|
-
"ts-jest": "^29.4.
|
|
82
|
-
"tsx": "^4.20.
|
|
83
|
-
"typescript": "^5.
|
|
77
|
+
"@types/node": "^24.3.0",
|
|
78
|
+
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
79
|
+
"jest": "^30.1.3",
|
|
80
|
+
"semantic-release": "^24.2.7",
|
|
81
|
+
"ts-jest": "^29.4.1",
|
|
82
|
+
"tsx": "^4.20.5",
|
|
83
|
+
"typescript": "^5.9.2"
|
|
84
84
|
}
|
|
85
85
|
}
|