@postalsys/email-ai-tools 2.3.2 → 2.4.1
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/CHANGELOG.md +14 -0
- package/dist/cjs/lib/authentication.d.ts +3 -1
- package/dist/cjs/lib/authentication.js +10 -2
- package/dist/cjs/package-info.d.ts +1 -1
- package/dist/cjs/package-info.js +1 -1
- package/dist/esm/lib/authentication.d.ts +3 -1
- package/dist/esm/lib/authentication.js +10 -2
- package/dist/esm/package-info.d.ts +1 -1
- package/dist/esm/package-info.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.1](https://github.com/postalsys/email-ai-tools/compare/v2.4.0...v2.4.1) (2026-11-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* update dependencies ([ecbd9a6](https://github.com/postalsys/email-ai-tools/commit/ecbd9a6bfb4d466c20389652699fa5c1775eb01d))
|
|
9
|
+
|
|
10
|
+
## [2.4.0](https://github.com/postalsys/email-ai-tools/compare/v2.3.2...v2.4.0) (2026-10-29)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* list the signing domains of passing DKIM signatures in parseAuthenticationResults ([e6d468e](https://github.com/postalsys/email-ai-tools/commit/e6d468e7ed4ce71d27da756d540a89cbdd7259b4))
|
|
16
|
+
|
|
3
17
|
## [2.3.2](https://github.com/postalsys/email-ai-tools/compare/v2.3.1...v2.3.2) (2026-10-22)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -15,11 +15,13 @@ export interface AuthenticationTrust {
|
|
|
15
15
|
* Parses one Authentication-Results header value
|
|
16
16
|
*
|
|
17
17
|
* @param value - Header value, unfolded
|
|
18
|
-
* @returns The authserv-id (null when the header carries none, as Microsoft's do)
|
|
18
|
+
* @returns The authserv-id (null when the header carries none, as Microsoft's do), the first result per method,
|
|
19
|
+
* and the signing domains of every passing DKIM signature (header.d, or the domain of header.i)
|
|
19
20
|
*/
|
|
20
21
|
declare function parseAuthenticationResults(value: unknown): {
|
|
21
22
|
authservId: string | null;
|
|
22
23
|
results: AuthenticationResults;
|
|
24
|
+
dkimDomains: string[];
|
|
23
25
|
} | null;
|
|
24
26
|
/**
|
|
25
27
|
* Tells whether an authserv-id names a server the caller trusts: the name itself or a host
|
|
@@ -67,7 +67,8 @@ function splitResinfo(value) {
|
|
|
67
67
|
* Parses one Authentication-Results header value
|
|
68
68
|
*
|
|
69
69
|
* @param value - Header value, unfolded
|
|
70
|
-
* @returns The authserv-id (null when the header carries none, as Microsoft's do)
|
|
70
|
+
* @returns The authserv-id (null when the header carries none, as Microsoft's do), the first result per method,
|
|
71
|
+
* and the signing domains of every passing DKIM signature (header.d, or the domain of header.i)
|
|
71
72
|
*/
|
|
72
73
|
function parseAuthenticationResults(value) {
|
|
73
74
|
const segments = splitResinfo(String(value ?? ''));
|
|
@@ -88,6 +89,7 @@ function parseAuthenticationResults(value) {
|
|
|
88
89
|
segments[0] = first.substring(firstToken.length).trim();
|
|
89
90
|
}
|
|
90
91
|
const results = {};
|
|
92
|
+
const dkimDomains = [];
|
|
91
93
|
for (const segment of segments) {
|
|
92
94
|
const match = /^([a-z0-9-]+)\s*=\s*([a-z0-9-]+)/i.exec(segment);
|
|
93
95
|
if (!match) {
|
|
@@ -98,13 +100,19 @@ function parseAuthenticationResults(value) {
|
|
|
98
100
|
if (!METHODS.includes(method)) {
|
|
99
101
|
continue;
|
|
100
102
|
}
|
|
103
|
+
if (method === 'dkim' && result === 'pass') {
|
|
104
|
+
const domain = /\bheader\.d\s*=\s*([a-z0-9.-]+)/i.exec(segment) || /\bheader\.i\s*=\s*[^\s@]*@([a-z0-9.-]+)/i.exec(segment);
|
|
105
|
+
if (domain) {
|
|
106
|
+
dkimDomains.push(domain[1].toLowerCase().replace(/\.$/, ''));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
101
109
|
// the first result per method: a second DKIM entry is another signature on the message,
|
|
102
110
|
// a mailing list's broken one as often as not, and not a verdict on the first
|
|
103
111
|
if (!(method in results)) {
|
|
104
112
|
results[method] = result;
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
|
-
return { authservId, results };
|
|
115
|
+
return { authservId, results, dkimDomains };
|
|
108
116
|
}
|
|
109
117
|
/**
|
|
110
118
|
* Tells whether an authserv-id names a server the caller trusts: the name itself or a host
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@postalsys/email-ai-tools";
|
|
2
|
-
export declare const version = "2.
|
|
2
|
+
export declare const version = "2.4.1";
|
package/dist/cjs/package-info.js
CHANGED
|
@@ -15,11 +15,13 @@ export interface AuthenticationTrust {
|
|
|
15
15
|
* Parses one Authentication-Results header value
|
|
16
16
|
*
|
|
17
17
|
* @param value - Header value, unfolded
|
|
18
|
-
* @returns The authserv-id (null when the header carries none, as Microsoft's do)
|
|
18
|
+
* @returns The authserv-id (null when the header carries none, as Microsoft's do), the first result per method,
|
|
19
|
+
* and the signing domains of every passing DKIM signature (header.d, or the domain of header.i)
|
|
19
20
|
*/
|
|
20
21
|
declare function parseAuthenticationResults(value: unknown): {
|
|
21
22
|
authservId: string | null;
|
|
22
23
|
results: AuthenticationResults;
|
|
24
|
+
dkimDomains: string[];
|
|
23
25
|
} | null;
|
|
24
26
|
/**
|
|
25
27
|
* Tells whether an authserv-id names a server the caller trusts: the name itself or a host
|
|
@@ -61,7 +61,8 @@ function splitResinfo(value) {
|
|
|
61
61
|
* Parses one Authentication-Results header value
|
|
62
62
|
*
|
|
63
63
|
* @param value - Header value, unfolded
|
|
64
|
-
* @returns The authserv-id (null when the header carries none, as Microsoft's do)
|
|
64
|
+
* @returns The authserv-id (null when the header carries none, as Microsoft's do), the first result per method,
|
|
65
|
+
* and the signing domains of every passing DKIM signature (header.d, or the domain of header.i)
|
|
65
66
|
*/
|
|
66
67
|
function parseAuthenticationResults(value) {
|
|
67
68
|
const segments = splitResinfo(String(value ?? ''));
|
|
@@ -82,6 +83,7 @@ function parseAuthenticationResults(value) {
|
|
|
82
83
|
segments[0] = first.substring(firstToken.length).trim();
|
|
83
84
|
}
|
|
84
85
|
const results = {};
|
|
86
|
+
const dkimDomains = [];
|
|
85
87
|
for (const segment of segments) {
|
|
86
88
|
const match = /^([a-z0-9-]+)\s*=\s*([a-z0-9-]+)/i.exec(segment);
|
|
87
89
|
if (!match) {
|
|
@@ -92,13 +94,19 @@ function parseAuthenticationResults(value) {
|
|
|
92
94
|
if (!METHODS.includes(method)) {
|
|
93
95
|
continue;
|
|
94
96
|
}
|
|
97
|
+
if (method === 'dkim' && result === 'pass') {
|
|
98
|
+
const domain = /\bheader\.d\s*=\s*([a-z0-9.-]+)/i.exec(segment) || /\bheader\.i\s*=\s*[^\s@]*@([a-z0-9.-]+)/i.exec(segment);
|
|
99
|
+
if (domain) {
|
|
100
|
+
dkimDomains.push(domain[1].toLowerCase().replace(/\.$/, ''));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
95
103
|
// the first result per method: a second DKIM entry is another signature on the message,
|
|
96
104
|
// a mailing list's broken one as often as not, and not a verdict on the first
|
|
97
105
|
if (!(method in results)) {
|
|
98
106
|
results[method] = result;
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
|
-
return { authservId, results };
|
|
109
|
+
return { authservId, results, dkimDomains };
|
|
102
110
|
}
|
|
103
111
|
/**
|
|
104
112
|
* Tells whether an authserv-id names a server the caller trusts: the name itself or a host
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@postalsys/email-ai-tools";
|
|
2
|
-
export declare const version = "2.
|
|
2
|
+
export declare const version = "2.4.1";
|
package/dist/esm/package-info.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postalsys/email-ai-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Summarize and risk-score email messages with an OpenAI-compatible chat model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -78,20 +78,20 @@
|
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@types/node": "20.19.43",
|
|
80
80
|
"c8": "12.0.0",
|
|
81
|
-
"eslint": "10.
|
|
81
|
+
"eslint": "10.14.0",
|
|
82
82
|
"eslint-config-prettier": "10.1.8",
|
|
83
|
-
"globals": "17.
|
|
84
|
-
"mailparser": "3.
|
|
83
|
+
"globals": "17.14.0",
|
|
84
|
+
"mailparser": "3.14.2",
|
|
85
85
|
"prettier": "3.9.10",
|
|
86
86
|
"typescript": "6.0.3",
|
|
87
|
-
"typescript-eslint": "8.72.
|
|
87
|
+
"typescript-eslint": "8.72.1"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@postalsys/email-text-tools": "2.6.
|
|
90
|
+
"@postalsys/email-text-tools": "2.6.2",
|
|
91
91
|
"dom-serializer": "2.0.0",
|
|
92
92
|
"domutils": "3.2.2",
|
|
93
93
|
"htmlparser2": "10.1.0",
|
|
94
|
-
"libmime": "5.6.
|
|
94
|
+
"libmime": "5.6.4",
|
|
95
95
|
"tldts": "7.4.19",
|
|
96
96
|
"undici": "7.30.1"
|
|
97
97
|
},
|