@framers/agentos-ext-channel-email 0.4.2 → 0.4.3
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 +16 -6
- package/dist/EmailService.d.ts +38 -1
- package/dist/EmailService.d.ts.map +1 -1
- package/dist/EmailService.js +55 -42
- package/dist/EmailService.js.map +1 -1
- package/dist/preferences/RecipientCapability.d.ts +14 -9
- package/dist/preferences/RecipientCapability.d.ts.map +1 -1
- package/dist/preferences/RecipientCapability.js +10 -8
- package/dist/preferences/RecipientCapability.js.map +1 -1
- package/dist/preferences/SuppressionStore.d.ts +23 -15
- package/dist/preferences/SuppressionStore.d.ts.map +1 -1
- package/dist/preferences/SuppressionStore.js +20 -12
- package/dist/preferences/SuppressionStore.js.map +1 -1
- package/dist/preferences/database.d.ts +20 -4
- package/dist/preferences/database.d.ts.map +1 -1
- package/dist/preferences/database.js +26 -6
- package/dist/preferences/database.js.map +1 -1
- package/dist/preferences/index.d.ts +2 -1
- package/dist/preferences/index.d.ts.map +1 -1
- package/dist/preferences/index.js +2 -1
- package/dist/preferences/index.js.map +1 -1
- package/dist/reads.d.ts +69 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +167 -0
- package/dist/reads.js.map +1 -0
- package/dist/tools/extractCodes.d.ts +5 -0
- package/dist/tools/extractCodes.d.ts.map +1 -1
- package/dist/tools/extractCodes.js +9 -1
- package/dist/tools/extractCodes.js.map +1 -1
- package/dist/tools/read.d.ts +5 -0
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +5 -1
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/search.d.ts +4 -0
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +8 -1
- package/dist/tools/search.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ The subject goes out on one line through both transports: each line break in it,
|
|
|
95
95
|
|
|
96
96
|
## Suppressions and unsubscribe tokens
|
|
97
97
|
|
|
98
|
-
Two stores a sender reads, each on the host's SQL database: `SqlSuppressionStore` keeps the addresses not to mail, each named by its SHA-256, and `SqlRecipientCapability` keeps opaque tokens, such as an unsubscribe link's, each naming a recipient and a scope. Both take [`@framers/sql-storage-adapter`](https://www.npmjs.com/package/@framers/sql-storage-adapter)'s adapter on SQLite or PostgreSQL, or any handle with its `run` and `get` (`?` placeholders, positional parameters), so the pack gains no dependency.
|
|
98
|
+
Two stores a sender reads, each on the host's SQL database: `SqlSuppressionStore` keeps the addresses not to mail, each named by a hash of it, such as its SHA-256, and `SqlRecipientCapability` keeps opaque tokens, such as an unsubscribe link's, each naming a recipient and a scope. Both take [`@framers/sql-storage-adapter`](https://www.npmjs.com/package/@framers/sql-storage-adapter)'s adapter on SQLite or PostgreSQL, or any handle with its `run` and `get` (`?` placeholders, positional parameters), so the pack gains no dependency. A handle's `run` answers `changes`, the rows the statement wrote. A handle whose answer holds no such count, because it leaves `changes` out or gives something other than a whole number of 0 or more (the adapter's Capacitor handle gave an object before 0.6.14), still records, issues and revokes, but `suppress` then answers `false` and `revoke` 0, whatever they wrote.
|
|
99
99
|
|
|
100
100
|
```ts
|
|
101
101
|
import { createHash } from 'node:crypto';
|
|
@@ -125,11 +125,11 @@ const link = `https://example.com/unsubscribe?t=${token}`;
|
|
|
125
125
|
const grant = await tokens.find(token); // { recipient: 'account-1', scope: 'weekly-summary' }, or null
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
`suppress(scope, addressHash, reason, day)` records an address in a scope with its reason and its day (`YYYY-MM-DD`), and no end: the store has no call that lifts an address, so an operator lifts one by deleting its row (
|
|
128
|
+
`suppress(scope, addressHash, reason, day)` records an address in a scope with its reason and its day (`YYYY-MM-DD`), and no end: the store has no call that lifts an address, so an operator lifts one by deleting its row through the same handle, as in `await db.run('DELETE FROM mail_suppressions WHERE scope = ? AND address_hash = ?', [DEFAULT_SUPPRESSION_SCOPE, addressHash])` for the example's prefix `mail`. The `?` placeholders are the adapter's, which binds the values given and on PostgreSQL writes `$1` and `$2` in their place. In a console, write the scope and the hash as quoted literals instead: PostgreSQL reads a `?` as an operator and refuses the statement, and the sqlite3 shell binds a `?` to NULL, so the statement deletes nothing. The reason is `bounce`, `complaint`, `suppressed` (the provider refused a message because its own list held the address) or `manual`. A second record of the address in the scope writes nothing and keeps the first, so a provider's repeated event is harmless; `suppress` answers `true` only for the call that recorded it, and two hosts recording one address at once leave one row. `isSuppressed(scope, addressHash)` answers for one scope. A scope is one list, and a host that keeps one passes `DEFAULT_SUPPRESSION_SCOPE` (`mail`) everywhere. `addressHash` is the address's hash as 64 lower-case hexadecimal characters, such as its SHA-256, which the host computes the same way wherever it reads or writes the record. Any other value, an address among them, throws a `TypeError` that holds none of it, so a mistake stores nothing and is never answered as not suppressed. The store takes any 64 lower-case hexadecimal characters, so the host chooses the hash. A plain SHA-256, as in the example, lets anyone who holds the table check an address they guess against it; a host that wants the table to tell nothing of an address it does not already hold computes HMAC-SHA256 under a secret key of its own instead, the same way at every reader and writer. `SUPPRESSION_REASONS` lists the four reasons, and it is frozen, since `suppress` checks a reason against it.
|
|
129
129
|
|
|
130
|
-
`issue(recipient, scope, nonce, key)` answers base64url of HMAC-SHA256 over the nonce under the key, 43 characters, and stores the token's SHA-256 beside the recipient and the scope: the token carries neither, and the table holds nothing it can be recovered from. The same nonce under the same key gives the same token, so each message takes a nonce of its own, such as its id. Issuing it again for the same recipient, scope and expiry writes nothing; for another recipient, scope or expiry it throws, and the first token keeps all three. The key is 32 bytes or more, given as bytes; a different key gives different tokens for the same nonces. `find(token)` answers the recipient and the scope, or `null` for a token that is malformed, unknown, revoked or past its expiry: it looks the token up by its SHA-256 and compares in constant time. `revoke(recipient)` ends every token of the recipient, in every scope, and answers how many it ended. Each revoked row stays, marked with the time of the revoke, so `issue` refuses a revoked token's nonce for every recipient, scope and expiry: a revoked link never works again and never comes to name someone else. A message that needs a working token after a revoke takes a new nonce, and the token it gets works. A token has no expiry unless `issue`'s options set `expiresAt`, in epoch milliseconds.
|
|
130
|
+
`issue(recipient, scope, nonce, key)` answers base64url of HMAC-SHA256 over the nonce under the key, 43 characters, and stores the token's SHA-256 beside the recipient and the scope: the token carries neither, and the table holds nothing it can be recovered from. The same nonce under the same key gives the same token, so each message takes a nonce of its own, such as its id. Issuing it again for the same recipient, scope and expiry writes nothing; for another recipient, scope or expiry it throws, and the first token keeps all three. The key is 32 random bytes or more, given as bytes and kept secret, such as `crypto.randomBytes(32)` stored with the host's other secrets; the store cannot judge how random a key is. A different key gives different tokens for the same nonces, and the same key the same tokens, whatever the prefix: the prefix keeps two hosts' tables apart, not their tokens. Two hosts on one database that share a key and use one nonce draw one token, and each one's `find` answers its own row for it, so a link one host sent could act on the other host's recipient. Each host takes a key of its own, or nonces no other host uses, such as its own name before each message id. `find(token)` answers the recipient and the scope, or `null` for a token that is malformed, unknown, revoked or past its expiry: it looks the token up by its SHA-256 and compares in constant time. `revoke(recipient)` ends every token of the recipient, in every scope, and answers how many it ended. Each revoked row stays, marked with the time of the revoke, so `issue` refuses a revoked token's nonce for every recipient, scope and expiry: a revoked link never works again and never comes to name someone else. A message that needs a working token after a revoke takes a new nonce, and the token it gets works. A token has no expiry unless `issue`'s options set `expiresAt`, in epoch milliseconds.
|
|
131
131
|
|
|
132
|
-
`suppressionStoreDdl(prefix)` makes the table `<prefix>_suppressions` (`scope`, `address_hash`, `reason`, `suppressed_on`), `recipientCapabilityDdl(prefix)` makes `<prefix>_capabilities` (`token_hash`, `recipient`, `scope`, `expires_at`, `revoked_at`) with its index on the recipient, and `emailPreferencesDdl(prefix)` makes both. The prefix is a lower-case letter and at most 39 lower-case letters, digits or underscores, and
|
|
132
|
+
`suppressionStoreDdl(prefix)` makes the table `<prefix>_suppressions` (`scope`, `address_hash`, `reason`, `suppressed_on`), `recipientCapabilityDdl(prefix)` makes `<prefix>_capabilities` (`token_hash`, `recipient`, `scope`, `expires_at`, `revoked_at`) with its index on the recipient, and `emailPreferencesDdl(prefix)` makes both. The prefix is a lower-case letter and at most 39 lower-case letters, digits or underscores, other than `sqlite` and a prefix beginning `sqlite_`, whose tables would begin `sqlite_`: SQLite keeps those names for its own tables and refuses to create one ([CREATE TABLE](https://www.sqlite.org/lang_createtable.html)). A refused prefix throws a `RangeError` from the DDL functions and both constructors. The prefix keeps two hosts' tables apart on one database. The statements are `CREATE ... IF NOT EXISTS`, so a migration can run them again, and they run on SQLite and PostgreSQL, from one process at a time: PostgreSQL does not promise that two `CREATE TABLE IF NOT EXISTS` of one new table at once both succeed, and one of them can fail on a duplicate key in `pg_type` (pgsql-hackers, 9 October 2018: [the report](https://www.postgresql.org/message-id/93336f06-86c2-71b6-abe3-0d42cc614b2b%40postgrespro.ru) and [the reply](https://www.postgresql.org/message-id/22700.1539093909%40sss.pgh.pa.us)). A host whose processes start together runs them in a migration, such as the adapter's `runSchemaMigrations` (0.7.2 or later), which takes an advisory lock on PostgreSQL. A token's row refuses its nonce for as long as it stays, revoked or not. A host that deletes a recipient's rows, by its own foreign key with `ON DELETE CASCADE` or by hand, never issues their nonces again: each message's nonce is one no other message ever had, such as a random id or a row id that is never reused. A host that cannot promise that calls `revoke` with each deletion and keeps the rows. Each store checks every argument before its first statement. A scope, a recipient and a nonce are strings of 1 to 512 UTF-16 code units (JavaScript's `length`, in which a character past U+FFFF counts two) with no U+0000, which PostgreSQL's text refuses, and no lone surrogate, which UTF-8 cannot encode, so a driver would store something else in its place: any other value throws a `TypeError` that holds none of it, and a name is stored as given on every backend. A database error passes through as it was thrown. A store made on the handle that the adapter's `transaction` gives its callback writes inside that transaction. On a server, open the database as the example does, with the adapter's `strict` option (0.6.15 or later): without it, a `url` that is unset opens a local SQLite database in its place, and the record a sender reads before each send would live there.
|
|
133
133
|
|
|
134
134
|
## Errors and retries
|
|
135
135
|
|
|
@@ -149,10 +149,18 @@ The wait is the answer's `retry-after` when it has one, else as many seconds as
|
|
|
149
149
|
|
|
150
150
|
`readInbox`, `searchEmails`, `extractCodes` and `replyToEmail` read through IMAP: the `imap` account (`host`, `user` and `password`, with `port` and `secure`, by default TLS on port 993), or the SMTP account when `imap` is not given. With Resend, reading needs `imap`. The pack's factory reads the account from the secrets `email.imap.host`, `email.imap.user` and `email.imap.password`, or from `IMAP_HOST`, `IMAP_USER` and `IMAP_PASSWORD`.
|
|
151
151
|
|
|
152
|
-
`searchEmails` finds the messages whose subject, body or From holds `query`, ignoring case, and gives the last `limit` it finds (20 by default), newest first. Each search answers UIDs, and the messages are fetched by those UIDs, which need not follow the messages' sequence numbers once a message has been removed ([RFC 3501 section 2.3.1.1](https://www.rfc-editor.org/rfc/rfc3501#section-2.3.1.1)).
|
|
152
|
+
`readInbox(folder?, limit?)` gives the last `limit` messages of `folder`, newest first: INBOX and 20 when they are not given. `searchEmails({ query, folder?, since?, limit? })` finds the messages whose subject, body or From holds `query`, ignoring case, received on or after the day `since` names when it is given, and gives the last `limit` it finds (20 by default), newest first. Each search answers UIDs, and the messages are fetched by those UIDs, which need not follow the messages' sequence numbers once a message has been removed ([RFC 3501 section 2.3.1.1](https://www.rfc-editor.org/rfc/rfc3501#section-2.3.1.1)).
|
|
153
|
+
|
|
154
|
+
`limit` is a whole number of at least 1. `since` is an ISO 8601 date, such as `2026-10-15`, alone or followed by a time and an offset, such as `2026-10-15T09:30:00-05:00`. The search finds the messages the server received on the day the date names, as written, or later, the time of day disregarded ([RFC 3501 section 6.4.4](https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4)), on every server: the time and the offset are checked, then disregarded, and imapflow is given the day as text, which it sends as `SINCE` and that day. Given a `Date`, imapflow would search a server that announces `WITHIN` from that moment, to the second ([RFC 5032 section 2](https://www.rfc-editor.org/rfc/rfc5032#section-2)), and any other server from its day in UTC.
|
|
155
|
+
|
|
156
|
+
`limit` and `since` count as not given when they are `undefined` or `null`, and `since` also when it is empty. Any other `limit` or `since` throws an `Error` before any mail is read: the fetch would otherwise name a message past the last one, which a server answers `BAD`, and imapflow leaves a date it cannot read out of the search, which then answers mail of every date. The refused `since` values include a number, text in another form such as `October 15, 2026`, which `Date` reads by guesswork and in the local time zone, and a day its month lacks such as `2026-02-30`, which `Date` reads as 2 March.
|
|
157
|
+
|
|
158
|
+
Each message read carries its `messageId`, the first address of its `from` and of its `to`, its `subject`, `date`, `body`, `flags` and `uid`. `date` is the message's Date field in ISO 8601, or the empty string when it has none or the field does not read as a date, so one such message never fails the read.
|
|
153
159
|
|
|
154
160
|
`extractCodes(messageId, pattern?)` and `replyToEmail(messageId, body, html?)` name an INBOX message by its Message-ID, with or without its angle brackets: `<id@example.com>` and `id@example.com` name the same message. An IMAP search matches every Message-ID that holds the text ([RFC 3501 section 6.4.4](https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4)), so each searches for the id in angle brackets and takes only the message whose own id is that one. `extractCodes` answers no codes for an id that is not one message id or that no message has.
|
|
155
161
|
|
|
162
|
+
`extractCodes` searches the message's plain part and its HTML part, each tag of the HTML (a `<`, at least one character, and the first `>` after it) written as a space, and answers each code once: the matches of `pattern` when it is given, else runs of four to eight digits, then the codes that phrases such as "code is", "OTP:", "is your" or "enter ... to" point to. `pattern` is a JavaScript regular expression, compiled with the `g` flag. A code is each match's first group, or the whole match when that group takes no part in it; an empty one is no code, and a match of empty text moves the search on by one character. A `pattern` that is `undefined`, `null` or empty counts as not given. One that is not a string, or that does not compile, throws an `Error` before any mail is read. The pattern runs over the message for at most 250 ms, timed by Node's `vm` module, which V8 honours at each step back a regular expression takes: one that runs longer, as a pattern that backtracks without end such as `(\d+)+$` can, throws an `Error` naming the limit. The limit holds however long the message, so a slow pattern over a very large message reaches it too. The `vm` module serves as a timer there, not as a sandbox: a regular expression runs no code of its own.
|
|
163
|
+
|
|
156
164
|
A reply goes out through the transport that sends:
|
|
157
165
|
|
|
158
166
|
- to the original's Reply-To, or its From when it names none ([RFC 5322 section 3.6.2](https://www.rfc-editor.org/rfc/rfc5322#section-3.6.2));
|
|
@@ -171,6 +179,8 @@ They send each attachment as they checked it: a copy of its own `filename`, `con
|
|
|
171
179
|
|
|
172
180
|
The subject, the bodies and the message id a reply names must be text. Through SMTP, nodemailer reads the file or fetches the address an object body names into the message, and writes an object subject or message id marked `prepared` into the headers as it is. So `sendEmail` and `replyToEmail`, whoever calls them, throw a `TypeError` that names the field, never its value, before anything is sent on either transport: `subject`, `body` and the reply's `messageId` must be strings, and `html` a string when given (`null` leaves the HTML part out). `emailSend` and `emailReply` answer it as `{ success: false, error }`, and the adapter throws it. A reply whose message id is not one message id, or names no message in INBOX, is answered and thrown the same way, with the `Error` [reading mail](#reading-mail) describes.
|
|
173
181
|
|
|
182
|
+
`emailRead`, `emailSearch` and `emailExtractCodes` answer a `limit`, a `since` or a `pattern` that [reading mail](#reading-mail) refuses as `{ success: false, error }`, before any mail is read, and a pattern that runs past its 250 ms the same way. `emailSearch` gives the last 20 messages it finds.
|
|
183
|
+
|
|
174
184
|
## API
|
|
175
185
|
|
|
176
186
|
| Export | What it is |
|
|
@@ -184,7 +194,7 @@ The subject, the bodies and the message id a reply names must be text. Through S
|
|
|
184
194
|
| `SqlSuppressionStore`, `suppressionStoreDdl(prefix)` | The suppression record on a SQL database, and its table's DDL |
|
|
185
195
|
| `SqlRecipientCapability`, `recipientCapabilityDdl(prefix)` | Recipient capabilities on a SQL database, and their table's DDL |
|
|
186
196
|
| `emailPreferencesDdl(prefix)` | Both tables' DDL |
|
|
187
|
-
| `DEFAULT_SUPPRESSION_SCOPE`, `SUPPRESSION_REASONS` | The scope of a host that keeps one list (`mail`), and the reasons an address is suppressed |
|
|
197
|
+
| `DEFAULT_SUPPRESSION_SCOPE`, `SUPPRESSION_REASONS` | The scope of a host that keeps one list (`mail`), and the reasons an address is suppressed, frozen |
|
|
188
198
|
| `EmailConfig`, `SendEmailOptions`, `EmailMessage`, `SearchEmailOptions`, `ResendOptions`, `OutgoingEmail`, `OutgoingAttachment`, `EmailChannelOptions`, `ExtensionContext`, `ExtensionPack` | The types of the configuration, the messages, the options and the pack |
|
|
189
199
|
| `SuppressionStore`, `SuppressionReason`, `RecipientCapability`, `RecipientGrant`, `RecipientCapabilityIssueOptions`, `SqlRecipientCapabilityOptions`, `EmailPreferencesDb` | The stores' interfaces, their answers and options, and what they need of a database |
|
|
190
200
|
|
package/dist/EmailService.d.ts
CHANGED
|
@@ -54,21 +54,39 @@ export interface SendEmailOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
headers?: Record<string, string>;
|
|
56
56
|
}
|
|
57
|
+
/** A message as `readInbox` and `searchEmails` give it. */
|
|
57
58
|
export interface EmailMessage {
|
|
59
|
+
/** Its Message-ID field as the server's envelope gives it, or the empty string when it has none. */
|
|
58
60
|
messageId: string;
|
|
61
|
+
/** The first address of its From, or the empty string. */
|
|
59
62
|
from: string;
|
|
63
|
+
/** The first address of its To, or the empty string. */
|
|
60
64
|
to: string;
|
|
61
65
|
subject: string;
|
|
66
|
+
/** Its Date field in ISO 8601, or the empty string when it has none or the field does not read as a date. */
|
|
62
67
|
date: string;
|
|
63
68
|
body: string;
|
|
64
69
|
html?: string;
|
|
65
70
|
flags: string[];
|
|
66
71
|
uid: number;
|
|
67
72
|
}
|
|
73
|
+
/** What `searchEmails` searches for. */
|
|
68
74
|
export interface SearchEmailOptions {
|
|
75
|
+
/** Text the subject, the body or the From holds, ignoring case; every message when empty. */
|
|
69
76
|
query: string;
|
|
77
|
+
/** The folder searched; INBOX when not given. */
|
|
70
78
|
folder?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The day to search from, as an ISO 8601 date such as `2026-10-15`, alone or followed by a time and an offset such as
|
|
81
|
+
* `2026-10-15T09:30:00-05:00`: messages the server received on the day the date names, as written, or later, the time
|
|
82
|
+
* and the offset disregarded, on every server. No bound when not given, `null` or empty. Any other value, a day its
|
|
83
|
+
* month lacks such as `2026-02-30` among them, throws an `Error` before the search.
|
|
84
|
+
*/
|
|
71
85
|
since?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The most messages given, a whole number of at least 1; 20 when not given or `null`. Any other value throws an `Error`
|
|
88
|
+
* before the search.
|
|
89
|
+
*/
|
|
72
90
|
limit?: number;
|
|
73
91
|
}
|
|
74
92
|
export declare class EmailService {
|
|
@@ -117,11 +135,24 @@ export declare class EmailService {
|
|
|
117
135
|
sendEmail(options: SendEmailOptions): Promise<{
|
|
118
136
|
messageId: string;
|
|
119
137
|
}>;
|
|
138
|
+
/**
|
|
139
|
+
* The last `limit` messages of `folder`, newest first: INBOX and 20 when they are not given, and 20 when `limit` is
|
|
140
|
+
* `null`. `limit` must be a whole number of at least 1: any other value throws an `Error` before any mail is read,
|
|
141
|
+
* where the fetch would name a message past the last one, which a server answers BAD. A message whose Date field does
|
|
142
|
+
* not read as a date is given with an empty `date`.
|
|
143
|
+
*/
|
|
120
144
|
readInbox(folder?: string, limit?: number): Promise<EmailMessage[]>;
|
|
121
145
|
/**
|
|
122
146
|
* The messages of `folder` (INBOX unless given) whose subject, body or From holds `query`, ignoring case, received on
|
|
123
147
|
* or after `since` when it is given: the last `limit` (20 unless given) the search finds, newest first. The search
|
|
124
148
|
* answers UIDs, and the messages are fetched by those UIDs, which need not follow the messages' sequence numbers.
|
|
149
|
+
*
|
|
150
|
+
* `limit` must be a whole number of at least 1, and `since` an ISO 8601 date, such as `2026-10-15`, alone or followed
|
|
151
|
+
* by a time and an offset, which are checked and then disregarded: the search starts from the day the date names, as
|
|
152
|
+
* written, on every server. Either counts as not given when `null`, and `since` when empty. Any other value of either,
|
|
153
|
+
* a day its month lacks such as `2026-02-30` among them, throws an `Error` before the search: imapflow leaves a date it
|
|
154
|
+
* cannot read out of the search, which would answer mail of every date, and `Date` rolls a day past its month's end
|
|
155
|
+
* over into the next month. A message whose Date field does not read as a date is given with an empty `date`.
|
|
125
156
|
*/
|
|
126
157
|
searchEmails(options: SearchEmailOptions): Promise<EmailMessage[]>;
|
|
127
158
|
/**
|
|
@@ -130,7 +161,13 @@ export declare class EmailService {
|
|
|
130
161
|
* is", "OTP:", "is your" or "enter ... to" point to, each once. The message is searched for by the id in angle brackets
|
|
131
162
|
* and fetched by the UID the search answers; a search matches every Message-ID that holds the text, so only the
|
|
132
163
|
* message whose own id is the one given counts. An id that is not one message id, or that no message has, gives no
|
|
133
|
-
* codes.
|
|
164
|
+
* codes. The text searched is the plain part and the HTML part, each tag of the HTML written as a space.
|
|
165
|
+
*
|
|
166
|
+
* `pattern` is a JavaScript regular expression, compiled with the `g` flag: each match's first group is a code, or the
|
|
167
|
+
* whole match when that group takes no part in it, and an empty one is none; a match of empty text moves the search
|
|
168
|
+
* on by one character. A pattern that is `null` or empty counts as not given. One that is not a string, or that does
|
|
169
|
+
* not compile, throws an `Error` before any mail is read. The pattern runs over the message for at most 250 ms, and
|
|
170
|
+
* one that runs longer, as one that backtracks without end such as `(\d+)+$` can, throws an `Error` naming that limit.
|
|
134
171
|
*/
|
|
135
172
|
extractCodes(messageId: string, pattern?: string): Promise<{
|
|
136
173
|
codes: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailService.d.ts","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailService.d.ts","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS1D,sGAAsG;AACtG,MAAM,WAAW,WAAW;IAC1B,0GAA0G;IAC1G,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,wFAAwF;IACxF,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,iIAAiI;IACjI,IAAI,CAAC,EAAE,MAAM,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Z,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;YAoEnB,aAAa;IAuB3B,OAAO,CAAC,gBAAgB;IAqCxB,OAAO,CAAC,eAAe;IA4BvB,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,cAAc;CAGvB"}
|
package/dist/EmailService.js
CHANGED
|
@@ -46,6 +46,7 @@ const imapflow_1 = require("imapflow");
|
|
|
46
46
|
const ResendTransport_js_1 = require("./ResendTransport.js");
|
|
47
47
|
const messageHeaders_js_1 = require("./messageHeaders.js");
|
|
48
48
|
const messageText_js_1 = require("./messageText.js");
|
|
49
|
+
const reads_js_1 = require("./reads.js");
|
|
49
50
|
// ---------------------------------------------------------------------------
|
|
50
51
|
// Helpers
|
|
51
52
|
// ---------------------------------------------------------------------------
|
|
@@ -64,6 +65,23 @@ function smtpField(key, value) {
|
|
|
64
65
|
function firstAddress(list) {
|
|
65
66
|
return list?.find((entry) => typeof entry?.address === 'string' && entry.address !== '')?.address;
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* A fetched message as `readInbox` and `searchEmails` give it. A Date field that does not read as a date gives an empty
|
|
70
|
+
* `date`: imapflow gives the field's text in place of a `Date` then, so one such message cannot fail the whole read.
|
|
71
|
+
*/
|
|
72
|
+
function emailMessageOf(msg, body) {
|
|
73
|
+
const envelope = msg.envelope;
|
|
74
|
+
return {
|
|
75
|
+
messageId: envelope?.messageId ?? '',
|
|
76
|
+
from: envelope?.from?.[0]?.address ?? '',
|
|
77
|
+
to: envelope?.to?.[0]?.address ?? '',
|
|
78
|
+
subject: envelope?.subject ?? '',
|
|
79
|
+
date: (0, reads_js_1.isoDateOf)(envelope?.date),
|
|
80
|
+
body,
|
|
81
|
+
flags: Array.from(msg.flags ?? []),
|
|
82
|
+
uid: msg.uid,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
67
85
|
// ---------------------------------------------------------------------------
|
|
68
86
|
// Service
|
|
69
87
|
// ---------------------------------------------------------------------------
|
|
@@ -199,8 +217,15 @@ class EmailService {
|
|
|
199
217
|
return { messageId: info.messageId };
|
|
200
218
|
}
|
|
201
219
|
// ── Read Inbox ──
|
|
202
|
-
|
|
220
|
+
/**
|
|
221
|
+
* The last `limit` messages of `folder`, newest first: INBOX and 20 when they are not given, and 20 when `limit` is
|
|
222
|
+
* `null`. `limit` must be a whole number of at least 1: any other value throws an `Error` before any mail is read,
|
|
223
|
+
* where the fetch would name a message past the last one, which a server answers BAD. A message whose Date field does
|
|
224
|
+
* not read as a date is given with an empty `date`.
|
|
225
|
+
*/
|
|
226
|
+
async readInbox(folder = 'INBOX', limit) {
|
|
203
227
|
this.requireRunning();
|
|
228
|
+
const count = (0, reads_js_1.requireLimit)(limit, 20);
|
|
204
229
|
const client = await this.getImapClient();
|
|
205
230
|
try {
|
|
206
231
|
const lock = await client.getMailboxLock(folder);
|
|
@@ -210,26 +235,14 @@ class EmailService {
|
|
|
210
235
|
const totalMessages = client.mailbox ? client.mailbox.exists : 0;
|
|
211
236
|
if (totalMessages === 0)
|
|
212
237
|
return [];
|
|
213
|
-
const startSeq = Math.max(1, totalMessages -
|
|
238
|
+
const startSeq = Math.max(1, totalMessages - count + 1);
|
|
214
239
|
for await (const msg of client.fetch(`${startSeq}:*`, {
|
|
215
240
|
envelope: true,
|
|
216
241
|
source: true,
|
|
217
242
|
flags: true,
|
|
218
243
|
uid: true,
|
|
219
244
|
})) {
|
|
220
|
-
|
|
221
|
-
const source = msg.source?.toString() ?? '';
|
|
222
|
-
const bodyText = this.extractPlainText(source);
|
|
223
|
-
messages.push({
|
|
224
|
-
messageId: envelope?.messageId ?? '',
|
|
225
|
-
from: envelope?.from?.[0]?.address ?? '',
|
|
226
|
-
to: envelope?.to?.[0]?.address ?? '',
|
|
227
|
-
subject: envelope?.subject ?? '',
|
|
228
|
-
date: envelope?.date?.toISOString() ?? '',
|
|
229
|
-
body: bodyText,
|
|
230
|
-
flags: Array.from(msg.flags ?? []),
|
|
231
|
-
uid: msg.uid,
|
|
232
|
-
});
|
|
245
|
+
messages.push(emailMessageOf(msg, this.extractPlainText(msg.source?.toString() ?? '')));
|
|
233
246
|
}
|
|
234
247
|
}
|
|
235
248
|
finally {
|
|
@@ -246,9 +259,18 @@ class EmailService {
|
|
|
246
259
|
* The messages of `folder` (INBOX unless given) whose subject, body or From holds `query`, ignoring case, received on
|
|
247
260
|
* or after `since` when it is given: the last `limit` (20 unless given) the search finds, newest first. The search
|
|
248
261
|
* answers UIDs, and the messages are fetched by those UIDs, which need not follow the messages' sequence numbers.
|
|
262
|
+
*
|
|
263
|
+
* `limit` must be a whole number of at least 1, and `since` an ISO 8601 date, such as `2026-10-15`, alone or followed
|
|
264
|
+
* by a time and an offset, which are checked and then disregarded: the search starts from the day the date names, as
|
|
265
|
+
* written, on every server. Either counts as not given when `null`, and `since` when empty. Any other value of either,
|
|
266
|
+
* a day its month lacks such as `2026-02-30` among them, throws an `Error` before the search: imapflow leaves a date it
|
|
267
|
+
* cannot read out of the search, which would answer mail of every date, and `Date` rolls a day past its month's end
|
|
268
|
+
* over into the next month. A message whose Date field does not read as a date is given with an empty `date`.
|
|
249
269
|
*/
|
|
250
270
|
async searchEmails(options) {
|
|
251
271
|
this.requireRunning();
|
|
272
|
+
const limit = (0, reads_js_1.requireLimit)(options.limit, 20);
|
|
273
|
+
const since = (0, reads_js_1.requireSince)(options.since);
|
|
252
274
|
const client = await this.getImapClient();
|
|
253
275
|
const folder = options.folder ?? 'INBOX';
|
|
254
276
|
try {
|
|
@@ -264,12 +286,14 @@ class EmailService {
|
|
|
264
286
|
{ from: options.query },
|
|
265
287
|
];
|
|
266
288
|
}
|
|
267
|
-
if (
|
|
268
|
-
|
|
289
|
+
if (since !== undefined) {
|
|
290
|
+
// Given as text, the day goes to every server as SINCE and that day. imapflow sends a Date to a server that
|
|
291
|
+
// announces WITHIN as YOUNGER and the seconds since that moment (RFC 5032), and to any other as its day in UTC.
|
|
292
|
+
searchCriteria.since = since;
|
|
269
293
|
}
|
|
270
294
|
const uids = await client.search(searchCriteria, { uid: true });
|
|
271
295
|
const uidList = Array.isArray(uids) ? uids : [];
|
|
272
|
-
const limitedUids = uidList.slice(-
|
|
296
|
+
const limitedUids = uidList.slice(-limit);
|
|
273
297
|
if (limitedUids.length > 0) {
|
|
274
298
|
// The search answered UIDs, so the fetch reads its range as UIDs rather than sequence numbers.
|
|
275
299
|
for await (const msg of client.fetch(limitedUids, {
|
|
@@ -278,19 +302,7 @@ class EmailService {
|
|
|
278
302
|
flags: true,
|
|
279
303
|
uid: true,
|
|
280
304
|
}, { uid: true })) {
|
|
281
|
-
|
|
282
|
-
const source = msg.source?.toString() ?? '';
|
|
283
|
-
const bodyText = this.extractPlainText(source);
|
|
284
|
-
messages.push({
|
|
285
|
-
messageId: envelope?.messageId ?? '',
|
|
286
|
-
from: envelope?.from?.[0]?.address ?? '',
|
|
287
|
-
to: envelope?.to?.[0]?.address ?? '',
|
|
288
|
-
subject: envelope?.subject ?? '',
|
|
289
|
-
date: envelope?.date?.toISOString() ?? '',
|
|
290
|
-
body: bodyText,
|
|
291
|
-
flags: Array.from(msg.flags ?? []),
|
|
292
|
-
uid: msg.uid,
|
|
293
|
-
});
|
|
305
|
+
messages.push(emailMessageOf(msg, this.extractPlainText(msg.source?.toString() ?? '')));
|
|
294
306
|
}
|
|
295
307
|
}
|
|
296
308
|
}
|
|
@@ -310,10 +322,17 @@ class EmailService {
|
|
|
310
322
|
* is", "OTP:", "is your" or "enter ... to" point to, each once. The message is searched for by the id in angle brackets
|
|
311
323
|
* and fetched by the UID the search answers; a search matches every Message-ID that holds the text, so only the
|
|
312
324
|
* message whose own id is the one given counts. An id that is not one message id, or that no message has, gives no
|
|
313
|
-
* codes.
|
|
325
|
+
* codes. The text searched is the plain part and the HTML part, each tag of the HTML written as a space.
|
|
326
|
+
*
|
|
327
|
+
* `pattern` is a JavaScript regular expression, compiled with the `g` flag: each match's first group is a code, or the
|
|
328
|
+
* whole match when that group takes no part in it, and an empty one is none; a match of empty text moves the search
|
|
329
|
+
* on by one character. A pattern that is `null` or empty counts as not given. One that is not a string, or that does
|
|
330
|
+
* not compile, throws an `Error` before any mail is read. The pattern runs over the message for at most 250 ms, and
|
|
331
|
+
* one that runs longer, as one that backtracks without end such as `(\d+)+$` can, throws an `Error` naming that limit.
|
|
314
332
|
*/
|
|
315
333
|
async extractCodes(messageId, pattern) {
|
|
316
334
|
this.requireRunning();
|
|
335
|
+
const custom = (0, reads_js_1.requirePattern)(pattern);
|
|
317
336
|
const wanted = (0, messageHeaders_js_1.oneMessageId)(messageId);
|
|
318
337
|
if (wanted === undefined)
|
|
319
338
|
return { codes: [], messageId };
|
|
@@ -340,15 +359,9 @@ class EmailService {
|
|
|
340
359
|
const bodyText = this.extractPlainText(source);
|
|
341
360
|
const htmlBody = this.extractHtmlBody(source);
|
|
342
361
|
const fullText = bodyText + ' ' + htmlBody;
|
|
343
|
-
//
|
|
344
|
-
const
|
|
345
|
-
? new RegExp(pattern, 'g')
|
|
346
|
-
: /\b(\d{4,8})\b/g;
|
|
347
|
-
const codes = [];
|
|
362
|
+
// A caller's pattern runs under its time limit; the default matches no empty text and takes time growing with the text.
|
|
363
|
+
const codes = custom === undefined ? Array.from(fullText.matchAll(/\b(\d{4,8})\b/g), (found) => found[1]) : (0, reads_js_1.codesMatching)(custom, fullText);
|
|
348
364
|
let match;
|
|
349
|
-
while ((match = regex.exec(fullText)) !== null) {
|
|
350
|
-
codes.push(match[1] ?? match[0]);
|
|
351
|
-
}
|
|
352
365
|
// Also look for common verification code patterns
|
|
353
366
|
const verifyPatterns = [
|
|
354
367
|
/(?:code|verification|OTP|pin)\s*(?:is|:)\s*(\w{4,8})/gi,
|
|
@@ -524,8 +537,8 @@ class EmailService {
|
|
|
524
537
|
if (part.match(/Content-Transfer-Encoding:\s*base64/i)) {
|
|
525
538
|
body = Buffer.from(body.replace(/\s/g, ''), 'base64').toString('utf-8');
|
|
526
539
|
}
|
|
527
|
-
//
|
|
528
|
-
return
|
|
540
|
+
// Each tag written as a space, found in one pass.
|
|
541
|
+
return (0, reads_js_1.withoutTags)(body).replace(/\s+/g, ' ').trim();
|
|
529
542
|
}
|
|
530
543
|
}
|
|
531
544
|
}
|
package/dist/EmailService.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailService.js","sourceRoot":"","sources":["../src/EmailService.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uDAAyC;AACzC,uCAAoC;AACpC,6DAAuD;AAEvD,2DAAiI;AACjI,qDAAsE;AA4EtE,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AAElE,qHAAqH;AACrH,SAAS,SAAS,CAAC,GAAW,EAAE,KAAa;IAC3C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;AAC7H,CAAC;AAED,oGAAoG;AACpG,SAAS,YAAY,CAAC,IAA6C;IACjE,OAAO,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC;AACpG,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAa,YAAY;IAMvB,YAAY,MAAmB;QAJvB,gBAAW,GAAkC,IAAI,CAAC;QAClD,WAAM,GAA2B,IAAI,CAAC;QACtC,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IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACrE,CAAC;CACF;AApgBD,oCAogBC"}
|
|
@@ -28,10 +28,12 @@ export interface RecipientCapability {
|
|
|
28
28
|
* and scope. A nonce whose token was revoked throws for every recipient, scope and expiry, so a message that needs a
|
|
29
29
|
* working token after `revoke` takes a new nonce.
|
|
30
30
|
*
|
|
31
|
-
* @param recipient The recipient: 1 to 512
|
|
31
|
+
* @param recipient The recipient: 1 to 512 UTF-16 code units, with no U+0000 and no lone surrogate.
|
|
32
32
|
* @param scope The scope, under the same rule.
|
|
33
33
|
* @param nonce The nonce, under the same rule: one message, one nonce, never another message's.
|
|
34
|
-
* @param key The key, 32 bytes or more, kept secret by the caller.
|
|
34
|
+
* @param key The key, 32 random bytes or more, kept secret by the caller. Two hosts that share a key draw the same
|
|
35
|
+
* token from the same nonce, whatever their prefixes, so each host takes a key of its own or nonces no other host
|
|
36
|
+
* uses.
|
|
35
37
|
* @param options The token's expiry, if it has one.
|
|
36
38
|
* @returns The token.
|
|
37
39
|
*/
|
|
@@ -48,8 +50,9 @@ export interface RecipientCapability {
|
|
|
48
50
|
* Ends every token issued for the recipient, in every scope. Each token's row stays, marked revoked, so its nonce is
|
|
49
51
|
* never issued again; a token issued afterwards from a new nonce works.
|
|
50
52
|
*
|
|
51
|
-
* @param recipient The recipient: 1 to 512
|
|
52
|
-
* @returns How many tokens it ended: a token ended by an earlier revoke is not counted again
|
|
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 ended: a token ended by an earlier revoke is not counted again, and 0 whatever it ended
|
|
55
|
+
* when the database's `run` answers no count of `changes`.
|
|
53
56
|
*/
|
|
54
57
|
revoke(recipient: string): Promise<number>;
|
|
55
58
|
}
|
|
@@ -69,12 +72,14 @@ export declare function capabilityTokenHash(token: string): string;
|
|
|
69
72
|
/**
|
|
70
73
|
* The recipient capabilities' table, `<prefix>_capabilities`, and the index `revoke` reads, for a host's migration: one
|
|
71
74
|
* row a token, its SHA-256 the key, with the recipient, the scope, an optional expiry and the time the token was
|
|
72
|
-
* revoked, if it was. Both statements are `IF NOT EXISTS`, so
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* with
|
|
75
|
+
* revoked, if it was. Both statements are `IF NOT EXISTS`, so a migration can run them again, and they run on SQLite
|
|
76
|
+
* and on PostgreSQL, from one process at a time: PostgreSQL does not promise that two processes making one new table at
|
|
77
|
+
* once both succeed. A row refuses its nonce for as long as it stays: a host that deletes rows, by its own foreign key
|
|
78
|
+
* with `ON DELETE CASCADE` or by hand, never issues their nonces again, and a host that cannot promise that calls
|
|
79
|
+
* `revoke` with each deletion and keeps the rows.
|
|
76
80
|
*
|
|
77
|
-
* @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores
|
|
81
|
+
* @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
|
|
82
|
+
* `sqlite` and a prefix beginning `sqlite_`.
|
|
78
83
|
* @throws RangeError when the prefix does not fit.
|
|
79
84
|
*/
|
|
80
85
|
export declare function recipientCapabilityDdl(prefix: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecipientCapability.d.ts","sourceRoot":"","sources":["../../src/preferences/RecipientCapability.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGxD,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,kCAAkC;AAClC,MAAM,WAAW,+BAA+B;IAC9C,gHAAgH;IAChH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,iDAAiD;AACjD,MAAM,WAAW,6BA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,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAuDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAY7D;AAED;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAW9D,OAAO,CAAC,QAAQ,CAAC,EAAE;IAVrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IAEnC;;;;;OAKG;gBAEgB,EAAE,EAAE,kBAAkB,EACvC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,6BAAkC;IAMvC,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,UAAU,EACf,OAAO,CAAC,EAAE,+BAA+B,GACxC,OAAO,CAAC,MAAM,CAAC;IA4BZ,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAgBnD,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CASjD"}
|
|
@@ -80,12 +80,14 @@ function isRevoked(row) {
|
|
|
80
80
|
/**
|
|
81
81
|
* The recipient capabilities' table, `<prefix>_capabilities`, and the index `revoke` reads, for a host's migration: one
|
|
82
82
|
* row a token, its SHA-256 the key, with the recipient, the scope, an optional expiry and the time the token was
|
|
83
|
-
* revoked, if it was. Both statements are `IF NOT EXISTS`, so
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* with
|
|
83
|
+
* revoked, if it was. Both statements are `IF NOT EXISTS`, so a migration can run them again, and they run on SQLite
|
|
84
|
+
* and on PostgreSQL, from one process at a time: PostgreSQL does not promise that two processes making one new table at
|
|
85
|
+
* once both succeed. A row refuses its nonce for as long as it stays: a host that deletes rows, by its own foreign key
|
|
86
|
+
* with `ON DELETE CASCADE` or by hand, never issues their nonces again, and a host that cannot promise that calls
|
|
87
|
+
* `revoke` with each deletion and keeps the rows.
|
|
87
88
|
*
|
|
88
|
-
* @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores
|
|
89
|
+
* @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
|
|
90
|
+
* `sqlite` and a prefix beginning `sqlite_`.
|
|
89
91
|
* @throws RangeError when the prefix does not fit.
|
|
90
92
|
*/
|
|
91
93
|
function recipientCapabilityDdl(prefix) {
|
|
@@ -126,9 +128,9 @@ class SqlRecipientCapability {
|
|
|
126
128
|
const tokenHash = capabilityTokenHash(token);
|
|
127
129
|
const inserted = await this.db.run(`INSERT INTO ${this.table} (token_hash, recipient, scope, expires_at) VALUES (?, ?, ?, ?) ` +
|
|
128
130
|
'ON CONFLICT (token_hash) DO NOTHING', [tokenHash, recipient, scope, expiresAt]);
|
|
129
|
-
if (inserted
|
|
131
|
+
if ((0, database_js_1.changesOf)(inserted) === 1)
|
|
130
132
|
return token;
|
|
131
|
-
// The nonce was issued before, or a handle that reports no `changes` wrote it: the stored row decides.
|
|
133
|
+
// The nonce was issued before, or a handle that reports no count of `changes` wrote it: the stored row decides.
|
|
132
134
|
const row = await this.db.get(`SELECT recipient, scope, expires_at, revoked_at FROM ${this.table} WHERE token_hash = ?`, [tokenHash]);
|
|
133
135
|
if (row === null || row === undefined) {
|
|
134
136
|
throw new Error('The token was not stored: its row was deleted while it was issued');
|
|
@@ -161,7 +163,7 @@ class SqlRecipientCapability {
|
|
|
161
163
|
const name = (0, database_js_1.requireName)('recipient', recipient);
|
|
162
164
|
// The rows stay, so `issue` can refuse their nonces; only the live ones are marked and counted.
|
|
163
165
|
const result = await this.db.run(`UPDATE ${this.table} SET revoked_at = ? WHERE recipient = ? AND revoked_at IS NULL`, [revokedAtOf(this.now()), name]);
|
|
164
|
-
return result
|
|
166
|
+
return (0, database_js_1.changesOf)(result);
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
exports.SqlRecipientCapability = SqlRecipientCapability;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecipientCapability.js","sourceRoot":"","sources":["../../src/preferences/RecipientCapability.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RecipientCapability.js","sourceRoot":"","sources":["../../src/preferences/RecipientCapability.ts"],"names":[],"mappings":";;;AA6FA,0CAEC;AAOD,kDAEC;AAoED,wDAYC;AAxLD;;;;;;;GAOG;AACH,6CAAsE;AAEtE,+CAAsE;AAuEtE,kEAAkE;AAClE,MAAM,KAAK,GAAG,qBAAqB,CAAC;AAEpC,gHAAgH;AAChH,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAa,EAAE,GAAe;IAC5D,OAAO,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,mHAAmH;AACnH,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,GAAG,YAAY,UAAU,IAAI,GAAG,CAAC,UAAU,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC;IACzE,MAAM,IAAI,SAAS,CAAC,mCAAmC,SAAS,kCAAkC,CAAC,CAAC;AACtG,CAAC;AAED,oHAAoH;AACpH,SAAS,aAAa,CAAC,OAAgB;IACrC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACpD,MAAM,IA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