@framers/agentos-ext-channel-email 0.4.4 → 0.6.0
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 +74 -9
- package/dist/EmailService.d.ts +286 -9
- package/dist/EmailService.d.ts.map +1 -1
- package/dist/EmailService.js +592 -35
- package/dist/EmailService.js.map +1 -1
- package/dist/attachments.d.ts +118 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/attachments.js +294 -0
- package/dist/attachments.js.map +1 -0
- package/dist/headers.d.ts +117 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +285 -0
- package/dist/headers.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/messageHeaders.d.ts +8 -0
- package/dist/messageHeaders.d.ts.map +1 -1
- package/dist/messageHeaders.js +2 -0
- package/dist/messageHeaders.js.map +1 -1
- package/dist/preferences/RecipientCapability.d.ts +3 -2
- package/dist/preferences/RecipientCapability.d.ts.map +1 -1
- package/dist/preferences/RecipientCapability.js +2 -1
- package/dist/preferences/RecipientCapability.js.map +1 -1
- package/dist/tools/messages.d.ts +32 -0
- package/dist/tools/messages.d.ts.map +1 -0
- package/dist/tools/messages.js +28 -0
- package/dist/tools/messages.js.map +1 -0
- package/dist/tools/read.d.ts +4 -2
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +10 -4
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/search.d.ts +4 -2
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +8 -3
- package/dist/tools/search.js.map +1 -1
- package/manifest.json +4 -3
- package/package.json +4 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview What a message's header fields say beside its envelope, as `EmailService`'s reads give it: the
|
|
3
|
+
* Delivered-To addresses, the threading ids, the fields that mark a message a machine sent, and the
|
|
4
|
+
* Authentication-Results field (RFC 8601) parsed to the DKIM, SPF and DMARC results, the domain the DMARC result speaks
|
|
5
|
+
* for, and the domain a DKIM signature aligns with the From address. A host that reads a message's header another way,
|
|
6
|
+
* such as through Gmail's API, reads the same fields with `readHeaderFields`.
|
|
7
|
+
*/
|
|
8
|
+
/** The results the receiving host recorded in its Authentication-Results field (RFC 8601). */
|
|
9
|
+
export interface EmailAuthentication {
|
|
10
|
+
/**
|
|
11
|
+
* The DKIM result (RFC 6376), in lowercase: `pass` when any signature passed, else the first signature's result, such
|
|
12
|
+
* as `fail`; `none` when the field names no DKIM result.
|
|
13
|
+
*/
|
|
14
|
+
dkim: string;
|
|
15
|
+
/** The SPF result (RFC 7208), in lowercase, such as `pass` or `softfail`; `none` when the field names none. */
|
|
16
|
+
spf: string;
|
|
17
|
+
/**
|
|
18
|
+
* The DMARC result (RFC 7489), in lowercase, such as `pass` or `fail`; `none` when the field names none. It is the
|
|
19
|
+
* receiving host's verdict for the domain `dmarcFrom` names, the From domain that host read; this result does not
|
|
20
|
+
* compare that domain with the From address a read gives, so a host that trusts it compares `dmarcFrom` with that
|
|
21
|
+
* address's domain.
|
|
22
|
+
*/
|
|
23
|
+
dmarc: string;
|
|
24
|
+
/**
|
|
25
|
+
* The domain the DMARC result names as `header.from`, the domain of the From field the receiving host read (RFC 7489
|
|
26
|
+
* section 11.1), in lowercase without a closing dot: the domain its DMARC result speaks for. `none` when the field
|
|
27
|
+
* names no DMARC result, or one that names no domain.
|
|
28
|
+
*/
|
|
29
|
+
dmarcFrom: string;
|
|
30
|
+
/**
|
|
31
|
+
* The From address's domain, in lowercase, when a DKIM signature that passed was made for that domain or for a domain
|
|
32
|
+
* it ends in after a dot: the signature's `header.d`, or the domain of its `header.i` where it names no `header.d`.
|
|
33
|
+
* `none` otherwise, and when the From address given names no domain, as a group's or an absent From's does. A
|
|
34
|
+
* signature made for a domain below the From domain, which RFC 7489 section 3.1.1's relaxed alignment also counts,
|
|
35
|
+
* does not count here: finding a domain's organizational domain needs the public suffix list.
|
|
36
|
+
*/
|
|
37
|
+
alignedDomain: string;
|
|
38
|
+
}
|
|
39
|
+
/** What `readHeaderFields` and `parseAuthenticationResults` read a header block against. */
|
|
40
|
+
export interface HeaderFieldOptions {
|
|
41
|
+
/**
|
|
42
|
+
* The message's From address, whose domain a DKIM signature must align with; a From that names no domain, such as the
|
|
43
|
+
* empty string, aligns with none. When `from` is not given at all, the `header.from` of the DMARC result names the
|
|
44
|
+
* domain.
|
|
45
|
+
*/
|
|
46
|
+
from?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The authserv-id of the host that takes mail into the mailbox, such as `mx.google.com`, compared ignoring case. Only
|
|
49
|
+
* the topmost Authentication-Results field is read, since each host that checks a message adds its field at the top
|
|
50
|
+
* (RFC 8601 sections 2.1 and 4), and given `authServId` it counts only when it names that host: a mail whose topmost
|
|
51
|
+
* field names another host, or none, reads `none` throughout, and a field below the topmost never counts, whatever
|
|
52
|
+
* host it names. Without it the topmost field counts whatever host it names. The topmost field is the receiving
|
|
53
|
+
* host's only when that host writes one on every message it takes in: on a host that writes none, it is one the
|
|
54
|
+
* sender wrote, and `authServId` cannot tell the two apart. A host that writes one field per test, as RFC 8601
|
|
55
|
+
* section 4 allows, gives its topmost field's results alone. Give it for any decision that trusts the results. A
|
|
56
|
+
* value that is not text, holds a control character or is white space alone throws an `Error`; `null` and the empty
|
|
57
|
+
* string count as not given.
|
|
58
|
+
*/
|
|
59
|
+
authServId?: string;
|
|
60
|
+
}
|
|
61
|
+
/** What `readHeaderFields` reads from a header block. */
|
|
62
|
+
export interface HeaderFields {
|
|
63
|
+
/** The address of each Delivered-To field, in lowercase, as `addressOf` gives it, in the header's order. */
|
|
64
|
+
deliveredTo: string[];
|
|
65
|
+
/** The first message id In-Reply-To lists, in angle brackets, or the empty string. */
|
|
66
|
+
inReplyTo: string;
|
|
67
|
+
/** The message ids References lists, each in angle brackets, in its order. */
|
|
68
|
+
references: string[];
|
|
69
|
+
/** The keyword of the first Auto-Submitted field (RFC 3834), in lowercase; `no` when the header has none. */
|
|
70
|
+
autoSubmitted: string;
|
|
71
|
+
/** The keyword of the first Precedence field, in lowercase, such as `bulk` or `list`; the empty string when none. */
|
|
72
|
+
precedence: string;
|
|
73
|
+
/** Whether the header holds an X-Autoreply or an X-Auto-Response-Suppress field, whatever its value. */
|
|
74
|
+
autoreply: boolean;
|
|
75
|
+
/** The receiving host's Authentication-Results, parsed. */
|
|
76
|
+
authentication: EmailAuthentication;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The receiving host's authserv-id in lowercase, or `undefined` when none is given: `undefined`, `null` or the empty
|
|
80
|
+
* string. A value that is not text, that holds a control character or that is white space alone, which would let the
|
|
81
|
+
* topmost field of any host count, throws an `Error` that holds none of it.
|
|
82
|
+
*
|
|
83
|
+
* @param authServId The authserv-id as a caller gave it.
|
|
84
|
+
*/
|
|
85
|
+
export declare function requireAuthServId(authServId: unknown): string | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* An address as a read gives it, in lowercase, or `undefined` when it names no local part or a domain with white space
|
|
88
|
+
* in it: its local part in quotes, as RFC 5322 writes it, only when it holds white space, a double quote or another
|
|
89
|
+
* special but the dot, and else bare. A server gives an envelope's local part with its quoting removed (RFC 3501 section
|
|
90
|
+
* 9, `addr-mailbox`), and a Delivered-To field keeps it as written, so `support team@example.com` from an envelope and
|
|
91
|
+
* `"Support Team"@example.com` from a field both read `"support team"@example.com`, and `"bob"@example.com` reads
|
|
92
|
+
* `bob@example.com`.
|
|
93
|
+
*
|
|
94
|
+
* @param text An address, alone.
|
|
95
|
+
*/
|
|
96
|
+
export declare function addressOf(text: string): string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* The DKIM, SPF and DMARC results, the domain the DMARC result names and the aligned domain a header block's topmost
|
|
99
|
+
* Authentication-Results field records, the receiving host's: given `authServId`, that field counts only when it names
|
|
100
|
+
* that host, and no field below it ever counts. A field that names no authserv-id, as Outlook writes it, is read from
|
|
101
|
+
* its first result and names no host. A result the field does not record, and a header with no field that counts, reads
|
|
102
|
+
* `none`. Comments are left out, so a semicolon inside one splits nothing, and a folded field is read whole. An
|
|
103
|
+
* `authServId` that is not text, holds a control character or is white space alone throws an `Error`.
|
|
104
|
+
*
|
|
105
|
+
* @param headerBlock The message's header block, or the fields of it a read fetched, in the header's order.
|
|
106
|
+
* @param options The From address to align with and the receiving host's authserv-id.
|
|
107
|
+
*/
|
|
108
|
+
export declare function parseAuthenticationResults(headerBlock: string, options?: HeaderFieldOptions): EmailAuthentication;
|
|
109
|
+
/**
|
|
110
|
+
* What a header block says beside the envelope: its Delivered-To addresses, its threading ids, the fields that mark a
|
|
111
|
+
* message a machine sent, and its Authentication-Results as `parseAuthenticationResults` reads them.
|
|
112
|
+
*
|
|
113
|
+
* @param headerBlock The message's header block, or the fields of it a read fetched, in the header's order.
|
|
114
|
+
* @param options The From address to align with and the receiving host's authserv-id.
|
|
115
|
+
*/
|
|
116
|
+
export declare function readHeaderFields(headerBlock: string, options?: HeaderFieldOptions): HeaderFields;
|
|
117
|
+
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,4FAA4F;AAC5F,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,4GAA4G;IAC5G,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,6GAA6G;IAC7G,aAAa,EAAE,MAAM,CAAC;IACtB,qHAAqH;IACrH,UAAU,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,cAAc,EAAE,mBAAmB,CAAC;CACrC;AAqBD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIzE;AAmLD;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW1D;AASD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,mBAAmB,CAErH;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,YAAY,CAgBpG"}
|
package/dist/headers.js
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview What a message's header fields say beside its envelope, as `EmailService`'s reads give it: the
|
|
4
|
+
* Delivered-To addresses, the threading ids, the fields that mark a message a machine sent, and the
|
|
5
|
+
* Authentication-Results field (RFC 8601) parsed to the DKIM, SPF and DMARC results, the domain the DMARC result speaks
|
|
6
|
+
* for, and the domain a DKIM signature aligns with the From address. A host that reads a message's header another way,
|
|
7
|
+
* such as through Gmail's API, reads the same fields with `readHeaderFields`.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.requireAuthServId = requireAuthServId;
|
|
11
|
+
exports.addressOf = addressOf;
|
|
12
|
+
exports.parseAuthenticationResults = parseAuthenticationResults;
|
|
13
|
+
exports.readHeaderFields = readHeaderFields;
|
|
14
|
+
const messageHeaders_js_1 = require("./messageHeaders.js");
|
|
15
|
+
/** A quoted string, a lone `=`, or a run of characters that are neither white space, `=` nor a double quote. */
|
|
16
|
+
const TOKEN = /"(?:[^"\\]|\\.)*"?|=|[^\s="]+/g;
|
|
17
|
+
/** A domain: labels of characters other than white space, `@` and `.`, at least two, joined by dots. */
|
|
18
|
+
const DOMAIN = /^[^\s@.]+(?:\.[^\s@.]+)+$/;
|
|
19
|
+
/** A control character, which no host's name holds. */
|
|
20
|
+
const CONTROL = /[\x00-\x1f\x7f]/;
|
|
21
|
+
/**
|
|
22
|
+
* The receiving host's authserv-id in lowercase, or `undefined` when none is given: `undefined`, `null` or the empty
|
|
23
|
+
* string. A value that is not text, that holds a control character or that is white space alone, which would let the
|
|
24
|
+
* topmost field of any host count, throws an `Error` that holds none of it.
|
|
25
|
+
*
|
|
26
|
+
* @param authServId The authserv-id as a caller gave it.
|
|
27
|
+
*/
|
|
28
|
+
function requireAuthServId(authServId) {
|
|
29
|
+
if (authServId === undefined || authServId === null || authServId === '')
|
|
30
|
+
return undefined;
|
|
31
|
+
if (typeof authServId === 'string' && !CONTROL.test(authServId) && authServId.trim() !== '')
|
|
32
|
+
return authServId.trim().toLowerCase();
|
|
33
|
+
throw new Error('The authServId was refused: give it as the name of the host that received the mail');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `value` with each comment written as a space (RFC 5322 section 3.2.2): text in parentheses, which may nest and may
|
|
37
|
+
* hold a quoted pair, outside quoted strings, where a parenthesis is text.
|
|
38
|
+
*/
|
|
39
|
+
function withoutComments(value) {
|
|
40
|
+
let out = '';
|
|
41
|
+
let depth = 0;
|
|
42
|
+
let quoted = false;
|
|
43
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
44
|
+
const character = value.charAt(index);
|
|
45
|
+
if (depth > 0) {
|
|
46
|
+
if (character === '\\')
|
|
47
|
+
index += 1;
|
|
48
|
+
else if (character === '(')
|
|
49
|
+
depth += 1;
|
|
50
|
+
else if (character === ')') {
|
|
51
|
+
depth -= 1;
|
|
52
|
+
if (depth === 0)
|
|
53
|
+
out += ' ';
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (quoted) {
|
|
58
|
+
out += character;
|
|
59
|
+
if (character === '\\' && index + 1 < value.length) {
|
|
60
|
+
index += 1;
|
|
61
|
+
out += value.charAt(index);
|
|
62
|
+
}
|
|
63
|
+
else if (character === '"') {
|
|
64
|
+
quoted = false;
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (character === '(')
|
|
69
|
+
depth = 1;
|
|
70
|
+
else {
|
|
71
|
+
if (character === '"')
|
|
72
|
+
quoted = true;
|
|
73
|
+
out += character;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
/** `value` split at each semicolon outside a quoted string. */
|
|
79
|
+
function segmentsOf(value) {
|
|
80
|
+
const segments = [];
|
|
81
|
+
let current = '';
|
|
82
|
+
let quoted = false;
|
|
83
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
84
|
+
const character = value.charAt(index);
|
|
85
|
+
if (quoted) {
|
|
86
|
+
current += character;
|
|
87
|
+
if (character === '\\' && index + 1 < value.length) {
|
|
88
|
+
index += 1;
|
|
89
|
+
current += value.charAt(index);
|
|
90
|
+
}
|
|
91
|
+
else if (character === '"') {
|
|
92
|
+
quoted = false;
|
|
93
|
+
}
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (character === ';') {
|
|
97
|
+
segments.push(current);
|
|
98
|
+
current = '';
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (character === '"')
|
|
102
|
+
quoted = true;
|
|
103
|
+
current += character;
|
|
104
|
+
}
|
|
105
|
+
segments.push(current);
|
|
106
|
+
return segments;
|
|
107
|
+
}
|
|
108
|
+
/** The tokens of a segment, each quoted string given as its content with its quoted pairs read. */
|
|
109
|
+
function tokensOf(segment) {
|
|
110
|
+
const tokens = [];
|
|
111
|
+
for (const [token] of segment.matchAll(TOKEN)) {
|
|
112
|
+
if (token === '=')
|
|
113
|
+
tokens.push(null);
|
|
114
|
+
else if (token.startsWith('"'))
|
|
115
|
+
tokens.push(token.replace(/^"|"$/g, '').replace(/\\(.)/g, '$1'));
|
|
116
|
+
else
|
|
117
|
+
tokens.push(token);
|
|
118
|
+
}
|
|
119
|
+
return tokens;
|
|
120
|
+
}
|
|
121
|
+
/** Each `name=value` the tokens hold, in order; a stray `=` or a word with no value is passed over. */
|
|
122
|
+
function pairsOf(tokens) {
|
|
123
|
+
const pairs = [];
|
|
124
|
+
let index = 0;
|
|
125
|
+
while (index + 2 < tokens.length) {
|
|
126
|
+
const name = tokens[index];
|
|
127
|
+
const value = tokens[index + 2];
|
|
128
|
+
if (typeof name === 'string' && tokens[index + 1] === null && typeof value === 'string') {
|
|
129
|
+
pairs.push([name, value]);
|
|
130
|
+
index += 3;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
index += 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return pairs;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* One Authentication-Results field's authserv-id, in lowercase, and each result it records (RFC 8601 section 2.2). An
|
|
140
|
+
* authserv-id is a token or a quoted string (RFC 2045 section 5.1), and a bare `=` is part of neither, so a field whose
|
|
141
|
+
* text before its first semicolon holds one names no authserv-id, as Outlook writes the field: that text is its first
|
|
142
|
+
* result, and its authserv-id reads as the empty string, which names no host.
|
|
143
|
+
*/
|
|
144
|
+
function resultsOf(value) {
|
|
145
|
+
const [head = '', ...rest] = segmentsOf(withoutComments(value));
|
|
146
|
+
const headTokens = tokensOf(head);
|
|
147
|
+
const namesHost = !headTokens.includes(null);
|
|
148
|
+
const id = namesHost ? headTokens[0] : undefined;
|
|
149
|
+
const results = [];
|
|
150
|
+
for (const segment of namesHost ? rest : [head, ...rest]) {
|
|
151
|
+
const [first, ...properties] = pairsOf(tokensOf(segment));
|
|
152
|
+
if (first === undefined)
|
|
153
|
+
continue;
|
|
154
|
+
const named = new Map();
|
|
155
|
+
for (const [name, property] of properties) {
|
|
156
|
+
const key = name.toLowerCase();
|
|
157
|
+
if (!named.has(key))
|
|
158
|
+
named.set(key, property);
|
|
159
|
+
}
|
|
160
|
+
// A method may carry a version after a slash, such as dkim/1.
|
|
161
|
+
results.push({ method: first[0].toLowerCase().replace(/\/.*$/, ''), result: first[1].toLowerCase(), properties: named });
|
|
162
|
+
}
|
|
163
|
+
return { authServId: typeof id === 'string' ? id.toLowerCase() : '', results };
|
|
164
|
+
}
|
|
165
|
+
/** The domain `text` names, in lowercase without a closing dot: all of it, or what follows its last `@`. */
|
|
166
|
+
function domainOf(text) {
|
|
167
|
+
if (text === undefined)
|
|
168
|
+
return undefined;
|
|
169
|
+
const domain = text
|
|
170
|
+
.slice(text.lastIndexOf('@') + 1)
|
|
171
|
+
.trim()
|
|
172
|
+
.toLowerCase()
|
|
173
|
+
.replace(/\.$/, '');
|
|
174
|
+
return DOMAIN.test(domain) ? domain : undefined;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The results of a header block's topmost Authentication-Results field: the receiving host's, since each host that
|
|
178
|
+
* checks a message adds its field at the top (RFC 8601 sections 2.1 and 4), so a field a sender wrote sits below it.
|
|
179
|
+
* Given `authServId`, that field counts only when it names that host, and no field below it ever counts, so a field a
|
|
180
|
+
* sender wrote naming that host is never read in place of a topmost field that names another host or none.
|
|
181
|
+
*/
|
|
182
|
+
function authenticationOf(fields, options) {
|
|
183
|
+
const wanted = requireAuthServId(options.authServId);
|
|
184
|
+
const topmost = fields.find(([name]) => name.toLowerCase() === 'authentication-results');
|
|
185
|
+
const field = topmost === undefined ? undefined : resultsOf(topmost[1]);
|
|
186
|
+
const results = field !== undefined && (wanted === undefined || field.authServId === wanted) ? field.results : [];
|
|
187
|
+
const dkim = results.filter((entry) => entry.method === 'dkim');
|
|
188
|
+
const spf = results.find((entry) => entry.method === 'spf');
|
|
189
|
+
const dmarc = results.find((entry) => entry.method === 'dmarc');
|
|
190
|
+
const passing = dkim.filter((entry) => entry.result === 'pass');
|
|
191
|
+
const dmarcFrom = domainOf(dmarc?.properties.get('header.from'));
|
|
192
|
+
// A From given that names no domain aligns with none; the DMARC result's domain stands in only for a From not given.
|
|
193
|
+
const fromDomain = options.from === undefined ? dmarcFrom : domainOf(options.from);
|
|
194
|
+
const aligned = fromDomain !== undefined &&
|
|
195
|
+
passing.some((entry) => {
|
|
196
|
+
const signing = domainOf(entry.properties.get('header.d')) ?? domainOf(entry.properties.get('header.i'));
|
|
197
|
+
return signing !== undefined && (signing === fromDomain || fromDomain.endsWith(`.${signing}`));
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
dkim: passing.length > 0 ? 'pass' : (dkim[0]?.result ?? 'none'),
|
|
201
|
+
spf: spf?.result ?? 'none',
|
|
202
|
+
dmarc: dmarc?.result ?? 'none',
|
|
203
|
+
dmarcFrom: dmarcFrom ?? 'none',
|
|
204
|
+
alignedDomain: aligned && fromDomain !== undefined ? fromDomain : 'none',
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/** The keyword a field such as Auto-Submitted gives, in lowercase: its text before any parameter, comments left out. */
|
|
208
|
+
function keywordOf(value) {
|
|
209
|
+
const [keyword = ''] = withoutComments(value).split(';');
|
|
210
|
+
return keyword.trim().toLowerCase();
|
|
211
|
+
}
|
|
212
|
+
/** A character a local part holds only in quotes (RFC 5322 section 3.2.3): white space or a special other than the dot. */
|
|
213
|
+
const QUOTED_ONLY = /[\s"(),:;<>@[\]\\]/;
|
|
214
|
+
/** A local part written in quotes: a double quote, text and quoted pairs, a double quote. */
|
|
215
|
+
const QUOTED_LOCAL = /^"(?:[^"\\]|\\.)*"$/;
|
|
216
|
+
/**
|
|
217
|
+
* An address as a read gives it, in lowercase, or `undefined` when it names no local part or a domain with white space
|
|
218
|
+
* in it: its local part in quotes, as RFC 5322 writes it, only when it holds white space, a double quote or another
|
|
219
|
+
* special but the dot, and else bare. A server gives an envelope's local part with its quoting removed (RFC 3501 section
|
|
220
|
+
* 9, `addr-mailbox`), and a Delivered-To field keeps it as written, so `support team@example.com` from an envelope and
|
|
221
|
+
* `"Support Team"@example.com` from a field both read `"support team"@example.com`, and `"bob"@example.com` reads
|
|
222
|
+
* `bob@example.com`.
|
|
223
|
+
*
|
|
224
|
+
* @param text An address, alone.
|
|
225
|
+
*/
|
|
226
|
+
function addressOf(text) {
|
|
227
|
+
const address = text.trim().toLowerCase();
|
|
228
|
+
const at = address.lastIndexOf('@');
|
|
229
|
+
if (at <= 0 || at === address.length - 1)
|
|
230
|
+
return undefined;
|
|
231
|
+
const written = address.slice(0, at);
|
|
232
|
+
const domain = address.slice(at + 1);
|
|
233
|
+
if (/\s/.test(domain))
|
|
234
|
+
return undefined;
|
|
235
|
+
// A quoted local part is read as the text it quotes, so that each address has one form whichever way it came.
|
|
236
|
+
const local = QUOTED_LOCAL.test(written) ? written.slice(1, -1).replace(/\\(.)/g, '$1') : written;
|
|
237
|
+
if (local !== '' && !QUOTED_ONLY.test(local))
|
|
238
|
+
return `${local}@${domain}`;
|
|
239
|
+
return `"${local.replace(/["\\]/g, (character) => `\\${character}`)}"@${domain}`;
|
|
240
|
+
}
|
|
241
|
+
/** The address a Delivered-To field names, as `addressOf` gives it, or `undefined` when it names none. */
|
|
242
|
+
function addressIn(value) {
|
|
243
|
+
const text = withoutComments(value);
|
|
244
|
+
const angle = /<([^<>]*)>/.exec(text);
|
|
245
|
+
return addressOf(angle === null ? text : (angle[1] ?? ''));
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The DKIM, SPF and DMARC results, the domain the DMARC result names and the aligned domain a header block's topmost
|
|
249
|
+
* Authentication-Results field records, the receiving host's: given `authServId`, that field counts only when it names
|
|
250
|
+
* that host, and no field below it ever counts. A field that names no authserv-id, as Outlook writes it, is read from
|
|
251
|
+
* its first result and names no host. A result the field does not record, and a header with no field that counts, reads
|
|
252
|
+
* `none`. Comments are left out, so a semicolon inside one splits nothing, and a folded field is read whole. An
|
|
253
|
+
* `authServId` that is not text, holds a control character or is white space alone throws an `Error`.
|
|
254
|
+
*
|
|
255
|
+
* @param headerBlock The message's header block, or the fields of it a read fetched, in the header's order.
|
|
256
|
+
* @param options The From address to align with and the receiving host's authserv-id.
|
|
257
|
+
*/
|
|
258
|
+
function parseAuthenticationResults(headerBlock, options = {}) {
|
|
259
|
+
return authenticationOf((0, messageHeaders_js_1.unfoldedFields)(headerBlock), options);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* What a header block says beside the envelope: its Delivered-To addresses, its threading ids, the fields that mark a
|
|
263
|
+
* message a machine sent, and its Authentication-Results as `parseAuthenticationResults` reads them.
|
|
264
|
+
*
|
|
265
|
+
* @param headerBlock The message's header block, or the fields of it a read fetched, in the header's order.
|
|
266
|
+
* @param options The From address to align with and the receiving host's authserv-id.
|
|
267
|
+
*/
|
|
268
|
+
function readHeaderFields(headerBlock, options = {}) {
|
|
269
|
+
const fields = (0, messageHeaders_js_1.unfoldedFields)(headerBlock);
|
|
270
|
+
const valuesOf = (name) => fields.filter(([field]) => field.toLowerCase() === name).map(([, value]) => value);
|
|
271
|
+
const [autoSubmitted] = valuesOf('auto-submitted');
|
|
272
|
+
const [precedence] = valuesOf('precedence');
|
|
273
|
+
return {
|
|
274
|
+
deliveredTo: valuesOf('delivered-to')
|
|
275
|
+
.map((value) => addressIn(value))
|
|
276
|
+
.filter((address) => address !== undefined),
|
|
277
|
+
inReplyTo: (0, messageHeaders_js_1.idsOf)(fields, 'in-reply-to')[0] ?? '',
|
|
278
|
+
references: (0, messageHeaders_js_1.idsOf)(fields, 'references'),
|
|
279
|
+
autoSubmitted: autoSubmitted === undefined ? 'no' : keywordOf(autoSubmitted),
|
|
280
|
+
precedence: precedence === undefined ? '' : keywordOf(precedence),
|
|
281
|
+
autoreply: fields.some(([field]) => ['x-autoreply', 'x-auto-response-suppress'].includes(field.toLowerCase())),
|
|
282
|
+
authentication: authenticationOf(fields, options),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
//# sourceMappingURL=headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../src/headers.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAuGH,8CAIC;AA6LD,8BAWC;AAoBD,gEAEC;AASD,4CAgBC;AAhWD,2DAA4D;AAqF5D,gHAAgH;AAChH,MAAM,KAAK,GAAG,gCAAgC,CAAC;AAE/C,wGAAwG;AACxG,MAAM,MAAM,GAAG,2BAA2B,CAAC;AAE3C,uDAAuD;AACvD,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAElC;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,UAAmB;IACnD,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC3F,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACpI,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;AACxG,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,M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AC,CAAC,IAAI,EAAE;QAChD,UAAU,EAAE,IAAA,yBAAK,EAAC,MAAM,EAAE,YAAY,CAAC;QACvC,aAAa,EAAE,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC;QAC5E,UAAU,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC;QACjE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;QAC9G,cAAc,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,13 @@ export interface EmailChannelOptions {
|
|
|
20
20
|
imapPassword?: string;
|
|
21
21
|
imapPort?: number;
|
|
22
22
|
imapSecure?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The authserv-id of the host that takes mail into the mailbox the pack reads, such as `mx.google.com`: the
|
|
25
|
+
* `authServId` of a read that names none, and the one the `emailRead` and `emailSearch` tools read under; without it
|
|
26
|
+
* those tools leave `authentication` out of their answers. Falls back to the secret `email.authServId`, then to
|
|
27
|
+
* `EMAIL_AUTH_SERV_ID`; `null` and the empty string at any of them count as none given, so the next one counts.
|
|
28
|
+
*/
|
|
29
|
+
authServId?: string;
|
|
23
30
|
/**
|
|
24
31
|
* Resend's API key. With no SMTP host, mail is sent through Resend's HTTPS API. Falls back to the secret
|
|
25
32
|
* `email.resendApiKey`, then to `RESEND_API_KEY`.
|
|
@@ -51,8 +58,10 @@ export interface ExtensionPack {
|
|
|
51
58
|
onDeactivate?: () => Promise<void>;
|
|
52
59
|
}
|
|
53
60
|
export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
|
|
54
|
-
export { EmailService } from './EmailService.js';
|
|
55
|
-
export type { EmailConfig, SendEmailOptions, EmailMessage, SearchEmailOptions } from './EmailService.js';
|
|
61
|
+
export { EmailService, EmailMailboxError } from './EmailService.js';
|
|
62
|
+
export type { EmailConfig, SendEmailOptions, EmailMessage, EmailAttachment, SearchEmailOptions, ReadOptions, ReadInboxOptions, MailboxOptions, EmailMailboxErrorCode, } from './EmailService.js';
|
|
63
|
+
export { parseAuthenticationResults, readHeaderFields } from './headers.js';
|
|
64
|
+
export type { EmailAuthentication, HeaderFieldOptions, HeaderFields } from './headers.js';
|
|
56
65
|
export { ResendTransport, EmailApiError, retryWaitSeconds } from './ResendTransport.js';
|
|
57
66
|
export type { ResendOptions, OutgoingEmail, OutgoingAttachment } from './ResendTransport.js';
|
|
58
67
|
export { EmailChannelAdapter } from './EmailChannelAdapter.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAeH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAC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AA+B,EAC/B,cAAc,EACd,6BAA6B,EAC7B,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @module @framers/agentos-ext-channel-email
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.suppressionStoreDdl = exports.recipientCapabilityDdl = exports.emailPreferencesDdl = exports.SqlSuppressionStore = exports.SqlRecipientCapability = exports.SUPPRESSION_REASONS = exports.DEFAULT_SUPPRESSION_SCOPE = exports.EmailReplyTool = exports.EmailExtractCodesTool = exports.EmailSearchTool = exports.EmailReadTool = exports.EmailSendTool = exports.EmailChannelAdapter = exports.retryWaitSeconds = exports.EmailApiError = exports.ResendTransport = exports.EmailService = void 0;
|
|
15
|
+
exports.suppressionStoreDdl = exports.recipientCapabilityDdl = exports.emailPreferencesDdl = exports.SqlSuppressionStore = exports.SqlRecipientCapability = exports.SUPPRESSION_REASONS = exports.DEFAULT_SUPPRESSION_SCOPE = exports.EmailReplyTool = exports.EmailExtractCodesTool = exports.EmailSearchTool = exports.EmailReadTool = exports.EmailSendTool = exports.EmailChannelAdapter = exports.retryWaitSeconds = exports.EmailApiError = exports.ResendTransport = exports.readHeaderFields = exports.parseAuthenticationResults = exports.EmailMailboxError = exports.EmailService = void 0;
|
|
16
16
|
exports.createExtensionPack = createExtensionPack;
|
|
17
17
|
const EmailService_js_1 = require("./EmailService.js");
|
|
18
18
|
const EmailChannelAdapter_js_1 = require("./EmailChannelAdapter.js");
|
|
@@ -60,6 +60,8 @@ function resolveConfig(opts, secrets) {
|
|
|
60
60
|
secrets['email.imap.password'] ??
|
|
61
61
|
process.env.IMAP_PASSWORD ??
|
|
62
62
|
process.env.EMAIL_IMAP_PASSWORD;
|
|
63
|
+
// The first source that gives one: an empty value counts as none given, so the source after it counts.
|
|
64
|
+
const authServId = [opts.authServId, secrets['email.authServId'], process.env.EMAIL_AUTH_SERV_ID].find((value) => value !== undefined && value !== null && value !== '');
|
|
63
65
|
// SMTP stays the transport whenever a host is given; Resend sends only when a key is given and no SMTP host.
|
|
64
66
|
const config = smtpHost === '' && resendApiKey
|
|
65
67
|
? { resend: { apiKey: resendApiKey, baseUrl: opts.resendBaseUrl }, from }
|
|
@@ -82,11 +84,20 @@ function resolveConfig(opts, secrets) {
|
|
|
82
84
|
secure: opts.imapSecure,
|
|
83
85
|
};
|
|
84
86
|
}
|
|
87
|
+
// The service checks it, and throws for one that names no host.
|
|
88
|
+
if (authServId !== undefined)
|
|
89
|
+
config.authServId = authServId;
|
|
85
90
|
return config;
|
|
86
91
|
}
|
|
87
92
|
// ---------------------------------------------------------------------------
|
|
88
93
|
// Factory
|
|
89
94
|
// ---------------------------------------------------------------------------
|
|
95
|
+
/**
|
|
96
|
+
* The version of the package this pack ships in, read from its `package.json`, which sits one folder above both `src`
|
|
97
|
+
* and the built `dist` and which every published tarball carries. The pack builds as CommonJS, where `require` reads a
|
|
98
|
+
* JSON file.
|
|
99
|
+
*/
|
|
100
|
+
const PACKAGE_VERSION = require('../package.json').version;
|
|
90
101
|
function createExtensionPack(context) {
|
|
91
102
|
const opts = (context.options ?? {});
|
|
92
103
|
const secrets = opts.secrets ?? context.secrets ?? {};
|
|
@@ -100,7 +111,7 @@ function createExtensionPack(context) {
|
|
|
100
111
|
const replyTool = new reply_js_1.EmailReplyTool(service);
|
|
101
112
|
return {
|
|
102
113
|
name: '@framers/agentos-ext-channel-email',
|
|
103
|
-
version:
|
|
114
|
+
version: PACKAGE_VERSION,
|
|
104
115
|
descriptors: [
|
|
105
116
|
{ id: 'emailSend', kind: 'tool', priority: 50, payload: sendTool },
|
|
106
117
|
{ id: 'emailRead', kind: 'tool', priority: 50, payload: readTool },
|
|
@@ -122,6 +133,10 @@ function createExtensionPack(context) {
|
|
|
122
133
|
// ---------------------------------------------------------------------------
|
|
123
134
|
var EmailService_js_2 = require("./EmailService.js");
|
|
124
135
|
Object.defineProperty(exports, "EmailService", { enumerable: true, get: function () { return EmailService_js_2.EmailService; } });
|
|
136
|
+
Object.defineProperty(exports, "EmailMailboxError", { enumerable: true, get: function () { return EmailService_js_2.EmailMailboxError; } });
|
|
137
|
+
var headers_js_1 = require("./headers.js");
|
|
138
|
+
Object.defineProperty(exports, "parseAuthenticationResults", { enumerable: true, get: function () { return headers_js_1.parseAuthenticationResults; } });
|
|
139
|
+
Object.defineProperty(exports, "readHeaderFields", { enumerable: true, get: function () { return headers_js_1.readHeaderFields; } });
|
|
125
140
|
var ResendTransport_js_1 = require("./ResendTransport.js");
|
|
126
141
|
Object.defineProperty(exports, "ResendTransport", { enumerable: true, get: function () { return ResendTransport_js_1.ResendTransport; } });
|
|
127
142
|
Object.defineProperty(exports, "EmailApiError", { enumerable: true, get: function () { return ResendTransport_js_1.EmailApiError; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;;;;GAUG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;;;;GAUG;;;AA8JH,kDAgCC;AA5LD,uDAAiD;AAEjD,qEAA+D;AAC/D,6CAAgD;AAChD,6CAAgD;AAChD,iDAAoD;AACpD,6DAAgE;AAChE,+CAAkD;AAuClD,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,SAAS,aAAa,CAAC,IAAyB,EAAE,OAA+B;IAC/E,MAAM,QAAQ,GACZ,IAAI,CAAC,QAAQ;QACb,OAAO,CAAC,gBAAgB,CAAC;QACzB,OAAO,CAAC,iBAAiB,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,SAAS;QACrB,OAAO,CAAC,GAAG,CAAC,eAAe;QAC3B,EAAE,CAAC;IACL,MAAM,QAAQ,GACZ,IAAI,CAA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|
* @param text The text of the message's Message-ID field.
|
|
58
58
|
*/
|
|
59
59
|
export declare function messageIdIn(text: unknown): string | undefined;
|
|
60
|
+
/** A header block's fields, unfolded (RFC 5322 section 2.2.3): each name, trimmed, with its value, to the blank line that ends the block. */
|
|
61
|
+
export declare function unfoldedFields(block: string): Array<[string, string]>;
|
|
62
|
+
/**
|
|
63
|
+
* The message ids the first field named `name` lists, any white space within an id dropped, as a fold inside one leaves
|
|
64
|
+
* it and as nodemailer reads it. An id that holds a character outside printable US-ASCII, or that is too long for one
|
|
65
|
+
* line of `References`, is left out.
|
|
66
|
+
*/
|
|
67
|
+
export declare function idsOf(fields: Array<[string, string]>, name: string): string[];
|
|
60
68
|
/**
|
|
61
69
|
* The message ids a reply's `References` lists before its original's own id, read from the original's header block as
|
|
62
70
|
* RFC 5322 section 3.6.4 has it: the ids of the original's `References`, or, when that lists none, the id of its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageHeaders.d.ts","sourceRoot":"","sources":["../src/messageHeaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuHH;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAExF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOrD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI7D;
|
|
1
|
+
{"version":3,"file":"messageHeaders.d.ts","sourceRoot":"","sources":["../src/messageHeaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuHH;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAEnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAExF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI9D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOrD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI7D;AAED,6IAA6I;AAC7I,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAarE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAM7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAMtD"}
|
package/dist/messageHeaders.js
CHANGED
|
@@ -16,6 +16,8 @@ exports.requireAddedHeaders = requireAddedHeaders;
|
|
|
16
16
|
exports.oneMessageId = oneMessageId;
|
|
17
17
|
exports.requireMessageId = requireMessageId;
|
|
18
18
|
exports.messageIdIn = messageIdIn;
|
|
19
|
+
exports.unfoldedFields = unfoldedFields;
|
|
20
|
+
exports.idsOf = idsOf;
|
|
19
21
|
exports.threadOf = threadOf;
|
|
20
22
|
/** RFC 5322 section 2.1.1: the most characters a line of a message may hold, its CRLF aside. */
|
|
21
23
|
const LONGEST_LINE = 998;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageHeaders.js","sourceRoot":"","sources":["../src/messageHeaders.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAoIH,wCAEC;AAWD,kDAEC;AASD,oCAIC;AAUD,4CAOC;AAQD,kCAIC;
|
|
1
|
+
{"version":3,"file":"messageHeaders.js","sourceRoot":"","sources":["../src/messageHeaders.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAoIH,wCAEC;AAWD,kDAEC;AASD,oCAIC;AAUD,4CAOC;AAQD,kCAIC;AAGD,wCAaC;AAOD,sBAMC;AAYD,4BAMC;AA1OD,gGAAgG;AAChG,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,6GAA6G;AAC7G,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,cAAc,GAAG,2CAA2C,CAAC;AAEnE,oCAAoC;AACpC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAExC,uDAAuD;AACvD,MAAM,KAAK,GAAG,UAAU,CAAC;AAEzB,oFAAoF;AACpF,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAEnD,0EAA0E;AAC1E,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B;;;GAGG;AACH,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAEnD,iGAAiG;AACjG,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAEtC,uFAAuF;AACvF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,E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EAAE,CAAC,IAAI,WAAW,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CAAC,WAAmB;IAC1C,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC/C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,UAAU,CAAC;IAC7C,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC/C,OAAO,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -51,8 +51,9 @@ export interface RecipientCapability {
|
|
|
51
51
|
* never issued again; a token issued afterwards from a new nonce works.
|
|
52
52
|
*
|
|
53
53
|
* @param recipient The recipient: 1 to 512 UTF-16 code units, with no U+0000 and no lone surrogate.
|
|
54
|
-
* @returns How many tokens it
|
|
55
|
-
*
|
|
54
|
+
* @returns How many tokens it marked: each of the recipient's tokens not revoked before, one past its expiry among
|
|
55
|
+
* them, so a token ended by an earlier revoke is not counted again; and 0 whatever it marked when the database's
|
|
56
|
+
* `run` answers no count of `changes`.
|
|
56
57
|
*/
|
|
57
58
|
revoke(recipient: string): Promise<number>;
|
|
58
59
|
}
|